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

Function step_2

pattern/vector/stemmer.py:178–190  ·  view source on GitHub ↗

Step 2 replaces double suffixes (singularization => singularize). This only happens if there is at least one vowel-consonant pair before the suffix.

(w)

Source from the content-addressed store, hash-verified

176 ("gi", (("logi", "log"),))
177]
178def step_2(w):
179 """ Step 2 replaces double suffixes (singularization => singularize).
180 This only happens if there is at least one vowel-consonant pair before the suffix.
181 """
182 for suffix, rules in suffixes2:
183 if w.endswith(suffix):
184 for A,B in rules:
185 if w.endswith(A):
186 return R1(w).endswith(A) and w[:-len(A)] + B or w
187 if w.endswith("li") and R1(w)[-3:-2] in VALID_LI:
188 # Delete -li if preceded by a valid li-ending.
189 return w[:-2]
190 return w
191
192suffixes3 = [
193 ("e", (("icate", "ic"), ("ative", ""), ("alize", "al"))),

Callers

nothing calls this directly

Calls 2

R1Function · 0.85
lenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…