packages feed

wordchoice 0.1.2.7 → 0.1.2.8

raw patch · 8 files changed

+49/−77 lines, 8 filesdep ~basesetup-changedPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

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

Files

README.md view
@@ -1,5 +1,4 @@ # Wordchoice Command-Line Tool-[![Build Status](https://travis-ci.org/vmchale/wordchoice.svg?branch=master)](https://travis-ci.org/vmchale/wordchoice)  ## Usage @@ -28,7 +27,8 @@  ## Installation -### Binary Release-- ### Cabal++```+cabal new-install wordchoice+```
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
app/Main.hs view
@@ -1,13 +1,11 @@-module Main where+module Main (main) where  import           Control.Arrow        ((&&&))-import           Control.Lens         (over, _2) import           Data.Binary          (decode, encode) import qualified Data.ByteString      as BS import qualified Data.ByteString.Lazy as BSL import qualified Data.IntMap          as IM import           Data.Maybe-import           Data.Monoid import qualified Data.Text.IO         as TIO import qualified Data.Text.Lazy       as TL import           Data.Text.WordCount@@ -60,12 +58,14 @@ wrapper :: ParserInfo Program wrapper = info (helper <*> versionInfo <*> program)     (fullDesc-    <> progDesc "Word choice is a command-line tool meant to help you improve your writing. Simply point it to a file containing text and it will list your most frequently used words and their frequencies."+    <> progDesc "Word choice is a command-line meant to help you improve your writing. Simply point it to a file containing text and it will list your most frequently used words and their frequencies."     <> header "Word choice command-line utility")  -- | Actual executable main :: IO () main = execParser wrapper >>= pick++-- TODO stream output nicely?  -- | Run parsed record pick :: Program -> IO ()
bench/Bench.hs view
@@ -1,10 +1,11 @@-module Main where+module Main (main) where  import           Criterion.Main import           Data.Text.Lazy      (fromStrict) import           Data.Text.WordCount import           Text.Pandoc +main :: IO () main = do     defaultMain [ env ulysses $ \file ->                   bgroup "ulysses all"@@ -13,5 +14,5 @@                   bgroup "beowulf all"                       [ bench "226" $ nf (fun 10000000) file ] ]     where fun n   = topN n . fromStrict-          ulysses = runIOorExplode $ processFile "test/ulysses.txt"-          beowulf = runIOorExplode $ processFile "test/beowulf.txt"+          ulysses = runIOorExplode $ processFile "test/data/ulysses.txt"+          beowulf = runIOorExplode $ processFile "test/data/beowulf.txt"
cabal.project.local view
@@ -1,2 +1,1 @@-with-compiler: ghc-8.2.2 optimization: 2
src/Data/Text/WordCount.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE FlexibleContexts #-} +-- Have a look at: https://sparverius.github.io/tmplats-doc/docs/CountingWords module Data.Text.WordCount     ( topN     , displayWords@@ -24,8 +25,6 @@ import qualified Data.IntMap                               as IM import           Data.List import qualified Data.Map.Lazy                             as M-import           Data.Map.Lens-import           Data.Monoid import           Data.Ord import qualified Data.Text                                 as T import qualified Data.Text.Lazy                            as TL@@ -72,16 +71,7 @@ order = sortBy (flip (comparing fst)) . fmap swap . M.toList  count :: [TL.Text] -> M.Map TL.Text Int-count words = foldr ((.) . go) id words M.empty-    where go word m = case m^.at word of-            Nothing -> at word ?~ 1 $ m-            _       -> ix word %~ (+1) $ m--count' :: [TL.Text] -> M.Map TL.Text Int-count' = M.fromListWith (+) . (`zip` repeat 1)--count'' :: [TL.Text] -> [(TL.Text, Int)]-count'' = fmap (head &&& length) . group . sort+count = M.fromListWith (+) . (`zip` repeat 1)  -- | Make a bar graph from the word frequencies --@@ -90,11 +80,11 @@ -- makeFile [(4,"it"),(3,"why")] "out.html" -- @ makeFile :: [(Int,TL.Text)] -> FilePath -> IO ()-makeFile points out = toFile def out (makeDistribution points)+makeFile ps out = toFile def out (makeDistribution ps) -makeDistribution points = do-    let values = addIndexes (fmap fst points)-    let alabels = fmap (TL.unpack . snd) points+makeDistribution ps = do+    let values = addIndexes (fst <$> ps)+    let alabels = fmap (TL.unpack . snd) ps     let fillStyle = solidFillStyle (opaque lightblue)     layout_title .= "Word Frequencies"     layout_x_axis . laxis_generate .= autoIndexAxis alabels
− stack.yaml
@@ -1,16 +0,0 @@-resolver: lts-9.10-packages:-- '.'-extra-deps:-- cmark-gfm-0.1.3-- composition-prelude-0.1.1.0-- pandoc-2.0-- hslua-0.9.2-- doctemplates-0.2.1-- check-gfm-0.1.3-- pandoc-types-1.17.2-- skylighting-0.4.2-flags:-    wordchoice:-        llvm-fast: true-extra-package-dbs: []
wordchoice.cabal view
@@ -1,35 +1,34 @@-cabal-version: >=1.10-name: wordchoice-version: 0.1.2.7-license: BSD3-license-file: LICENSE-copyright: 2017,2018 Vanessa McHale-maintainer: vamchale@gmail.com-author: Vanessa McHale-synopsis: Get word counts and distributions+cabal-version:      >=1.10+name:               wordchoice+version:            0.1.2.8+license:            BSD3+license-file:       LICENSE+copyright:          2017,2018 Vanessa McHale+maintainer:         vamchale@gmail.com+author:             Vanessa McHale+synopsis:           Get word counts and distributions description:     A command line tool to compute the word distribution from various types of document, converting to text with pandoc.-category: Web-build-type: Simple++category:           Web+build-type:         Simple extra-source-files:     README.md-    stack.yaml     cabal.project.local  source-repository head-    type: git+    type:     git     location: https://hub.darcs.net/vmchale/wordchoice  library-    exposed-modules:-        Data.Text.WordCount-    hs-source-dirs: src-    other-modules:-        Data.Text.WordCount.FileRead-    default-language: Haskell2010+    exposed-modules:    Data.Text.WordCount+    hs-source-dirs:     src+    other-modules:      Data.Text.WordCount.FileRead+    default-language:   Haskell2010     default-extensions: OverloadedStrings+    ghc-options:        -Wall     build-depends:-        base >=4.8 && <5,+        base >=4.11 && <5,         pandoc >=2.0,         containers -any,         Glob -any,@@ -46,11 +45,11 @@         transformers -any  executable wrd-    main-is: Main.hs-    hs-source-dirs: app-    other-modules:-        Paths_wordchoice+    main-is:          Main.hs+    hs-source-dirs:   app+    other-modules:    Paths_wordchoice     default-language: Haskell2010+    ghc-options:      -Wall     build-depends:         base -any,         optparse-applicative -any,@@ -63,20 +62,21 @@         wordchoice -any  test-suite wordchoice-test-    type: exitcode-stdio-1.0-    main-is: Spec.hs-    hs-source-dirs: test+    type:             exitcode-stdio-1.0+    main-is:          Spec.hs+    hs-source-dirs:   test     default-language: Haskell2010-    ghc-options: -threaded -rtsopts -with-rtsopts=-N+    ghc-options:      -threaded -rtsopts -with-rtsopts=-N -Wall     build-depends:         base -any,         wordchoice -any  benchmark wordchoice-bench-    type: exitcode-stdio-1.0-    main-is: Bench.hs-    hs-source-dirs: bench+    type:             exitcode-stdio-1.0+    main-is:          Bench.hs+    hs-source-dirs:   bench     default-language: Haskell2010+    ghc-options:      -Wall     build-depends:         base -any,         criterion -any,