Add fisWithSizePolyMap and a comment

parent 856e569f
......@@ -122,6 +122,8 @@ data Scored t = Scored { _scored_terms :: !t
, _scored_speGen :: !SpecificityGenericity
} deriving (Show)
-- TODO in the textflow we end up needing these indices, it might be better
-- to compute them earlier and pass them around.
coocScored :: Ord t => Map (t,t) Int -> [Scored t]
coocScored m = zipWith (\(i,t) (inc,spe) -> Scored t inc spe) (M.toList fi) scores
where
......
......@@ -21,6 +21,7 @@ module Gargantext.Text.Metrics.FrequentItemSet
, fisWith
, fisWithSizePoly
, fisWithSizePoly2
, fisWithSizePolyMap
, module HLCM
)
where
......@@ -91,8 +92,10 @@ fisWithSize n f is = case n of
cond a' x b' = a' <= x && x <= b'
--- Filter on Fis and not on [Item]
fisWith :: Maybe ([Item] -> Bool) -> Frequency -> [[Item]] -> [Fis]
fisWith s f is = catMaybes $ map items2fis $ filter' $ runLCMmatrix is f
-- drop unMaybe
where
filter' = case s of
Nothing -> identity
......@@ -113,6 +116,10 @@ fisWithSizePoly2 n f is = fisWithSizePoly n f ks is
where
ks = Set.fromList $ concat is
fisWithSizePolyMap :: Ord a => Size -> Frequency -> [[a]] -> Map (Set a) Int
fisWithSizePolyMap n f is =
Map.fromList $ (\i -> (Set.fromList (_fisItemSet i), _fisCount i)) <$> fisWithSizePoly2 n f is
------------------------------------------------------------------------
------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment