1 module Data.Gargantext.Analysis where
3 -- import qualified Data.Text.Lazy as DTL
4 import Data.Either.Extra (fromRight)
5 import Data.Gargantext.Database.Node
6 import Data.Gargantext.Parsers.Occurrences
7 import Data.Gargantext.Prelude
8 import Data.Gargantext.Types
10 import Opaleye (Column, PGInt4)
12 -- | Simple function to count Occurrences in a context of text.
13 occOfDocument :: Column PGInt4 -> Text -> IO Int
14 occOfDocument = undefined
15 --occOfDocument c_id txt = do
16 -- docs <- pm (hyperdataDocument_Abstract . node_hyperdata) <$> getCorpusDocument c_id
17 -- let occs = pm (\x -> maybe "" identity x) docs
18 -- let result = case sequence $ pm (parseOccurrences txt) occs of
19 -- -- TODO find a way to get nice message d'errors (file, function, line)
20 -- Left str -> error $ "[ERRROR] at file/function/line" ++ str