Re: [2005] Compare Strings
well you could check characters for equality to get a % of what matches, however that would basically break as soon as it encountered a difference, because it would now know where to then pick up from in the matching again unless you have a pretty spiffy algo in place to do so.
Re: [2005] Compare Strings
Looks like I need to use Levenshtein Distance Algorithm that will get me pretty close.
Re: [2005] Compare Strings
An algorithm/idea you could use could be:
The number of words stringA and stringB has.(Do they have same number or within the same range?)
Does each word from stringA have a matching word from stringB.
The location of the matching words, are they placed in the same place or within a certain range.
For instance:
stringA = "Dog chewed on bone"
stringB = "Dog chewed bone"
stringA has 4 words and stringB has 3 words. So they have "about" same number of words. So you can take that into account. StringA has 3 words that have matching words from stringB which are "Dog", "chewed", and "bone". So 3 out of 4 matching words; So you take that into account. Then location, stringA's "bone" is fourth word in string, while stringB's "bone" is third word, and depending on how you want the range to be, you can use that on how to determine how close the strings match.
Re: [2005] Compare Strings
This is a complicated subject, the first place to start is to define what you mean by "similarity", the differences between two text strings are usually stated as being one or more of the following (I got this list from a book I have).
Shared letters
Shared sequences of letters
Shared words
Shared sequences of words
Shared sequences of word segments
Shared syntax
Shared vocabulary
Shared equivalence of word meanings
Writing an algorithm for the first four or five is probably not that tough, but the last ones would be real nasty.