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
200
Issues
200
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
e10c2ed4
Commit
e10c2ed4
authored
Nov 10, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] SocialLists clean/refact
parent
137eca93
Pipeline
#1204
failed with stage
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
24 deletions
+34
-24
Group.hs
src/Gargantext/Core/Text/Group.hs
+32
-22
List.hs
src/Gargantext/Core/Text/List.hs
+2
-2
No files found.
src/Gargantext/Core/Text/Group.hs
View file @
e10c2ed4
...
...
@@ -78,31 +78,40 @@ ngramsGroup (GroupParams l _m _n _) =
.
Text
.
replace
"-"
" "
------------------------------------------------------------------------
{-
mergeMapParent :: Map Text (GroupedText b)
-> Map Text (Map Text Int)
-> Map Text (GroupedText b)
mergeMapParent = undefined
-}
------------------------------------------------------------------------
data
GroupedTextParams
a
b
=
GroupedTextParams
{
_gt_fun_stem
::
Text
->
Text
,
_gt_fun_score
::
a
->
b
,
_gt_fun_texts
::
a
->
Set
Text
,
_gt_fun_nodeIds
::
a
->
Set
NodeId
}
makeLenses
'G
r
oupedTextParams
toGroupedText
::
Ord
b
=>
(
Text
->
Text
)
->
(
a
->
b
)
->
(
a
->
Set
Text
)
->
(
a
->
Set
NodeId
)
=>
GroupedTextParams
a
b
->
[(
Text
,
a
)]
->
Map
Stem
(
GroupedText
b
)
toGroupedText
fun_stem
fun_score
fun_texts
fun_nodeId
s
from
=
toGroupedText
gparam
s
from
=
Map
.
fromListWith
grouping
$
map
group
from
where
group
(
t
,
d
)
=
let
t'
=
fun_stem
t
group
(
t
,
d
)
=
let
t'
=
(
gparams
^.
gt_fun_stem
)
t
in
(
t'
,
GroupedText
Nothing
t
(
fun_score
d
)
(
fun_texts
d
)
(
(
gparams
^.
gt_fun_score
)
d
)
(
(
gparams
^.
gt_fun_texts
)
d
)
(
size
t
)
t'
(
fun_nodeIds
d
)
(
(
gparams
^.
gt_fun_nodeIds
)
d
)
)
grouping
::
Ord
a
...
...
@@ -127,9 +136,7 @@ toGroupedText_FlowListScores :: ( FlowList a b
->
Map
Text
(
GroupedText
b
)
toGroupedText_FlowListScores
=
undefined
toGroupedText_FlowListScores'
::
(
FlowList
a
b
)
toGroupedText_FlowListScores'
::
(
FlowList
a
b
)
=>
[
a
]
->
Map
Text
FlowListScores
->
(
[
a
]
...
...
@@ -157,16 +164,6 @@ class HasGroup a b | a -> b where
->
GroupedText
b
------------------------------------------
instance
HasGroup
(
Text
,
Set
NodeId
)
Int
where
createGroupWith
fs
(
t
,
ns
)
=
GroupedText
(
mapMax
$
fs
^.
flc_lists
)
t
(
Set
.
size
ns
)
Set
.
empty
(
size
t
)
t
ns
updateGroupWith
fs
(
t
,
ns
)
g
=
undefined
mapMax
::
Map
a
b
->
Maybe
a
mapMax
m
=
(
fst
.
fst
)
<$>
Map
.
maxViewWithKey
m
------------------------------------------------------------------------
...
...
@@ -197,6 +194,19 @@ instance (Eq a, Ord a) => Ord (GroupedText a) where
-- Lenses Instances
makeLenses
'G
r
oupedText
------------------------------------------------------------------------
instance
HasGroup
(
Text
,
Set
NodeId
)
Int
where
createGroupWith
fs
(
t
,
ns
)
=
GroupedText
(
mapMax
$
fs
^.
flc_lists
)
t
(
Set
.
size
ns
)
Set
.
empty
(
size
t
)
t
ns
updateGroupWith
fs
(
t
,
ns
)
g
=
set
gt_listType
(
mapMax
$
fs
^.
flc_lists
)
$
set
gt_nodes
(
Set
.
union
ns
$
g
^.
gt_nodes
)
g
------------------------------------------------------------------------
addListType
::
Map
Text
ListType
->
GroupedText
a
->
GroupedText
a
addListType
m
g
=
set
gt_listType
(
hasListType
m
g
)
g
...
...
src/Gargantext/Core/Text/List.hs
View file @
e10c2ed4
...
...
@@ -95,7 +95,7 @@ buildNgramsOthersList user uCid groupIt (nt, MapListSize mapListSize) = do
-- >8 >8 >8 >8 >8 >8 >8
let
grouped
=
toGroupedText
groupIt
(
Set
.
size
.
snd
)
fst
snd
grouped
=
toGroupedText
(
GroupedTextParams
groupIt
(
Set
.
size
.
snd
)
fst
snd
)
$
Map
.
toList
$
Map
.
mapWithKey
(
\
k
(
a
,
b
)
->
(
Set
.
delete
k
a
,
b
))
$
ngs
...
...
@@ -157,7 +157,7 @@ buildNgramsTermsList user uCid mCid groupParams = do
-- printDebug "stopTerms" stopTerms
-- Grouping the ngrams and keeping the maximum score for label
let
grouped
=
toGroupedText
(
ngramsGroup
groupParams
)
identity
(
const
Set
.
empty
)
(
const
Set
.
empty
)
allTerms
let
grouped
=
toGroupedText
(
GroupedTextParams
(
ngramsGroup
groupParams
)
identity
(
const
Set
.
empty
)
(
const
Set
.
empty
)
)
allTerms
groupedWithList
=
map
(
addListType
(
invertForw
socialLists
))
grouped
...
...
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