Skip to content
Browse files

2 extra rules for words like grades, abodes and fires, acres

  • Loading branch information...
1 parent 7861599 commit e8cb67d1a81a79b2eb37e429b5ed2798929af4dd @bananastalktome bananastalktome committed Jan 6, 2011
Showing with 16 additions and 0 deletions.
  1. +2 −0 lib/uea-stemmer.rb
  2. +14 −0 test/uea_stemmer_test.rb
View
2 lib/uea-stemmer.rb
@@ -326,6 +326,8 @@ def create_rules
@rules << EndingRule.new('oded', 1, 61.1)
@rules << EndingRule.new('ated', 1, 61)
@rules << CustomRule.new(/.*\w\weds?$/, 2, 62)
+ @rules << EndingRule.new('des', 1, 63.10) # Fix for words like grades, escapades, abodes
+ @rules << EndingRule.new('res', 1, 63.9) # Fix for words like fires, acres, wires, cares
@rules << EndingRule.new('pes', 1, 63.8)
@rules << EndingRule.new('mes', 1, 63.7)
@rules << EndingRule.new('ones', 1, 63.6)
View
14 test/uea_stemmer_test.rb
@@ -65,6 +65,20 @@ class UeaStemmerTest < Test::Unit::TestCase
assert_equal @stemmer.stem('smokes'), 'smoke'
assert_equal @stemmer.stem('does'), 'do'
end
+
+ should "stem various words with -des suffix" do
+ assert_equal @stemmer.stem('abodes'), 'abode'
+ assert_equal @stemmer.stem('escapades'), 'escapade'
+ assert_equal @stemmer.stem('crusades'), 'crusade'
+ assert_equal @stemmer.stem('grades'), 'grade'
+ end
+
+ should "stem various words with -res suffix" do
+ assert_equal @stemmer.stem('wires'), 'wire'
+ assert_equal @stemmer.stem('acres'), 'acre'
+ assert_equal @stemmer.stem('fires'), 'fire'
+ assert_equal @stemmer.stem('cares'), 'care'
+ end
should "stem acronyms when pluralized otherwise they should be left alone" do
assert_equal @stemmer.stem('USA'), 'USA'

0 comments on commit e8cb67d

Please sign in to comment.
Something went wrong with that request. Please try again.