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

Home Posts Topics Members FAQ

String matching algorythm

3 New Member
Hello,

I'm writting a program in C++.
One part of my program is to compare two strings and as a result I have to have a number (range:0-1) which represents a similarity between those two strings.

I don't need a solution in C++, I just need a hint which algorythm to use to implement this concept.
I searched Web, but there is a million of algorythms and I don't know which to use.

Thanx for any help!!!
Aug 9 '07 #1
5 2413
JosAH
11,448 Recognized Expert MVP
Hello,

I'm writting a program in C++.
One part of my program is to compare two strings and as a result I have to have a number (range:0-1) which represents a similarity between those two strings.

I don't need a solution in C++, I just need a hint which algorythm to use to implement this concept.
I searched Web, but there is a million of algorythms and I don't know which to use.

Thanx for any help!!!
Google for "gestalt matching". This algorithm is constructed around the LCS
algorithm (Largest Common Substring). It's a fun algorithm to implement.

kind regards,

Jos
Aug 9 '07 #2
plisho
3 New Member
Hello,

I'm writting a program in C++.
One part of my program is to compare two strings and as a result I have to have a number (range:0-1) which represents a similarity between those two strings.

I don't need a solution in C++, I just need a hint which algorythm to use to implement this concept.
I searched Web, but there is a million of algorythms and I don't know which to use.

Thanx for any help!!!
If someone has a C++ solution, I wouldn't mind :P
Aug 9 '07 #3
JosAH
11,448 Recognized Expert MVP
If someone has a C++ solution, I wouldn't mind :P
If you had read the posting guidelines (top right 'Help' link) you would've known
that we don't spoonfeed complete boilerplate code here. We're very willing to
help you when you get stuck trying to implement it *yourself*.

kind regards,

Jos
Aug 9 '07 #4
plisho
3 New Member
Google for "gestalt matching". This algorithm is constructed around the LCS
algorithm (Largest Common Substring). It's a fun algorithm to implement.

kind regards,

Jos

That's great start.
But gestalt matching matches the patterns. I need a simple string matcher that compares common prefixes and suffixes of literals.

For example, I compared 'Birthdate' (column name from first table) and 'Date' (column name from second table) and gestalt matching gave 100% similarity.
But obviously these two literals does not represent same thing. It should be about 66%.

Do you know something suitable for this concept?
Aug 9 '07 #5
JosAH
11,448 Recognized Expert MVP
That's great start.
But gestalt matching matches the patterns. I need a simple string matcher that compares common prefixes and suffixes of literals.
We're talking different gestalt matchers then: for two words X and Y it tries to
find a longest substring S such that X = LxSRx and Y = LySRy. the number
2*|S|/(|X|+|Y|) where |Z| denotes the length of a string Z is a measure for how
'identical' the two strings are. Pure gestalt matching uses a recursive application
where Lx, Ly and Rx, Ry are taken in consideration as well and the measure
of being 'identical' is added to the total.

Two unequal strings never give a 100% gestalt match.

kind regards,

Jos
Aug 9 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1776
by: Federico Babelis | last post by:
Hi: Any could help my find how to create the code for the following algorythm: In1: 10000000 In2: 00000000000 the algorythm runs and this is the output: 01A6DC6B07262F69
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.
1
383
by: Earl Teigrob | last post by:
Does someone have or know of an algorythm (method) that will delete all files under a give directory and its subdirectories based on a wildcard mask? I can use this for one directory for each file in Directory.GetFiles("pic1.*") file.Delete() but will need to use a recursive algorythm to get all its subdirectories
15
2291
by: Beeeeeves | last post by:
Is there a quick way to find the index of the first character different in two strings? For instance, if I had the strings "abcdefghijkl" and "abcdefxyz" I would want the return value to be 6. Either in C# or C++. (I obviously know how to do it by looping through the
0
1676
by: Andrés Giraldo | last post by:
Hi! I'm trying to use a System.Security.Criptography function, it works on my machine but when I publish the site, it gives me the following error: Can't find a cryptographic service provider (CSP) in this algorythm... Any Idea of what's wrong??? Thanks
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($)
28
5312
by: Andre | last post by:
Hi, Does anyone know whether the ECMA, or an other standard document, specifies a maximum for the value that can be pass to the setTimeOut() function in Javascript? Andre
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
0
9672
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
9519
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
10439
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...
1
10165
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
9043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6783
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
5437
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?
1
4113
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

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.