Sha256: 971851fb16841d3f9ba650d3719c72683700e0274d7e441fcd1f75e245600dcd
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
# encoding: utf-8 require "spec_helper" describe TextNlp::Pattern do context "with normalize option" do it "should match or not the pattern" do pattern = TextNlp::Pattern.new("(BD OR 'bande dessinée') AND -samsung") pattern.match?("cette BD est super").should be_true pattern.match?("cette bd est illisible sur samsung NTC").should be_false pattern.match?("cette bande dessinee est illisible sur samsung NTC").should be_false pattern.match?("cette bande dessinee est illisible").should be_true pattern = TextNlp::Pattern.new("'toulouse fc' OR ((toulouse OR tfc) AND (foot OR football OR 'ligue 1' OR 'ligue 2' OR l1 OR l2))") pattern.match?("toulouse est une belle ville").should be_false end end context "with no normalized option" do it "should match or not the pattern" do pattern = TextNlp::Pattern.new("(BD OR 'bande dessinée') AND -samsung", :normalize => false) pattern.match?("cette BD est super").should be_true pattern.match?("cette bd est super").should be_false pattern.match?("cette bande dessinee est illisible").should be_false pattern.match?("cette bande dessinée est illisible").should be_true pattern.match?("cette bande dessinée est illisible sur samsung").should be_false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
text_nlp-0.0.3 | spec/pattern_spec.rb |