packages feed

wordchoice 0.1.2.8 → 0.1.2.9

raw patch · 6 files changed

+58/−55 lines, 6 filesdep ~pandocPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: pandoc

API changes (from Hackage documentation)

- Data.Text.WordCount: makeDistribution :: BarsPlotValue a => [(a, Text)] -> StateT (Layout PlotIndex a) (State CState) ()
+ Data.Text.WordCount: makeDistribution :: BarsPlotValue y => [(y, Text)] -> StateT (Layout PlotIndex y) (State CState) ()

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright Vanessa McHale (c) 2017+Copyright Vanessa McHale (c) 2017-2018, 2021  All rights reserved. 
app/Main.hs view
@@ -25,20 +25,20 @@ -- | Command line argument parser program :: Parser Program program = Program-    <$> (argument str+    <$> argument str         (metavar "FILEPATH"         <> completer (bashCompleter "file -o plusdirs")-        <> help "File to analyze"))-    <*> (optional (read <$> strOption+        <> help "File to analyze")+    <*> optional (read <$> strOption         (short 'n'         <> long "number"         <>  metavar "NUM"-        <> help "Top NUM words will be listed")))-    <*> (optional (strOption+        <> help "Top NUM words will be listed"))+    <*> optional (strOption         (short 'o'         <> long "output"         <>  metavar "OUTPUT"-        <> help "Filepath for output graph")))+        <> help "Filepath for output graph"))     <*> switch         (short 'f'         <> long "filter"
cabal.project.local view
@@ -1,1 +1,4 @@ optimization: 2++package zlig+  flags: +bundled-c-zlib -pkg-config
src/Data/Text/WordCount.hs view
@@ -63,12 +63,12 @@ buildFreq = count . filter (/=" ") . TL.split (`elem` (" \n;:,./" :: String)) . TL.map toLower  orderM :: M.Map TL.Text Int -> IM.IntMap [TL.Text]-orderM = IM.fromList . fmap ((fst . head) &&& fmap snd) . groupBy go . sortBy (flip (comparing fst)) . fmap swap . M.toList+orderM = IM.fromList . fmap ((fst . head) &&& fmap snd) . groupBy go . sortOn (Down . fst) . fmap swap . M.toList     where go :: (Int, TL.Text) -> (Int, TL.Text) -> Bool           go = on (==) fst  order :: M.Map TL.Text Int -> [(Int, TL.Text)]-order = sortBy (flip (comparing fst)) . fmap swap . M.toList+order = sortOn (Down . fst) . fmap swap . M.toList  count :: [TL.Text] -> M.Map TL.Text Int count = M.fromListWith (+) . (`zip` repeat 1)
src/Data/Text/WordCount/FileRead.hs view
@@ -16,22 +16,22 @@ globFile :: String -> IO T.Text globFile str = do     files <- glob str-    fmap T.concat . sequence $ fmap runIOorExplode $ fmap processFile files+    fmap T.concat (mapM runIOorExplode (fmap processFile files))  -- | Process a file given a filename. Return text only, discarding superflouous material. processFile :: String -> PandocIO T.Text-processFile filepath = (T.filter goodChar) <$> case (extension . decodeString $ filepath) of-    (Just "md") -> (writePlain def <=< fmap filterCode . (readMarkdown def =<<)) <$> liftIO $ TIO.readFile filepath-    (Just "dbk") -> (writePlain def <=< fmap filterCode . (readDocBook def =<<)) <$> liftIO $ TIO.readFile filepath-    (Just "docx") -> (writePlain def <=< fmap filterCode . (readDocx def =<<)) $ liftIO $ BSL.readFile filepath-    (Just "epub") -> (writePlain def <=< fmap filterCode . (readEPUB def =<<)) $ liftIO $ BSL.readFile filepath-    (Just "html") -> (writePlain def <=< fmap filterCode . (readHtml def =<<)) $ liftIO $ TIO.readFile filepath-    (Just "tex") -> (writePlain def <=< fmap filterCode . (readLaTeX def =<<)) $ liftIO $ TIO.readFile filepath-    (Just "xml") -> (writePlain def <=< fmap filterCode . (readOPML def =<<)) $ liftIO $ TIO.readFile filepath-    (Just "odt") -> (writePlain def <=< fmap filterCode . (readOdt def =<<)) $ liftIO $ BSL.readFile filepath-    (Just "rst") -> (writePlain def <=< fmap filterCode . (readRST def =<<)) $ liftIO $ TIO.readFile filepath-    (Just "textile") -> (writePlain def <=< fmap filterCode . (readTextile def =<<)) $ liftIO $ TIO.readFile filepath-    _ -> liftIO $ TIO.readFile filepath+processFile filepath = T.filter goodChar <$> case extension . decodeString $ filepath of+  (Just "md") -> (writePlain def <=< fmap filterCode . (readMarkdown def =<<)) <$> liftIO $ TIO.readFile filepath+  (Just "dbk") -> (writePlain def <=< fmap filterCode . (readDocBook def =<<)) <$> liftIO $ TIO.readFile filepath+  (Just "docx") -> (writePlain def <=< fmap filterCode . (readDocx def =<<)) $ liftIO $ BSL.readFile filepath+  (Just "epub") -> (writePlain def <=< fmap filterCode . (readEPUB def =<<)) $ liftIO $ BSL.readFile filepath+  (Just "html") -> (writePlain def <=< fmap filterCode . (readHtml def =<<)) $ liftIO $ TIO.readFile filepath+  (Just "tex") -> (writePlain def <=< fmap filterCode . (readLaTeX def =<<)) $ liftIO $ TIO.readFile filepath+  (Just "xml") -> (writePlain def <=< fmap filterCode . (readOPML def =<<)) $ liftIO $ TIO.readFile filepath+  (Just "odt") -> (writePlain def <=< fmap filterCode . (readODT def =<<)) $ liftIO $ BSL.readFile filepath+  (Just "rst") -> (writePlain def <=< fmap filterCode . (readRST def =<<)) $ liftIO $ TIO.readFile filepath+  (Just "textile") -> (writePlain def <=< fmap filterCode . (readTextile def =<<)) $ liftIO $ TIO.readFile filepath+  _ -> liftIO $ TIO.readFile filepath  goodChar :: Char -> Bool goodChar = not . flip any (".,?_()![]{}*&$#" :: String) . (==)
wordchoice.cabal view
@@ -1,9 +1,9 @@ cabal-version:      >=1.10 name:               wordchoice-version:            0.1.2.8+version:            0.1.2.9 license:            BSD3 license-file:       LICENSE-copyright:          2017,2018 Vanessa McHale+copyright:          2017-2018, 2021 Vanessa McHale maintainer:         vamchale@gmail.com author:             Vanessa McHale synopsis:           Get word counts and distributions@@ -17,7 +17,7 @@     cabal.project.local  source-repository head-    type:     git+    type:     darcs     location: https://hub.darcs.net/vmchale/wordchoice  library@@ -29,20 +29,20 @@     ghc-options:        -Wall     build-depends:         base >=4.11 && <5,-        pandoc >=2.0,-        containers -any,-        Glob -any,-        bytestring -any,-        binary -any,-        text -any,-        directory -any,-        composition-prelude -any,-        Chart -any,-        bytestring -any,-        system-filepath -any,-        Chart-diagrams -any,-        lens -any,-        transformers -any+        pandoc >=2.10,+        containers,+        Glob,+        bytestring,+        binary,+        text,+        directory,+        composition-prelude,+        Chart,+        bytestring,+        system-filepath,+        Chart-diagrams,+        lens,+        transformers  executable wrd     main-is:          Main.hs@@ -51,15 +51,15 @@     default-language: Haskell2010     ghc-options:      -Wall     build-depends:-        base -any,-        optparse-applicative -any,-        directory -any,-        bytestring -any,-        binary -any,-        containers -any,-        lens -any,-        text -any,-        wordchoice -any+        base,+        optparse-applicative,+        directory,+        bytestring,+        binary,+        containers,+        lens,+        text,+        wordchoice  test-suite wordchoice-test     type:             exitcode-stdio-1.0@@ -68,8 +68,8 @@     default-language: Haskell2010     ghc-options:      -threaded -rtsopts -with-rtsopts=-N -Wall     build-depends:-        base -any,-        wordchoice -any+        base,+        wordchoice  benchmark wordchoice-bench     type:             exitcode-stdio-1.0@@ -78,8 +78,8 @@     default-language: Haskell2010     ghc-options:      -Wall     build-depends:-        base -any,-        criterion -any,-        text -any,-        wordchoice -any,-        pandoc -any+        base,+        criterion,+        text,+        wordchoice,+        pandoc