Perl 中的简单除法问题

问题描述

尝试计算 Flesch-Kincaid 年级水平。这里的划分有什么问题?

$flesh_grade = 0.39 * ($total_words/$total_sentences) + ($total_syllables/$total_words);

解决方法

CPAN has a very diverse 可用的模块景观,我们也可以在那里找到这个计算:

    my $score = ( ($words_per_sentence * 0.39) + ($syllables_per_word * 11.8) ) - 15.59;
    $text->{kincaid} =  (11.8 * $text->{syllables_per_word}) +
         (0.39 * $text->{words_per_sentence}) - 15.59;