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
6857a2f6
Commit
6857a2f6
authored
Dec 11, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Patches to scores (WIP)
parent
812ce833
Pipeline
#1294
failed with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
11 deletions
+59
-11
package.yaml
package.yaml
+1
-0
Social.hs
src/Gargantext/Core/Text/List/Social.hs
+36
-1
History.hs
src/Gargantext/Core/Text/List/Social/History.hs
+6
-0
Patch.hs
src/Gargantext/Core/Text/List/Social/Patch.hs
+16
-10
No files found.
package.yaml
View file @
6857a2f6
...
...
@@ -188,6 +188,7 @@ library:
-
product-profunctors
-
profunctors
-
protolude
-
pretty-simple
-
pureMD5
-
quickcheck-instances
-
rake
...
...
src/Gargantext/Core/Text/List/Social.hs
View file @
6857a2f6
...
...
@@ -11,11 +11,14 @@ Portability : POSIX
module
Gargantext.Core.Text.List.Social
where
import
Data.Map
(
Map
)
import
Data.Monoid
(
mconcat
)
import
Data.Text
(
Text
)
import
Gargantext.API.Ngrams.Tools
import
Gargantext.API.Ngrams.Types
import
Gargantext.Core.Text.List.Social.Find
import
Gargantext.Core.Text.List.Social.History
import
Gargantext.Core.Text.List.Social.Patch
import
Gargantext.Core.Text.List.Social.Prelude
import
Gargantext.Core.Text.List.Social.Scores
import
Gargantext.Core.Types.Individu
...
...
@@ -81,9 +84,41 @@ flowSocialList flowPriority user nt flc =
)
=>
NgramsType
->
FlowCont
Text
FlowListScores
->
[
Node
Id
]
->
[
List
Id
]
->
m
(
FlowCont
Text
FlowListScores
)
flowSocialListByModeWith
nt''
flc''
ns
=
mapM
(
\
l
->
getListNgrams
[
l
]
nt''
)
ns
>>=
pure
.
toFlowListScores
(
keepAllParents
nt''
)
flc''
-----------------------------------------------------------------
getHistory
::
(
RepoCmdM
env
err
m
,
CmdM
env
err
m
,
HasNodeError
err
,
HasTreeError
err
)
=>
History
->
NgramsType
->
[
ListId
]
->
m
(
Map
NgramsType
(
Map
ListId
[
Map
NgramsTerm
NgramsPatch
]))
getHistory
hist
nt
listes
=
history
hist
[
nt
]
listes
<$>
getRepo
getHistoryScores
::
(
RepoCmdM
env
err
m
,
CmdM
env
err
m
,
HasNodeError
err
,
HasTreeError
err
)
=>
History
->
NgramsType
->
FlowCont
Text
FlowListScores
->
[
ListId
]
->
m
(
FlowCont
Text
FlowListScores
)
getHistoryScores
hist
nt
fl
listes
=
addScorePatches
nt
listes
fl
<$>
getHistory
hist
nt
listes
src/Gargantext/Core/Text/List/Social/History.hs
View file @
6857a2f6
...
...
@@ -21,13 +21,18 @@ import Gargantext.Prelude
import
qualified
Data.List
as
List
import
qualified
Data.Map.Strict
as
Map
-- TODO put this in Prelude maybe
cons
::
a
->
[
a
]
cons
a
=
[
a
]
------------------------------------------------------------------------
-- | History control
data
History
=
User
|
NotUser
|
AllHistory
------------------------------------------------------------------------
-- | Main Function
history
::
History
->
[
NgramsType
]
->
[
ListId
]
...
...
@@ -44,6 +49,7 @@ history NotUser t l = clean . (history' t l)
history
AllHistory
t
l
=
history'
t
l
------------------------------------------------------------------------
history'
::
[
NgramsType
]
->
[
ListId
]
...
...
src/Gargantext/Core/Text/List/Social/Patch.hs
View file @
6857a2f6
...
...
@@ -26,23 +26,20 @@ import qualified Data.List as List
import
qualified
Data.Map
as
Map
import
qualified
Data.Patch.Class
as
Patch
(
Replace
(
..
))
{-
fromList [(NgramsTerms,fromList [(NodeId 189,
-}
addScorePaches
::
NgramsType
->
[
ListId
]
->
Map
NgramsType
(
Map
ListId
[
Map
NgramsTerm
NgramsPatch
])
addScorePatches
::
NgramsType
->
[
ListId
]
->
FlowCont
Text
FlowListScores
->
Map
NgramsType
(
Map
ListId
[
Map
NgramsTerm
NgramsPatch
])
->
FlowCont
Text
FlowListScores
addScorePa
ches
nt
listes
repo
fl
=
foldl'
(
addScorePa
chesList
nt
repo
)
fl
listes
addScorePa
tches
nt
listes
fl
repo
=
foldl'
(
addScorePat
chesList
nt
repo
)
fl
listes
addScorePachesList
::
NgramsType
addScorePa
t
chesList
::
NgramsType
->
Map
NgramsType
(
Map
ListId
[
Map
NgramsTerm
NgramsPatch
])
->
FlowCont
Text
FlowListScores
->
ListId
->
FlowCont
Text
FlowListScores
addScorePachesList
nt
repo
fl
lid
=
foldl'
addScorePatch
fl
patches
addScorePa
t
chesList
nt
repo
fl
lid
=
foldl'
addScorePatch
fl
patches
where
patches
=
maybe
[]
(
List
.
concat
.
(
map
Map
.
toList
))
patches'
...
...
@@ -77,6 +74,17 @@ addScorePatch fl (NgramsTerm t, (NgramsPatch _children (Patch.Replace old_list n
{-
[fromList [(NgramsTerm {unNgramsTerm = "approach"},NgramsPatch {_patch_children = PatchMSet (PatchMap (fromList [(NgramsTerm {unNgramsTerm = "order"},Replace {_old = Just (), _new = Nothing})])), _patch_list = Keep})]
,fromList [(NgramsTerm {unNgramsTerm = "approach"},NgramsPatch {_patch_children = PatchMSet (PatchMap (fromList [(NgramsTerm {unNgramsTerm = "order"},Replace {_old = Nothing, _new = Just ()})])), _patch_list = Keep})]
fromList [(NgramsTerm {unNgramsTerm = "Journals"}
,NgramsReplace { _patch_old = Nothing
, _patch_new = Just (NgramsRepoElement { _nre_size = 1
, _nre_list = MapTerm
, _nre_root = Nothing
, _nre_parent = Nothing, _nre_children = MSet (fromList [(NgramsTerm {unNgramsTerm = "European Journal of Operational Research"},()),(NgramsTerm {unNgramsTerm = "Physical Review C"},())])})})]
,fromList [(NgramsTerm {unNgramsTerm = "NOT FOUND"},NgramsPatch {_patch_children = PatchMSet (PatchMap (fromList [])), _patch_list = Replace {_old = MapTerm, _new = StopTerm}})]])])]
-}
addScorePatch
fl
(
NgramsTerm
t
,
NgramsPatch
children
Patch
.
Keep
)
=
foldl'
add
fl
$
toList
children
where
...
...
@@ -107,5 +115,3 @@ score field list n m = (Just mempty <> m)
.
field
.
at
list
%~
(
<>
Just
n
)
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