Search code examples
javastringtextcomparisondiff

Java library for free-text diff


I need to match up two almost-the-same long freetext strings; i.e., to find index-to-index correspondences wherever possible.

Because this is freetext, the comparison should not be line-based as in code diffing.

Any suggestions for Java libraries?

A simple example (In real life , of course, there would not be extra whitespace to line things up, and there may be more complex challenges like entire clauses moved around.)

The quick brown  fox jumped over the  lazy     dog.
||||||||||      |||||||||||||||||||||         |||||
The quick yellow fox jumped over the well-bred dog.

Solution

  • This one might be good Diff Match Patch.