Sha256: 34ac207a3debab19c44564daa3ae96d6250c9cf9dee386163e9f049b8c9dc95e
Contents?: true
Size: 924 Bytes
Versions: 6
Compression:
Stored size: 924 Bytes
Contents
require 'spec_helper' describe ::Bae::Classifier do subject { described_class.new } it "can classify from ruby to java with a hash document" do subject.train("positive", {"aaa" => 0, "bbb" => 1}) subject.train("negative", {"ccc" => 2, "ddd" => 3}) results = subject.classify({"aaa" => 1, "bbb" => 1}) expect(results["positive"]).to be_within(0.001).of(0.94117) expect(results["negative"]).to be_within(0.001).of(0.05882) end it "can classify from ruby to java with a string based document" do subject.train("positive", "aaa aaa bbb"); subject.train("negative", "ccc ccc ddd ddd"); subject.train("neutral", "eee eee eee fff fff fff"); results = subject.classify("aaa bbb") expect(results["positive"]).to be_within(0.001).of(0.89626) expect(results["negative"]).to be_within(0.001).of(0.06639) expect(results["neutral"]).to be_within(0.001).of(0.03734) end end
Version data entries
6 entries across 6 versions & 1 rubygems