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
731b13e9
Commit
731b13e9
authored
Dec 10, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] lens for flowcont and flowlistscores (wip)
parent
a0c61ebe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
4 deletions
+60
-4
History.hs
src/Gargantext/Core/Text/List/Social/History.hs
+4
-4
Patch.hs
src/Gargantext/Core/Text/List/Social/Patch.hs
+56
-0
No files found.
src/Gargantext/Core/Text/List/Social/History.hs
View file @
731b13e9
...
...
@@ -12,10 +12,10 @@ module Gargantext.Core.Text.List.Social.History
where
import
Data.Map
(
Map
)
import
Control.Lens
(
view
)
import
Control.Lens
hiding
(
cons
)
import
Gargantext.API.Ngrams.Types
import
Gargantext.Prelude
import
Gargantext.Core.Types
(
List
Type
(
..
),
List
Id
,
NodeId
)
import
Gargantext.Core.Types
(
ListId
,
NodeId
)
import
qualified
Data.Map.Strict.Patch
as
PatchMap
import
qualified
Data.Map.Strict
as
Map
import
qualified
Data.List
as
List
...
...
@@ -26,11 +26,12 @@ userHistory :: [NgramsType]
->
[
ListId
]
->
Repo
s
NgramsStatePatch
->
Map
NgramsType
(
Map
ListId
[
Map
NgramsTerm
NgramsPatch
])
userHistory
t
l
r
=
clean
$
history
t
l
r
userHistory
t
l
=
clean
.
(
history
t
l
)
where
clean
=
Map
.
map
(
Map
.
map
List
.
init
)
history
::
[
NgramsType
]
->
[
ListId
]
->
Repo
s
NgramsStatePatch
...
...
@@ -73,4 +74,3 @@ toMap = Map.map (Map.map unNgramsTablePatch) . (Map.map toMap') . toMap'
unNgramsTablePatch
::
NgramsTablePatch
->
Map
NgramsTerm
NgramsPatch
unNgramsTablePatch
(
NgramsTablePatch
p
)
=
toMap'
p
src/Gargantext/Core/Text/List/Social/Patch.hs
0 → 100644
View file @
731b13e9
{-|
Module : Gargantext.Core.Text.List.Social.Patch
Description :
Copyright : (c) CNRS, 2018-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
module
Gargantext.Core.Text.List.Social.Patch
where
import
Data.Text
(
Text
)
import
Data.Map
(
Map
)
import
Data.Monoid
import
Control.Lens
hiding
(
cons
)
import
Gargantext.API.Ngrams.Types
import
Gargantext.Prelude
import
Gargantext.Core.Types
(
ListType
(
..
),
ListId
,
NodeId
)
import
Gargantext.Core.Text.List.Social
import
Gargantext.Core.Text.List.Social.Prelude
import
qualified
Data.Map.Strict.Patch
as
PatchMap
import
qualified
Data.Map.Strict
as
Map
import
qualified
Data.List
as
List
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
-- (1,Nothing) & _2 %~ (<> (Just (-1)))
{-
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 = "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 = "problem"},NgramsPatch {_patch_children = PatchMSet (PatchMap (fromList [])), _patch_list = Replace {_old = MapTerm, _new = CandidateTerm}})]
,fromList [(NgramsTerm {unNgramsTerm = "paper"},NgramsPatch {_patch_children = PatchMSet (PatchMap (fromList [])), _patch_list = Replace {_old = MapTerm, _new = StopTerm}})]])])]
-}
addScorePatch
::
Text
{--> NgramsPatch-}
->
FlowCont
Text
FlowListScores
addScorePatch
t
=
fl
&
flc_scores
.
at
t
%~
score
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