- MFH: Fixed bug #48709 (metaphone and 'wh')

This commit is contained in:
Felipe Pena 2009-06-30 11:46:20 +00:00
parent 51f8b64752
commit 0e294f2121
2 changed files with 34 additions and 4 deletions

View File

@ -225,15 +225,14 @@ static int metaphone(unsigned char *word, int word_len, long max_phonemes, char
w_idx += 2;
}
break;
/* WH becomes H,
/* WH becomes W,
WR becomes R
W if followed by a vowel */
case 'W':
if (Next_Letter == 'H' ||
Next_Letter == 'R') {
if (Next_Letter == 'R') {
Phonize(Next_Letter);
w_idx += 2;
} else if (isvowel(Next_Letter)) {
} else if (Next_Letter == 'H' || isvowel(Next_Letter)) {
Phonize('W');
w_idx += 2;
}

View File

@ -0,0 +1,31 @@
--TEST--
Bug #48709 (metaphone and 'wh')
--FILE--
<?php
/* Initial letter exceptions */
$exceptions = array(
'kn', // Drop first letter
'gn', // ditto
'pn', // ditto
'ae', // ditto
'wr', // ditto
'x', // s
'wh', // w
'wa' // w
);
foreach ($exceptions as $letter) {
printf("%s => %s\n", $letter, metaphone($letter));
}
?>
--EXPECT--
kn => N
gn => N
pn => N
ae => E
wr => R
x => S
wh => W
wa => W