Commit 961c0068 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[PHYLO] implementation to Garg Flow (main fun ok).

parent 8aa7050d
......@@ -49,6 +49,20 @@ getListNgrams nodeIds ngramsType = do
pure ngrams
getTermsWith :: RepoCmdM env err m
=> [ListId]
-> NgramsType -> ListType
-> m (Map Text [Text])
getTermsWith ls ngt lt = Map.fromListWith (<>)
<$> map toTree
<$> Map.toList
<$> Map.filter (\f -> (fst f) == lt)
<$> mapTermListRoot ls ngt
where
toTree (t, (_lt, maybeRoot)) = case maybeRoot of
Nothing -> (t, [])
Just r -> (r, [t])
mapTermListRoot :: RepoCmdM env err m
=> [ListId] -> NgramsType
-> m (Map Text (ListType, (Maybe Text)))
......
......@@ -99,10 +99,10 @@ buildNgramsTermsList' uCid groupIt stop gls is = do
(maps, candidates') = takeScored gls is
$ getCoocByNgrams' snd (Diagonal True)
$ Map.fromList candidates
toList' t = (fst t, (fromIntegral $ Set.size $ snd $ snd t, fst $ snd t))
(s,c,m) = (stops
, List.filter (\(k,_) -> List.elem k candidates') candidates
, List.filter (\(k,_) -> List.elem k maps) candidates
......@@ -116,7 +116,7 @@ buildNgramsTermsList' uCid groupIt stop gls is = do
pure $ Map.fromList [(NgramsTerms, ngs')]
buildNgramsTermsList :: Lang -> Int -> Int -> StopSize -> UserCorpusId -> MasterCorpusId
-> Cmd err (Map NgramsType [NgramsElement])
buildNgramsTermsList l n m s uCid mCid = do
......
......@@ -149,4 +149,4 @@ setPhyloBranches lvl p = alterGroupWithLevel (\g ->
--------------------------------------
-- trace' bs = trace bs
\ No newline at end of file
-- trace' bs = trace bs
......@@ -878,13 +878,27 @@ defaultWeightedLogJaccard :: Proximity
defaultWeightedLogJaccard = WeightedLogJaccard (initWeightedLogJaccard Nothing Nothing)
-- Queries
type Title = Text
type Desc = Text
defaultQueryBuild :: PhyloQueryBuild
defaultQueryBuild = initPhyloQueryBuild "Cesar et Cleôpatre" "An example of Phylomemy (french without accent)"
Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
defaultQueryBuild = defaultQueryBuild'
"Cesar et Cleôpatre"
"An example of Phylomemy (french without accent)"
defaultQueryBuild' :: Title -> Desc -> PhyloQueryBuild
defaultQueryBuild' t d = initPhyloQueryBuild t d
Nothing Nothing Nothing
Nothing Nothing Nothing
Nothing Nothing Nothing
Nothing Nothing Nothing
defaultQueryView :: PhyloQueryView
defaultQueryView = initPhyloQueryView Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
defaultQueryView = initPhyloQueryView
Nothing Nothing Nothing
Nothing Nothing Nothing
Nothing Nothing Nothing
Nothing Nothing
-- Software
......
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