|The stupid question is the question not asked|
Smart Comparison of Buffy Stringsby Cody Pendant (Prior)
|on Feb 03, 2002 at 00:23 UTC||Need Help??|
Cody Pendant has asked for the
wisdom of the Perl Monks concerning the following question:
This is a more or less theoretical question, but I hope that fellow monks might find it interesting.
I'm working on a database of quotes (from Buffy The Vampire Slayer).
I want people to be able to add a quote to the database, but I also want to check the quote isn't already there.
So say I have this quote in the database:
what if someone comes along and enters an abbreviated version -- say they think it's better just as:
or what if their spelling/interpretation differs slightly:
I would like to be able to somehow compare the strings in such a way that the fact that the quote is already entered shows up, despite the fact that it's not exactly the same, either shorter or longer or slightly differently written in some aspects.
I can't think of a smart way to do this, though of course you could just compare all possible substrings of the two strings, which seems overly mechanical.
The result should presumably be a percentage score or similar?
Thanks in Advance,