"Nicholas Sherlock" <n_********@hotmail.com> wrote in message
news:d4**********@lust.ihug.co.nz...
Bosconian wrote: "Nicholas Sherlock" <n_********@hotmail.com> wrote in message
news:d4**********@lust.ihug.co.nz...
Bosconian wrote:
I'm looking for a method to compare two strings and grade them for
similarity.
http://docs.php.net/en/function.levenshtein.html
or
http://docs.php.net/en/function.similar-text.html
BTW, would you happen to know if this can be done at the query level?
Ah, do you want to something like this made up query:
SELECT * FROM mytable WHERE text IS SORT OF SIMILAR TO $mysearch ?
If so, you can't do this with PHP functions. You may be able to find an
add-on for your database server which will add functionality like this,
but I don't think that it comes standard with any databases.
Cheers,
Nicholas Sherlock
Something like your mock query makes sense... kind of a LIKE clause on
steroids. I'm surprise MySQL doesn't support it.
In my case it's not a big deal. I'm only dealing with a couple hundred
records at the most. I can simply loop through the recordset (like the
levenshtein php.net example) and find any/all similarities with a value of
less than 10 or whatever.