remove the abstract stemmer class, because we only need an interface
This commit is contained in:
parent
c2a5caa487
commit
8e6c5fa321
|
@ -1,25 +0,0 @@
|
|||
module Polecat
|
||||
# abstract class for stemmer
|
||||
#
|
||||
# This class can be used for inheritence for your own stemmer.
|
||||
# A stemmer is responsible to convert an document into an array of fragments
|
||||
# which then merged with the index. As every document can be built of
|
||||
# different words and fragments, the stemmer is very important to get the
|
||||
# best result when searching.
|
||||
#
|
||||
# Be warned, that you use the same stemmer for the index as for the search
|
||||
# input!
|
||||
#
|
||||
# To build your own stemmer implement the methods #stem and #result.
|
||||
class Stemmer
|
||||
# stems the word
|
||||
#
|
||||
# This method changes the word into a form, which get's interted into the
|
||||
# index.
|
||||
# @param [Object] word word to stem
|
||||
# @return [Object] the stemmed variant of the word or the same object
|
||||
def stem word
|
||||
raise NotImplementedError, 'please implement #stem'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe "Stemmer#new" do
|
||||
it "creates a new stemmer" do
|
||||
s = Polecat::Stemmer.new
|
||||
s.class.should be(Polecat::Stemmer)
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe "Stemmer#stem" do
|
||||
let (:s) { Polecat::Stemmer.new }
|
||||
|
||||
it "takes one argument" do
|
||||
s.method(:stem).arity.should == 1
|
||||
end
|
||||
|
||||
it "raises an error, because it's an abstract class" do
|
||||
lambda { s.stem "word" }.should raise_error(NotImplementedError)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue