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
195
Issues
195
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
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
Pipeline
#1303
failed with stage
Changes
3
Pipelines
1
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
...
@@ -100,18 +100,18 @@ buildNgramsOthersList user uCid groupParams (nt, MapListSize mapListSize) = do
$
List
.
zip
(
Map
.
keys
allTerms
)
$
List
.
zip
(
Map
.
keys
allTerms
)
(
List
.
cycle
[
mempty
])
(
List
.
cycle
[
mempty
])
)
)
{-
if
nt
==
Authors
if nt ==
Sources --
Authors
then printDebug "flowSocialList" socialLists
then printDebug "flowSocialList" socialLists
else printDebug "flowSocialList" ""
else printDebug "flowSocialList" ""
-}
let
let
groupedWithList
=
toGroupedTree
groupParams
socialLists
allTerms
groupedWithList
=
toGroupedTree
groupParams
socialLists
allTerms
{-
if
nt
==
Authors
if nt ==
Sources --
Authors
then printDebug "groupedWithList" groupedWithList
then printDebug "groupedWithList" groupedWithList
else printDebug "groupedWithList" ""
else printDebug "groupedWithList" ""
-}
let
let
(
stopTerms
,
tailTerms
)
=
Map
.
partition
((
==
Just
StopTerm
)
.
viewListType
)
(
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
...
@@ -38,12 +38,14 @@ groupWithScores' flc scores = FlowCont groups orphans
-- parent/child relation is inherited from social lists
-- parent/child relation is inherited from social lists
groups
=
toGroupedTree
groups
=
toGroupedTree
$
toMapMaybeParent
scores
$
toMapMaybeParent
scores
$
view
flc_scores
flc
$
(
view
flc_scores
flc
<>
view
flc_cont
flc
)
-- orphans should be filtered already
-- orphans should be filtered already
orphans
=
toGroupedTree
orphans
=
mempty
{-
toGroupedTree
$ toMapMaybeParent scores
$ toMapMaybeParent scores
$ view flc_cont flc
$ view flc_cont flc
-}
------------------------------------------------------------------------
------------------------------------------------------------------------
toMapMaybeParent
::
(
Eq
a
,
Ord
a
,
Monoid
a
)
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
...
@@ -97,14 +97,6 @@ parentUnionsExcl :: Ord a
->
Map
a
b
->
Map
a
b
parentUnionsExcl
=
Map
.
unions
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
-- | Takes key with max value if and only if value > 0
-- If value <= 0 alors key is not taken at all
-- If value <= 0 alors key is not taken at all
...
@@ -113,12 +105,15 @@ hasParent t m = case Map.lookup t m of
...
@@ -113,12 +105,15 @@ hasParent t m = case Map.lookup t m of
-- Just 'z'
-- Just 'z'
-- >>> keyWithMaxValue $ DM.fromList $ zip (['a'..'z'] :: [Char]) ([-1,-2..]::[Int])
-- >>> keyWithMaxValue $ DM.fromList $ zip (['a'..'z'] :: [Char]) ([-1,-2..]::[Int])
-- Nothing
-- 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
keyWithMaxValue
m
=
do
k
<-
headMay
$
getMaxFromMap
m
maxKey
<-
headMay
$
getMaxFromMap
m
maxValue
<-
Map
.
lookup
k
m
maxValue
<-
Map
.
lookup
maxKey
m
if
maxValue
>
0
if
maxValue
>
0
then
pure
k
then
pure
maxKey
else
Nothing
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