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