Sha256: bf490f6d9576adcd95354b96335e0b420f1e9f77c96453e313c4c25782d7c173

Contents?: true

Size: 881 Bytes

Versions: 6

Compression:

Stored size: 881 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

module Semantic
  describe Parser do

    it "should remove stop words" do
      file = mock("file")
      file.stub!(:read).and_return("a to be")
      File.stub!(:open).and_yield(file)
      parser = Parser.new

      parser.remove_stop_words(['a','house']).should == ['house']
    end

    it "should remove any non characters" do
      file = mock("file")
      file.stub!(:read).and_return("a to be")
      File.stub!(:open).and_yield(file)

      parser = Parser.new
      parser.tokenise_and_stem("dragon.").should == ["dragon"]
    end

    it "should tokenise the string" do
      parser = Parser.new

      parser.stub!(:remove_stop_words).and_return(['mouse','trap'])
      parser.should_receive(:tokenise_and_stem).and_return(['mouse','trap'])

      parser.tokenise_and_filter(['the mouse trap'])
    end

  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
josephwilk-rsemantic-0.1.0 spec/semantic/parser_spec.rb
josephwilk-rsemantic-0.1.1 spec/semantic/parser_spec.rb
josephwilk-rsemantic-0.1.2 spec/semantic/parser_spec.rb
josephwilk-rsemantic-0.1.3 spec/semantic/parser_spec.rb
josephwilk-semantic-0.1.0 spec/semantic/parser_spec.rb
rsemantic-0.1.3 spec/semantic/parser_spec.rb