All problems
Rule-Based Verb Lemmatization
Problem
Lemmatize a verb with simple rules. Return irregular[word] when present.
Otherwise, for words longer than 5 ending in 'ing' drop the suffix, and for words longer than 4 ending in 'ed' drop the suffix. If the remaining stem ends in a doubled consonant other than 'l' or 's', drop one copy. Words matching no rule are returned unchanged.
Hint
Undoubling happens only for doubled consonants other than l and s.
Test cases
case 1
in: ["running",{}]
expected: "run"
case 2
in: ["stopped",{}]
expected: "stop"
case 3
in: ["walked",{}]
expected: "walk"
case 4
in: ["went",{"went":"go"}]
expected: "go"
case 5
in: ["called",{}]
expected: "call"
Starter codePython
def rule_based_lemma_verbs(word, irregular):
# Your code here
pass5 test cases · run your code against them in the editor