From 063e67d00316a3b77ec99fda202677718b4f89d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Delano=C3=AB?= <devel+git@delanoe.org> Date: Wed, 21 Oct 2020 17:56:48 +0200 Subject: [PATCH] [Clean] --- src/Gargantext/Core/Text/Group.hs | 13 ++++++------- src/Gargantext/Core/Text/List.hs | 7 ++++--- src/Gargantext/Core/Text/List/Social.hs | 1 - 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Gargantext/Core/Text/Group.hs b/src/Gargantext/Core/Text/Group.hs index 96f562cc..3654f50b 100644 --- a/src/Gargantext/Core/Text/Group.hs +++ b/src/Gargantext/Core/Text/Group.hs @@ -63,7 +63,8 @@ ngramsGroup :: GroupParams -> Text -> Text ngramsGroup GroupIdentity = identity -ngramsGroup (GroupParams l _m _n _) = Text.intercalate " " +ngramsGroup (GroupParams l _m _n _) = + Text.intercalate " " . map (stem l) -- . take n . List.sort @@ -79,10 +80,10 @@ mergeMapParent = undefined ------------------------------------------------------------------------ toGroupedText :: Ord b - => (Text -> Text) - -> (a -> b) - -> (a -> Set Text) - -> (a -> Set NodeId) + => (Text -> Text ) + -> (a -> b ) + -> (a -> Set Text ) + -> (a -> Set NodeId) -> [(Text,a)] -> Map Stem (GroupedText b) toGroupedText fun_stem fun_score fun_texts fun_nodeIds from = groupStems' $ map group from @@ -152,5 +153,3 @@ addListType m g = set gt_listType (hasListType m g) g $ map (\t -> Map.lookup t m') $ Set.toList $ Set.insert label g' - - diff --git a/src/Gargantext/Core/Text/List.hs b/src/Gargantext/Core/Text/List.hs index f357983c..0dae6096 100644 --- a/src/Gargantext/Core/Text/List.hs +++ b/src/Gargantext/Core/Text/List.hs @@ -58,8 +58,8 @@ buildNgramsLists :: ( RepoCmdM env err m buildNgramsLists user gp uCid mCid = do ngTerms <- buildNgramsTermsList user uCid mCid gp othersTerms <- mapM (buildNgramsOthersList user uCid (ngramsGroup GroupIdentity)) - [ (Authors, MapListSize 9) - , (Sources, MapListSize 9) + [ (Authors , MapListSize 9) + , (Sources , MapListSize 9) , (Institutes, MapListSize 9) ] @@ -83,7 +83,8 @@ buildNgramsOthersList user uCid groupIt (nt, MapListSize mapListSize) = do ngs <- groupNodesByNgramsWith groupIt <$> getNodesByNgramsUser uCid nt let - grouped = toGroupedText groupIt (Set.size . snd) fst snd (Map.toList $ Map.mapWithKey (\k (a,b) -> (Set.delete k a, b)) $ ngs) + grouped = toGroupedText groupIt (Set.size . snd) fst snd + (Map.toList $ Map.mapWithKey (\k (a,b) -> (Set.delete k a, b)) $ ngs) socialLists <- flowSocialList user nt (Set.fromList $ Map.keys ngs) diff --git a/src/Gargantext/Core/Text/List/Social.hs b/src/Gargantext/Core/Text/List/Social.hs index 0e93ac42..0a70e9c2 100644 --- a/src/Gargantext/Core/Text/List/Social.hs +++ b/src/Gargantext/Core/Text/List/Social.hs @@ -57,7 +57,6 @@ flowSocialList user nt ngrams' = do -- printDebug "* socialLists *: results \n" result pure result - ------------------------------------------------------------------------ unions :: (Ord a, Semigroup a, Semigroup b, Ord b) => [Map a (Set b)] -> Map a (Set b) -- 2.21.0