Beispiel #1
0
function hardwords($text, $wordstotal)
{
    $syllables = 0;
    $words = explode(' ', $text);
    for ($i = 0; $i < count($words); $i++) {
        if (count_syllables($words[$i]) > 2) {
            //echo $words[$i] . "/" . count_syllables($words[$i]) ."<br />";
            $syllables++;
        }
    }
    $score = round($syllables / $wordstotal * 100, 2);
    return array($syllables, $score);
}
Beispiel #2
0
function percentage_number_words_three_syllables($text)
{
    $syllables = 0;
    $words = explode(' ', $text);
    for ($i = 0; $i < count($words); $i++) {
        if (count_syllables($words[$i]) > 2) {
            $syllables++;
        }
    }
    $score = number_format($syllables / count($words) * 100);
    return $score;
}