Sha256: 969e7df19bd5e275eb6ed32bce7a261e3257fd02a312ea925b55e104cba7dea2
Contents?: true
Size: 1.72 KB
Versions: 3
Compression:
Stored size: 1.72 KB
Contents
# encoding: utf-8 require "spec_helper" describe TextNlp::Expressions do it "should find the expressions" do expression_values = ['nicolas sarkozy','nicolas sarkozy 1er de france','carla bruni','carla bruni sarkozy a'] etree = TextNlp::Expressions.new(expression_values) expressions = etree.find('nicolas sarkozy 1er de italie est marie a carla bruni qui de fait est devenue carla bruni sarkozy a') expressions.size.should eq 3 ['nicolas sarkozy','carla bruni','carla bruni sarkozy a'].each { |e| expressions.include?(e).should be_true } expression_values.size.should eq etree.values.size expression_values.each do |v| etree.values.include?(v).should be_true end end it "should expressionize the text" do expression_values = ['nicolas sarkozy','nicolas sarkozy 1er de france','carla bruni','carla bruni sarkozy a'] etree = TextNlp::Expressions.new(expression_values) expressions = etree.expressionize('nicolas sarkozy 1er de italie est marie a carla bruni qui de fait est devenue carla bruni sarkozy a') expressions.should eq ['nicolas sarkozy','1er','de','italie','est','marie','a','carla bruni','qui','de','fait','est','devenue','carla bruni sarkozy a'] ['nicolas sarkozy','1er','de','italie','est','marie','a','carla bruni','qui','de','fait','est','devenue','carla bruni sarkozy a'].each { |e| expressions.include?(e).should be_true } end it "should returns true or false if any expression present in text" do etree = TextNlp::Expressions.new(['olympique de marseille','lyon']) etree.any?("l olympique de marseille").should be_true etree.any?("lyon c est plus ce que c etait").should be_true etree.any?("marseille pres du vieux port").should be_false end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
text_nlp-0.0.3 | spec/expressions_spec.rb |
text_nlp-0.0.2 | spec/expressions_spec.rb |
text_nlp-0.0.1 | spec/expressions_spec.rb |