6

I want to filter out duplicate customer names from a database. A single customer may have more than one entry to the system with the same name but with little difference in spelling. So here is an example: A customer named Brook may have three entries to the system with this variations:

  1. Brook Berta
  2. Bruck Berta
  3. Biruk Berta

Let's assume we are putting this name in one database column. I would like to know the different mechanisms to identify such duplications form say a 100,000 records. We may use regular expressions in C# to iterate through all records or some other pattern matching technique or we may export these records to what ever best fits for such queries (SQL with Regular Expression capabilities)).

This is what I thought as a solution

  • Write a C# code to iterate through each record
  • Get only the Consonant letters in order (in the above case: BrKBrt)
  • Search for the same Consonant pattern from the other records considering similar sounding letters like (C,K) (C,S), (F, PH)

So please forward any ideas.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Elias Haileselassie
  • 1,385
  • 1
  • 18
  • 26
  • Are you sure this is safe? What about names like Andrei/Andreea (Romanian male/female names): would they be considered the same and if so, if you had brothers/spouses with the same last name you'd exclude one? – Rox Jun 22 '10 at 08:01

8 Answers8

8

The Double Metaphone algorithm, published in 2000, is a new and improved version of the Soundex algorithm that was patented in 1918.

The article has links to Double Metaphone implementations in many languages.

Ray Burns
  • 62,163
  • 12
  • 140
  • 141
2

The obvious, established (and well documented) algorithms for finding string similarity are:

mkj
  • 2,761
  • 5
  • 24
  • 28
symcbean
  • 47,736
  • 6
  • 59
  • 94
2

Have a look at Soundex

There is a Soundex function in Transact-SQL (see http://msdn.microsoft.com/en-us/library/ms187384.aspx):

SELECT 
SOUNDEX('brook berta'),
SOUNDEX('Bruck Berta'),
SOUNDEX('Biruk Berta')

returns the same value B620 for each of the example values

Mario Menger
  • 5,862
  • 2
  • 28
  • 31
1

I would consider writing something such as the "famous" python spell checker.

http://norvig.com/spell-correct.html

This will take a word and find all possible alternatives based on missing letters, adding letters, swapping letters, etc.

Robin Day
  • 100,552
  • 23
  • 116
  • 167
1

You might want to google for phonetic similarity algorithm and you'll find plenty of information about this. Including this article on Codeproject about implementing a solution in C#.

Hans Olsson
  • 54,199
  • 15
  • 94
  • 116
1

Look into soundex. It's a pretty standard library in most languages that does what you require, i.e. algorithmically identify phonetic similarity. http://en.wikipedia.org/wiki/Soundex

Leo
  • 6,553
  • 2
  • 29
  • 48
1

There is a very nice R (just search for "R" in Google) package for Record Linkage. The standard examples target exactly your problem: R RecordLinkage

The C-Code for Soundex etc. is taken directly from PostgreSQL!

FloE
  • 1,166
  • 1
  • 10
  • 19
0

I would recommend Soundex and derived algorithms over Lev distance for this solution. Levenstein distance more appropriate for spell checking solutions imho.

James Westgate
  • 11,306
  • 8
  • 61
  • 68