logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Text::Metaphone - A modern soundex. Phonetic encoding of words.

Author

       Michael G Schwern <schwern@pobox.com>

Caveats

Metaphonealgorithmchanges

       I have made a few minor changes to the traditional metaphone algorithm found in the books.  The most
       significant one is that it will differenciate between SCH and SCHW making the former K (As in School) and
       the latter sh (as in Schwartz and Schwern).

       My changes can be turned off by defining the USE_TRADITIONAL_METAPHONE flag in metaphone.h.

       Due to these changes, any users of Metaphone v1.00 or earlier which have stored metaphonetic encodings,
       they should recalculate those with the new version.

Description

       Metaphone() is a function whereby a string/word is broken down into a rough approximation of its english
       phonetic pronunciation.  Very similar in concept and purpose to soundex, but much more comprehensive in
       its approach.

Functions

Metaphone

           $phoned_word = Metaphone($word, $max_phone_len);

       Takes a word and encodes it according to the Metaphone algorithm.  The algorithm only deals with
       alphabetical characters, all else is ignored.

       If $max_phone_len is provided, Metaphone will only encode up to that many characters for each word.

       'sh' is encoded as 'X', 'th' is encoded as '0'.  This can be changed in the metaphone.h header file.

Name

       Text::Metaphone - A modern soundex.  Phonetic encoding of words.

See Also

Manpages
       Text::Soundex - A simpler word hashing algorithm Text::DoubleMetaphone - Improved metaphone
       Text::Phonetic - A collection of phonetic algorithms

   Books,JournalsandMagazinesBinstock,Andrew&Rex,John."Metaphone:AModernSoundex."PracticalAlgorithmsForProgrammers.Reading,Mass:Addion-Wesley,1995pp160-169

       Contains an explanation of the basic metaphone concept & algorithm and C code from which I learned of
       Metaphone and ported this module.

       Parker,Gary."ABetterPhoneticSearch."CGazette,Vol.5,No.4(June/July),1990.

       This is the public-domain C version of metaphone from which Binstock & Rex based their own..  I haven't
       actually read it.

       Philips,Lawrence.ComputerLanguage,Vol.7,No.12(December),1990.

       And here's the original Metaphone algorithm as presented in Pick BASIC.

Synopsis

         use Text::Metaphone;

         # XWRN
         my $phoned_word = Metaphone('Schwern');

See Also