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
147
Issues
147
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
295ff34d
Commit
295ff34d
authored
Apr 16, 2019
by
Alexandre Delanoë
Committed by
Quentin Lobbé
May 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bin.Phylo] parse fix list of Text.
parent
8abbe219
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
Main.hs
bin/gargantext-phylo/Main.hs
+13
-3
No files found.
bin/gargantext-phylo/Main.hs
View file @
295ff34d
...
...
@@ -23,7 +23,7 @@ Phylo binaries
module
Main
where
import
Data.Aeson
import
Data.Text
(
Text
)
import
Data.Text
(
Text
,
unwords
)
import
GHC.Generics
import
GHC.IO
(
FilePath
)
import
Gargantext.Prelude
...
...
@@ -60,7 +60,7 @@ filterTerms :: Patterns -> (a, Text) -> (a, [Text])
filterTerms
patterns
(
year'
,
doc
)
=
(
year'
,
termsInText
patterns
doc
)
where
termsInText
::
Patterns
->
Text
->
[
Text
]
termsInText
pats
txt
=
extractTermsWithList'
pats
txt
termsInText
pats
txt
=
DL
.
nub
$
DL
.
concat
$
map
(
map
unwords
)
$
extractTermsWithList
pats
txt
-- csvToCorpus :: Int -> FilePath -> IO (DM.Map Int [Text])
...
...
@@ -71,6 +71,17 @@ csvToCorpus limit csv = DV.toList
.
DV
.
map
(
\
n
->
(
csv_publication_year
n
,
(
csv_title
n
)
<>
" "
<>
(
csv_abstract
n
)))
.
snd
<$>
readCsv
csv
type
ListPath
=
FilePath
type
CorpusPath
=
FilePath
type
Limit
=
Int
parse
::
Limit
->
CorpusPath
->
ListPath
->
IO
[
Document
]
parse
limit
corpus
liste
=
do
corpus'
<-
csvToCorpus
limit
corpus
liste'
<-
csvGraphTermList
liste
let
patterns
=
buildPatterns
liste'
pure
$
map
(
(
\
(
y
,
t
)
->
Document
y
t
)
.
filterTerms
patterns
)
corpus'
main
::
IO
()
main
=
do
...
...
@@ -108,4 +119,3 @@ main = do
L
.
writeFile
outputPath
$
encode
corpusParsed
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