I am working on a search where user would search names. Spelling mistakes are bound to happen. I have used edit distance, soundex and metaphone implementations in java so far. Each one separately and then different combinations too. Finally, a combination of soundex and metaphone seemed to work. There are more than 30 thousand names that would be searched for the match when ever a user enters a name. The search is sequential and would stop when ever a match is found. Now the problem is. Lets say in fol figure:-   User Input Name = Peeter---------------------------------------------------- Serial       Name----------------------------------------------------   1           Tom   2           Petay (Near match say 70%)   3           Jack   4           Peteh (Near Match say 75%)   5           Peter (The closest Match say 100%)----------------------------------------------------The closest match for Peeter is Peter and near match is Petay, Peteh etc. The search would stop at Petay, returning Petay as the name which would be least expected by the user. So for me, 2 solutions comes to mind.Search all 30 thousand names every time, get a list of all matches and ask user to choose the best matchSecondly, present 3 or say 5 top matching (by top matching i mean the closest match, let say more than 90% similar sounding) names to user.I already have implemented option 1 but it returns some times more than 100 matches! it would not be possible for the user to go through all of them. So is there any way to implement option 2 mentioned above? i.e to find out to what degree soundex or metaphone match is made to a name.Thanks in advance.
Finding Degree of match with Soundex or Metaphone
search algorithms