Skip to content

Commit

Permalink
add a rule to handle lying vs flying
Browse files Browse the repository at this point in the history
  • Loading branch information
ealdent committed Jul 16, 2009
1 parent 78f8d23 commit 337bf42
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/uea-stemmer.rb
Expand Up @@ -302,6 +302,7 @@ def create_rules

# plural change - this differs from Perl v1.03
@rules << ConcatenatingEndingRule.new('dying', 4, 58.2, 'ie') # added by JMA
@rules << ExhaustiveConcatenatingEndingRule.new('lying', 4, 58.2, 'ie') # added by JMA (lying vs flying)
@rules << ConcatenatingEndingRule.new('tying', 4, 58.2, 'ie') # added by JMA
@rules << EndingRule.new('thing', 0, 58.1)
@rules << EndingRule.new('things', 1, 58.1)
Expand Down
6 changes: 6 additions & 0 deletions lib/uea-stemmer/rule.rb
Expand Up @@ -81,6 +81,12 @@ def to_s
end
end

class ExhaustiveConcatenatingEndingRule < ConcatenatingEndingRule
def handle(word)
super(word) if word == @original_pattern
end
end

class CustomRule < Rule
def initialize(pattern, suffix_size, rule_num)
super(pattern, suffix_size, rule_num)
Expand Down

0 comments on commit 337bf42

Please sign in to comment.