That is very difficult, because what exactly means "appears to be the same"? They appear to be the same when a human quickly looks at both strings?
In order to write a program you must be able to exactly specify what this means, which is very difficult. "Appears to be the same" is a very fuzzy and inexact definition. Note that it might also be different for different people - maybe for you those two strings appear to be the same if you look at them quickly, but if I look at them quickly then I see immediately that they are different.
One idea would be to use some kind of diff algorithm and count the number of differences.
It's hard to give more advice without knowing what you want to do this for.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Mar 29, 2006
Thanks for replies.
Like i have two Strings :
String 1: My name is abc
String 2: My name abc
These above two Strings are different but i want that when this type of copmparision will come it will show result as equal inspite of not equal
You might be talking about the concept of using a stopword filter for text. The idea is to filter out common words like "the", "and" and "is" before comparing text, because they don't contribute to the meaning of the text.
A related important concept is stemming, which reduces words like "fishing", "fished", "fish", and "fisher" to their root, "fish".
There is no such method which compares strings so intelligently as you want.So,you have to make your own method and use that method wherever you want. I think your requirement is only for small sentences like : String1 = My name is abc String2 = My name abc You can go towards grammer side also like.. Adjective+noun+adverb+noun,so that wherever you get this sequence you can replace it with Adjective+noun+noun. I don't know to which level you want,means can the sentences be big also... I have told you option ,rest you can try and decide yourself
Well Tony, you wouldn't even have to think very hard to implement it in Java, because you can just copy and paste the source code from the website you linked to!
Joined: Sep 24, 2003
Originally posted by Jesper Young: Well Tony, you wouldn't even have to think very hard to implement it in Java, because you can just copy and paste the source code from the website you linked to!
Nice one I have written in Java before (using destructive update on an array), but I also have it written in Scala (which is callable from Java) using pure function calls (the Scala compiler tail call eliminates). I have also written it in C# and Haskell. LCS-based delta (and therefore, ED) is a problem that I happen to be very familiar with