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

This @group@ function groups horizontally ngrams in their context of
sentence according to grammars specific of each language. In english, JJ
is ADJectiv in french.

-}


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

import Gargantext.Prelude
import Gargantext.Core.Types
import Gargantext.Core.Text.Terms.Multi.Group (group2)

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
            -- group2 IN DT
            ([TokenTag] -> [TokenTag]) -> [TokenTag] -> [TokenTag]
forall a b. (a -> b) -> a -> b
$ POS -> POS -> [TokenTag] -> [TokenTag]
group2 POS
VB POS
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
NP POS
JJ
            ([TokenTag] -> [TokenTag]) -> [TokenTag] -> [TokenTag]
forall a b. (a -> b) -> a -> b
$ POS -> POS -> [TokenTag] -> [TokenTag]
group2 POS
JJ POS
JJ
            -- group2 JJ CC
            ([TokenTag] -> [TokenTag]) -> [TokenTag] -> [TokenTag]
forall a b. (a -> b) -> a -> b
$ [TokenTag]
ntags

------------------------------------------------------------------------
-- TODO
--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)