Grzegorz Chrupała avatar Grzegorz Chrupała committed 7a0fc80

Add NLP.Scores.fstElems and sndElems

Comments (0)

Files changed (2)

nlp-scores/NLP/Scores.hs

 
 module NLP.Scores 
     ( 
-      -- * Scores for classification and ranking
+    -- * Scores for classification and ranking
       accuracy
     , recipRank
     , avgPrecision
-      -- * Scores for clustering
+    -- * Scores for clustering
     , ari
     , mi
     , vi
-      -- * Auxiliary types and functions
+    -- * Auxiliary types and functions
     , Count
     , Counts
     , counts
     , jaccard
     , entropy
     , histogram
-      -- * Extracting joint and marginal counts from 'Counts'
+    -- * Extracting joint and marginal counts from 'Counts'
     , countJoint
     , countFst
     , countSnd
+    -- * Extracting lists of values from Counts
+    , fstElems
+    , sndElems
     )
 where
 import qualified Data.Foldable as F
 -- | Count of second element
 countSnd :: Ord k => k -> Counts a k -> Count
 countSnd y = Map.findWithDefault 0 y . marginalSnd
+
+-- | List of values of first element
+fstElems :: Counts k b -> [k]
+fstElems = Map.keys . marginalFst
+-- | List of values of second element
+sndElems :: Counts a k -> [k]
+sndElems = Map.keys . marginalSnd

nlp-scores/nlp-scores.cabal

 -- The package version. See the Haskell package versioning policy
 -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for
 -- standards guiding when and how versions should be incremented.
-Version:             0.4.4
+Version:             0.4.5
 
 -- A short (one-line) description of the package.
 Synopsis:            Scoring functions commonly used for evaluation in NLP and IR
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.