Skip to content

Instantly share code, notes, and snippets.

@Sirsirious
Created February 10, 2020 18:03
Show Gist options
  • Select an option

  • Save Sirsirious/593f34974946f89b2585e47aaec09934 to your computer and use it in GitHub Desktop.

Select an option

Save Sirsirious/593f34974946f89b2585e47aaec09934 to your computer and use it in GitHub Desktop.
Step 3 of porter Stemmer.
def _porter_step_3(self, stem):
pair_tests = [('icate','ic'),('ative',''),('alize','al'),('iciti','ic'),('ical','ic'),('ful',''),('ness','')]
if self._det_m(stem) > 0:
for term, subs in pair_tests:
if stem.endswith(term):
return stem[:-len(term)]+subs
return stem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment