Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
141
Issues
141
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
a188045f
Commit
a188045f
authored
Nov 25, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Cont can be empty now.
parent
2e7ec2f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
16 deletions
+17
-16
List.hs
src/Gargantext/Core/Text/List.hs
+3
-4
Prelude.hs
src/Gargantext/Core/Text/List/Social/Prelude.hs
+4
-8
Scores.hs
src/Gargantext/Core/Text/List/Social/Scores.hs
+10
-4
No files found.
src/Gargantext/Core/Text/List.hs
View file @
a188045f
...
...
@@ -15,7 +15,6 @@ Portability : POSIX
module
Gargantext.Core.Text.List
where
import
Control.Lens
((
^.
),
view
,
over
)
import
Data.Map
(
Map
)
import
Data.Maybe
(
catMaybes
)
...
...
@@ -94,12 +93,12 @@ buildNgramsOthersList user uCid groupIt (nt, MapListSize mapListSize) = do
$
List
.
zip
(
Map
.
keys
ngs'
)
(
List
.
cycle
[
mempty
])
)
{-
printDebug "flowSocialList'"
$ Map.filter (not . ((==) Map.empty) . (view fls_parents))
$ view flc_scores socialLists'
-}
let
groupedWithList
=
toGroupedTreeText
groupIt
socialLists'
ngs'
...
...
@@ -152,8 +151,8 @@ buildNgramsTermsList user uCid mCid groupParams = do
groupedWithList
=
map
(
addListType
(
invertForw
socialLists
))
grouped
(
stopTerms
,
candidateTerms
)
=
Map
.
partition
((
==
Just
StopTerm
)
.
viewListType
)
groupedWithList
(
groupedMono
,
groupedMult
)
=
Map
.
partition
(
\
t
->
t
^.
gt_size
<
2
)
candidateTerms
-- (groupedMono, groupedMult) = Map.partitionWithKey (\t
-> t ^. gt_size
< 2) candidateTerms
(
groupedMono
,
groupedMult
)
=
Map
.
partition
(
\
t
->
t
^.
gt_size
<
2
)
candidateTerms
-- (groupedMono, groupedMult) = Map.partitionWithKey (\t
_v -> size t
< 2) candidateTerms
-- printDebug "\n * stopTerms * \n" stopTerms
-- splitting monterms and multiterms to take proportional candidates
...
...
src/Gargantext/Core/Text/List/Social/Prelude.hs
View file @
a188045f
...
...
@@ -44,14 +44,10 @@ instance (Ord a, Eq b) => Monoid (FlowCont a b) where
mempty
=
FlowCont
mempty
mempty
instance
(
Eq
a
,
Ord
a
,
Eq
b
)
=>
Semigroup
(
FlowCont
a
b
)
where
(
<>
)
(
FlowCont
m1
s1
)
(
FlowCont
m2
s2
)
=
FlowCont
m
s
where
m
=
Map
.
union
m1
m2
s
|
s1
==
mempty
=
s2
|
s2
==
mempty
=
s1
|
otherwise
=
Map
.
intersection
s1
s2
(
<>
)
(
FlowCont
m1
s1
)
(
FlowCont
m2
s2
)
=
FlowCont
(
m1
<>
m2
)
(
s1
<>
s2
)
makeLenses
''
F
lowCont
...
...
src/Gargantext/Core/Text/List/Social/Scores.hs
View file @
a188045f
...
...
@@ -44,7 +44,7 @@ toFlowListScores k flc_origin = foldl' (toFlowListScores_Level1 k flc_origin) me
->
Map
Text
NgramsRepoElement
->
FlowCont
Text
FlowListScores
toFlowListScores_Level1
k'
flc_origin'
flc_dest
ngramsRepo
=
Set
.
foldl'
(
toFlowListScores_Level2
k'
ngramsRepo
flc_origin'
)
Set
.
foldl'
(
toFlowListScores_Level2
k'
ngramsRepo
flc_origin'
)
flc_dest
(
Set
.
fromList
$
Map
.
keys
$
view
flc_cont
flc_origin'
)
...
...
@@ -56,9 +56,15 @@ toFlowListScores k flc_origin = foldl' (toFlowListScores_Level1 k flc_origin) me
->
FlowCont
Text
FlowListScores
toFlowListScores_Level2
k''
ngramsRepo
flc_origin''
flc_dest'
t
=
case
Map
.
lookup
t
ngramsRepo
of
Nothing
->
over
flc_cont
(
Map
.
union
(
Map
.
singleton
t
mempty
))
flc_dest'
Just
nre
->
over
flc_scores
(
(
Map
.
alter
(
addParent
k''
nre
(
Set
.
fromList
$
Map
.
keys
$
view
flc_cont
flc_origin''
))
t
)
Nothing
->
over
flc_cont
(
Map
.
union
$
Map
.
singleton
t
mempty
)
flc_dest'
Just
nre
->
over
flc_cont
(
Map
.
delete
t
)
$
over
flc_scores
(
(
Map
.
alter
(
addParent
k''
nre
(
Set
.
fromList
$
Map
.
keys
$
view
flc_cont
flc_origin''
)
)
t
)
.
(
Map
.
alter
(
addList
$
_nre_list
nre
)
t
)
)
flc_dest'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment