在我的脑海中,您可以使用soundex查找音节。这就是我要探索的方向,基于一个可发音的单词至少有一个音节的假设。
编辑:这是一个计算音节的函数:
function count_syllables($word) {
$subsyl = Array(
'cial'
,'tia'
,'cius'
,'cious'
,'giu'
,'ion'
,'iou'
,'sia$'
,'.ely$'
);
$addsyl = Array(
'ia'
,'riet'
,'dien'
,'iu'
,'io'
,'ii'
,'[aeiouym]bl$'
,'[aeiou]{3}'
,'^mc'
,'ism$'
,'([^aeiouy])\1l$'
,'[^l]lien'
,'^coa[dglx].'
,'[^gq]ua[^auieo]'
,'dnt$'
);
// Based on Greg Fast's Perl module Lingua::EN::Syllables
$word = preg_replace('/[^a-z]/is', '', strtolower($word));
$word_parts = preg_split('/[^aeiouy]+/', $word);
foreach ($word_parts as $key => $value) {
if ($value <> '') {
$valid_word_parts[] = $value;
}
}
$syllables = 0;
// Thanks to Joe Kovar for correcting a bug in the following lines
foreach ($subsyl as $syl) {
$syllables -= preg_match('~'.$syl.'~', $word);
}
foreach ($addsyl as $syl) {
$syllables += preg_match('~'.$syl.'~', $word);
}
if (strlen($word) == 1) {
$syllables++;
}
$syllables += count($valid_word_parts);
$syllables = ($syllables == 0) ? 1 : $syllables;
return $syllables;
}
从这个非常有趣的链接:
http://www.addedbytes.com/php/flesch-kincaid-function/