1 {-# LANGUAGE OverloadedStrings #-}
5 import Control.Exception (evaluate)
8 import Data.Text (Text)
9 import Data.Gargantext.Parsers.Occurrences (parseOccurrences)
10 -- import Data.Gargantext.Analysis (occOfCorpus)
14 parsersTest = hspec $ do
15 describe "Parser for occurrences" $ do
19 it "returns the result of one parsing" $ do
20 parseOccurrences "internet" "internet" `shouldBe` Right 1
22 -- | Context of Text should be toLower
23 it "returns the result of one parsing not case sensitive" $ do
24 let txtCase = "Internet"
25 parseOccurrences txtCase "internet" `shouldBe` Right 1
27 it "returns the result of one parsing after space" $ do
28 parseOccurrences txt " internet"
31 it "returns the result of one parsing after chars" $ do
32 parseOccurrences txt "l'internet"
35 it "returns the result of multiple parsing" $ do
36 parseOccurrences txt "internet internet of things"
39 it "returns the result of multiple parsing separated by text" $ do
40 parseOccurrences txt "internet in the internet of things"
43 it "returns the result of multiple parsing separated by punctuation" $ do
44 parseOccurrences txt "internet. In the internet of things, internet like; internet?"
47 -- describe "Parser for nodes" $ do
48 -- it "returns the result of one parsing after space" $ do
49 -- occOfCorpus 249509 "sciences" `shouldReturn` 7