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
9
Merge Requests
9
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
e14b2fc6
Commit
e14b2fc6
authored
Apr 26, 2023
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Iramuteq parser (WIP)
parent
2ddd6408
Pipeline
#3943
failed with stage
in 28 minutes and 33 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
2 deletions
+15
-2
New.hs
src/Gargantext/API/Node/Corpus/New.hs
+1
-0
Types.hs
src/Gargantext/API/Node/Corpus/New/Types.hs
+3
-1
Parsers.hs
src/Gargantext/Core/Text/Corpus/Parsers.hs
+10
-0
RIS.hs
src/Gargantext/Core/Text/Corpus/Parsers/RIS.hs
+1
-1
No files found.
src/Gargantext/API/Node/Corpus/New.hs
View file @
e14b2fc6
...
...
@@ -263,6 +263,7 @@ addToCorpusWithForm user cid (NewWithForm ft ff d l _n sel) jobHandle = do
CSV
->
Parser
.
parseFormatC
Parser
.
CsvGargV3
WOS
->
Parser
.
parseFormatC
Parser
.
WOS
PresseRIS
->
Parser
.
parseFormatC
Parser
.
RisPresse
Iramuteq
->
Parser
.
parseFormatC
Parser
.
Iramuteq
-- TODO granularity of the logStatus
let
data
'
=
case
ff
of
...
...
src/Gargantext/API/Node/Corpus/New/Types.hs
View file @
e14b2fc6
...
...
@@ -14,6 +14,7 @@ data FileType = CSV
|
CSV_HAL
|
PresseRIS
|
WOS
|
Iramuteq
deriving
(
Eq
,
Show
,
Generic
)
instance
ToSchema
FileType
instance
Arbitrary
FileType
where
arbitrary
=
elements
[
CSV
,
PresseRIS
]
...
...
@@ -26,7 +27,8 @@ instance FromHttpApiData FileType where
parseUrlPiece
"CSV_HAL"
=
pure
CSV_HAL
parseUrlPiece
"PresseRis"
=
pure
PresseRIS
parseUrlPiece
"WOS"
=
pure
WOS
parseUrlPiece
_
=
pure
CSV
-- TODO error here
parseUrlPiece
"Iramuteq"
=
pure
Iramuteq
parseUrlPiece
_
=
panic
"[G.A.A.Node.Corpus.New] File Type not implemented (yet)"
instance
ToHttpApiData
FileType
where
toUrlPiece
=
pack
.
show
...
...
src/Gargantext/Core/Text/Corpus/Parsers.hs
View file @
e14b2fc6
...
...
@@ -118,6 +118,16 @@ parseFormatC WOS Plain bs = do
.|
mapC
(
map
$
first
WOS
.
keys
)
.|
mapC
(
map
$
both
decodeUtf8
)
.|
mapMC
(
toDoc
WOS
))
)
<$>
eDocs
parseFormatC
Iramuteq
Plain
bs
=
do
let
eDocs
=
runParser'
Iramuteq
bs
pure
$
(
\
docs
->
(
Just
$
fromIntegral
$
length
docs
,
yieldMany
docs
.|
mapC
(
map
$
first
Iramuteq
.
keys
)
.|
mapC
(
map
$
both
decodeUtf8
)
.|
mapMC
((
toDoc
Iramuteq
)
.
(
map
(
second
(
Text
.
replace
"_"
" "
))))
))
<$>
eDocs
parseFormatC
ft
ZIP
bs
=
do
path
<-
liftBase
$
emptySystemTempFile
"parsed-zip"
liftBase
$
DB
.
writeFile
path
bs
...
...
src/Gargantext/Core/Text/Corpus/Parsers/RIS.hs
View file @
e14b2fc6
...
...
@@ -25,8 +25,8 @@ import Data.Attoparsec.ByteString.Char8 (isEndOfLine)
import
Data.ByteString
(
ByteString
,
intercalate
)
import
Gargantext.Prelude
hiding
(
takeWhile
,
take
)
import
qualified
Data.List
as
DL
-------------------------------------------------------------
-------------------------------------------------------------
parser
::
Parser
[[(
ByteString
,
ByteString
)]]
parser
=
do
n
<-
notice
"TY -"
...
...
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