2 Module : Ngrams.Lang.Occurrences
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 Here is a longer description of this module, containing some
11 commentary with @some markup@.
14 {-# LANGUAGE ScopedTypeVariables #-}
16 module Ngrams.Lang.Occurrences where
20 import Data.Either (Either(Right))
22 import Gargantext.Prelude
23 import Gargantext.Text.Metrics.Occurrences (parseOccurrences)
26 parsersTest = hspec $ do
27 describe "Parser for occurrences" $ do
31 it "returns the result of one parsing" $ do
32 parseOccurrences "internet" "internet" `shouldBe` Right 1
34 -- | Context of Text should be toLower
35 it "returns the result of one parsing not case sensitive" $ do
36 let txtCase = "Internet"
37 parseOccurrences txtCase "internet" `shouldBe` Right 1
39 it "returns the result of one parsing after space" $ do
40 parseOccurrences txt " internet"
43 it "returns the result of one parsing after chars" $ do
44 parseOccurrences txt "l'internet"
47 it "returns the result of multiple parsing" $ do
48 parseOccurrences txt "internet internet of things"
51 it "returns the result of multiple parsing separated by text" $ do
52 parseOccurrences txt "internet in the internet of things"
55 it "returns the result of multiple parsing separated by punctuation" $ do
56 parseOccurrences txt "internet. In the internet of things, internet like; internet?"
59 -- describe "Parser for nodes" $ do
60 -- it "returns the result of one parsing after space" $ do
61 -- occOfCorpus 249509 "sciences" `shouldReturn` 7