wordchoice-0.1.2.9: Get word counts and distributions
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Text.WordCount

Synopsis

Documentation

topN :: Int -> Text -> [(Int, Text)] Source #

Return top n words and their frequencies

>>> topN 2 "hello hello goodbye it is time is it why why why it it"
[(4,"it"),(3,"why")]

filterTop :: Int -> (Text -> Bool) -> Text -> [(Int, Text)] Source #

Return the top n words, with some filter applied.

Filters

For making graphs

makeFile :: [(Int, Text)] -> FilePath -> IO () Source #

Make a bar graph from the word frequencies

makeFile :: IO ()
makeFile [(4,"it"),(3,"why")] "out.html"

File processing with pandoc

processFile :: String -> PandocIO Text Source #

Process a file given a filename. Return text only, discarding superflouous material.

globFile :: String -> IO Text Source #

Process files given a filename glob

Keyed maps

indexed :: Text -> IntMap [Text] Source #

Return an IntMap containing words indexed by their frequencies.