{-|
Module      : Gargantext.Core.Text.Terms.Multi.Lang.En
Description : English Grammar rules to group postag tokens.
Copyright   : (c) CNRS, 2017-Present
License     : AGPL + CECILL v3
Maintainer  : team@gargantext.org
Stability   : experimental
Portability : POSIX

Rule-based grammars are computed in this english module in order to group
the tokens into extracted terms.

-}


module Gargantext.Core.Text.Terms.Multi.Lang.En (groupTokens)
  where

import Gargantext.Prelude
import Gargantext.Core.Types
import Gargantext.Core.Text.Terms.Multi.Group

------------------------------------------------------------------------
-- | Rule grammar to group tokens
groupTokens :: [TokenTag] -> [TokenTag]
groupTokens :: [TokenTag] -> [TokenTag]
groupTokens []    = []
groupTokens [TokenTag]
ntags = POS -> POS -> [TokenTag] -> [TokenTag]
group2 POS
NP POS
NP
                  ([TokenTag] -> [TokenTag]) -> [TokenTag] -> [TokenTag]
forall a b. (a -> b) -> a -> b
$ POS -> POS -> [TokenTag] -> [TokenTag]
group2 POS
NP POS
VB
        --          $ group2 NP IN
                  ([TokenTag] -> [TokenTag]) -> [TokenTag] -> [TokenTag]
forall a b. (a -> b) -> a -> b
$ POS -> POS -> [TokenTag] -> [TokenTag]
group2 POS
IN POS
DT
        --          $ group2 VB NP
                  ([TokenTag] -> [TokenTag]) -> [TokenTag] -> [TokenTag]
forall a b. (a -> b) -> a -> b
$ POS -> POS -> [TokenTag] -> [TokenTag]
group2 POS
JJ POS
NP
                  ([TokenTag] -> [TokenTag]) -> [TokenTag] -> [TokenTag]
forall a b. (a -> b) -> a -> b
$ POS -> POS -> [TokenTag] -> [TokenTag]
group2 POS
JJ POS
JJ
                  ([TokenTag] -> [TokenTag]) -> [TokenTag] -> [TokenTag]
forall a b. (a -> b) -> a -> b
$ POS -> POS -> [TokenTag] -> [TokenTag]
group2 POS
JJ POS
CC
                  ([TokenTag] -> [TokenTag]) -> [TokenTag] -> [TokenTag]
forall a b. (a -> b) -> a -> b
$ [TokenTag]
ntags

------------------------------------------------------------------------
--groupNgrams ((x,_,"PERSON"):(y,yy,"PERSON"):xs)             = groupNgrams ((x <> " " <> y,yy,"PERSON"):xs)
--groupNgrams ((x,_,"ORGANIZATION"):(y,yy,"ORGANIZATION"):xs) = groupNgrams ((x <> " " <> y,yy,"ORGANIZATION"):xs)
--groupNgrams ((x,_,"LOCATION"):(y,yy,"LOCATION"):xs)         = groupNgrams ((x <> " " <> y,yy,"LOCATION"):xs)
--
--groupNgrams (x:xs)                                          = (x:(groupNgrams xs))