Like the title, How to compare text?. For a example, go to textdiff.com.
+4
A:
Check out Levenshtein distance. This is a fairly general algorithm for identifying differences between two strings.
JoshD
2010-10-04 05:19:18
No, i want to ask the algorithm. Not a software. But it is good if you give me a php class
Snoob
2010-10-04 05:20:00
PHP has a `levenshtein()` function you can look into.
Russell Dias
2010-10-04 05:45:18
Levensthein measures the "amount of difference" between two strings, but will not return the location of the differences. Also, I am not sure how useful it is for comparing sentences. `Text_Diff` will do exactly what the OP asked for (see my answer for links)
nico
2010-10-04 06:01:46
@Snoob: Yes, `Text_Diff` is one of the classes of the Pear framework. You will have to install the base Pear components first (see http://pear.php.net/manual/en/installation.introduction.php ) and, once that is working you can add Text_Diff. Looking at the page you linked I would say that's what they used. `Text_Diff` comes with documentation and examples: http://pear.php.net/package/Text_Diff/docs/latest/
nico
2010-10-04 05:26:43
A:
if you're looking for a terminal command, check out diff, found in linux by default. You can also have it on windows by installing cygwin [with a LOT of excess baggage. :\ ]
Karthick
2010-10-04 05:30:51