Commit 21ff436a authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] Social List with new created ngrams (or category) that do not exist in the corpus

parent f3f8a296
...@@ -57,17 +57,35 @@ toFlowListScores k flc_origin = foldl' (toFlowListScores_Level1 k flc_origin) me ...@@ -57,17 +57,35 @@ toFlowListScores k flc_origin = foldl' (toFlowListScores_Level1 k flc_origin) me
toFlowListScores_Level2 k'' ngramsRepo flc_origin'' flc_dest' t = toFlowListScores_Level2 k'' ngramsRepo flc_origin'' flc_dest' t =
case Map.lookup t ngramsRepo of case Map.lookup t ngramsRepo of
Nothing -> over flc_cont (Map.union $ Map.singleton t mempty) flc_dest' Nothing -> over flc_cont (Map.union $ Map.singleton t mempty) flc_dest'
Just nre -> over flc_cont (Map.delete t) Just nre -> updateScoresParent k'' ngramsRepo nre flc_origin''
$ over flc_scores $ updateScores k'' t nre setText flc_dest'
( (Map.alter (addParent k'' nre ( Set.fromList where
$ Map.keys setText = Set.fromList
$ view flc_cont flc_origin'' $ Map.keys
) $ view flc_cont flc_origin''
) t
)
. (Map.alter (addList $ _nre_list nre) t) updateScoresParent :: KeepAllParents -> Map Text NgramsRepoElement -> NgramsRepoElement
) -> FlowCont Text FlowListScores
flc_dest' -> FlowCont Text FlowListScores
-> FlowCont Text FlowListScores
updateScoresParent keep@(KeepAllParents k''') ngramsRepo nre flc_origin'' flc_dest'' = case k''' of
False -> flc_dest''
True -> case view nre_parent nre of
Nothing -> flc_dest''
Just (NgramsTerm parent) -> toFlowListScores_Level2 keep ngramsRepo flc_origin'' flc_dest'' parent
------------------------------------------------------------------------
updateScores :: KeepAllParents
-> Text -> NgramsRepoElement -> Set Text
-> FlowCont Text FlowListScores
-> FlowCont Text FlowListScores
updateScores k t nre setText mtf =
over flc_cont ( Map.delete t)
$ over flc_scores ((Map.alter (addParent k nre setText ) t)
.(Map.alter (addList $ view nre_list nre) t)
) mtf
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- | Main addFunctions to groupResolution the FlowListScores -- | Main addFunctions to groupResolution the FlowListScores
......
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