问题描述
尝试计算 Flesch-Kincaid 年级水平。这里的划分有什么问题?
$flesh_grade = 0.39 * ($total_words/$total_sentences) + ($total_syllables/$total_words);
解决方法
CPAN has a very diverse 可用的模块景观,我们也可以在那里找到这个计算:
- 在
Text::Info
module 中,我们找到了一种方法,但如果 sanity checks 会通过,此代码会运行:
my $score = ( ($words_per_sentence * 0.39) + ($syllables_per_word * 11.8) ) - 15.59;
- 在
Lingua::En::Fathom
module 中,我们发现以下内容:
$text->{kincaid} = (11.8 * $text->{syllables_per_word}) +
(0.39 * $text->{words_per_sentence}) - 15.59;