473,659 Members | 3,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Comparing text strings

I have a monthly safety slogan competition which requires back
checking to a list of already submitted slogans. This takes forerver
to do. I have 2 lists: this month's slogans and a master list of all
slogans.

Here is an example:
S1Master: An unsafe behavior can bring you down
S1Submitted: Unsafe behaviors can bring you down

I am thinking that after removing the plural "s", and then counting
the number of words that are in both sentences, as a percentage of the
total number of words. Percentage greater than 90% say would be listed
as a match.

6 words in 2 sentences the same = 12/13 words = 92.31%
therefore this is a matched pair.

I am trying to keep it simple but have enough accuracy, its not
terrible if a few slip by. Will the above method work and can I
achieve it without VBA. Please guide me.

Thanks
Steve
Nov 13 '05 #1
3 2880
steve wrote:
I have a monthly safety slogan competition which requires back
checking to a list of already submitted slogans. This takes forerver
to do. I have 2 lists: this month's slogans and a master list of all
slogans.

Here is an example:
S1Master: An unsafe behavior can bring you down
S1Submitted: Unsafe behaviors can bring you down

I am thinking that after removing the plural "s", and then counting
the number of words that are in both sentences, as a percentage of the
total number of words. Percentage greater than 90% say would be listed
as a match.

6 words in 2 sentences the same = 12/13 words = 92.31%
therefore this is a matched pair.

I am trying to keep it simple but have enough accuracy, its not
terrible if a few slip by. Will the above method work and can I
achieve it without VBA. Please guide me.

Thanks
Steve


I don't know how you can do it without VBA. Also, do you want the
computer to figure this out for you or do you want to figure it out? To
keep it simple, some human interaction would be better.

For example, the 2 key words I saw in your example was "unsafe
behavior". You could run a query to find all master records that have
"unsafe behavior". Or you could create a query that finds all records
that contain "unsafe" and "behavior". See, here you are getting rid of
plurals. You control the keywords to search on.

Let's say you the master had a key value and the phrase. You have a
form to input 6 up to key words called Form1 with 6 keywords called
Key1..Key6. These Keywords that you type in have a default value of
Null. You could create a query to select the phrase.

Select Phrase, _
IIF(instr([Phrase],IIF(Not
IsNull(Forms!Fo rm1!Key1),Forms !Form1!Key1,chr (0))) > 0,1,0) As Key1Cnt,
IIF(instr([Phrase],IIF(Not
IsNull(Forms!Fo rm1!Key2),Forms !Form1!Key2,chr (0))) > 0,1,0) As Key2Cnt,
....etc.

What this does is it looks for the Key1 word in the phrase if there is a
Key1 value. Same for Key2. Does this for Key1 to Key6. If the key
word is found in the phrase, the value of the column is 1, if not found
or if the keyword to search is blank, the value is 0.

Save this as query1.

Now create another query. The first column is the phrase. The second
column is Key1Cnt + Key2Cnt + Key3Cnt...Key6C nt. Click Show to off.
Set the criteria to >0. Sort in descending value. Save as query2. Run
this query.

This will exclude all records from the master table where no keywords
matched and present those that did have matches in the number of words
that did match. This method does not account for misspelled words.
Nov 13 '05 #2
Browsing these forums some more I see that that it might be important
to point out that I am using Access 2000. Also it seems like the split
function to break the string into an array is what I need to do but I
don;t know how.
Thanks,
Nov 13 '05 #3
You actually might need to take a few steps back.... natural language
processing is simply NOT going to be this simple, no matter how simple it
appears to be nor how much you try to "dumb down" the approach.

As this is a pure programming task, the version does not matter quite as
much. but developing a language parser is a monumental task, the kind of
thing that might get you a doctorate from the Dept. of Brain and Cognitive
Sciences at MIT if you could get in there and could actually prove a theory
enough to have such a successful applied model. To do so in VBA is a
herculean task, worthy of only a masochist beyond the level of the
aforementioned doctoral candidate.

