Original Post
I'm using a Levenshtein Distance in C# algorthm to do a fuzzy matching of a game name from a list of games.
public string GetClosestMatch(string str)
{
string strMatch = str;
int minDistance = Int32.MaxValue;
if (String.IsNullOrEmpty(str))
return strMatch;
for (int i = 0; i < GameArray.Length; i++)
{
string fileName = GameArray;
int strDistance = LevenshteinDistance.Compute(str, fileName);
if (strDistance < minDistance)
{
minDistance = strDistance;
strMatch = fileName;
}
}
return strMatch;
} The problem is, this algorithm while it does work in most cases, there are cases where this algorithm doesn't work so well. For example, consider a game "APB" I want to match it from a list of games. But it is returning "Qix" as a match instead of "APB - All Points Bulletin". Is there a more efficient algorithm for my needs, or any suggestions on how to change the current algorithm to be more suited to my needs.