I'm trying to write a program that reads a text file, then displays the frequencies and count of words in the file. What I need to do next is filter certain words from the text file. I have been looking at online resources for a couple of hours and still can't find what I'm looking for!
I have provided my code for the program so far below:
lowercase = map toLower
top doc = wordPairs
where
listOfWords = words (lowercase doc)
wordGroups = group (sort listOfWords)
wordPairs = reverse
$ sort
$ map (\x -> (length x, head x))
$ filterWords
wordGroups
filterWords :: String -> String
filterWords = filter (all (`elem` ["poultry outwits ants"])) . words
"poultry","outwits","ants"? The function ```elem["poultry outwits ants"]``` will only filter out a string matching the exact value"poultry outwits ants", not any of the strings"poultry","outwits", or"ants".elem["poultry", "outwits", "ants"] . words' but it still gives me the same error "parse error (possibly incorrect indentation or mismatched brackets)" I'm not sure how to go about solving this issue. Thanks