metaphoneDescriptionmetaphone() is used to generate a metaphone key for a string. Metaphone keys are strings that represent approximately how a string of characters would sound when pronounced using English-language pronunciation rules. Metaphone keys are extremely useful for text search-and-match applications.
NoteMetaphone was developed by Lawrence Philips <lphilips@verity.com>. More information can be found at http://aspell.sourceforge.net/metaphone/nd in "Practical Algorithms for Programmers" (Binstock & Rex, Addison Wesley, 1995). ExampleExample 1208. Compare words by their metaphone keys <?php $words = array('shoos', 'shoes', 'chute', 'schuss'); foreach($words as $word_one) { $key_one = metaphone($word_one); echo "\n'$word_one' (Metaphone key: '$key_one') and ...\n"; foreach($words as $word_two) { $key_two = metaphone($word_two); echo "\t '$word_two' (Metaphone key: '$key_two') sound ", $key_one == $key_two ? 'alike' : 'different', "\n"; } } ?> Output: 'shoos' (Metaphone key: 'XS') and ... 'shoos' (Metaphone key: 'XS') sound alike 'shoes' (Metaphone key: 'XS') sound alike 'chute' (Metaphone key: 'XT') sound different 'schuss' (Metaphone key: 'SXS') sound different 'shoes' (Metaphone key: 'XS') and ... 'shoos' (Metaphone key: 'XS') sound alike 'shoes' (Metaphone key: 'XS') sound alike 'chute' (Metaphone key: 'XT') sound different 'schuss' (Metaphone key: 'SXS') sound different 'chute' (Metaphone key: 'XT') and ... 'shoos' (Metaphone key: 'XS') sound different 'shoes' (Metaphone key: 'XS') sound different 'chute' (Metaphone key: 'XT') sound alike 'schuss' (Metaphone key: 'SXS') sound different 'schuss' (Metaphone key: 'SXS') and ... 'shoos' (Metaphone key: 'XS') sound different 'shoes' (Metaphone key: 'XS') sound different 'chute' (Metaphone key: 'XT') sound different 'schuss' (Metaphone key: 'SXS') sound alike
PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing
(Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch).
This material may be distributed only subject to the terms and conditions set forth
in the Open Publication License, v1.0 or later (the latest version is presently available at
http://www.opencontent.org/openpub/).
The authors of this book have elected not to choose any options under the OPL. This online book was obtained
from http://www.fooassociates.com/phpfer/
and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4
for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All
persons and entities shall have neither liability nor responsibility to any person or entity with respect to
any loss or damage arising from the information contained in this book.
|