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
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
Julien Moutinho
haskell-gargantext
Commits
62fcd6ea
Commit
62fcd6ea
authored
Nov 03, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] SocialList. Realizing we need PatchMap here.
parent
093afa75
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
20 deletions
+32
-20
List.hs
src/Gargantext/Core/Text/List.hs
+0
-3
Social.hs
src/Gargantext/Core/Text/List/Social.hs
+6
-6
Group.hs
src/Gargantext/Core/Text/List/Social/Group.hs
+21
-9
ListType.hs
src/Gargantext/Core/Text/List/Social/ListType.hs
+5
-2
No files found.
src/Gargantext/Core/Text/List.hs
View file @
62fcd6ea
...
@@ -79,10 +79,8 @@ buildNgramsOthersList ::( HasNodeError err
...
@@ -79,10 +79,8 @@ buildNgramsOthersList ::( HasNodeError err
->
(
NgramsType
,
MapListSize
)
->
(
NgramsType
,
MapListSize
)
->
m
(
Map
NgramsType
[
NgramsElement
])
->
m
(
Map
NgramsType
[
NgramsElement
])
buildNgramsOthersList
user
uCid
groupIt
(
nt
,
MapListSize
mapListSize
)
=
do
buildNgramsOthersList
user
uCid
groupIt
(
nt
,
MapListSize
mapListSize
)
=
do
ngs
<-
groupNodesByNgramsWith
groupIt
<$>
getNodesByNgramsUser
uCid
nt
ngs
<-
groupNodesByNgramsWith
groupIt
<$>
getNodesByNgramsUser
uCid
nt
let
let
grouped
=
toGroupedText
groupIt
(
Set
.
size
.
snd
)
fst
snd
grouped
=
toGroupedText
groupIt
(
Set
.
size
.
snd
)
fst
snd
(
Map
.
toList
$
Map
.
mapWithKey
(
\
k
(
a
,
b
)
->
(
Set
.
delete
k
a
,
b
))
$
ngs
)
(
Map
.
toList
$
Map
.
mapWithKey
(
\
k
(
a
,
b
)
->
(
Set
.
delete
k
a
,
b
))
$
ngs
)
...
@@ -265,7 +263,6 @@ buildNgramsTermsList user uCid mCid groupParams = do
...
@@ -265,7 +263,6 @@ buildNgramsTermsList user uCid mCid groupParams = do
-- printDebug "monoScoredInclHead" monoScoredInclHead
-- printDebug "monoScoredInclHead" monoScoredInclHead
-- printDebug "monoScoredExclHead" monoScoredExclTail
-- printDebug "monoScoredExclHead" monoScoredExclTail
--
-- printDebug "multScoredInclHead" multScoredInclHead
-- printDebug "multScoredInclHead" multScoredInclHead
-- printDebug "multScoredExclTail" multScoredExclTail
-- printDebug "multScoredExclTail" multScoredExclTail
...
...
src/Gargantext/Core/Text/List/Social.hs
View file @
62fcd6ea
...
@@ -79,12 +79,12 @@ flowSocialListByMode listIds nt ngrams' = do
...
@@ -79,12 +79,12 @@ flowSocialListByMode listIds nt ngrams' = do
flowSocialListByMode'
::
(
RepoCmdM
env
err
m
flowSocialListByMode'
::
(
RepoCmdM
env
err
m
,
CmdM
env
err
m
,
CmdM
env
err
m
,
HasNodeError
err
,
HasNodeError
err
,
HasTreeError
err
,
HasTreeError
err
)
)
=>
[
NodeId
]
->
NgramsType
->
Set
Text
=>
[
NodeId
]
->
NgramsType
->
Set
Text
->
m
(
Map
Text
FlowListScores
)
->
m
(
Map
Text
FlowListScores
)
flowSocialListByMode'
ns
nt
st
=
do
flowSocialListByMode'
ns
nt
st
=
do
ngramsRepos
<-
mapM
(
\
l
->
getListNgrams
[
l
]
nt
)
ns
ngramsRepos
<-
mapM
(
\
l
->
getListNgrams
[
l
]
nt
)
ns
pure
$
toFlowListScores
st
Map
.
empty
ngramsRepos
pure
$
toFlowListScores
st
Map
.
empty
ngramsRepos
...
...
src/Gargantext/Core/Text/List/Social/Group.hs
View file @
62fcd6ea
...
@@ -106,11 +106,9 @@ toFlowListScores ts = foldl' (toFlowListScores' ts)
...
@@ -106,11 +106,9 @@ toFlowListScores ts = foldl' (toFlowListScores' ts)
$
Map
.
alter
(
addList
$
_nre_list
nre
)
t
to''
$
Map
.
alter
(
addList
$
_nre_list
nre
)
t
to''
------------------------------------------------------------------------
------------------------------------------------------------------------
-- | Main addFunctions to FlowListScores
-- | Main addFunctions to groupResolution the FlowListScores
------------------------------------------------------------------------
-- Use patch-map library here
-- diff, transformWith patches simplifies functions below
-- | Unseful but nice comment:
-- "this function looks like an ASCII bird"
addList
::
ListType
addList
::
ListType
->
Maybe
FlowListScores
->
Maybe
FlowListScores
->
Maybe
FlowListScores
->
Maybe
FlowListScores
...
@@ -121,16 +119,30 @@ addList l (Just (FlowListScores mapParent mapList)) =
...
@@ -121,16 +119,30 @@ addList l (Just (FlowListScores mapParent mapList)) =
Just
$
FlowListScores
mapParent
mapList'
Just
$
FlowListScores
mapParent
mapList'
where
where
mapList'
=
addList'
l
mapList
mapList'
=
addList'
l
mapList
-- * Unseful but nice comment:
-- "the addList function looks like an ASCII bird in a blue sky"
-- _
-- ___| | ___ _
-- / __| |/ / | | |
-- \__ \ <| |_| |
-- |___/_|\_\\__, |
-- |___/
--
--
--
-- | Concrete function to pass to PatchMap
addList'
::
ListType
->
Map
ListType
Int
->
Map
ListType
Int
addList'
::
ListType
->
Map
ListType
Int
->
Map
ListType
Int
addList'
l
m
=
Map
.
alter
(
plus
l
)
l
m
addList'
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
plus
_
Nothing
=
Just
3
plus
MapTerm
Nothing
=
Just
2
plus
_
(
Just
x
)
=
Just
$
x
+
3
plus
MapTerm
(
Just
x
)
=
Just
$
x
+
2
plus
StopTerm
Nothing
=
Just
3
plus
StopTerm
(
Just
x
)
=
Just
$
x
+
3
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
...
...
src/Gargantext/Core/Text/List/Social/ListType.hs
View file @
62fcd6ea
...
@@ -87,6 +87,9 @@ countList t m input = case Map.lookup t m of
...
@@ -87,6 +87,9 @@ countList t m input = case Map.lookup t m of
plus
CandidateTerm
Nothing
=
Just
1
plus
CandidateTerm
Nothing
=
Just
1
plus
CandidateTerm
(
Just
x
)
=
Just
$
x
+
1
plus
CandidateTerm
(
Just
x
)
=
Just
$
x
+
1
plus
_
Nothing
=
Just
3
plus
MapTerm
Nothing
=
Just
2
plus
_
(
Just
x
)
=
Just
$
x
+
3
plus
MapTerm
(
Just
x
)
=
Just
$
x
+
2
plus
StopTerm
Nothing
=
Just
3
plus
StopTerm
(
Just
x
)
=
Just
$
x
+
3
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