]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Core/Text/Convert.hs
[FIX] Clean Text before sending it to NLP micro services + tests + clean code for...
[gargantext.git] / src / Gargantext / Core / Text / Convert.hs
1 {-|
2 Module : Gargantext.Core.Text.Convert
3 Description : All parsers of Gargantext in one file.
4 Copyright : (c) CNRS, 2017
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 Format Converter.
11
12 -}
13
14 {-# LANGUAGE PackageImports #-}
15
16 module Gargantext.Core.Text.Convert (risPress2csvWrite)
17 where
18
19 import Data.Either (Either(..))
20 import qualified Data.Text as T
21 import System.FilePath (FilePath()) -- , takeExtension)
22
23 import Gargantext.Prelude
24 import Gargantext.Core.Text.Corpus.Parsers.CSV (writeDocs2Csv)
25 import Gargantext.Core.Text.Corpus.Parsers (parseFile, FileFormat(..), FileType(..))
26
27
28 risPress2csvWrite :: FilePath -> IO ()
29 risPress2csvWrite f = do
30 eContents <- parseFile RisPresse Plain (f <> ".ris")
31 case eContents of
32 Right contents -> writeDocs2Csv (f <> ".csv") contents
33 Left e -> panic $ "Error: " <> (T.pack e)
34
35
36