]> Git — Sourcephile - gargantext.git/blob - src-test/Ngrams/Lang/Fr.hs
[MERGE] fix warnings
[gargantext.git] / src-test / Ngrams / Lang / Fr.hs
1 {-|
2 Module : Ngrams.Lang
3 Description :
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 Here is a longer description of this module, containing some
11 commentary with @some markup@.
12 -}
13
14 {-# LANGUAGE ScopedTypeVariables #-}
15
16 module Ngrams.Lang.Fr where
17
18 {-
19 import Test.Hspec
20
21 import Gargantext.Prelude
22 import Gargantext.Core (Lang(..))
23 -- TODO this import is not used anymore
24 import Gargantext.Text.Ngrams.PosTagging.Parser (extractNgrams, selectNgrams)
25 -- use instead
26 -
27 ngramsExtractionTest :: IO ()
28 ngramsExtractionTest = hspec $ do
29 describe "Behavioral tests: ngrams extraction in French Language" $ do
30 it "Groupe : adjectif et nom commun" $ do
31 let textFr = "Le beau texte fut écrit."
32 testFr <- map (selectNgrams FR) <$> (extractNgrams FR) textFr
33 testFr `shouldBe` [[("beau texte","NC","O")]]
34
35 it "Groupe : adjectifs et nom commun" $ do
36 let textFr = "Le beau petit texte fut écrit."
37 testFr <- map (selectNgrams FR) <$> (extractNgrams FR) textFr
38 testFr `shouldBe` [[("beau petit texte","NC","O")]]
39 -- `shouldBe` [[("beau texte","NC","O"),("petit texte","NC","O")]] ?
40
41 it "Groupe : nom commun et adjectif" $ do
42 let textFr = "Le livre blanc fut écrit."
43 testFr <- map (selectNgrams FR) <$> (extractNgrams FR) textFr
44 testFr `shouldBe` [[("livre blanc","NC","O")]]
45
46 it "Groupe : nom commun et adjectifs avec conjonction" $ do
47 let textFr = "Le livre blanc et rouge."
48 testFr <- map (selectNgrams FR) <$> (extractNgrams FR) textFr
49 testFr `shouldBe` [[("livre blanc","NC","O"),("livre rouge","NC","O")]]
50 -- `shouldBe` [[("livre blanc et rouge","N","O")]] ?
51
52 it "Groupe: Nom commun + préposition + Nom commun" $ do
53 let textFr0 = "Le problème du jour est résolu."
54 testFr0 <- map (selectNgrams FR) <$> (extractNgrams FR) textFr0
55 testFr0 `shouldBe` [[("problème du jour","NC","O")]]
56
57 it "Groupe: Nom commun + préposition + déterminant + Nom commun" $ do
58 let textFr0 = "Emmanuel Macron est le président de la France."
59 testFr0 <- map (selectNgrams FR) <$> (extractNgrams FR) textFr0
60 testFr0 `shouldBe` [[("Emmanuel Macron","NPP","PERSON"),("président de la France","NC","LOCATION")]]
61
62
63 it "Groupe: Nom commun + préposition + Nom commun + prép + Nom commun" $ do
64 let textFr1 = "L'heure d'arrivée des coureurs dépend de la météo du jour."
65 testFr1 <- map (selectNgrams FR) <$> (extractNgrams FR) textFr1
66 testFr1 `shouldBe` [[("heure d' arrivée des coureurs","NC","O"),("météo du jour","NC","O")]]
67 -}