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
198
Issues
198
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
da402977
Commit
da402977
authored
Mar 14, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Cooc with diagonal (or not).
parent
1f520fdb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
Tools.hs
src/Gargantext/API/Ngrams/Tools.hs
+6
-3
Node.hs
src/Gargantext/API/Node.hs
+2
-3
No files found.
src/Gargantext/API/Ngrams/Tools.hs
View file @
da402977
...
...
@@ -84,14 +84,17 @@ groupNodesByNgrams syn occs = Map.fromListWith (<>) occs'
Nothing
->
(
t
,
ns
)
Just
r'
->
(
r'
,
ns
)
type
Diagonal
=
Bool
getCoocByNgrams
::
Map
Text
(
Set
NodeId
)
->
Map
(
Text
,
Text
)
Int
getCoocByNgrams
m
=
getCoocByNgrams
::
Diagonal
->
Map
Text
(
Set
NodeId
)
->
Map
(
Text
,
Text
)
Int
getCoocByNgrams
diag
m
=
Map
.
fromList
[((
t1
,
t2
)
,
maybe
0
Set
.
size
$
Set
.
intersection
<$>
Map
.
lookup
t1
m
<*>
Map
.
lookup
t2
m
)
|
(
t1
,
t2
)
<-
[
(
x
,
y
)
|
x
<-
Map
.
keys
m
,
y
<-
Map
.
keys
m
,
x
<=
y
]
)
|
(
t1
,
t2
)
<-
case
diag
of
True
->
[
(
x
,
y
)
|
x
<-
Map
.
keys
m
,
y
<-
Map
.
keys
m
,
x
<=
y
]
False
->
listToCombi
identity
(
Map
.
keys
m
)
]
src/Gargantext/API/Node.hs
View file @
da402977
...
...
@@ -289,7 +289,7 @@ graphAPI nId = do
lId
<-
defaultList
cId
ngs
<-
filterListWithRoot
GraphTerm
<$>
mapTermListRoot
[
lId
]
NgramsTerms
myCooc
<-
Map
.
filter
(
>
1
)
<$>
getCoocByNgrams
myCooc
<-
Map
.
filter
(
>
1
)
<$>
getCoocByNgrams
False
<$>
groupNodesByNgrams
ngs
<$>
getNodesByNgramsOnlyUser
cId
NgramsTerms
(
Map
.
keys
ngs
)
...
...
@@ -405,7 +405,7 @@ getMetrics cId maybeListId maybeTabType maybeLimit = do
let
ngs
=
Map
.
unions
$
map
(
\
t
->
filterListWithRoot
t
ngs'
)
[
GraphTerm
,
StopTerm
,
CandidateTerm
]
myCooc
<-
Map
.
filter
(
>
1
)
<$>
getCoocByNgrams
myCooc
<-
Map
.
filter
(
>
1
)
<$>
getCoocByNgrams
True
<$>
groupNodesByNgrams
ngs
<$>
getNodesByNgramsOnlyUser
cId
ngramsType
(
Map
.
keys
ngs
)
...
...
@@ -421,4 +421,3 @@ getMetrics cId maybeListId maybeTabType maybeLimit = do
pure
$
Metrics
metricsFiltered
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