Soundex in Java


Soundex is a phonetic algorithm for indexing names by sound, as pronounced in English. The goal is for homophones to be encoded to the same representation so that they can be matched despite minor differences in spelling. The algorithm mainly encodes consonants; a vowel will not be encoded unless it is the first letter. Soundex is the most widely known of all phonetic algorithms (in part because it is a standard feature of popular database software such as PostgreSQL, MySQL, MS SQL Server and Oracle) and is often used (incorrectly) as a synonym for “phonetic algorithm”. Improvements to Soundex are the basis for many modern phonetic algorithms.





import org.apache.commons.codec.language.Soundex;

private String soundex(String var) {
    Soundex soundex = new Soundex();
    return soundex.encode(var);

Add comment

Leave a Reply


Tag Cloud


%d bloggers like this: