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
157
Issues
157
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
a21bbb3d
Commit
a21bbb3d
authored
Jan 12, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Cosmetics]
parent
3de15d1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
Parsers.hs
src/Data/Gargantext/Parsers.hs
+12
-12
No files found.
src/Data/Gargantext/Parsers.hs
View file @
a21bbb3d
...
...
@@ -28,7 +28,7 @@ import Data.Map as DM
----import Data.Either.Extra(Either(..))
----
--import Control.Monad (join)
import
Codec.Archive.Zip
import
Codec.Archive.Zip
(
withArchive
,
getEntry
,
getEntries
)
import
Path.IO
(
resolveFile'
)
------ import qualified Data.ByteString.Lazy as B
--import Control.Applicative ( (<$>) )
...
...
@@ -53,10 +53,18 @@ data FileFormat = WOS -- Implemented (ISI Format)
-- | XML -- Not Implemented / see :
-- -- > http://chrisdone.com/posts/fast-haskell-c-parsing-xml
---- | withParser:
---- According the format of the text, choosing the right parser.
parse
::
FileFormat
->
FilePath
->
IO
[
Either
String
[[(
DB
.
ByteString
,
DB
.
ByteString
)]]]
parse
format
path
=
do
files
<-
case
takeExtension
path
of
".zip"
->
openZip
path
_
->
pure
<$>
DB
.
readFile
path
mapConcurrently
(
runParser
format
)
files
--withParser :: FileFormat -> ByteString -> IO Corpus
-- | withParser:
-- According the format of the text, choosing the right parser.
-- TODO withParser :: FileFormat -> Parser [Document]
withParser
::
FileFormat
->
Parser
[[(
DB
.
ByteString
,
DB
.
ByteString
)]]
withParser
WOS
=
wosParser
--withParser DOC = docParser
...
...
@@ -75,12 +83,4 @@ openZip fp = do
bs
<-
mapConcurrently
(
\
s
->
withArchive
path
(
getEntry
s
))
entries
pure
bs
parse
::
FileFormat
->
FilePath
->
IO
[
Either
String
[[(
DB
.
ByteString
,
DB
.
ByteString
)]]]
parse
format
path
=
do
files
<-
case
takeExtension
path
of
".zip"
->
openZip
path
_
->
pure
<$>
DB
.
readFile
path
mapConcurrently
(
runParser
format
)
files
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