]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/NgramsPostag.hs
[FIX] Phylo
[gargantext.git] / src / Gargantext / Database / Schema / NgramsPostag.hs
1 {-|
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
8 Portability : POSIX
9
10 Each Ngrams has a pos-tagging version to ease the default groups of
11 ngrams in NgramsTerm Lists.
12
13 -}
14
15 {-# LANGUAGE Arrows #-}
16 {-# LANGUAGE FunctionalDependencies #-}
17 {-# LANGUAGE QuasiQuotes #-}
18 {-# LANGUAGE TemplateHaskell #-}
19
20 module Gargantext.Database.Schema.NgramsPostag
21 where
22
23 import Control.Lens
24 import Data.Text (Text)
25 import Gargantext.Database.Schema.Prelude
26 import Gargantext.Prelude
27 import qualified Database.PostgreSQL.Simple as PGS
28
29
30 data NgramsPostagPoly id
31 lang_id
32 algo_id
33 postag
34 ngrams_id
35 lemm_id
36 score
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
44 } deriving (Show)
45
46 ------------------------------------------------------------------------
47 data PosTag = PosTag { unPosTag :: !Text }
48 | NER { unNER :: !Text } -- TODO
49
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
53
54 ------------------------------------------------------------------------
55 type NgramsPosTagWrite = NgramsPostagPoly (Maybe (Column SqlInt4))
56 (Column SqlInt4)
57 (Column SqlInt4)
58 (Maybe (Column SqlText))
59 (Column SqlInt4)
60 (Column SqlInt4)
61 (Maybe (Column SqlInt4))
62
63 type NgramsPosTagRead = NgramsPostagPoly (Column SqlInt4)
64 (Column SqlInt4)
65 (Column SqlInt4)
66 (Column SqlText)
67 (Column SqlInt4)
68 (Column SqlInt4)
69 (Column SqlInt4)
70 makeLenses ''NgramsPostagPoly
71
72 instance PGS.ToRow NgramsPostagDB where
73 toRow (NgramsPostagPoly f0 f1 f2 f3 f4 f5 f6) = [ toField f0
74 , toField f1
75 , toField f2
76 , toField f3
77 , toField f4
78 , toField f5
79 , toField f6
80 ]