Commits

Matt Chaput committed 5c242aa

Don't try to deal with -y ending if the word is just "y". Fixes issue #2.

Comments (0)

Files changed (2)

 
 setup(
     name = "stemming",
-    version = "1.0",
+    version = "1.0.1",
     #package_dir = {'': ''},
     packages = ["stemming"],
     

stemming/porter2.py

     return word
  
 def step_1c(word):
-    if word.endswith('y') or word.endswith('Y'):
+    if word.endswith('y') or word.endswith('Y') and len(word) > 1:
         if word[-2] not in 'aeiouy':
             if len(word) > 2:
                 return word[:-1] + 'i'
 
     return word
 
+if __name__ == "__main__":
+    assert stem("bill's") == "bill"
+    assert stem("y's") == "y"
+