I want to count the number of syllables in a word, by counting the number of vowels in that word, and not counting the last "e" in the words that end with "ed" and "es".
I ran the following code, but I'm not able to handle that exception:
import re
vowelRegex = re.compile(r'[aeiouAEIOU^ed$|^es$]')
vowelRegex.findall('RoboCoped eatsed babyes food. BABY FOOD.')
This is the output i got:
['o',
'o',
'o',
'e',
'd',
'e',
'a',
's',
'e',
'd',
'a',
'e',
's',
'o',
'o',
'd',
'A',
'O',
'O']