Fuzzy match in C#
Does C# has its own library for Fuzzy match(Fuzzy Search) or a method that can be used directly fr开发者_Python百科om .net libraries?
Not a library, but check out the Levenshtein edit distance algorithm:
http://en.wikipedia.org/wiki/Levenshtein_distance
It's well known and established and excellent for fuzzy matching text. There are many other examples out there besides the link i provided in case it doesn't suit you: Google Search
Current versions don't have it built in.
I have seen and used Soundex (a method for fuzzy matching) operations for this in the past. Here's an article on how to implement Soundex in .Net.
http://www.codeproject.com/KB/aspnet/Soundex.aspx
If its for a kindof "did you mean" function you could have a look at Lorenzo Stoakes C# implementation of Peter Norvig's Spelling Corrector.
If you need more elaborate search features like ranking and such, you could also take at look at Lucene.Net
精彩评论