From ABBYY XML to Org Mode

Digitised books are often distributed as page images, plain OCR text, PDF, or ABBYY XML. Plain text is easy to read but loses structure. PDF preserves visual appearance but is awkward to correct and republish. ABBYY XML can provide a better starting point because it records pages, regions, lines, words, styles, and confidence information.

Why Org mode

Org mode is a practical intermediate source format: it is plain text, version-controllable, manually editable, and exportable to HTML, LaTeX, PDF, EPUB, and other formats. It can represent headings, paragraphs, lists, tables, notes, links, images, and metadata without embedding the editorial workflow in a proprietary application.

The conversion problem

A converter must reconstruct logical structure from page-oriented OCR data. Typical tasks include:

  • joining lines into paragraphs while preserving real breaks;
  • detecting headings from style and layout information;
  • removing repeated headers, footers, and page numbers;
  • retaining emphasis and special characters;
  • locating images and associating captions;
  • rebuilding tables from cells or coordinates;
  • connecting footnote references to footnote bodies;
  • preserving page provenance for later verification.

Confidence and ambiguity

OCR output is evidence, not truth. Low-confidence words, unusual typography, hyphenation, mathematical notation, and historical spelling require different treatment. The converter should avoid silently replacing uncertain content with a guess.

A useful workflow records warnings and keeps enough source location information to return from an Org paragraph to the corresponding page image or XML region.

Reproducible editing

The raw OCR archive should remain immutable. Conversion code produces an initial Org document and a machine-readable report. Manual corrections are then version-controlled separately, so improvements to the parser do not erase editorial work.

For large works, the process benefits from explicit stages: structural conversion, normalisation, automated checks, visual comparison, copy-editing, and final export.

Images and tables

Images should be extracted as independent assets with stable names and links. Tables require particular caution: visual alignment in OCR data does not always encode semantic row and column relationships. When reconstruction is uncertain, preserving an image of the original table alongside a partial transcription is better than manufacturing false precision.

Objective

The final result should be readable, correctable, and regenerable. Conversion quality is measured not only by character accuracy, but by how well the document's intellectual structure and provenance survive the transformation.