Count Syllables

Estimate the number of syllables in an English word.

Code

General
w=$(echo "$word" | tr '[:upper:]' '[:lower:]' | sed -E 's/([^laeiouy]es|ed|[^laeiouy]e)$//')
count=$(echo "$w" | grep -oE '[aeiouy]{1,2}' | wc -l)
echo $((count > 0 ? count : 1))

Parameters

Word to count syllables in

Server

More Bash Snippets