3

I want to compare two editions of one book. The book is very long and the editions are close but not identical.

I have extracted the texts with OCR. The obtained text-files have mistakes and many things left from text formating. Now I want to make a rough comparison of the text-files --- I want to ignore most of the things, but I need to capture something like a sentence or at least new paragraph.

The file comparison (like meld) does not seem to be useful for this (ignoring white space does not help at all).

Any suggestion?

  • Can you program? – Mawg Jun 30 '17 at 8:33
  • 1
    @Mawg I can write a script, but not good at that. – Anton Petrunin Jun 30 '17 at 15:09
  • Actually, the coding would not be the hard part - that would be figuring out the algorithm – Mawg Jul 1 '17 at 8:37
2

I think a good buzzword here would be "fuzzy diff".

Possible answer: https://github.com/google/diff-match-patch

online tool to evaluate: https://neil.fraser.name/software/diff_match_patch/demos/diff.html (activate efficiency cleanup)

Technical explanations of the algorithm: https://neil.fraser.name/writing/diff/

Other possibilities and related questions:

https://stackoverflow.com/questions/3108274/generate-fuzzy-difference-of-two-files-in-python-with-approximate-comparison

https://pypi.python.org/pypi/fuzzywuzzy

Looking at the motivation for the question it might also be possible to take some software which can compare two pdfs visually (or based on available ocr layer) such as https://github.com/zeliboba/DiffPDF-app newer versions are commercial: http://www.qtrac.eu/diffpdf.html

alternatives (really different in spite of similar names): https://github.com/JoshData/pdf-diff http://vslavik.github.io/diff-pdf/

I have personally only tried the DiffPDF-app and at least in my case it did not seem work 100% perfectly in my case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.