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
69bb5e8d
Commit
69bb5e8d
authored
Nov 19, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DOC] better variable names + warnings
parent
ebfd968f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
22 deletions
+24
-22
Prelude.hs
src/Gargantext/Core/Text/List/Social/Prelude.hs
+1
-1
Scores.hs
src/Gargantext/Core/Text/List/Social/Scores.hs
+23
-21
No files found.
src/Gargantext/Core/Text/List/Social/Prelude.hs
View file @
69bb5e8d
...
...
@@ -132,7 +132,7 @@ unions' = invertBack . Map.unionsWith (<>) . map invertForw
invertForw
::
(
Ord
b
,
Semigroup
a
)
=>
Map
a
(
Set
b
)
->
Map
b
a
invertForw
=
Map
.
unionsWith
(
<>
)
.
(
map
(
\
(
k
,
s
ets
)
->
Map
.
fromSet
(
\
_
->
k
)
sets
))
.
(
map
(
\
(
k
,
s
t
)
->
Map
.
fromSet
(
\
_
->
k
)
st
))
.
Map
.
toList
invertBack
::
(
Ord
a
,
Ord
b
)
=>
Map
b
a
->
Map
a
(
Set
b
)
...
...
src/Gargantext/Core/Text/List/Social/Scores.hs
View file @
69bb5e8d
...
...
@@ -35,30 +35,34 @@ toFlowListScores :: KeepAllParents
->
FlowListCont
Text
->
[
Map
Text
NgramsRepoElement
]
->
FlowListCont
Text
toFlowListScores
k
flc
=
foldl'
(
toFlowListScores'
k
flc
)
mempty
toFlowListScores
k
flc_origin
=
foldl'
(
toFlowListScores_Level1
k
flc_origin
)
mempty
where
toFlowListScores'
::
KeepAllParents
toFlowListScores_Level1
::
KeepAllParents
->
FlowListCont
Text
->
FlowListCont
Text
->
Map
Text
NgramsRepoElement
->
FlowListCont
Text
toFlowListScores'
k'
flc
flc'
ngramsRepo
=
Set
.
foldl'
(
toFlowListScores''
k'
ngramsRepo
flc
)
flc'
(
view
flc_cont
flc
)
toFlowListScores_Level1
k'
flc_origin'
flc_dest
ngramsRepo
=
Set
.
foldl'
(
toFlowListScores_Level2
k'
ngramsRepo
flc_origin'
)
flc_dest
(
view
flc_cont
flc_origin'
)
toFlowListScores
''
::
KeepAllParents
toFlowListScores
_Level2
::
KeepAllParents
->
Map
Text
NgramsRepoElement
->
FlowListCont
Text
->
FlowListCont
Text
->
Text
->
FlowListCont
Text
toFlowListScores
''
k''
ngramsRepo
flc
to'
'
t
=
toFlowListScores
_Level2
k''
ngramsRepo
flc_origin''
flc_dest
'
t
=
case
Map
.
lookup
t
ngramsRepo
of
Nothing
->
over
flc_cont
(
Set
.
insert
t
)
to'
'
Nothing
->
over
flc_cont
(
Set
.
insert
t
)
flc_dest
'
Just
nre
->
over
flc_scores
(
(
Map
.
alter
(
addParent
k''
nre
(
view
flc_cont
flc
))
t
)
(
(
Map
.
alter
(
addParent
k''
nre
(
view
flc_cont
flc
_origin''
))
t
)
.
(
Map
.
alter
(
addList
$
_nre_list
nre
)
t
)
)
to'
'
)
flc_dest
'
------------------------------------------------------------------------
-- | Main addFunctions to groupResolution the FlowListScores
...
...
@@ -68,18 +72,17 @@ addList :: ListType
->
Maybe
FlowListScores
->
Maybe
FlowListScores
addList
l
Nothing
=
Just
$
FlowListScores
Map
.
empty
(
addList
'
l
Map
.
empty
)
Just
$
FlowListScores
Map
.
empty
(
addList
Score
l
Map
.
empty
)
addList
l
(
Just
(
FlowListScores
mapParent
mapList
))
=
Just
$
FlowListScores
mapParent
mapList'
where
mapList'
=
addList'
l
mapList
Just
$
FlowListScores
mapParent
(
addListScore
l
mapList
)
-- * Unseful but nice comment:
-- "the addList function looks like an ASCII bird"
-- | Concrete function to pass to PatchMap
addList
'
::
ListType
->
Map
ListType
Int
->
Map
ListType
Int
addList
'
l
m
=
Map
.
alter
(
plus
l
)
l
m
addList
Score
::
ListType
->
Map
ListType
Int
->
Map
ListType
Int
addList
Score
l
m
=
Map
.
alter
(
plus
l
)
l
m
where
plus
CandidateTerm
Nothing
=
Just
1
plus
CandidateTerm
(
Just
x
)
=
Just
$
x
+
1
...
...
@@ -90,7 +93,6 @@ addList' l m = Map.alter (plus l) l m
plus
StopTerm
Nothing
=
Just
3
plus
StopTerm
(
Just
x
)
=
Just
$
x
+
3
------------------------------------------------------------------------
------------------------------------------------------------------------
data
KeepAllParents
=
KeepAllParents
Bool
...
...
@@ -101,21 +103,21 @@ addParent :: KeepAllParents -> NgramsRepoElement -> Set Text
addParent
k
nre
ss
Nothing
=
Just
$
FlowListScores
mapParent
Map
.
empty
where
mapParent
=
addParent
'
k
(
_nre_parent
nre
)
ss
Map
.
empty
mapParent
=
addParent
Score
k
(
_nre_parent
nre
)
ss
Map
.
empty
addParent
k
nre
ss
(
Just
(
FlowListScores
mapParent
mapList
))
=
Just
$
FlowListScores
mapParent'
mapList
where
mapParent'
=
addParent
'
k
(
_nre_parent
nre
)
ss
mapParent
mapParent'
=
addParent
Score
k
(
_nre_parent
nre
)
ss
mapParent
addParent
'
::
Num
a
addParent
Score
::
Num
a
=>
KeepAllParents
->
Maybe
NgramsTerm
->
Set
Text
->
Map
Text
a
->
Map
Text
a
addParent
'
_
Nothing
_ss
mapParent
=
mapParent
addParent
'
(
KeepAllParents
k
)
(
Just
(
NgramsTerm
p'
))
ss
mapParent
=
addParent
Score
_
Nothing
_ss
mapParent
=
mapParent
addParent
Score
(
KeepAllParents
k
)
(
Just
(
NgramsTerm
p'
))
ss
mapParent
=
case
k
of
True
->
Map
.
alter
addCount
p'
mapParent
False
->
case
Set
.
member
p'
ss
of
...
...
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