For more info on why you are moving into an area that will definitely
"stretch" your knowledge and probably your sanity, I would recommend "The
Language Instinct" by Steven Pinker. He will show you that once you think
you have plural forms figured out, that there are many exceptions to the "s"
suffix pluralization rules (ones not as easy to detect). And then he will
show you how other markers, such as those for case and tense, can be used to
confound your parsing efforts, as can reversals of the typical SVO order of
English that are commonly done with case markers, especially in slogans
which are meant to be catchy.

Summary -- this is way to big of a job for anything less than a team of
people, with an actual PhD on the team.
--
MichKa [MS]
(armchair linguist)
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies
Windows International Division

This posting is provided "AS IS" with
no warranties, and confers no rights.
"steve" <ha***@asus.net > wrote in message
news:2d******** *************** ***@posting.goo gle.com...
Browsing these forums some more I see that that it might be important
to point out that I am using Access 2000. Also it seems like the split
function to break the string into an array is what I need to do but I
don;t know how.
Thanks,

Nov 13 '05 #4

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

Similar topics

5
7591
by: beliavsky | last post by:
By mistake I coded something like print ("1" > 1) and got the result "True". Comparing an integer and a string seems meaningless to me, and I would prefer to have an exception thrown. Can someone explain why Python allows comparisons between integers and strings, and how it handles those cases? Why is "1" > 1? Pychecker does not warn about the line of code above -- I wish it did.
1
2969
by: Doug | last post by:
I need to compare two "address" structures within a document, and perform some action if they are not equal. The XML document is a purchase order, with an address at both the header and line item level: <Order> <Header> ... other header level stuff ... <Address>
5
2417
by: Curtis Gilchrist | last post by:
I am required to read in records from a file and store them in descending order by an customer number, which is a c-style string of length 5. I am storing these records in a linked list. My problem is in comparing the customer number I just read in with those in the list. I'm not sure how to go about comparing c-style strings for greater than, less than.. here is how I am currently trying to do it: while( ( custinfo.number >...
4
10530
by: agent349 | last post by:
First off, I know arrays can't be compared directly (ie: if (arrary1 == array2)). However, I've been trying to compare two arrays using pointers with no success. Basically, I want to take three sets of character strings from the user. Then I want to run through each element and compare the two strings. If they match I print they match... I'm having a bit of trouble with the actual loop through each array using the pointers and comparing...
3
2027
by: Robert Dell | last post by:
I have a problem comparing strings in an order form i'm writing. I want to give a running total at the bottom of the page and it appears to be working except it doesn't compare correctly (it always adds things up when you didn't select them) so i only added 2 of the items until I got it worked out. here's the page source (you can look at it yourself at http://robertdell.dyndns.org/shifts/ <!DOCTYPE HTML PUBLIC> <html> <head>
41
3937
by: Odd-R. | last post by:
I have to lists, A and B, that may, or may not be equal. If they are not identical, I want the output to be three new lists, X,Y and Z where X has all the elements that are in A, but not in B, and Y contains all the elements that are B but not in A. Z will then have the elements that are in both A and B. One way of doing this is of course to iterate throug the lists and compare each of the element, but is there a more efficient way? ...
88
22018
by: William Krick | last post by:
I'm currently evaluating two implementations of a case insensitive string comparison function to replace the non-ANSI stricmp(). Both of the implementations below seem to work fine but I'm wondering if one is better than the other or if there is some sort of hybrid of the two that would be superior. IMPLEMENTATION 1: #ifndef HAVE_STRCASECMP
15
3910
by: luc.saffre | last post by:
Hello, here is something that surprises me. #coding: iso-8859-1 s1=u"Frau Müller machte große Augen" s2="Frau Müller machte große Augen" if s1 == s2: pass
2
3379
by: Pugi! | last post by:
hi, I am using this code for checking wether a value (form input) is an integer and wether it is smaller than a given maximum and greater then a given minimum value: function checkInteger(&$value, $checks) { $err = ''; if (!is_numeric($value) || (floatval($value) != intval($value))) { $err .= 'Input must be an integer. ';
6
4106
by: cutlass | last post by:
Need help in thus script. Trying to create the script that uses comparison operators and functions to compare two strings entered by user. When I add in the info in the script section everything falls apart. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Compare Strings</title>
0
8337
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
8851
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
8748
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
8628
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
6181
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
4175
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
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
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
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.