One of my friends is married to a prof of computer science. When she buys a new dress she asks him "don't you think this is pretty?" And he inevitably answers "Compared to what?"
I think that's the key issue. What are you comparing? It sounds like a simple question. But, the vagaries of natural language seem to imply that the first requirement is identifying what is considered a match. Then an algorithm can be developed for it.
Soundex was developed to support a phonetic-based filing system. It helped group names that were close in sound but not close in spelling. The first letter is preserved, vowels dropped, and following consonants identified by a numeric value between 0 and 9 -- a method which considers similar sounding consonants to be the same. Because it is used for names, it was designed for single words and wouldn't really work in your situation.
DIFFERENCE actually compares two words and returns a value of from 0 to 4 of increasing likeness. Comparing the 2 phrases returns 1 -- it doesn't think they're very similar.
There have been some other algorithms created that have appeared in various Fox publications.
But, could you develop something yourself? Are you interested in whether the words contained in A also appear in B? You could parse A to determine the individual words, then find out if they appear in B (or how many times). Then you could compare the length of strings to see how much they differ. Then weight the importance of the two as you see appropriate and calculate the result. All of that would be straightforward to do in Fox.
For more heavy duty parsing, Windows Scripting Host provides a regular expression parser. Several folks here at UT work with WSH regularly.
Jay
>Hi All
>
>i was wondering, does anyone know where one could get a utility that compares two strings (a+b) and returns a percentage match
>
>Eg A = "JOE BLOGGS HOUSE"
> B = "My Friend Joe Bloggs Lives In a huge House Down the Road"
>
>The utility would return a percentage figure of a match say 80% as it found "Joe Bloggs" and "House" in the sentence
>
>
>Thanks
>Mark
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only