: : How would i go about writing a script that counts syllables? : : : : Ehh, what's "syllables"? : a syllable breaks up words into sections depending on vowls and such. ie: "hello" has 2 syllables. "bright" is 1 syllable. "banana" has 3 syllables, etc.
function findchar($char,$str,$chararray) { # returns the positions of a char in a string by recursively saving them in an array. # Example: find("t","this is a test to show how it works") would return an array with # 4 items where array[0] = 0, array[1] = 10, and so on .... till array[3] $newpos = strpos($str, $char); if(($newpos != -1) || ($newpos != false)) { $chararray[]=$newpos ; $newlen = strlen($str) - $newpos + 1; return findchar($char, substr($newpos, $newlen), $chararray); } else return $chararray ; }
Comments
:
Ehh, what's "syllables"?
: :
:
: Ehh, what's "syllables"?
:
a syllable breaks up words into sections depending on vowls and such. ie: "hello" has 2 syllables. "bright" is 1 syllable. "banana" has 3 syllables, etc.
function findchar($char,$str,$chararray) {
# returns the positions of a char in a string by recursively saving them in an array.
# Example: find("t","this is a test to show how it works") would return an array with
# 4 items where array[0] = 0, array[1] = 10, and so on .... till array[3]
$newpos = strpos($str, $char);
if(($newpos != -1) || ($newpos != false)) {
$chararray[]=$newpos ;
$newlen = strlen($str) - $newpos + 1;
return findchar($char, substr($newpos, $newlen), $chararray);
} else return $chararray ;
}