Avatar of umaxim
umaxim
Flag for United States of America asked on

Compare Text

Maybe some one did before. I want to make script which will found in mysql text which more similar. Like fore example i have 1000 text in my database and i need to find which is more similar.
Can any one give idea how i can make this script. Which way is better to server and speed. I will made all in php. Maybe some one have some script
PHP

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Marco Gasi

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ray Paseur

Speed will not really be an issue if the numbers are in the range of "have 1000 text in my database" because 1,000 of anything will get processed very fast.  The central issue here is going to be how you define "similar."

Please post two or three examples of your texts and a test case that should be found to be similar to one of the examples.  Then we can provide more concrete assistance.  The length of the text matters a great deal, so it will be best for us to start from examples.  In very short texts, some combinations of soundex(), metaphone(), and sometimes levenshtein() may be the right tools.
umaxim

ASKER
I will just by text.Like if i take "Hi my name is maxym" i need to show up all text where i have "Hi my name is maxym" and for the same staff all text. I think i will split by senteces and then check which text have what sentences.
Marco Gasi

I don't know if I really understand but can you test this?

$sql="SELECT text FROM table HWERE text LIKE "%Hi my name is maxym%";
$res = mysql_query($sql) etc...

Cheers
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
umaxim

ASKER
eap i think to do like this but how to do is it will have like 500 word. It will take for long time to find everything by sentences.
Ray Paseur

Please post two or three examples of your texts and a test case that should be found to be similar to one of the examples.  Thanks.