// Since we can't tell which new paragraph mapped to which old one to do a straight up diff,
// this method gets the edit distance between each remaining new paragraph
// and each remaining old paragraph. It finds the minimum edit distance for each new
// paragraph, and if it's higher than the threshold, we highlight it.
if (!newParagraphs.isEmpty()) {
diff_match_patch dmp = new diff_match_patch();
for (Node newParagraph : newParagraphs) {
int minEditDistance = Integer.MAX_VALUE;
for (Node oldParagraph : oldParagraphs) {
LinkedList<Diff> diffs = dmp.diff_main(
getTextContent(oldParagraph), getTextContent(newParagraph));
minEditDistance = Math.min(minEditDistance, modifiedLevenshteinDistance(diffs));
}
if (minEditDistance > EDIT_DISTANCE_THRESHOLD) {
Element paragraphElement = (Element) newParagraph;