Last active
May 14, 2021 21:00
-
-
Save SethVandebrooke/8a7a3b36b2f25ad1e8fc83b92b1aae3d to your computer and use it in GitHub Desktop.
Get the number of syllables in a word or sentence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSyllables(word) { | |
return word.replace(/e$/,'').match(/tion|sion|[aeiou]{3,}|[aeou]+|[aeiou]/g).length; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment