Metaphone is a phonetic algorithm, an algorithm published in 1990 for indexing words by their English pronunciation. The algorithm produces variable length keys as its output, as opposed to Soundex's fixed-length keys. Similar sounding words share the same keys.

metaphone(str) → returns string

This function requires Lucee.  Not supported on Adobe ColdFusion, etc.

Argument Reference

str string

Links more information about metaphone

Sample code invoking the metaphone function

This compound word is the longest word published with 79 letters according to the 1996 Guinness Book of World Records


Expected Result: TNTM


Expected Result: TRK/TRK

Adding a word changes the whole metaphone

Metaphone("Trek")&"/"&Metaphone("Star Trek")

Expected Result: TRK/STRT

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub