Class: UEAStemmer::ConcatenatingEndingRule
- Inherits:
-
EndingRule
- Object
- Rule
- EndingRule
- UEAStemmer::ConcatenatingEndingRule
- Defined in:
- lib/uea-stemmer/rule.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#new_suffix ⇒ Object
readonly
Returns the value of attribute new_suffix.
Attributes inherited from EndingRule
Attributes inherited from Rule
#pattern, #rule_num, #suffix_size
Instance Method Summary collapse
- #handle(word) ⇒ Object
-
#initialize(pattern, suffix_size, rule_num, new_suffix) ⇒ ConcatenatingEndingRule
constructor
A new instance of ConcatenatingEndingRule.
- #to_s ⇒ Object
Methods included from StringHelpers
Constructor Details
#initialize(pattern, suffix_size, rule_num, new_suffix) ⇒ ConcatenatingEndingRule
Returns a new instance of ConcatenatingEndingRule.
60 61 62 63 |
# File 'lib/uea-stemmer/rule.rb', line 60 def initialize(pattern, suffix_size, rule_num, new_suffix) super(pattern, suffix_size, rule_num) @new_suffix = new_suffix.dup.freeze end |
Instance Attribute Details
#new_suffix ⇒ Object (readonly)
Returns the value of attribute new_suffix.
58 59 60 |
# File 'lib/uea-stemmer/rule.rb', line 58 def new_suffix @new_suffix end |
Instance Method Details
#handle(word) ⇒ Object
65 66 67 |
# File 'lib/uea-stemmer/rule.rb', line 65 def handle(word) [remove_suffix(word, @suffix_size) + @new_suffix, @rule_num, self] if word =~ @pattern end |
#to_s ⇒ Object
69 70 71 |
# File 'lib/uea-stemmer/rule.rb', line 69 def to_s "rule ##{@rule_num} (remove -#{@original_pattern[@original_pattern.size - @suffix_size, @suffix_size]} and add -#{new_suffix} when the word ends in -#{@original_pattern})" end |