ID: 48709
Updated by: [email protected]
Reported By: brettz9 at yahoo dot com
-Status: Open
+Status: Closed
Bug Type: Unknown/Other Function
Operating System: Windows
PHP Version: 6CVS-2009-06-28 (snap)
-Assigned To:
+Assigned To: felipe
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Fixed in 5.2 and HEAD.
5.3 in soon.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2009-06-28 05:29:41] brettz9 at yahoo dot com
Description:
------------
The source for metaphone() states in the comments that "WH becomes H"
and when one tests it, e.g., with "whit", as per the comment on line 227
and the code which phonizes Next_Letter on line 233 when there is a 'W'
followed by 'H', it returns 'H' ("ht" for 'whit').
However, according to the metaphone() algorithm (see
http://aspell.net/metaphone/ and the original implementation at
http://aspell.net/metaphone/metaphone.basic ), 'wh' should become 'w',
not 'h'.
So, to fix it, you could change the comment on 233 to:
/* WH becomes W,
and then change the 'if' on 231-234 to:
if (Next_Letter == 'H') {
Phonize('W');
w_idx += 2;
} else if (Next_Letter == 'R') {
Phonize(Next_Letter);
w_idx += 2;
Reproduce code:
---------------
<?php
echo metaphone('Whit');
?>
Expected result:
----------------
WT
Actual result:
--------------
HT
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48709&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.