Class: UEAStemmer::EndingRule

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

Instance Attribute Summary collapse

Attributes inherited from Rule

#pattern, #rule_num, #suffix_size

Instance Method Summary collapse

Methods inherited from Rule

#handle

Methods included from StringHelpers

#ends_with?, #remove_suffix

Constructor Details

#initialize(pattern, suffix_size, rule_num) ⇒ EndingRule

Returns a new instance of EndingRule.



47
48
49
50
# File 'lib/uea-stemmer/rule.rb', line 47

def initialize(pattern, suffix_size, rule_num)
  super(/^.*#{pattern}$/, suffix_size, rule_num)
  @original_pattern = pattern.dup.freeze
end

Instance Attribute Details

#original_patternObject (readonly)

Returns the value of attribute original_pattern.



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

def original_pattern
  @original_pattern
end

Instance Method Details

#to_sObject



52
53
54
# File 'lib/uea-stemmer/rule.rb', line 52

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