]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Text/Analysis.hs
[Structure] Ngrams -> Text.
[gargantext.git] / src / Gargantext / Text / Analysis.hs
1 {-|
2 Module : Gargantext.Analysis
3 Description : Gargantext Analysis
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9 -}
10
11 {-# LANGUAGE NoImplicitPrelude #-}
12
13
14 module Gargantext.Text.Analysis
15 where
16
17 import Gargantext.Prelude (undefined, IO(), Int())
18
19 -- import qualified Data.Text.Lazy as DTL
20 import Data.Text
21 import Opaleye (Column, PGInt4)
22 --import Data.Map as DM
23 --import Data.Vector as DV
24
25 -- | Simple function to count Occurrences in a context of text.
26 occOfDocument :: Column PGInt4 -> Text -> IO Int
27 occOfDocument = undefined
28 --occOfDocument c_id txt = do
29 -- docs <- pm (hyperdataDocument_Abstract . node_hyperdata) <$> getCorpusDocument c_id
30 -- let occs = pm (\x -> maybe "" identity x) docs
31 -- let result = case sequence $ pm (parseOccurrences txt) occs of
32 -- -- TODO find a way to get nice message d'errors (file, function, line)
33 -- Left str -> error $ "[ERRROR] at file/function/line" ++ str
34 -- Right xs -> xs
35 -- pure (sum result)
36
37
38
39 data Occurrences a b = Map a b
40
41
42
43
44
45
46
47
48