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
21 import Data.Either (Either(Right))
23 import Gargantext.Prelude
24 import Gargantext.Text.Metrics.Occurrences (parseOccurrences)
27 parsersTest = hspec $ do
28 describe "Parser for occurrences" $ do
32 it "returns the result of one parsing" $ do
33 parseOccurrences "internet" "internet" `shouldBe` Right 1
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
40 it "returns the result of one parsing after space" $ do
41 parseOccurrences txt " internet"
44 it "returns the result of one parsing after chars" $ do
45 parseOccurrences txt "l'internet"
48 it "returns the result of multiple parsing" $ do
49 parseOccurrences txt "internet internet of things"
52 it "returns the result of multiple parsing separated by text" $ do
53 parseOccurrences txt "internet in the internet of things"
56 it "returns the result of multiple parsing separated by punctuation" $ do
57 parseOccurrences txt "internet. In the internet of things, internet like; internet?"
60 -- describe "Parser for nodes" $ do
61 -- it "returns the result of one parsing after space" $ do
62 -- occOfCorpus 249509 "sciences" `shouldReturn` 7