tags:

views:

595

answers:

4
+7  Q: 

Fuzzy match in C#

Does C# has its own library for Fuzzy match(Fuzzy Search) or a method that can be used directly from .net libraries?

+4  A: 

Not a library, but check out the Levenshtein edit distance algorithm:

http://www.merriampark.com/ldcsharp.htm

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

Paul Sasik
I know Levenshtein edit distance algorithm and I already used it but I'm wondering if .net has one.
Eyla
Not built in. Not as of 3.5 anyway. Though it's fairly trivial to implement as is. Why not just reuse what you already know? Btw. You can add it as an extension method and make it feel like a .Net library function. ;-)
Paul Sasik
+1  A: 

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

David Stratton
Soundex gives pretty awful results compared to Levenshtein.
Hightechrider
Thanks. I've bookmarked this because I want to try the Levenshtein next time I have a need for such logic.
David Stratton
+1  A: 

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

Luhmann
A: 

www.match-logics.com

paul