Cody Pendant has asked for the wisdom of the Perl Monks concerning the following question:
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:
I walk. I talk. I shop, I sneeze. I'm gonna be a fireman when the floods roll back. There's trees in the desert since you moved out. And I don't sleep on a bed of bones.
what if someone comes along and enters an abbreviated version -- say they think it's better just as:
I'm gonna be a fireman when the floods roll back. There's trees in the desert since you moved out.
or what if their spelling/interpretation differs slightly:
I'm going to be a fireman when the floods roll back. ^^^^^^^^^^^
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,
CP
--
Weaselling out of things is important. It's what separates us from the animals ... except the weasel.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Smart Comparison of Buffy Strings
by dws (Chancellor) on Feb 03, 2002 at 00:57 UTC | |
Re: Smart Comparison of Buffy Strings
by blakem (Monsignor) on Feb 03, 2002 at 01:37 UTC | |
(cLive ;-) Re: Smart Comparison of Buffy Strings
by cLive ;-) (Prior) on Feb 03, 2002 at 03:15 UTC | |
Re: Smart Comparison of Buffy Strings
by drinkd (Pilgrim) on Feb 03, 2002 at 13:50 UTC | |
by hossman (Prior) on Feb 03, 2002 at 23:12 UTC | |
Re: Smart Comparison of Buffy Strings
by dws (Chancellor) on Feb 05, 2002 at 07:57 UTC |