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
149
Issues
149
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
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
b50e7bde
Commit
b50e7bde
authored
Jun 23, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] Connection to Isidore.
parent
7d6d74c4
Pipeline
#489
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
Flow.hs
src/Gargantext/Database/Flow.hs
+28
-4
IsidoreApi.hs
src/Gargantext/Text/Parsers/IsidoreApi.hs
+0
-1
No files found.
src/Gargantext/Database/Flow.hs
View file @
b50e7bde
...
...
@@ -29,8 +29,8 @@ Portability : POSIX
module
Gargantext.Database.Flow
-- (flowDatabase, ngrams2list)
where
--
import Debug.Trace (trace)
import
Prelude
(
String
)
import
Debug.Trace
(
trace
)
import
Control.Lens
((
^.
),
view
,
Lens
'
,
_Just
)
import
Control.Monad
(
mapM_
)
import
Control.Monad.IO.Class
(
liftIO
)
...
...
@@ -63,6 +63,7 @@ import Gargantext.Prelude
import
Gargantext.Text.Terms.Eleve
(
buildTries
,
toToken
)
import
Gargantext.Text.List
(
buildNgramsLists
,
StopSize
(
..
))
import
Gargantext.Text.Parsers
(
parseFile
,
FileFormat
)
import
qualified
Gargantext.Text.Parsers.IsidoreApi
as
Isidore
import
Gargantext.Text.Terms
(
TermType
(
..
),
tt_lang
,
extractTerms
,
uniText
)
import
Gargantext.Text.Terms.Mono.Stem.En
(
stemIt
)
import
Servant
(
ServantErr
)
...
...
@@ -89,6 +90,30 @@ type FlowCorpus a = ( AddUniqId a
------------------------------------------------------------------------
data
ApiQuery
=
ApiIsidoreQuery
Text
|
ApiIsidoreAuth
Text
-- | APIs
-- TODO instances
getDataApi
::
Lang
->
Maybe
Limit
->
ApiQuery
->
IO
[
HyperdataDocument
]
getDataApi
lang
limit
(
ApiIsidoreQuery
q
)
=
Isidore
.
get
lang
limit
(
Just
q
)
Nothing
getDataApi
lang
limit
(
ApiIsidoreAuth
q
)
=
Isidore
.
get
lang
limit
Nothing
(
Just
q
)
flowCorpusApi
::
(
FlowCmdM
env
ServantErr
m
)
=>
Username
->
CorpusName
->
TermType
Lang
->
Maybe
Limit
->
ApiQuery
->
m
CorpusId
flowCorpusApi
u
n
tt
l
q
=
do
docs
<-
liftIO
$
splitEvery
500
<$>
getDataApi
(
_tt_lang
tt
)
l
q
flowCorpus
u
n
tt
docs
------------------------------------------------------------------------
flowAnnuaire
::
FlowCmdM
env
ServantErr
m
=>
Username
->
CorpusName
->
(
TermType
Lang
)
->
FilePath
->
m
AnnuaireId
flowAnnuaire
u
n
l
filePath
=
do
...
...
@@ -108,7 +133,6 @@ flowCorpusDebat u n l fp = do
)
flowCorpus
u
n
(
Multi
FR
)
(
map
(
map
toHyperdataDocument
)
docs
)
flowCorpusFile
::
FlowCmdM
env
ServantErr
m
=>
Username
->
CorpusName
->
Limit
-- Limit the number of docs (for dev purpose)
...
...
@@ -193,7 +217,7 @@ insertMasterDocs c lang hs = do
fixLang
(
Unsupervised
l
n
s
m
)
=
Unsupervised
l
n
s
m'
where
m'
=
case
m
of
Nothing
->
Just
$
buildTries
n
(
fmap
toToken
$
uniText
$
Text
.
intercalate
" "
$
List
.
concat
$
map
hasText
documentsWithId
)
Nothing
->
trace
(
"buildTries here"
::
String
)
$
Just
$
buildTries
n
(
fmap
toToken
$
uniText
$
Text
.
intercalate
" "
$
List
.
concat
$
map
hasText
documentsWithId
)
m''
->
m''
fixLang
l
=
l
...
...
src/Gargantext/Text/Parsers/IsidoreApi.hs
View file @
b50e7bde
...
...
@@ -9,7 +9,6 @@ Portability : POSIX
-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings #-}
...
...
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