Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
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
Przemyslaw Kaminski
haskell-gargantext
Commits
3edc87d8
Commit
3edc87d8
authored
Jan 31, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[john-snow] implement pos/lemma language
parent
39f51130
Pipeline
#2426
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
JohnSnowNLP.hs
src/Gargantext/Utils/JohnSnowNLP.hs
+16
-8
No files found.
src/Gargantext/Utils/JohnSnowNLP.hs
View file @
3edc87d8
...
...
@@ -32,16 +32,24 @@ import Gargantext.Core.Text.Terms.Multi.PosTagging.Types
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
data
JSSpell
=
JSPOS
|
JSLemma
data
JSSpell
=
JSPOS
Lang
|
JSLemma
Lang
deriving
(
Show
)
instance
ToJSON
JSSpell
where
toJSON
JSPOS
=
"pos"
toJSON
JSLemma
=
"lemma"
toJSON
(
JSPOS
EN
)
=
"en.pos"
toJSON
(
JSPOS
FR
)
=
"fr.pos"
toJSON
(
JSPOS
All
)
=
"pos"
toJSON
(
JSLemma
EN
)
=
"en.lemma"
toJSON
(
JSLemma
FR
)
=
"fr.lemma"
toJSON
(
JSLemma
All
)
=
"lemma"
instance
FromJSON
JSSpell
where
parseJSON
(
String
"pos"
)
=
pure
JSPOS
parseJSON
(
String
"lemma"
)
=
pure
JSLemma
parseJSON
(
String
"en.pos"
)
=
pure
$
JSPOS
EN
parseJSON
(
String
"fr.pos"
)
=
pure
$
JSPOS
FR
parseJSON
(
String
"pos"
)
=
pure
$
JSPOS
All
parseJSON
(
String
"en.lemma"
)
=
pure
$
JSLemma
EN
parseJSON
(
String
"fr.lemma"
)
=
pure
$
JSLemma
FR
parseJSON
(
String
"lemma"
)
=
pure
$
JSLemma
All
parseJSON
s
=
prependFailure
"parsing spell failed, "
(
typeMismatch
"Spell"
s
)
...
...
@@ -172,9 +180,9 @@ waitForJsTask jsTask = wait' 0
wait'
$
counter
+
1
getPosTagAndLems
::
Lang
->
Text
->
IO
PosSentences
getPosTagAndLems
_
l
t
=
do
jsPosTask
<-
jsRequest
t
JSPOS
jsLemmaTask
<-
jsRequest
t
JSLemma
getPosTagAndLems
l
t
=
do
jsPosTask
<-
jsRequest
t
(
JSPOS
l
)
jsLemmaTask
<-
jsRequest
t
(
JSLemma
l
)
-- wait for both tasks
jsPos
<-
waitForJsTask
jsPosTask
...
...
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