Hi all,
Is there any good gem to do string comparison so that the following will
be considered the same even there are one or two words or spaces
differences?
Thanks in advance.
string1=“A boy comes to see me this morning.”
string2="A male comes to see me this morning. "
What codes should be written so that string1 is considered the same as
string2?
I don’t know of a gem. In general, that is a very hard problem. It
first requires a dictionary that says “boy” is the same as “male”. Once
you have that, the rest is not mega hard but it is still non-trivial.
I don’t know of a gem that can do that. One thought is to read
something like Chapter 12 of the PostgreSQL documentation “Full Text
Search”. Pick up some terms that are used in that problem space, and
then do Google searches with those terms.
If you are seeking similarity between strings, I’d suggest to read about
measuring of Levenshtein distance
(Levenshtein distance - Wikipedia), if not already did.