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
141
Issues
141
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
fe9024c8
Commit
fe9024c8
authored
Nov 17, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] warnings
parent
0ed6cf38
Pipeline
#1215
failed with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
45 deletions
+14
-45
package.yaml
package.yaml
+1
-1
List.hs
src/Gargantext/Core/Text/List.hs
+8
-23
Group.hs
src/Gargantext/Core/Text/List/Group.hs
+2
-10
WithScores.hs
src/Gargantext/Core/Text/List/Group/WithScores.hs
+3
-11
No files found.
package.yaml
View file @
fe9024c8
...
...
@@ -73,7 +73,7 @@ library:
-
Gargantext.Core.Text.Corpus.API
-
Gargantext.Core.Text.Corpus.Parsers.CSV
-
Gargantext.Core.Text.Examples
-
Gargantext.Core.Text.List.CSV
-
Gargantext.Core.Text.List.
Formats.
CSV
-
Gargantext.Core.Text.Metrics
-
Gargantext.Core.Text.Metrics.TFICF
-
Gargantext.Core.Text.Metrics.CharByChar
...
...
src/Gargantext/Core/Text/List.hs
View file @
fe9024c8
...
...
@@ -9,7 +9,8 @@ Portability : POSIX
-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.Core.Text.List
where
...
...
@@ -30,7 +31,6 @@ import qualified Data.Text as Text
-- import Gargantext.API.Ngrams.Tools (getCoocByNgrams', Diagonal(..))
import
Gargantext.API.Ngrams.Types
(
NgramsElement
,
mkNgramsElement
,
NgramsTerm
(
..
),
RootParent
(
..
),
mSetFromList
)
import
Gargantext.API.Ngrams.Types
(
RepoCmdM
)
import
Gargantext.Core.Text
(
size
)
import
Gargantext.Core.Text.List.Social
(
flowSocialList
,
flowSocialList'
,
FlowSocialListPriority
(
..
),
invertForw
)
import
Gargantext.Core.Text.List.Social.Scores
(
FlowListScores
)
import
Gargantext.Core.Text.List.Group
...
...
@@ -39,7 +39,7 @@ import Gargantext.Core.Text.Metrics (scored', Scored(..), normalizeGlobal, norma
import
Gargantext.Core.Types
(
ListType
(
..
),
MasterCorpusId
,
UserCorpusId
)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Admin.Types.Node
(
NodeId
)
import
Gargantext.Database.Action.Metrics.NgramsByNode
(
getNodesByNgramsUser
,
g
roupNodesByNgramsWith
,
g
etNodesByNgramsOnlyUser
)
import
Gargantext.Database.Action.Metrics.NgramsByNode
(
getNodesByNgramsUser
,
getNodesByNgramsOnlyUser
)
import
Gargantext.Database.Action.Metrics.TFICF
(
getTficf
)
import
Gargantext.Database.Prelude
(
CmdM
)
import
Gargantext.Database.Query.Table.Node
(
defaultList
)
...
...
@@ -91,27 +91,11 @@ buildNgramsOthersList user uCid groupIt (nt, MapListSize mapListSize) = do
-- PrivateFirst for first developments since Public NodeMode is not implemented yet
let
groupParams
=
GroupedTextParams
groupIt
(
Set
.
size
.
snd
)
fst
snd
{-(size . fst)-}
grouped
'
=
toGroupedText
groupParams
socialLists'
ngs'
groupParams
=
GroupedTextParams
groupIt
(
Set
.
size
.
snd
)
fst
snd
{-(size . fst)-}
grouped
WithList
=
toGroupedText
groupParams
socialLists'
ngs'
-- 8< 8< 8< 8< 8< 8< 8<
let
ngs
::
Map
Text
(
Set
Text
,
Set
NodeId
)
=
groupNodesByNgramsWith
groupIt
ngs'
socialLists
<-
flowSocialList
user
nt
(
Set
.
fromList
$
Map
.
keys
ngs
)
-- >8 >8 >8 >8 >8 >8 >8
let
grouped
=
groupedTextWithStem
(
GroupedTextParams
groupIt
(
Set
.
size
.
snd
)
fst
snd
{-(size . fst)-}
)
-- socialLists'
$
Map
.
mapWithKey
(
\
k
(
a
,
b
)
->
(
Set
.
delete
k
a
,
b
))
$
ngs
let
groupedWithList
=
map
(
addListType
(
invertForw
socialLists
))
grouped
(
stopTerms
,
tailTerms
)
=
Map
.
partition
(
\
t
->
t
^.
gt_listType
==
Just
StopTerm
)
groupedWithList
(
mapTerms
,
tailTerms'
)
=
Map
.
partition
(
\
t
->
t
^.
gt_listType
==
Just
MapTerm
)
tailTerms
(
stopTerms
,
tailTerms
)
=
Map
.
partition
(
\
t
->
t
^.
gt_listType
==
Just
StopTerm
)
groupedWithList
(
mapTerms
,
tailTerms'
)
=
Map
.
partition
(
\
t
->
t
^.
gt_listType
==
Just
MapTerm
)
tailTerms
listSize
=
mapListSize
-
(
List
.
length
mapTerms
)
(
mapTerms'
,
candiTerms
)
=
List
.
splitAt
listSize
...
...
@@ -126,6 +110,7 @@ buildNgramsOthersList user uCid groupIt (nt, MapListSize mapListSize) = do
$
map
(
set
gt_listType
(
Just
CandidateTerm
))
candiTerms
)
)]
-- TODO use ListIds
buildNgramsTermsList
::
(
HasNodeError
err
,
CmdM
env
err
m
...
...
src/Gargantext/Core/Text/List/Group.hs
View file @
fe9024c8
...
...
@@ -18,27 +18,19 @@ Portability : POSIX
module
Gargantext.Core.Text.List.Group
where
import
Data.Maybe
(
fromMaybe
)
import
Control.Lens
(
makeLenses
,
set
,
(
^.
))
import
Control.Lens
(
set
)
import
Data.Set
(
Set
)
import
Data.Map
(
Map
)
import
Data.Text
(
Text
)
import
Data.Semigroup
(
Semigroup
,
(
<>
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.Text
(
size
)
import
Gargantext.Core.Types
(
ListType
(
..
))
-- (MasterCorpusId, UserCorpusId)
import
Gargantext.Database.Admin.Types.Node
(
NodeId
)
-- import Gargantext.Core.Text.List.Learn (Model(..))
import
Gargantext.Core.Text.List.Social.Scores
(
FlowListScores
(
..
),
flc_lists
,
flc_parents
,
keyWithMaxValue
)
import
Gargantext.Core.Text.List.Social.Scores
(
FlowListScores
(
..
))
import
Gargantext.Core.Text.List.Group.WithStem
import
Gargantext.Core.Text.List.Group.WithScores
import
Gargantext.Core.Text.Terms.Mono.Stem
(
stem
)
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
import
Gargantext.Prelude
import
qualified
Data.Set
as
Set
import
qualified
Data.Map
as
Map
import
qualified
Data.List
as
List
import
qualified
Data.Text
as
Text
------------------------------------------------------------------------
toGroupedText
::
GroupedTextParams
a
b
...
...
src/Gargantext/Core/Text/List/Group/WithScores.hs
View file @
fe9024c8
...
...
@@ -14,25 +14,17 @@ Portability : POSIX
module
Gargantext.Core.Text.List.Group.WithScores
where
import
Data.Maybe
(
fromMaybe
)
import
Control.Lens
(
makeLenses
,
set
,
(
^.
),
(
%~
),
over
,
view
)
import
Control.Lens
(
makeLenses
,
set
,
over
,
view
)
import
Data.Set
(
Set
)
import
Data.Map
(
Map
)
import
Data.Text
(
Text
)
import
Data.Semigroup
(
Semigroup
,
(
<>
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.Text
(
size
)
import
Gargantext.Core.Types
(
ListType
(
..
))
-- (MasterCorpusId, UserCorpusId)
import
Gargantext.Database.Admin.Types.Node
(
NodeId
)
-- import Gargantext.Core.Text.List.Learn (Model(..))
import
Gargantext.Core.Text.List.Social.Scores
import
Gargantext.Core.Text.Terms.Mono.Stem
(
stem
)
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
import
Gargantext.Prelude
import
qualified
Data.Set
as
Set
import
qualified
Data.Map
as
Map
import
qualified
Data.List
as
List
import
qualified
Data.Text
as
Text
------------------------------------------------------------------------
...
...
@@ -66,7 +58,7 @@ groupWithScores scores =
scoresToGroupedTextScores
::
Maybe
GroupedWithListScores
->
Text
->
Set
NodeId
->
GroupedTextScores
(
Set
NodeId
)
scoresToGroupedTextScores
Nothing
t
ns
=
GroupedTextScores
Nothing
ns
Set
.
empty
scoresToGroupedTextScores
Nothing
_
ns
=
GroupedTextScores
Nothing
ns
Set
.
empty
scoresToGroupedTextScores
(
Just
g
)
t
ns
=
GroupedTextScores
list
ns
(
Set
.
singleton
t
)
where
list
=
view
gwls_listType
g
...
...
@@ -78,7 +70,7 @@ toGroupedWithListScores ms = foldl' (toGroup ms) Map.empty (Map.toList ms)
->
Map
Text
GroupedWithListScores
->
(
Text
,
FlowListScores
)
->
Map
Text
GroupedWithListScores
toGroup
ms'
result
(
t
,
fs
)
=
case
(
keyWithMaxValue
$
view
flc_parents
fs
)
of
toGroup
_
result
(
t
,
fs
)
=
case
(
keyWithMaxValue
$
view
flc_parents
fs
)
of
Nothing
->
Map
.
alter
(
addGroupedParent
(
t
,
fs
))
t
result
Just
parent
->
Map
.
alter
(
addGroupedChild
(
t
,
fs
))
parent
result
...
...
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