Commit fbc1dbea authored by Alexandre Delanoë's avatar Alexandre Delanoë

[DATABASE] New Table for postagging

parent 8404a553
......@@ -39,6 +39,8 @@ CREATE TABLE public.nodes (
);
ALTER TABLE public.nodes OWNER TO gargantua;
--------------------------------------------------------------
-- | Ngrams
CREATE TABLE public.ngrams (
id SERIAL,
terms CHARACTER varying(255),
......@@ -47,6 +49,20 @@ CREATE TABLE public.ngrams (
);
ALTER TABLE public.ngrams OWNER TO gargantua;
-- | Ngrams PosTag
CREATE TABLE public.ngrams_postag (
id SERIAL,
lang_id INTEGER,
algo_id INTEGER,
postag CHARACTER varying(5),
ngrams_id INTEGER NOT NULL,
lemm_id INTEGER NOT NULL,
score INTEGER DEFAULT 1 ::integer NOT NULL,
FOREIGN KEY (ngrams_id) REFERENCES public.ngrams(id) ON DELETE CASCADE,
FOREIGN KEY (lemm_id) REFERENCES public.ngrams(id) ON DELETE CASCADE
);
ALTER TABLE public.ngrams_postag OWNER TO gargantua;
--------------------------------------------------------------
CREATE TABLE public.node_ngrams (
id SERIAL,
......
......@@ -115,7 +115,7 @@ corenlp' lang txt = do
let properties = case lang of
EN -> "{\"annotators\": \"tokenize,ssplit,pos,ner\", \"outputFormat\": \"json\"}"
-- FR -> "{\"annotators\": \"tokenize,ssplit,pos,ner\", \"outputFormat\": \"json\"}"
FR -> "{\"annotators\": \"tokenize,ssplit,pos,ner\", \"parse.model\":\"edu/stanford/nlp/models/lexparser/frenchFactored.ser.gz\", \"pos.model\":\"edu/stanford/nlp/models/pos-tagger/french/french.tagger\", \"tokenize.language\":\"fr\", \"outputFormat\": \"json\"}"
FR -> "{\"annotators\": \"tokenize,ssplit,pos,lemma,ner\", \"parse.model\":\"edu/stanford/nlp/models/lexparser/frenchFactored.ser.gz\", \"pos.model\":\"edu/stanford/nlp/models/pos-tagger/french/french.tagger\", \"tokenize.language\":\"fr\", \"outputFormat\": \"json\"}"
_ -> panic $ pack "not implemented yet"
url <- parseRequest $ "POST http://localhost:9000/?properties=" <> properties
let request = setRequestBodyLBS (cs txt) url
......
{-|
Module : Gargantext.Database.Schema.Ngrams
Module : Gargantext.Database.Schema.NgramsPostag
Description : Ngram connection to the Database
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
......
{-|
Module : Gargantext.Database.Schema.NgramsPostag
Description : Ngram connection to the Database
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
Each Ngrams has a pos-tagging version to ease the default groups of
ngrams in NgramsTerm Lists.
-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
module Gargantext.Database.Schema.NgramsPostag
where
import Data.Text (Text)
import Gargantext.Prelude
import Gargantext.Database.Schema.Prelude
data NgramsPosTagPoly id
lang_id
algo_id
postag
ngrams_id
lemm_id
score
= NgramsPosTagDB { _ngramsPosTag_id :: !id
, _ngramsPosTag_lang_id :: !lang_id
, _ngramsPosTag_algo_id :: !algo_id
, _ngramsPosTag_postag :: !postag
, _ngramsPosTag_ngrams_id :: !ngrams_id
, _ngramsPosTag_lemm_id :: !lemm_id
, _ngramsPosTag_score :: !score
} deriving (Show)
------------------------------------------------------------------------
type NgramsPosTagWrite = NgramsPosTagPoly (Maybe (Column PGInt4))
(Column PGInt4)
(Column PGInt4)
(Maybe (Column PGText))
(Column PGInt4)
(Column PGInt4)
(Maybe (Column PGInt4))
type NgramsPosTagRead = NgramsPosTagPoly (Column PGInt4)
(Column PGInt4)
(Column PGInt4)
(Column PGText)
(Column PGInt4)
(Column PGInt4)
(Column PGInt4)
type NgramsPosTagReadNull = NgramsPosTagPoly (Column (Nullable PGInt4))
(Column (Nullable PGInt4))
(Column (Nullable PGInt4))
(Column (Nullable PGText))
(Column (Nullable PGInt4))
(Column (Nullable PGInt4))
(Column (Nullable PGInt4))
type NgramsPosTagDB = NgramsPosTagPoly Int Int Int Text Int Int Int
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment