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
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
Christian Merten
haskell-gargantext
Commits
39aa6434
Commit
39aa6434
authored
Mar 05, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Prelude] listToCombi(naisons), thanks to Quentin, authors of this nice function.
parent
f37b439f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
NgramsByNode.hs
src/Gargantext/Database/Metrics/NgramsByNode.hs
+1
-3
Prelude.hs
src/Gargantext/Prelude.hs
+5
-0
No files found.
src/Gargantext/Database/Metrics/NgramsByNode.hs
View file @
39aa6434
...
@@ -147,9 +147,7 @@ getCoocByNgramsOnly cId nt ngs = do
...
@@ -147,9 +147,7 @@ getCoocByNgramsOnly cId nt ngs = do
<$>
Map
.
lookup
t1
ngs'
<$>
Map
.
lookup
t1
ngs'
<*>
Map
.
lookup
t2
ngs'
<*>
Map
.
lookup
t2
ngs'
)
)
|
(
t1
,
t2
)
<-
list2combi
$
Map
.
keys
ngs'
]
|
(
t1
,
t2
)
<-
listToCombi
identity
$
Map
.
keys
ngs'
]
where
list2combi
=
undefined
getNodesByNgramsOnlyUser
::
CorpusId
->
NgramsType
->
[
Text
]
->
Cmd
err
(
Map
Text
(
Set
NodeId
))
getNodesByNgramsOnlyUser
::
CorpusId
->
NgramsType
->
[
Text
]
->
Cmd
err
(
Map
Text
(
Set
NodeId
))
getNodesByNgramsOnlyUser
cId
nt
ngs
=
fromListWith
(
<>
)
<$>
map
(
\
(
n
,
t
)
->
(
t
,
Set
.
singleton
n
))
getNodesByNgramsOnlyUser
cId
nt
ngs
=
fromListWith
(
<>
)
<$>
map
(
\
(
n
,
t
)
->
(
t
,
Set
.
singleton
n
))
...
...
src/Gargantext/Prelude.hs
View file @
39aa6434
...
@@ -258,3 +258,8 @@ zipSnd f xs = zip xs (f xs)
...
@@ -258,3 +258,8 @@ zipSnd f xs = zip xs (f xs)
maximumWith
::
(
Ord
a1
,
Foldable
t
)
=>
(
a2
->
a1
)
->
t
a2
->
a2
maximumWith
::
(
Ord
a1
,
Foldable
t
)
=>
(
a2
->
a1
)
->
t
a2
->
a2
maximumWith
f
=
L
.
maximumBy
(
compare
`
on
`
f
)
maximumWith
f
=
L
.
maximumBy
(
compare
`
on
`
f
)
-- | To get all combinations of a list with no repetition and apply a function to the resulting list of pairs
listToCombi
::
forall
a
b
.
(
a
->
b
)
->
[
a
]
->
[(
b
,
b
)]
listToCombi
f
l
=
[
(
f
x
,
f
y
)
|
(
x
:
rest
)
<-
L
.
tails
l
,
y
<-
rest
]
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