Perform a SoundEx String Comparison

Problem

You want to compare two strings based on their sound.

Solution

Implement a text-matching algorithm such as SoundEx.

Discussion

The SoundEx algorithm is one of the best-known algorithms for "fuzzy" text matching. It’s designed to convert a word into a code based on one possible phonetic representation. Similar sounding words map to the same codes, enabling you to identify which words sound the same.

There are several SoundEx variants, all of which provide slightly different implementations of the same core rules:

  • Simplified. The original SoundEx from late 1800s.

  • Miracode. The modified SoundEx from 1910.

  • KnuthEd2. The SoundEx algorithm from The Art of Computer Programming, Volume 3: Sorting and Searching, Second ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.