Step 2 replaces double suffixes (singularization => singularize). This only happens if there is at least one vowel-consonant pair before the suffix.
(w)
| 176 | ("gi", (("logi", "log"),)) |
| 177 | ] |
| 178 | def 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 | |
| 192 | suffixes3 = [ |
| 193 | ("e", (("icate", "ic"), ("ative", ""), ("alize", "al"))), |