]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Text/Terms/Multi/Lang/En.hs
Merge branch 'dev-phylo' into dev-merge
[gargantext.git] / src / Gargantext / Text / Terms / Multi / Lang / En.hs
1 {-|
2 Module : Gargantext.Text.Terms.Multi.Lang.En
3 Description : English Grammar rules to group postag tokens.
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 Rule-based grammars are computed in this english module in order to group
11 the tokens into extracted terms.
12
13 -}
14
15 {-# LANGUAGE NoImplicitPrelude #-}
16 {-# LANGUAGE OverloadedStrings #-}
17
18 module Gargantext.Text.Terms.Multi.Lang.En (group)
19 where
20
21 import Gargantext.Prelude
22 import Gargantext.Core.Types
23 import Gargantext.Text.Terms.Multi.Group
24
25 ------------------------------------------------------------------------
26 -- | Rule grammar to group tokens
27 group :: [TokenTag] -> [TokenTag]
28 group [] = []
29 group ntags = group2 NP NP
30 $ group2 NP VB
31 -- $ group2 NP IN
32 $ group2 IN DT
33 -- $ group2 VB NP
34 $ group2 JJ NP
35 $ group2 JJ JJ
36 $ group2 JJ CC
37 $ ntags
38
39 ------------------------------------------------------------------------
40 --groupNgrams ((x,_,"PERSON"):(y,yy,"PERSON"):xs) = groupNgrams ((x <> " " <> y,yy,"PERSON"):xs)
41 --groupNgrams ((x,_,"ORGANIZATION"):(y,yy,"ORGANIZATION"):xs) = groupNgrams ((x <> " " <> y,yy,"ORGANIZATION"):xs)
42 --groupNgrams ((x,_,"LOCATION"):(y,yy,"LOCATION"):xs) = groupNgrams ((x <> " " <> y,yy,"LOCATION"):xs)
43 --
44 --groupNgrams (x:xs) = (x:(groupNgrams xs))
45