2 Module : Gargantext.Database.Schema.NgramsPostag
3 Description : Ngram connection to the Database
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 Each Ngrams has a pos-tagging version to ease the default groups of
11 ngrams in NgramsTerm Lists.
15 {-# LANGUAGE Arrows #-}
16 {-# LANGUAGE FunctionalDependencies #-}
17 {-# LANGUAGE QuasiQuotes #-}
18 {-# LANGUAGE TemplateHaskell #-}
20 module Gargantext.Database.Schema.NgramsPostag
24 import Data.Text (Text)
25 import Gargantext.Core
26 import Gargantext.Database.Schema.Prelude
27 import Gargantext.API.Ngrams.Types
28 import Gargantext.Prelude
29 import qualified Database.PostgreSQL.Simple as PGS
31 data NgramsPostagPoly id
38 = NgramsPostagPoly { _ngramsPostag_id :: !id
39 , _ngramsPostag_lang_id :: !lang_id
40 , _ngramsPostag_algo_id :: !algo_id
41 , _ngramsPostag_postag :: !postag
42 , _ngramsPostag_ngrams_id :: !ngrams_id
43 , _ngramsPostag_lemm_id :: !lemm_id
44 , _ngramsPostag_score :: !score
47 ------------------------------------------------------------------------
48 data PosTag = PosTag { unPosTag :: Text }
49 | NER { unNER :: Text } -- TODO
51 ------------------------------------------------------------------------
52 -- type NgramsPostag = NgramsPostagPoly (Maybe Int) Lang PostTagAlgo (Maybe PosTag) NgramsTerm NgramsTerm (Maybe Int)
53 type NgramsPostagDB = NgramsPostagPoly (Maybe Int) Int Int (Maybe Text) Int Int Int
55 ------------------------------------------------------------------------
56 type NgramsPosTagWrite = NgramsPostagPoly (Maybe (Column PGInt4))
59 (Maybe (Column PGText))
62 (Maybe (Column PGInt4))
64 type NgramsPosTagRead = NgramsPostagPoly (Column PGInt4)
72 type NgramsPosTagReadNull = NgramsPostagPoly (Column (Nullable PGInt4))
73 (Column (Nullable PGInt4))
74 (Column (Nullable PGInt4))
75 (Column (Nullable PGText))
76 (Column (Nullable PGInt4))
77 (Column (Nullable PGInt4))
78 (Column (Nullable PGInt4))
79 makeLenses ''NgramsPostagPoly
81 instance PGS.ToRow NgramsPostagDB where
82 toRow (NgramsPostagPoly f0 f1 f2 f3 f4 f5 f6) = [ toField f0