Commit 5a332bda authored by Alexandre Delanoë's avatar Alexandre Delanoë

[TYPING] Diagnoal option clearer.

parent 3d05ad43
......@@ -84,10 +84,10 @@ groupNodesByNgrams syn occs = Map.fromListWith (<>) occs'
Nothing -> (t, ns)
Just r' -> (r',ns)
type Diagonal = Bool
data Diagonal = Diagonal Bool
getCoocByNgrams :: Diagonal -> Map Text (Set NodeId) -> Map (Text, Text) Int
getCoocByNgrams diag m =
getCoocByNgrams (Diagonal diag) m =
Map.fromList [((t1,t2)
,maybe 0 Set.size $ Set.intersection
<$> Map.lookup t1 m
......
......@@ -290,7 +290,7 @@ graphAPI nId = do
lId <- defaultList cId
ngs <- filterListWithRoot GraphTerm <$> mapTermListRoot [lId] NgramsTerms
myCooc <- Map.filter (>1) <$> getCoocByNgrams False
myCooc <- Map.filter (>1) <$> getCoocByNgrams (Diagonal False)
<$> groupNodesByNgrams ngs
<$> getNodesByNgramsOnlyUser cId NgramsTerms (Map.keys ngs)
......
......@@ -28,7 +28,7 @@ import Gargantext.Database.Metrics.NgramsByNode (getNodesByNgramsOnlyUser)
import Gargantext.Database.Schema.Node (defaultList)
import Gargantext.Database.Types.Node (ListId, CorpusId)
import Gargantext.Prelude
import Gargantext.Text.Metrics
import Gargantext.Text.Metrics (scored, Scored(..))
import Servant (ServantErr)
import qualified Data.Map as Map
......@@ -51,7 +51,7 @@ getMetrics' cId maybeListId tabType maybeLimit = do
take' Nothing xs = xs
take' (Just n) xs = take n xs
myCooc <- Map.filter (>1) <$> getCoocByNgrams True
myCooc <- Map.filter (>1) <$> getCoocByNgrams (Diagonal True)
<$> groupNodesByNgrams ngs
<$> getNodesByNgramsOnlyUser cId ngramsType (take' maybeLimit $ Map.keys ngs)
......
......@@ -100,7 +100,7 @@ toTermList stop ns = map (toTermList' stop CandidateTerm) xs
ys = take b $ drop a ns
zs = drop b $ drop a ns
a = 10
a = 3
b = 400
isStopTerm :: Text -> Bool
......
......@@ -76,10 +76,10 @@ scored2map m = Map.fromList $ map (\(Scored t i s) -> (t, Vec.fromList [i,s])) $
map2scored :: Ord t => Map t (Vec.Vector Double) -> [Scored t]
map2scored = map (\(t, ds) -> Scored t (Vec.head ds) (Vec.last ds)) . Map.toList
-- TODO in the textflow we end up needing these indices, it might be better
-- to compute them earlier and pass them around.
-- TODO in the textflow we end up needing these indices , it might be
-- better to compute them earlier and pass them around.
scored' :: Ord t => Map (t,t) Int -> [Scored t]
scored' m = zipWith (\(_,t) (inc,spe) -> Scored t inc spe) (Map.toList fi) scores
scored' m = zipWith (\(_,t) (inc,spe) -> Scored t (inc) (spe)) (Map.toList fi) scores
where
(ti, fi) = createIndices m
(is, ss) = incExcSpeGen $ cooc2mat ti m
......
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