Class: UEAStemmer::EndingRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/rule.rb

Instance Attribute Summary

Attributes inherited from Rule

#pattern, #rule_num, #suffix_size

Instance Method Summary collapse

Methods inherited from Rule

#initialize

Methods included from StringHelpers

#ends_with?, #remove_suffix

Constructor Details

This class inherits a constructor from UEAStemmer::Rule

Instance Method Details

#handle(word) ⇒ Object



45
46
47
# File 'lib/rule.rb', line 45

def handle(word)
  [remove_suffix(word, @suffix_size), @rule_num, self] if ends_with?(word, @pattern)
end

#to_sObject



49
50
51
# File 'lib/rule.rb', line 49

def to_s
  "rule ##{@rule_num} (remove -#{@pattern[@pattern.size - @suffix_size, @suffix_size]} when the word ends in -#{@pattern})"
end