fuzzy match

  • Thread starter Thread starter michael.f.morrison
  • Start date Start date
M

michael.f.morrison

Hi all,

Does anyone now if there is a way to do a fuzzy string compare in c#?
For example, comparing 'cat' to 'cats' would return something like a
90% match ratio. I was told that this type of fuctionality exists in
Perl but I can't find anything about it in c#.

Thanks
Mike
 
use a regular expression

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
Hi all,

Does anyone now if there is a way to do a fuzzy string compare in c#? For
example, comparing 'cat' to 'cats' would return something like a 90% match
ratio. I was told that this type of fuctionality exists in Perl but I
can't find anything about it in c#.

Thanks
Mike

Don't waste your time investigating regular expressions as suggested; a
regexp either matches or does not match, there is no fuzziness about it.
Regexps *may* help you in implementing a fuzzy matching algorithm in some
small way.

I'd suggest that you may want to investigate ways to implement the
Levenshtein distance if you are comparing multiple terms. The following
link has a nice explanation and source code in VB, Java and C

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

and here's the c# version for the truly lazy :)

http://www.merriampark.com/ldcsharp.htm
 
seani said:
Don't waste your time investigating regular expressions as suggested; a
regexp either matches or does not match, there is no fuzziness about it.
Regexps *may* help you in implementing a fuzzy matching algorithm in some
small way.

I'd suggest that you may want to investigate ways to implement the
Levenshtein distance if you are comparing multiple terms. The following
link has a nice explanation and source code in VB, Java and C

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

and here's the c# version for the truly lazy :)

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


Thanks
-Mike
 
Back
Top