Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
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
Przemyslaw Kaminski
haskell-gargantext
Commits
0ba78c07
Commit
0ba78c07
authored
Dec 15, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] History patch working, bug several NRE fixed, needs stemming scores now
parent
ad759fa0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
20 deletions
+17
-20
List.hs
src/Gargantext/Core/Text/List.hs
+6
-6
WithScores.hs
src/Gargantext/Core/Text/List/Group/WithScores.hs
+4
-2
Prelude.hs
src/Gargantext/Core/Text/List/Social/Prelude.hs
+7
-12
No files found.
src/Gargantext/Core/Text/List.hs
View file @
0ba78c07
...
...
@@ -100,18 +100,18 @@ buildNgramsOthersList user uCid groupParams (nt, MapListSize mapListSize) = do
$
List
.
zip
(
Map
.
keys
allTerms
)
(
List
.
cycle
[
mempty
])
)
if
nt
==
Authors
{-
if nt ==
Sources --
Authors
then printDebug "flowSocialList" socialLists
else printDebug "flowSocialList" ""
-}
let
groupedWithList
=
toGroupedTree
groupParams
socialLists
allTerms
if
nt
==
Authors
{-
if nt ==
Sources --
Authors
then printDebug "groupedWithList" groupedWithList
else printDebug "groupedWithList" ""
-}
let
(
stopTerms
,
tailTerms
)
=
Map
.
partition
((
==
Just
StopTerm
)
.
viewListType
)
...
...
src/Gargantext/Core/Text/List/Group/WithScores.hs
View file @
0ba78c07
...
...
@@ -38,12 +38,14 @@ groupWithScores' flc scores = FlowCont groups orphans
-- parent/child relation is inherited from social lists
groups
=
toGroupedTree
$
toMapMaybeParent
scores
$
view
flc_scores
flc
$
(
view
flc_scores
flc
<>
view
flc_cont
flc
)
-- orphans should be filtered already
orphans
=
toGroupedTree
orphans
=
mempty
{-
toGroupedTree
$ toMapMaybeParent scores
$ view flc_cont flc
-}
------------------------------------------------------------------------
toMapMaybeParent
::
(
Eq
a
,
Ord
a
,
Monoid
a
)
...
...
src/Gargantext/Core/Text/List/Social/Prelude.hs
View file @
0ba78c07
...
...
@@ -97,14 +97,6 @@ parentUnionsExcl :: Ord a
->
Map
a
b
parentUnionsExcl
=
Map
.
unions
------------------------------------------------------------------------
hasParent
::
Text
->
Map
Text
(
Map
Parent
Int
)
->
Maybe
Parent
hasParent
t
m
=
case
Map
.
lookup
t
m
of
Nothing
->
Nothing
Just
m'
->
keyWithMaxValue
m'
------------------------------------------------------------------------
-- | Takes key with max value if and only if value > 0
-- If value <= 0 alors key is not taken at all
...
...
@@ -113,12 +105,15 @@ hasParent t m = case Map.lookup t m of
-- Just 'z'
-- >>> keyWithMaxValue $ DM.fromList $ zip (['a'..'z'] :: [Char]) ([-1,-2..]::[Int])
-- Nothing
keyWithMaxValue
::
(
Ord
a
,
Ord
b
,
Num
b
)
=>
Map
a
b
->
Maybe
a
-- TODO duplicate with getMaxFromMap and improve it (lookup value should not be needed)
-- TODO put in custom Prelude
keyWithMaxValue
::
(
Ord
a
,
Ord
b
,
Num
b
)
=>
Map
a
b
->
Maybe
a
keyWithMaxValue
m
=
do
k
<-
headMay
$
getMaxFromMap
m
maxValue
<-
Map
.
lookup
k
m
maxKey
<-
headMay
$
getMaxFromMap
m
maxValue
<-
Map
.
lookup
maxKey
m
if
maxValue
>
0
then
pure
k
then
pure
maxKey
else
Nothing
...
...
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