我需要实现某种形式:
string textToSearch = "Extreme Golf: The Showdown";
string textToSearchFor = "Golf Extreme Showdown";
int fuzzyMatchScoreThreshold = 80; // One a 0 to 100 scale
bool searchSuccessful = IsFuzzyMatch(textToSearch, textToSearchFor, fuzzyMatchScoreThreshold);
if (searchSuccessful == true)
{
-- we have a match.
}
Run Code Online (Sandbox Code Playgroud)
这是用C#编写的函数存根:
public bool IsFuzzyMatch (string textToSearch, string textToSearchFor, int fuzzyMatchScoreThreshold)
{
bool isMatch = false;
// do fuzzy logic here and set isMatch to true if successful match.
return isMatch;
}
Run Code Online (Sandbox Code Playgroud)
但我不知道如何在IsFuzzyMatch方法中实现逻辑.有任何想法吗?也许为此目的有一个现成的解决方案?