Count Syllables

Estimate the number of syllables in an English word.

Code

General
import re
w = re.sub(r'(?:[^laeiouy]es|ed|[^laeiouy]e)$', '', word.lower())
matches = re.findall(r'[aeiouy]{1,2}', w)
return len(matches) if matches else 1

Parameters

Word to count syllables in

Server

More Python Snippets