

def is_short_syllable(w, before=None):
    ' A short syllable in a word is either:\n        - a vowel followed by a non-vowel other than w, x or Y and preceded by a non-vowel\n        - a vowel at the beginning of the word followed by a non-vowel. \n        Checks the three characters before the given index in the word (or entire word if None).\n    '
    if (before != None):
        i = (((before < 0) and (len(w) + before)) or before)
        return is_short_syllable(w[max(0, (i - 3)):i])
    if ((len(w) == 3) and is_consonant(w[0]) and is_vowel(w[1]) and is_consonant(w[2]) and (w[2] not in 'wxY')):
        return True
    if ((len(w) == 2) and is_vowel(w[0]) and is_consonant(w[1])):
        return True
    return False

dataset/ETHPy150Open clips/pattern/pattern/vector/stemmer.py is_short_syllable/original