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 NoImplicitPrelude #-}
15 {-# LANGUAGE OverloadedStrings #-}
16 {-# LANGUAGE ScopedTypeVariables #-}
18 module Ngrams.Lang.Occurrences where
22 import Data.Either (Either(Right))
24 import Gargantext.Prelude
25 import Gargantext.Text.Occurrences (parseOccurrences)
28 parsersTest = hspec $ do
29 describe "Parser for occurrences" $ do
33 it "returns the result of one parsing" $ do
34 parseOccurrences "internet" "internet" `shouldBe` Right 1
36 -- | Context of Text should be toLower
37 it "returns the result of one parsing not case sensitive" $ do
38 let txtCase = "Internet"
39 parseOccurrences txtCase "internet" `shouldBe` Right 1
41 it "returns the result of one parsing after space" $ do
42 parseOccurrences txt " internet"
45 it "returns the result of one parsing after chars" $ do
46 parseOccurrences txt "l'internet"
49 it "returns the result of multiple parsing" $ do
50 parseOccurrences txt "internet internet of things"
53 it "returns the result of multiple parsing separated by text" $ do
54 parseOccurrences txt "internet in the internet of things"
57 it "returns the result of multiple parsing separated by punctuation" $ do
58 parseOccurrences txt "internet. In the internet of things, internet like; internet?"
61 -- describe "Parser for nodes" $ do
62 -- it "returns the result of one parsing after space" $ do
63 -- occOfCorpus 249509 "sciences" `shouldReturn` 7