]> Git — Sourcephile - gargantext.git/blob - src/Data/Gargantext/Analysis.hs
[FEAT] Ngrams metrics, thanks to text-metrics to begin with.
[gargantext.git] / src / Data / Gargantext / Analysis.hs
1 module Data.Gargantext.Analysis where
2
3 -- import qualified Data.Text.Lazy as DTL
4 import Data.Text
5 import Opaleye (Column, PGInt4)
6 --import Data.Map as DM
7 --import Data.Vector as DV
8
9 -- | Simple function to count Occurrences in a context of text.
10 occOfDocument :: Column PGInt4 -> Text -> IO Int
11 occOfDocument = undefined
12 --occOfDocument c_id txt = do
13 -- docs <- pm (hyperdataDocument_Abstract . node_hyperdata) <$> getCorpusDocument c_id
14 -- let occs = pm (\x -> maybe "" identity x) docs
15 -- let result = case sequence $ pm (parseOccurrences txt) occs of
16 -- -- TODO find a way to get nice message d'errors (file, function, line)
17 -- Left str -> error $ "[ERRROR] at file/function/line" ++ str
18 -- Right xs -> xs
19 -- pure (sum result)
20
21
22
23 data Occurrences a b = Map a b
24
25
26
27
28
29
30
31
32