Step 4 strips -ant, -ent etc. suffixes. This only happens if there is more than one vowel-consonant pair before the suffix.
(w)
| 217 | (("m","i","s"), ("ism", "iti", "ous")) |
| 218 | ] |
| 219 | def step_4(w): |
| 220 | """ Step 4 strips -ant, -ent etc. suffixes. |
| 221 | This only happens if there is more than one vowel-consonant pair before the suffix. |
| 222 | """ |
| 223 | for suffix, rules in suffixes4: |
| 224 | if w.endswith(suffix): |
| 225 | for A in rules: |
| 226 | if w.endswith(A): |
| 227 | return R2(w).endswith(A) and w[:-len(A)] or w |
| 228 | if R2(w).endswith("ion") and w[:-3].endswith(("s", "t")): |
| 229 | # Delete -ion if preceded by s or t. |
| 230 | return w[:-3] |
| 231 | return w |
| 232 | |
| 233 | def step_5a(w): |
| 234 | """ Step 5a strips suffix -e if preceded by multiple vowel-consonant pairs, |