Skip to content
DeepForgeby svx
All problems
HardNLPnlp-395

Porter Step One A Plural Stripping

Problem

Porter step 1a strips plurals: replace a trailing "sses" with "ss", a trailing "ies" with "i", keep a trailing "ss", and otherwise drop a trailing "s".

Given a word, return the stemmed result.

Hint

Check the longest suffixes first.

Test cases

case 1
in: ["caresses"]
expected: "caress"
case 2
in: ["ponies"]
expected: "poni"
case 3
in: ["gas"]
expected: "ga"
Starter codePython
def porter_step_one_a_plural_stripping(word):
    # Your code here
    pass

3 test cases · run your code against them in the editor