]> Git — Sourcephile - gargantext.git/blob - bin/gargantext-cli/Main.hs
WIP Gargantext/Text/Terms/WithList
[gargantext.git] / bin / gargantext-cli / Main.hs
1 {-|
2 Module : Main.hs
3 Description : Gargantext starter
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 Main specifications to index a corpus with a term list
11
12 -}
13
14 {-# LANGUAGE DataKinds #-}
15 {-# LANGUAGE DeriveGeneric #-}
16 {-# LANGUAGE FlexibleInstances #-}
17 {-# LANGUAGE NoImplicitPrelude #-}
18 {-# LANGUAGE OverloadedStrings #-}
19 {-# LANGUAGE StandaloneDeriving #-}
20 {-# LANGUAGE TypeOperators #-}
21 {-# LANGUAGE Strict #-}
22
23 module Main where
24
25 import qualified Data.Vector as DV
26
27 import Gargantext.Prelude
28 import Data.Text (Text)
29
30 import Gargantext.Text.Parsers.CSV (readCsv)
31 import Gargantext.Text.List.CSV (fromCsvListFile)
32
33 main :: IO ()
34 main = do
35 [corpusfile, termListFile, outputFile] <- readParams
36
37 -- corpus :: [Text]
38 corpus <- DV.toList <$> map DV.csv_abstract <$> readCsv corpusFile
39
40 -- termListMap :: [Text]
41 termList <- termListMap <$> fromCsvListFile termListFile
42
43 let corpusIndexed = indexCorpusWith corpus termList
44 let cooc = cooccurrences corpusIndexed
45
46 writeFile outputFile cooc