473,804 Members | 3,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fuzzy match

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

Nov 17 '05 #1
3 8235
use a regular expression

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

<mi************ ****@colostate. edu> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
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

Nov 17 '05 #2
On Mon, 23 May 2005 15:09:51 -0700, michael.f.morri son wrote:
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
Nov 17 '05 #3

seani wrote:
On Mon, 23 May 2005 15:09:51 -0700, michael.f.morri son wrote:
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

Thanks
-Mike

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
14078
by: Andrew McLean | last post by:
I have a problem that is suspect isn't unusual and I'm looking to see if there is any code available to help. I've Googled without success. Basically, I have two databases containing lists of postal addresses and need to look for matching addresses in the two databases. More precisely, for each address in database A I want to find a single matching address in database B. I'm 90% of the way there, in the sense that I have a simplistic...
4
3765
by: Tim Mackey | last post by:
hi, when a user reaches a 404 page not found on my web site, i want to give them one or more 'best guess' links to the page they are looking for (MS do this on their site...). i have a list of all the available pages to compare the requested url against. i've hunted around on google and newsgroups like alt.comp.fuzzy, but i can't find a nice .NET API that i can just call in my code to give me a closest match. i would define closest...
1
4201
by: Ray Gardener | last post by:
I was wondering if anyone had tried implementing fuzzy logic set concepts in C++, because in FL, the concept of "type" or "class" is fuzzy; things belong (or are of) a given type only by degree. e.g., in a hypothetical fuzzy C++ language one could say: class pickle : public vegetable 0.2 { // pickle is not so much a vegetable as, say, onion is. };
1
3783
by: Evaluating Fuzzy SW | last post by:
Hi All We are using soundex (and later tried Nysiis) for fuzzy name search software. But we faced a lot of problems the search accuracy was not very good also we saw a lot of misses of relevant names. There are many problems other than precision and accuracy, with soundex and NYSIIS.
24
2704
by: BBands | last post by:
I have some CDs and have been archiving them on a PC. I wrote a Python script that spans the archive and returns a list of its contents: ...]. I wanted to add a search function to locate all the versions of a particular song. This is harder than you might think. For example the Cajun "national anthem" is Jolie Blond, but it can be spelled several different ways jolie, joli, blon, blond, etc... In addition the various online services that...
24
14419
by: cassetti | last post by:
Here's the issue: I have roughly 20 MS excel spreadsheets, each row contains a record. These records were hand entered by people in call centers. The problem is, there can and are duplicate phone numbers, and emails and addresses even person names. I need to sift through all this data (roughly 300,000+ records and use fuzzy logic to break it down, so that i have only unique records.
11
8731
by: John Henry | last post by:
I am just wondering what's with get_close_matches() in difflib. What's the magic? How fuzzy do I need to get in order to get a match?
14
13500
by: Steve Bergman | last post by:
I'm looking for a module to do fuzzy comparison of strings. I have 2 item master files which are supposed to be identical, but they have thousands of records where the item numbers don't match in various ways. One might include a '-' or have leading zeros, or have a single character missing, or a zero that is typed as a letter 'O'. That kind of thing. These tables currently reside in a mysql database. I was wondering if there is a...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5515
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.