

def step_2(w):
    ' Step 2 replaces double suffixes (singularization => singularize).\n        This only happens if there is at least one vowel-consonant pair before the suffix.\n    '
    for (suffix, rules) in suffixes2:
        if rules.endswith(suffix):
            for (A, B) in rules:
                if w.endswith(A):
                    return ((R1(w).endswith(A) and (w[:(- len(A))] + B)) or w)
    if (w.endswith('li') and (R1(w)[(- 3):(- 2)] in VALID_LI)):
        return w[:(- 2)]
    return w

dataset/ETHPy150Open clips/pattern/pattern/vector/stemmer.py step_2/VarMisuse@24/89 `w`->`rules`