Counting syllables - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Counting syllables

stevetomorrowstevetomorrow Posts: 58Member
How would i go about writing a script that counts syllables?

Comments

  • hicohico Posts: 3Member
    : How would i go about writing a script that counts syllables?
    :

    Ehh, what's "syllables"?
  • stevetomorrowstevetomorrow Posts: 58Member
    : : 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.
  • cmario00cmario00 Posts: 12Member
    A recursive function of mine, may have errors

    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 ;
    }
Sign In or Register to comment.