spec/string_spec.rb in text_nlp-0.0.1 vs spec/string_spec.rb in text_nlp-0.0.2
- old
+ new
@@ -23,9 +23,16 @@
String.tokenizer = tokenizer
tokenizer.should_receive(:tokenize).with(text)
text.tokenize
end
+ it "should call translator" do
+ text = "TOTO"
+ translator = double()
+ translator.should_receive(:translate).with(text)
+ text.translate(translator)
+ end
+
it "should compute similarity" do
"il fait chaud".similarity("il fait chaud").should eq 1.0
"il fait chaud".similarity("putin c nul ici").should eq 0.0
"il fait chaud".similarity("youhou ca le fait").should be_within(0.01).of(0.29)
"".similarity("il fait chaud").should eq 0.0
\ No newline at end of file