ljfbot/conjugate.py

14 lines
425 B
Python
Raw Normal View History

def conjugate(verb):
if verb[-2:] == 'ed' and verb[-3] not in {'a', 'e', 'i', 'o', 'u'}:
verb = verb[:-2]
if verb[-1] in {'a', 'i', 'o', 'u'}:
verb = verb + 'es'
elif verb[-1] != 'e' and (verb[-1] in {'s', 'x'} or verb[-2] in {'s', 'x'} or verb[-2:] == 'ch'):
verb = verb + 'es'
elif verb[-1] == 'y' and verb[-2] not in {'a', 'e', 'i', 'o', 'u'}:
verb = verb[:-1] + 'ies'
else:
verb = verb + 's'
return verb