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
fe9024c8
Commit
fe9024c8
authored
Nov 17, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] warnings
parent
0ed6cf38
Changes
4
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:
...
@@ -73,7 +73,7 @@ library:
-
Gargantext.Core.Text.Corpus.API
-
Gargantext.Core.Text.Corpus.API
-
Gargantext.Core.Text.Corpus.Parsers.CSV
-
Gargantext.Core.Text.Corpus.Parsers.CSV
-
Gargantext.Core.Text.Examples
-
Gargantext.Core.Text.Examples
-
Gargantext.Core.Text.List.CSV
-
Gargantext.Core.Text.List.
Formats.
CSV
-
Gargantext.Core.Text.Metrics
-
Gargantext.Core.Text.Metrics
-
Gargantext.Core.Text.Metrics.TFICF
-
Gargantext.Core.Text.Metrics.TFICF
-
Gargantext.Core.Text.Metrics.CharByChar
-
Gargantext.Core.Text.Metrics.CharByChar
...
...
src/Gargantext/Core/Text/List.hs
View file @
fe9024c8
...
@@ -9,7 +9,8 @@ Portability : POSIX
...
@@ -9,7 +9,8 @@ Portability : POSIX
-}
-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.Core.Text.List
module
Gargantext.Core.Text.List
where
where
...
@@ -30,7 +31,6 @@ import qualified Data.Text as Text
...
@@ -30,7 +31,6 @@ import qualified Data.Text as Text
-- import Gargantext.API.Ngrams.Tools (getCoocByNgrams', Diagonal(..))
-- import Gargantext.API.Ngrams.Tools (getCoocByNgrams', Diagonal(..))
import
Gargantext.API.Ngrams.Types
(
NgramsElement
,
mkNgramsElement
,
NgramsTerm
(
..
),
RootParent
(
..
),
mSetFromList
)
import
Gargantext.API.Ngrams.Types
(
NgramsElement
,
mkNgramsElement
,
NgramsTerm
(
..
),
RootParent
(
..
),
mSetFromList
)
import
Gargantext.API.Ngrams.Types
(
RepoCmdM
)
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
(
flowSocialList
,
flowSocialList'
,
FlowSocialListPriority
(
..
),
invertForw
)
import
Gargantext.Core.Text.List.Social.Scores
(
FlowListScores
)
import
Gargantext.Core.Text.List.Social.Scores
(
FlowListScores
)
import
Gargantext.Core.Text.List.Group
import
Gargantext.Core.Text.List.Group
...
@@ -39,7 +39,7 @@ import Gargantext.Core.Text.Metrics (scored', Scored(..), normalizeGlobal, norma
...
@@ -39,7 +39,7 @@ import Gargantext.Core.Text.Metrics (scored', Scored(..), normalizeGlobal, norma
import
Gargantext.Core.Types
(
ListType
(
..
),
MasterCorpusId
,
UserCorpusId
)
import
Gargantext.Core.Types
(
ListType
(
..
),
MasterCorpusId
,
UserCorpusId
)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Admin.Types.Node
(
NodeId
)
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.Action.Metrics.TFICF
(
getTficf
)
import
Gargantext.Database.Prelude
(
CmdM
)
import
Gargantext.Database.Prelude
(
CmdM
)
import
Gargantext.Database.Query.Table.Node
(
defaultList
)
import
Gargantext.Database.Query.Table.Node
(
defaultList
)
...
@@ -91,27 +91,11 @@ buildNgramsOthersList user uCid groupIt (nt, MapListSize mapListSize) = do
...
@@ -91,27 +91,11 @@ buildNgramsOthersList user uCid groupIt (nt, MapListSize mapListSize) = do
-- PrivateFirst for first developments since Public NodeMode is not implemented yet
-- PrivateFirst for first developments since Public NodeMode is not implemented yet
let
let
groupParams
=
GroupedTextParams
groupIt
(
Set
.
size
.
snd
)
fst
snd
{-(size . fst)-}
groupParams
=
GroupedTextParams
groupIt
(
Set
.
size
.
snd
)
fst
snd
{-(size . fst)-}
grouped
'
=
toGroupedText
groupParams
socialLists'
ngs'
grouped
WithList
=
toGroupedText
groupParams
socialLists'
ngs'
-- 8< 8< 8< 8< 8< 8< 8<
(
stopTerms
,
tailTerms
)
=
Map
.
partition
(
\
t
->
t
^.
gt_listType
==
Just
StopTerm
)
groupedWithList
let
(
mapTerms
,
tailTerms'
)
=
Map
.
partition
(
\
t
->
t
^.
gt_listType
==
Just
MapTerm
)
tailTerms
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
listSize
=
mapListSize
-
(
List
.
length
mapTerms
)
listSize
=
mapListSize
-
(
List
.
length
mapTerms
)
(
mapTerms'
,
candiTerms
)
=
List
.
splitAt
listSize
(
mapTerms'
,
candiTerms
)
=
List
.
splitAt
listSize
...
@@ -126,6 +110,7 @@ buildNgramsOthersList user uCid groupIt (nt, MapListSize mapListSize) = do
...
@@ -126,6 +110,7 @@ buildNgramsOthersList user uCid groupIt (nt, MapListSize mapListSize) = do
$
map
(
set
gt_listType
(
Just
CandidateTerm
))
candiTerms
)
$
map
(
set
gt_listType
(
Just
CandidateTerm
))
candiTerms
)
)]
)]
-- TODO use ListIds
-- TODO use ListIds
buildNgramsTermsList
::
(
HasNodeError
err
buildNgramsTermsList
::
(
HasNodeError
err
,
CmdM
env
err
m
,
CmdM
env
err
m
...
...
src/Gargantext/Core/Text/List/Group.hs
View file @
fe9024c8
...
@@ -18,27 +18,19 @@ Portability : POSIX
...
@@ -18,27 +18,19 @@ Portability : POSIX
module
Gargantext.Core.Text.List.Group
module
Gargantext.Core.Text.List.Group
where
where
import
Data.Maybe
(
fromMaybe
)
import
Control.Lens
(
set
)
import
Control.Lens
(
makeLenses
,
set
,
(
^.
))
import
Data.Set
(
Set
)
import
Data.Set
(
Set
)
import
Data.Map
(
Map
)
import
Data.Map
(
Map
)
import
Data.Text
(
Text
)
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.Core.Types
(
ListType
(
..
))
-- (MasterCorpusId, UserCorpusId)
import
Gargantext.Database.Admin.Types.Node
(
NodeId
)
import
Gargantext.Database.Admin.Types.Node
(
NodeId
)
-- import Gargantext.Core.Text.List.Learn (Model(..))
import
Gargantext.Core.Text.List.Social.Scores
(
FlowListScores
(
..
))
import
Gargantext.Core.Text.List.Social.Scores
(
FlowListScores
(
..
),
flc_lists
,
flc_parents
,
keyWithMaxValue
)
import
Gargantext.Core.Text.List.Group.WithStem
import
Gargantext.Core.Text.List.Group.WithStem
import
Gargantext.Core.Text.List.Group.WithScores
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
Gargantext.Prelude
import
qualified
Data.Set
as
Set
import
qualified
Data.Set
as
Set
import
qualified
Data.Map
as
Map
import
qualified
Data.Map
as
Map
import
qualified
Data.List
as
List
import
qualified
Data.List
as
List
import
qualified
Data.Text
as
Text
------------------------------------------------------------------------
------------------------------------------------------------------------
toGroupedText
::
GroupedTextParams
a
b
toGroupedText
::
GroupedTextParams
a
b
...
...
src/Gargantext/Core/Text/List/Group/WithScores.hs
View file @
fe9024c8
...
@@ -14,25 +14,17 @@ Portability : POSIX
...
@@ -14,25 +14,17 @@ Portability : POSIX
module
Gargantext.Core.Text.List.Group.WithScores
module
Gargantext.Core.Text.List.Group.WithScores
where
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.Set
(
Set
)
import
Data.Map
(
Map
)
import
Data.Map
(
Map
)
import
Data.Text
(
Text
)
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.Core.Types
(
ListType
(
..
))
-- (MasterCorpusId, UserCorpusId)
import
Gargantext.Database.Admin.Types.Node
(
NodeId
)
import
Gargantext.Database.Admin.Types.Node
(
NodeId
)
-- import Gargantext.Core.Text.List.Learn (Model(..))
-- import Gargantext.Core.Text.List.Learn (Model(..))
import
Gargantext.Core.Text.List.Social.Scores
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
Gargantext.Prelude
import
qualified
Data.Set
as
Set
import
qualified
Data.Set
as
Set
import
qualified
Data.Map
as
Map
import
qualified
Data.Map
as
Map
import
qualified
Data.List
as
List
import
qualified
Data.Text
as
Text
------------------------------------------------------------------------
------------------------------------------------------------------------
...
@@ -66,7 +58,7 @@ groupWithScores scores =
...
@@ -66,7 +58,7 @@ groupWithScores scores =
scoresToGroupedTextScores
::
Maybe
GroupedWithListScores
scoresToGroupedTextScores
::
Maybe
GroupedWithListScores
->
Text
->
Set
NodeId
->
Text
->
Set
NodeId
->
GroupedTextScores
(
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
)
scoresToGroupedTextScores
(
Just
g
)
t
ns
=
GroupedTextScores
list
ns
(
Set
.
singleton
t
)
where
where
list
=
view
gwls_listType
g
list
=
view
gwls_listType
g
...
@@ -78,7 +70,7 @@ toGroupedWithListScores ms = foldl' (toGroup ms) Map.empty (Map.toList ms)
...
@@ -78,7 +70,7 @@ toGroupedWithListScores ms = foldl' (toGroup ms) Map.empty (Map.toList ms)
->
Map
Text
GroupedWithListScores
->
Map
Text
GroupedWithListScores
->
(
Text
,
FlowListScores
)
->
(
Text
,
FlowListScores
)
->
Map
Text
GroupedWithListScores
->
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
Nothing
->
Map
.
alter
(
addGroupedParent
(
t
,
fs
))
t
result
Just
parent
->
Map
.
alter
(
addGroupedChild
(
t
,
fs
))
parent
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