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
153
Issues
153
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
f33b0c12
Unverified
Commit
f33b0c12
authored
Jul 03, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More WithList fixes
parent
4348e54a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
Main.hs
bin/gargantext-cli/Main.hs
+2
-1
WithList.hs
src/Gargantext/Text/Terms/WithList.hs
+5
-5
No files found.
bin/gargantext-cli/Main.hs
View file @
f33b0c12
...
...
@@ -52,7 +52,8 @@ main = do
putStrLn
$
show
$
length
termList
corpusIndexed
<-
mapM
(
terms
(
WithList
$
buildPatterns
termList
))
corpus
let
patterns
=
WithList
$
buildPatterns
termList
corpusIndexed
<-
mapM
(
terms
patterns
)
corpus
putStrLn
$
show
corpusIndexed
let
myCooc
=
cooc
corpusIndexed
...
...
src/Gargantext/Text/Terms/WithList.hs
View file @
f33b0c12
...
...
@@ -20,7 +20,7 @@ import qualified Data.Algorithms.KMP as KMP
import
Data.Text
(
Text
)
import
qualified
Data.IntMap.Strict
as
IntMap
import
Gargantext.Core.Types
(
Terms
(
Terms
))
import
Gargantext.Core.Types
(
Terms
(
..
))
import
Gargantext.Text.Context
import
Gargantext.Text.Terms.Mono
(
monoTextsBySentence
)
...
...
@@ -50,8 +50,8 @@ replaceTerms pats terms = go 0
|
otherwise
=
case
IntMap
.
lookup
ix
m
of
Nothing
->
go
(
ix
+
1
)
Just
(
len
,
term
s
)
->
term
s
:
go
(
ix
+
len
)
Just
(
len
,
term
)
->
term
:
go
(
ix
+
len
)
merge
(
len1
,
lab1
)
(
len2
,
lab2
)
=
...
...
@@ -59,8 +59,8 @@ replaceTerms pats terms = go 0
m
=
IntMap
.
fromListWith
merge
[
(
ix
,
(
len
,
term
s
))
|
Pattern
pat
len
term
s
<-
pats
,
ix
<-
KMP
.
match
pat
terms
]
[
(
ix
,
(
len
,
term
))
|
Pattern
pat
len
term
<-
pats
,
ix
<-
KMP
.
match
pat
(
_terms_label
term
)
]
buildPatterns
::
TermList
->
Patterns
buildPatterns
=
sortWith
(
Down
.
_pat_length
)
.
concatMap
buildPattern
...
...
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