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
31ac4c9c
Commit
31ac4c9c
authored
Dec 11, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Patch new / old implemented
parent
23b11d68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
13 deletions
+33
-13
Patch.hs
src/Gargantext/Core/Text/List/Social/Patch.hs
+33
-13
No files found.
src/Gargantext/Core/Text/List/Social/Patch.hs
View file @
31ac4c9c
...
@@ -24,14 +24,12 @@ import qualified Data.Map.Strict.Patch as PatchMap
...
@@ -24,14 +24,12 @@ import qualified Data.Map.Strict.Patch as PatchMap
import
qualified
Data.Map.Strict
as
Map
import
qualified
Data.Map.Strict
as
Map
import
qualified
Data.List
as
List
import
qualified
Data.List
as
List
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
import
Gargantext.API.Ngrams.Types
import
qualified
Data.Patch.Class
as
Patch
(
Replace
(
..
))
-- (1,Nothing) & _2 %~ (<> (Just (-1)))
{-
{-
fromList [(NgramsTerms,fromList [(NodeId 189,
fromList [(NgramsTerms,fromList [(NodeId 189,
fromList [(NgramsTerm {unNgramsTerm = "journal"},NgramsReplace {_patch_old = Nothing, _patch_new = Just (NgramsRepoElement {_nre_size = 1, _nre_list = CandidateTerm, _nre_root = Nothing, _nre_parent = Nothing, _nre_children = MSet (fromList [])})})],f
fromList [(NgramsTerm {unNgramsTerm = "journal"},NgramsReplace {_patch_old = Nothing, _patch_new = Just (NgramsRepoElement {_nre_size = 1, _nre_list = CandidateTerm, _nre_root = Nothing, _nre_parent = Nothing, _nre_children = MSet (fromList [])})})],f
[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 = Just (), _new = Nothing})])), _patch_list = Keep})]
...
@@ -41,16 +39,38 @@ fromList [(NgramsTerm {unNgramsTerm = "journal"},NgramsReplace {_patch_old = Not
...
@@ -41,16 +39,38 @@ fromList [(NgramsTerm {unNgramsTerm = "journal"},NgramsReplace {_patch_old = Not
,fromList [(NgramsTerm {unNgramsTerm = "paper"},NgramsPatch {_patch_children = PatchMSet (PatchMap (fromList [])), _patch_list = Replace {_old = MapTerm, _new = StopTerm}})]])])]
,fromList [(NgramsTerm {unNgramsTerm = "paper"},NgramsPatch {_patch_children = PatchMSet (PatchMap (fromList [])), _patch_list = Replace {_old = MapTerm, _new = StopTerm}})]])])]
-}
-}
addScorePatch
::
Text
{--> NgramsPatch-}
->
FlowCont
Text
FlowListScores
addScorePatch
::
(
NgramsTerm
,
NgramsPatch
)
addScorePatch
t
=
fl
&
flc_scores
.
at
t
%~
score
->
FlowCont
Text
FlowListScores
->
FlowCont
Text
FlowListScores
addScorePatch
(
NgramsTerm
t
,
(
NgramsPatch
children
(
Patch
.
Replace
old_list
new_list
)))
fl
=
fl
&
with_old_list
&
with_new_list
-- & addParent
where
-- Old list get -1 score
-- New list get +1 score
-- Hence others lists lay around 0 score
with_old_list
=
flc_scores
.
at
t
%~
(
score
old_list
(
-
1
))
with_new_list
=
flc_scores
.
at
t
%~
(
score
new_list
(
1
))
score
list
n
m
=
(
Just
mempty
<>
m
)
&
_Just
.
fls_listType
.
at
list
%~
(
<>
Just
n
)
{-
addParent = flc_scores . at t %~ (score MapTerm 1)
parent term n m = (Just mempty <> m)
& _Just
. fls_listType
. at list
%~ (<> Just n)
-}
where
fl
=
FlowCont
mempty
mempty
score
m
=
(
Just
mempty
<>
m
)
&
_Just
.
fls_listType
.
at
MapTerm
%~
(
<>
Just
1
)
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