Subject: | "I" and "A" are returned as two syllables. |
This appears to be fixable by removing the following line:
$syl++ if length($word)==1;
As we are splitting off of groups of vowels and taking the size of the array, we start with a value of "0" for consonants, but 1 for vowels. When we increment this value with one character words, we get “1” for consonants, but “2” for vowels.
This action appears to be unnecessary as we are setting the count to 1 on empty below. So if remove this line, we will continue to set the count to “1” for consonants as they are zero at the split. And we will not be double incrementing for vowels.
Side note, I would like to fix this bug and have the change tested. I am opening this bug to track this future submission.