0
0
Fork 0
polecat/lib/polecat/stemmer/simple.rb

19 lines
490 B
Ruby

module Polecat
# simple stemmer for cleaning in a simple way
#
# This class can be used for cleaning strings in the most simple way. If it
# does not do, what you intent it to do, inherit from Polecat::Stemmer and
# implement your own.
class SimpleStemmer
def stem word
if word.class == Array
word.each {|w| self.stem w }
elsif word.class == String && word.length > 1
word.gsub /(ing|ed)$/, ''
else
word
end
end
end
end