2 Module : Gargantext.Database.Schema.NgramsPostag
3 Description : Ngrams 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.Database.Schema.Prelude
26 import Gargantext.Prelude
27 import qualified Database.PostgreSQL.Simple as PGS
30 data NgramsPostagPoly id
37 = NgramsPostagPoly { _ngramsPostag_id :: !id
38 , _ngramsPostag_lang_id :: !lang_id
39 , _ngramsPostag_algo_id :: !algo_id
40 , _ngramsPostag_postag :: !postag
41 , _ngramsPostag_ngrams_id :: !ngrams_id
42 , _ngramsPostag_lemm_id :: !lemm_id
43 , _ngramsPostag_score :: !score
46 ------------------------------------------------------------------------
47 data PosTag = PosTag { unPosTag :: !Text }
48 | NER { unNER :: !Text } -- TODO
50 ------------------------------------------------------------------------
51 -- type NgramsPostag = NgramsPostagPoly (Maybe Int) Lang PostTagAlgo (Maybe PosTag) NgramsTerm NgramsTerm (Maybe Int)
52 type NgramsPostagDB = NgramsPostagPoly (Maybe Int) Int Int (Maybe Text) Int Int Int
54 ------------------------------------------------------------------------
55 type NgramsPosTagWrite = NgramsPostagPoly (Maybe (Column SqlInt4))
58 (Maybe (Column SqlText))
61 (Maybe (Column SqlInt4))
63 type NgramsPosTagRead = NgramsPostagPoly (Column SqlInt4)
71 type NgramsPosTagReadNull = NgramsPostagPoly (Column (Nullable SqlInt4))
72 (Column (Nullable SqlInt4))
73 (Column (Nullable SqlInt4))
74 (Column (Nullable SqlText))
75 (Column (Nullable SqlInt4))
76 (Column (Nullable SqlInt4))
77 (Column (Nullable SqlInt4))
78 makeLenses ''NgramsPostagPoly
80 instance PGS.ToRow NgramsPostagDB where
81 toRow (NgramsPostagPoly f0 f1 f2 f3 f4 f5 f6) = [ toField f0