MCPcopy Index your code
hub / github.com/clips/pattern / step_4

Function step_4

pattern/vector/stemmer.py:219–231  ·  view source on GitHub ↗

Step 4 strips -ant, -ent etc. suffixes. This only happens if there is more than one vowel-consonant pair before the suffix.

(w)

Source from the content-addressed store, hash-verified

217 (("m","i","s"), ("ism", "iti", "ous"))
218]
219def 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
233def step_5a(w):
234 """ Step 5a strips suffix -e if preceded by multiple vowel-consonant pairs,

Callers

nothing calls this directly

Calls 2

R2Function · 0.85
lenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…