Sha256: a147fcba9bcbdc01b6b3e1d71692798124b1a4bb15fabe91de3f482e3554e30b
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require File.join(File.dirname(__FILE__), "..", "spec_helper") describe FeatureExtractor do DocumentMock = Struct.new(:vector_of_features) it "should save to file" it "should be loadable from file" it "should return number of features" do FeatureExtractor.new(%w[one two]).number_of_features.should == 2 end it "should throw away extra features" do doc = DocumentMock.new([Feature.new("keep"), Feature.new("throwaway")]) FeatureExtractor.new(%w[keep]).extract(doc).should == [Feature.new("keep")] end it "should extract no features from a doc with no features" do FeatureExtractor.new(%w[keep]).extract(DocumentMock.new([])).should == [] end it "should extract numbered features" do doc = DocumentMock.new([Feature.new("keep", 0)]) FeatureExtractor.new(%w[keep]).extract_numbered(doc).should == [Feature.new(1, 0)] end it "should sort extracted numbered features" do feature_extractor = FeatureExtractor.new(%w[keep1 keep2]) doc = DocumentMock.new([Feature.new("keep2", 10), Feature.new("keep1", 20)]) feature_extractor.extract_numbered(doc).should == [Feature.new(1, 20), Feature.new(2, 10)] end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
danielsdeleo-basset-1.0.4 | spec/unit/feature_extractor_spec.rb |
rjspotter-basset-1.0.5 | spec/unit/feature_extractor_spec.rb |