1 {-# LANGUAGE OverloadedStrings #-}
2 {-# LANGUAGE ScopedTypeVariables #-}
4 module Ngrams.Lang.Occurrences where
7 import Control.Exception (evaluate)
10 import Data.Text (Text)
12 import Gargantext.Prelude
13 import Gargantext.Types.Main (Language(..))
14 import Gargantext.Ngrams
15 import Gargantext.Ngrams.Occurrences (parseOccurrences)
16 import Gargantext.Ngrams.Parser (extractNgrams, selectNgrams)
19 parsersTest = hspec $ do
20 describe "Parser for occurrences" $ do
24 it "returns the result of one parsing" $ do
25 parseOccurrences "internet" "internet" `shouldBe` Right 1
27 -- | Context of Text should be toLower
28 it "returns the result of one parsing not case sensitive" $ do
29 let txtCase = "Internet"
30 parseOccurrences txtCase "internet" `shouldBe` Right 1
32 it "returns the result of one parsing after space" $ do
33 parseOccurrences txt " internet"
36 it "returns the result of one parsing after chars" $ do
37 parseOccurrences txt "l'internet"
40 it "returns the result of multiple parsing" $ do
41 parseOccurrences txt "internet internet of things"
44 it "returns the result of multiple parsing separated by text" $ do
45 parseOccurrences txt "internet in the internet of things"
48 it "returns the result of multiple parsing separated by punctuation" $ do
49 parseOccurrences txt "internet. In the internet of things, internet like; internet?"
52 -- describe "Parser for nodes" $ do
53 -- it "returns the result of one parsing after space" $ do
54 -- occOfCorpus 249509 "sciences" `shouldReturn` 7