Re: Determining the similarity between a user supplied short piece of text (between 5 and 15 characters) and a list of similar length text items.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 15, 2010 at 11:54, Richard Quadling <rquadling@xxxxxxxxx> wrote:
>
> I'm looking for is a way to compare what they've entered against a
> known list and to provide my 10 best guesses.

    Look into the following functions and families:

        levenshtein()
        similar_text()

    You wouldn't want to use metaphone() or soundex(), because you're
working with alphanumeric combinations, but if you want to be a
glutton for punishment, it could be fun.  Something along the lines of
using levenshtein() to get the best matches, then similar_text() to
score each of the matches would probably be a viable solution for you.
 The last time I incorporated something like that was for my own use
to track down a record in a MySQL database for which I could remember
just a small blip of text.  It looked through about 23 million records
in under two minutes and I found exactly what it was for which I was
searching --- even though I was off by one word.  Would've taken me
forever to find it using alternative methods.

-- 
</Daniel P. Brown>
UNADVERTISED DEDICATED SERVER SPECIALS
SAME-DAY SETUP
Just ask me what we're offering today!
daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux