Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Przemyslaw Kaminski
haskell-gargantext
Commits
086e254a
Commit
086e254a
authored
Feb 01, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] map list to 0
parent
5f971241
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
WithScores.hs
src/Gargantext/Core/Text/List/Group/WithScores.hs
+13
-7
No files found.
src/Gargantext/Core/Text/List/Group/WithScores.hs
View file @
086e254a
...
...
@@ -35,7 +35,8 @@ groupWithScores' :: (Eq a, Ord a, Monoid a)
groupWithScores'
flc
scores
=
FlowCont
groups
orphans
where
-- parent/child relation is inherited from social lists
groups
=
toGroupedTree
groups
=
HashMap
.
filter
(
\
v
->
view
gts'_score
v
/=
mempty
)
$
toGroupedTree'
$
toMapMaybeParent
scores
$
(
view
flc_scores
flc
<>
view
flc_cont
flc
)
...
...
@@ -66,22 +67,27 @@ fromScores'' f' (t, fs) = ( maybeParent
maybeList
=
keyWithMaxValue
$
view
fls_listType
fs
------------------------------------------------------------------------
toGroupedTree
::
Eq
a
toGroupedTree
'
::
Eq
a
=>
HashMap
(
Maybe
Parent
)
(
HashMap
NgramsTerm
(
GroupedTreeScores
a
))
->
HashMap
Parent
(
GroupedTreeScores
a
)
toGroupedTree
m
=
case
HashMap
.
lookup
Nothing
m
of
toGroupedTree
'
m
=
case
HashMap
.
lookup
Nothing
m
of
Nothing
->
mempty
Just
m'
->
toGroupedTree'
m
m'
Just
m'
->
toGroupedTree''
m
m'
filterGroupedTree
::
(
GroupedTreeScores
a
->
Bool
)
->
HashMap
Parent
(
GroupedTreeScores
a
)
->
HashMap
Parent
(
GroupedTreeScores
a
)
filterGroupedTree
f
=
HashMap
.
filter
f
toGroupedTree'
::
Eq
a
=>
HashMap
(
Maybe
Parent
)
(
HashMap
NgramsTerm
(
GroupedTreeScores
a
))
toGroupedTree'
'
::
Eq
a
=>
HashMap
(
Maybe
Parent
)
(
HashMap
NgramsTerm
(
GroupedTreeScores
a
))
->
(
HashMap
NgramsTerm
(
GroupedTreeScores
a
))
->
HashMap
Parent
(
GroupedTreeScores
a
)
toGroupedTree'
m
notEmpty
toGroupedTree'
'
m
notEmpty
|
notEmpty
==
mempty
=
mempty
|
otherwise
=
HashMap
.
mapWithKey
(
addGroup
m
)
notEmpty
where
addGroup
m'
k
v
=
over
gts'_children
(
(
toGroupedTree'
m'
)
addGroup
m'
k
v
=
over
gts'_children
(
(
toGroupedTree'
'
m'
)
.
(
HashMap
.
union
(
fromMaybe
mempty
$
HashMap
.
lookup
(
Just
k
)
m'
)
...
...
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