nlp-scores 0.1.0 → 0.2.0
raw patch · 2 files changed
+10/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ NLP.Scores: jaccard :: (Fractional n, Ord a) => Set a -> Set a -> n
Files
- NLP/Scores.hs +9/−0
- nlp-scores.cabal +1/−1
NLP/Scores.hs view
@@ -6,6 +6,7 @@ , accuracy , recipRank , avgPrecision+ , jaccard ) where import Data.List hiding (sum)@@ -52,3 +53,11 @@ . mapAccumL (\z (r,rel) -> (z+rel,(r,rel,z+rel))) 0 $ [ (r,fromEnum $ x `Set.member` gold) | (x,r) <- zip xs [1..]] +-- | Jaccard coefficient+-- J(A,B) = |AB| / |A union B|+jaccard :: (Fractional n, Ord a) => Set.Set a -> Set.Set a -> n+jaccard a b = + fromIntegral (Set.size (Set.intersection a b))+ / + fromIntegral (Set.size (Set.union a b))+
nlp-scores.cabal view
@@ -7,7 +7,7 @@ -- 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.1.0+Version: 0.2.0 -- A short (one-line) description of the package. Synopsis: Scoring functions commonly used for evaluation in NLP and IR