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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
9bb32e37
Commit
9bb32e37
authored
Nov 12, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Social lists WithParent class and instances
parent
8bccd07f
Pipeline
#1207
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
Group.hs
src/Gargantext/Core/Text/Group.hs
+13
-10
No files found.
src/Gargantext/Core/Text/Group.hs
View file @
9bb32e37
...
...
@@ -136,30 +136,29 @@ toGroupedText_FlowListScores :: ( FlowList a b
toGroupedText_FlowListScores
=
undefined
toGroupedText_FlowListScores'
::
(
FlowList
a
b
,
Ord
b
)
=>
(
Map
Text
c
,
Maybe
a
->
(
Text
,
c
)
->
a
,
Text
->
a
->
a
)
=>
Map
Text
c
->
Map
Text
FlowListScores
->
(
[
a
]
,
Map
Text
(
GroupedText
b
)
)
toGroupedText_FlowListScores'
(
ms'
,
to
,
with
)
scores
=
foldl'
fun_group
start
ms
toGroupedText_FlowListScores'
ms'
scores
=
foldl'
fun_group
start
ms
where
start
=
(
[]
,
Map
.
empty
)
ms
=
(
to
Nothing
)
<$>
Map
.
toList
ms'
ms
=
map
selfParent
(
Map
.
toList
ms'
)
fun_group
(
left
,
grouped
)
current
=
case
Map
.
lookup
(
hasNgrams
current
)
scores
of
Just
scores'
->
case
keyWithMaxValue
$
scores'
^.
flc_parents
of
Nothing
->
(
left
,
Map
.
alter
(
updateWith
scores'
current
)
(
hasNgrams
current
)
grouped
)
Just
parent
->
fun_group
(
left
,
grouped
)
(
with
parent
current
)
Just
scores'
->
case
keyWithMaxValue
$
scores'
^.
flc_parents
of
Nothing
->
(
left
,
Map
.
alter
(
updateWith
scores'
current
)
(
hasNgrams
current
)
grouped
)
Just
parent
->
fun_group
(
left
,
grouped
)
(
withParent
ms'
parent
current
)
Nothing
->
(
current
:
left
,
grouped
)
updateWith
scores
current
Nothing
=
Just
$
createGroupWith
scores
current
updateWith
scores
current
(
Just
x
)
=
Just
$
updateGroupWith
scores
current
x
type
FlowList
a
b
=
(
HasNgrams
a
,
HasGroup
a
b
)
------------------------------------------------------------------------
type
FlowList
a
b
=
(
HasNgrams
a
,
HasGroup
a
b
,
WithParent
a
)
class
HasNgrams
a
where
hasNgrams
::
a
->
Text
...
...
@@ -168,6 +167,10 @@ class HasGroup a b | a -> b where
createGroupWith
::
FlowListScores
->
a
->
GroupedText
b
updateGroupWith
::
FlowListScores
->
a
->
GroupedText
b
->
GroupedText
b
class
WithParent
a
where
selfParent
::
(
Text
,
c
)
->
a
withParent
::
Map
Text
c
->
Text
->
a
->
a
------------------------------------------------------------------------
type
Stem
=
Text
type
Label
=
Text
...
...
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