]> Git — Sourcephile - gargantext.git/blob - src-test/Ngrams/Lang/Occurrences.hs
[FIX] API to unpublish: ok
[gargantext.git] / src-test / Ngrams / Lang / Occurrences.hs
1 {-|
2 Module : Ngrams.Lang.Occurrences
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.Occurrences where
17
18 {-
19 import Test.Hspec
20
21 import Data.Either (Either(Right))
22
23 import Gargantext.Prelude
24 import Gargantext.Text.Metrics.Occurrences (parseOccurrences)
25
26 parsersTest :: IO ()
27 parsersTest = hspec $ do
28 describe "Parser for occurrences" $ do
29
30 let txt = "internet"
31
32 it "returns the result of one parsing" $ do
33 parseOccurrences "internet" "internet" `shouldBe` Right 1
34
35 -- | Context of Text should be toLower
36 it "returns the result of one parsing not case sensitive" $ do
37 let txtCase = "Internet"
38 parseOccurrences txtCase "internet" `shouldBe` Right 1
39
40 it "returns the result of one parsing after space" $ do
41 parseOccurrences txt " internet"
42 `shouldBe` Right 1
43
44 it "returns the result of one parsing after chars" $ do
45 parseOccurrences txt "l'internet"
46 `shouldBe` Right 1
47
48 it "returns the result of multiple parsing" $ do
49 parseOccurrences txt "internet internet of things"
50 `shouldBe` Right 2
51
52 it "returns the result of multiple parsing separated by text" $ do
53 parseOccurrences txt "internet in the internet of things"
54 `shouldBe` Right 2
55
56 it "returns the result of multiple parsing separated by punctuation" $ do
57 parseOccurrences txt "internet. In the internet of things, internet like; internet?"
58 `shouldBe` Right 4
59
60 -- describe "Parser for nodes" $ do
61 -- it "returns the result of one parsing after space" $ do
62 -- occOfCorpus 249509 "sciences" `shouldReturn` 7
63 -}