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
3a533287
Commit
3a533287
authored
Apr 22, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[GRAPH] adding type Ordering to sortTficf and others
parent
07c6753c
Pipeline
#830
failed with stage
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
8 deletions
+19
-8
Types.hs
src/Gargantext/Core/Types.hs
+3
-0
NgramsByNode.hs
src/Gargantext/Database/Action/Metrics/NgramsByNode.hs
+6
-2
List.hs
src/Gargantext/Text/List.hs
+8
-5
Tools.hs
src/Gargantext/Viz/Graph/Tools.hs
+2
-1
No files found.
src/Gargantext/Core/Types.hs
View file @
3a533287
...
@@ -25,6 +25,7 @@ module Gargantext.Core.Types ( module Gargantext.Core.Types.Main
...
@@ -25,6 +25,7 @@ module Gargantext.Core.Types ( module Gargantext.Core.Types.Main
,
Name
,
Name
,
TableResult
(
..
)
,
TableResult
(
..
)
,
NodeTableResult
,
NodeTableResult
,
Ordering
(
..
)
,
TODO
(
..
)
,
TODO
(
..
)
)
where
)
where
...
@@ -46,6 +47,8 @@ import Gargantext.Database.Admin.Types.Node
...
@@ -46,6 +47,8 @@ import Gargantext.Database.Admin.Types.Node
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Test.QuickCheck.Arbitrary
(
Arbitrary
,
arbitrary
)
import
Test.QuickCheck.Arbitrary
(
Arbitrary
,
arbitrary
)
data
Ordering
=
Down
|
Up
------------------------------------------------------------------------
------------------------------------------------------------------------
type
Name
=
Text
type
Name
=
Text
type
Term
=
Text
type
Term
=
Text
...
...
src/Gargantext/Database/Action/Metrics/NgramsByNode.hs
View file @
3a533287
...
@@ -23,12 +23,14 @@ module Gargantext.Database.Action.Metrics.NgramsByNode
...
@@ -23,12 +23,14 @@ module Gargantext.Database.Action.Metrics.NgramsByNode
import
Data.Map.Strict
(
Map
,
fromListWith
,
elems
,
toList
,
fromList
)
import
Data.Map.Strict
(
Map
,
fromListWith
,
elems
,
toList
,
fromList
)
import
Data.Map.Strict.Patch
(
PatchMap
,
Replace
,
diff
)
import
Data.Map.Strict.Patch
(
PatchMap
,
Replace
,
diff
)
import
Data.Set
(
Set
)
import
Data.Set
(
Set
)
import
qualified
Data.Ord
as
DO
(
Down
(
..
))
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Data.Tuple.Extra
(
second
,
swap
)
import
Data.Tuple.Extra
(
second
,
swap
)
import
Database.PostgreSQL.Simple.SqlQQ
(
sql
)
import
Database.PostgreSQL.Simple.SqlQQ
(
sql
)
import
Database.PostgreSQL.Simple.Types
(
Values
(
..
),
QualifiedIdentifier
(
..
))
import
Database.PostgreSQL.Simple.Types
(
Values
(
..
),
QualifiedIdentifier
(
..
))
import
Debug.Trace
(
trace
)
import
Debug.Trace
(
trace
)
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.Types
(
Ordering
(
..
))
import
Gargantext.Database.Admin.Config
(
nodeTypeId
)
import
Gargantext.Database.Admin.Config
(
nodeTypeId
)
import
Gargantext.Database.Admin.Types.Node
-- (ListId, CorpusId, NodeId)
import
Gargantext.Database.Admin.Types.Node
-- (ListId, CorpusId, NodeId)
import
Gargantext.Database.Admin.Utils
(
Cmd
,
runPGSQuery
)
import
Gargantext.Database.Admin.Utils
(
Cmd
,
runPGSQuery
)
...
@@ -60,9 +62,11 @@ ngramsGroup l _m _n = Text.intercalate " "
...
@@ -60,9 +62,11 @@ ngramsGroup l _m _n = Text.intercalate " "
.
Text
.
replace
"-"
" "
.
Text
.
replace
"-"
" "
sortTficf
::
(
Map
Text
(
Double
,
Set
Text
))
sortTficf
::
Ordering
->
(
Map
Text
(
Double
,
Set
Text
))
->
[
(
Text
,(
Double
,
Set
Text
))]
->
[
(
Text
,(
Double
,
Set
Text
))]
sortTficf
=
List
.
sortOn
(
fst
.
snd
)
.
toList
sortTficf
Down
=
List
.
sortOn
(
DO
.
Down
.
fst
.
snd
)
.
toList
sortTficf
Up
=
List
.
sortOn
(
fst
.
snd
)
.
toList
getTficf
::
UserCorpusId
getTficf
::
UserCorpusId
...
...
src/Gargantext/Text/List.hs
View file @
3a533287
...
@@ -24,7 +24,7 @@ import Data.Text (Text)
...
@@ -24,7 +24,7 @@ import Data.Text (Text)
import
Gargantext.API.Ngrams
(
NgramsElement
,
mkNgramsElement
,
RootParent
(
..
),
mSetFromList
)
import
Gargantext.API.Ngrams
(
NgramsElement
,
mkNgramsElement
,
RootParent
(
..
),
mSetFromList
)
-- import Gargantext.API.Ngrams.Tools (getCoocByNgrams', Diagonal(..))
-- import Gargantext.API.Ngrams.Tools (getCoocByNgrams', Diagonal(..))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.Types
(
ListType
(
..
),
MasterCorpusId
,
UserCorpusId
)
import
Gargantext.Core.Types
(
ListType
(
..
),
MasterCorpusId
,
UserCorpusId
,
Ordering
(
..
)
)
import
Gargantext.Database.Action.Metrics.NgramsByNode
(
getTficf
,
sortTficf
,
ngramsGroup
,
getNodesByNgramsUser
,
groupNodesByNgramsWith
)
import
Gargantext.Database.Action.Metrics.NgramsByNode
(
getTficf
,
sortTficf
,
ngramsGroup
,
getNodesByNgramsUser
,
groupNodesByNgramsWith
)
import
Gargantext.Database.Admin.Utils
(
Cmd
)
import
Gargantext.Database.Admin.Utils
(
Cmd
)
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
...
@@ -139,18 +139,21 @@ buildNgramsTermsList :: Lang
...
@@ -139,18 +139,21 @@ buildNgramsTermsList :: Lang
->
MasterCorpusId
->
MasterCorpusId
->
Cmd
err
(
Map
NgramsType
[
NgramsElement
])
->
Cmd
err
(
Map
NgramsType
[
NgramsElement
])
buildNgramsTermsList
l
n
m
s
uCid
mCid
=
do
buildNgramsTermsList
l
n
m
s
uCid
mCid
=
do
candidates
<-
sortTficf
<$>
getTficf
uCid
mCid
NgramsTerms
(
ngramsGroup
l
n
m
)
candidates
<-
sortTficf
Up
<$>
getTficf
uCid
mCid
NgramsTerms
(
ngramsGroup
l
n
m
)
let
let
candidatesSize
=
10
00
candidatesSize
=
4
00
{-
a = 50
a = 50
b = 50
b = 50
-}
candidatesHead
=
List
.
take
candidatesSize
candidates
candidatesHead
=
List
.
take
candidatesSize
candidates
candidatesTail
=
List
.
drop
candidatesSize
candidates
candidatesTail
=
List
.
drop
candidatesSize
candidates
termList
=
(
toTermList
a
b
((
isStopTerm
s
)
.
fst
)
candidatesHead
)
termList
=
-- (toTermList a b ((isStopTerm s) . fst) candidatesHead)
(
map
(
toList
((
isStopTerm
s
)
.
fst
)
GraphTerm
)
candidatesHead
)
<>
(
map
(
toList
((
isStopTerm
s
)
.
fst
)
CandidateTerm
)
candidatesTail
)
<>
(
map
(
toList
((
isStopTerm
s
)
.
fst
)
CandidateTerm
)
candidatesTail
)
ngs
=
List
.
concat
$
map
toNgramsElement
termList
ngs
=
List
.
concat
$
map
toNgramsElement
termList
...
...
src/Gargantext/Viz/Graph/Tools.hs
View file @
3a533287
...
@@ -77,7 +77,8 @@ cooc2graph threshold myCooc = do
...
@@ -77,7 +77,8 @@ cooc2graph threshold myCooc = do
else
panic
"Text.Flow: DistanceMap is empty"
else
panic
"Text.Flow: DistanceMap is empty"
let
let
bridgeness'
=
bridgeness
rivers
partitions
distanceMap
bridgeness'
=
distanceMap
_bridgeness'
=
bridgeness
rivers
partitions
distanceMap
confluence'
=
confluence
(
Map
.
keys
bridgeness'
)
3
True
False
confluence'
=
confluence
(
Map
.
keys
bridgeness'
)
3
True
False
pure
$
data2graph
(
Map
.
toList
ti
)
myCooc'
bridgeness'
confluence'
partitions
pure
$
data2graph
(
Map
.
toList
ti
)
myCooc'
bridgeness'
confluence'
partitions
...
...
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