473,795 Members | 3,231 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

String matching (Inteligent)

Hey

I need a string comparison algorithm which can comapre 2 strings and come
with a number, eg %, which indicates how much the string a alike.

I could of course just comapre the number of occurences of each letter, but
then aab woudl be equal aba. This is not good enough. So the algorithm also
has to compare closeness og letters etc.

I hope i can find a "finished" or skeleton algorithm since i am convicnced
that other, which have the time, could implement this much better than me.

Optimally i want something like this:
double closeness = SuperComparere( "My string", "My strong"); // returns eg.
93%

Anyone heard about above and know sources for solutions?

Kindly Regards
Anders
Sep 26 '06 #1
4 2001
<"anderskj1" <none>wrote:
I need a string comparison algorithm which can comapre 2 strings and come
with a number, eg %, which indicates how much the string a alike.

I could of course just comapre the number of occurences of each letter, but
then aab woudl be equal aba. This is not good enough. So the algorithm also
has to compare closeness og letters etc.

I hope i can find a "finished" or skeleton algorithm since i am convicnced
that other, which have the time, could implement this much better than me.

Optimally i want something like this:
double closeness = SuperComparere( "My string", "My strong"); // returns eg.
93%

Anyone heard about above and know sources for solutions?
I haven't done anything similar myself, but
http://en.wikipedia.org/wiki/Fuzzy_string_searching
might be useful to you.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Sep 26 '06 #2
I need a string comparison algorithm which can comapre 2 strings and come
with a number, eg %, which indicates how much the string a alike.
What you are referring to is a rather difficult topic. I think (but am
not sure) that many SQL dbms systems provide something alike, but they
need to index the searchable data every once in a while. (PS: found it
at wikipedia,
http://en.wikipedia.org/wiki/SQL_Ser...l_Text_Search).

Anyways, the only thing I can really contribute to this thread is that
I think you should search for some code (.NET or 3rd party) that does
this, as it's a difficult task. Perhaps the Regex libraries provide
some help.

Good luck. Let us know what you chose to do.

Sep 26 '06 #3
This is a common operation when working with DNA/protein sequences.

There are many free tools/algorithms you should be able to steal
inspiration from.

One starting point could be:
http://en.wikipedia.org/wiki/Sequence_alignment

/Per

Sep 26 '06 #4
Hi

Take a look on Google for Levenstein (think that's spelt correctly)
Distance Calculation - from memory it sounds remarkably close to what
you're after

Cheers
Martin
pe*****@gmail.c om wrote:
This is a common operation when working with DNA/protein sequences.

There are many free tools/algorithms you should be able to steal
inspiration from.

One starting point could be:
http://en.wikipedia.org/wiki/Sequence_alignment

/Per
Sep 26 '06 #5

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

Similar topics

9
3218
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # Matching string patterns # # Sometimes you want to know if a string is of # particular pattern. Let's say in your website # you have converted all images files from gif # format to png format. Now you need to change the # html code to use the .png files. So, essentially
19
78845
by: Paul | last post by:
hi, there, for example, char *mystr="##this is##a examp#le"; I want to replace all the "##" in mystr with "****". How can I do this? I checked all the string functions in C, but did not find one.
10
9567
by: javuchi | last post by:
I'm searching for a library which makes aproximative string matching, for example, searching in a dictionary the word "motorcycle", but returns similar strings like "motorcicle". Is there such a library?
5
5760
by: olaufr | last post by:
Hi, I'd need to perform simple pattern matching within a string using a list of possible patterns. For example, I want to know if the substring starting at position n matches any of the string I have a list, as below: sentence = "the color is $red" patterns = pos = sentence.find($)
4
1477
by: anderskj1 | last post by:
Hey I need a string comparison algorithm which can comapre 2 strings and come with a number, eg %, which indicates how much the string a alike. I could of course just comapre the number of occurences of each letter, but then aab woudl be equal aba. This is not good enough. So the algorithm also has to compare closeness og letters etc. I hope i can find a "finished" or skeleton algorithm since i am convicnced
9
2683
by: | last post by:
I am interested in scanning web pages for content of interest, and then auto-classifying that content. I have tables of metadata that I can use for the classification, e.g. : "John P. Jones" "Jane T. Smith" "Fred Barzowsky" "Department of Oncology" "Office of Student Affairs" "Lewis Hall" etc. etc. etc. I am wondering what the efficient way to do this in code might be. The dumb and brute-force way would be to loop through the content...
0
10603
NeoPa
by: NeoPa | last post by:
ANSI-89 v ANSI-92 Before we get into all the various types of pattern matching that can be used, there are two ANSI standards used for the main types of wildcard matching (matching zero or more characters or simply matching a single character) : ANSI-89 - Mainly used only by Jet / ACE SQL ANSI-92 - Mainly used by SQL Server and other grown-up products In the later versions of Access it is now possible to select ANSI-92 compatibility as an...
11
4846
by: tech | last post by:
Hi, I need a function to specify a match pattern including using wildcard characters as below to find chars in a std::string. The match pattern can contain the wildcard characters "*" and "?", where "*" matches zero or more consecutive occurrences of any character and "?" matches a single occurrence of any character. Does boost or some other library have this capability? If boost does have this, do i need to include an entire
1
4250
by: Ben | last post by:
I apologize in advance for the newbie question. I'm trying to figure out a way to find all of the occurrences of a regular expression in a string including the overlapping ones. For example, given the string 123456789 I'd like to use the RE ((2)|(4)){3} to get the following matches: 2345 4567
0
10435
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
10213
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...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6779
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
5436
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...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2920
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.