

def upper_consonant_y(w):
    ' Sets the initial y, or y after a vowel, to Y.\n        Of course, y is interpreted as a vowel and Y as a consonant.\n    '
    a = []
    p = None
    for ch in w:
        if ((ch == 'y') and ((p is None) or (p in VOWELS))):
            a.append('Y')
        else:
            a.append(ch)
        p = ch
    return ''.join(a)

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