Text::TransMetaphone - Translingual phonetic encoding of words.
use Text::TransMetaphone qw( trans_metaphone reverse_key );
my @keys = trans_metaphone ( "Waldo" ); # convert to IPA symbols
print reverse_key ( $key, "chr" ); # print in Cherokee
This module implements a "sounds like" algorithm developed by Lawrence Philips which he published in the June, 2000 issue of C/C++ Users Journal. Trans-Metaphone is a variation of Philips' original Metaphone algorithm.
The TransMetaphone package implements an "N-Metaphone" algorithm for supportedlanguages where keys are generated in IPA symbols. There are no restrictions on the number of encoded keys that may be returned. The number of encoded keys returned is left to the descression of implementer and what s/he finds practical for the writing system of concern.
IPA encoding is applied to normalize language and script boundaries. IPA encoded words can then be readily compared between different languages and writing systems. Applied to text retrieval, you can can generate a key in one language and then search for it any other supported language.
For additional details, see the
doc/index.html file provided with this package and the demonstration scripts found under the
- trans_metaphone ( STRING [, ISO639_LANGUAGE_CODE] )
Takes a word and returns a phonetic encoding with IPA symbols. Optionally, an ISO-639 language code can be set to specify the locale applicable to the passed string. When not passed, the locale will be guessed based on the character range of the string.
In an array context, the function returns all logical phonetic encodings for the word. The first encoding in the array will be the most literal, later encodings will be the less probable, the final encoding will be a regular expression suitable for matching all returned encodings.
In a scalar context, the function returns only the first encoding.
- reverse_key ( IPA-STRING, ISO639_LANGUAGE_CODE )
The reverse_key function takes an IPA encoded string (such as one returnedd by the trans_metaphone function) and returns a regular expression to match the sequence under the orthography conventions of the locale specified.
This function is experimental, it offers an aid for transliterating a normalized IPA sequence into a supported writing convention. It may also be helpful for debugging.
View the documentation of individual locale modules for limitations.
Daniel Yacob, firstname.lastname@example.org
This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
Philips, Lawrence. C/C++ Users Journal, June, 2000. http://www.cuj.com/articles/2000/0006/0006d/0006d.htm?topic=articles
Philips, Lawrence. Computer Language, Vol. 7, No. 12 (December), 1990.
Text::DoubleMetaphone by Maurice Aubrey <email@example.com>.
Kevin Atkinson (author of the Aspell spell checker) maintains a page dedicated to the Metaphone and Double Metaphone algorithms at <http://aspell.sourceforge.net/metaphone/>