Copywriting & Brand Narrative

The Marginal Note a Machine Treats as Part of the Letter

A scribbled margin gloss was never meant to be read mid-sentence. Machine learning OCR frequently flattens document layers that history requires separating.

By Paulo Codinha Copywriting & SEO ~7 min

If you spend your days digitizing early modern correspondence, parish registers, or diplomatic chancery rolls from the seventeenth and eighteenth centuries, you understand the living complexity of a handwritten page. A historical letter is rarely an inert plane of text; it is an active palimpsest of overlapping intentions. Down the center of the sheet flows the composed handwriting of the sender, observing formal epistolary protocols. Along the left margin, scrawled in darker ink, sits a hurried post-script added moments before the wax seal was stamped. And across the upper margin, one finds the filing clerk’s docket written three weeks later upon arrival in a distant maritime port.

Place that parchment under an overhead preservation scanner and pipe it into a conventional optical character recognition (OCR) or handwritten text recognition (HTR) pipeline.

The neural spatial segmentation model parses the graphic weight of the page. It clusters contiguous text blocks and, driven by a probabilistic language model tuned on modern syntax, attempts to establish a top-to-bottom, left-to-right reading order. Within milliseconds, the software commits an egregious philological violation: it injects the marginal annotation directly into the middle of the second paragraph, fusing two unrelated voices into a single nonsensical sentence.

The resulting transcript attributes words to the author that they never penned and dismantles centuries of established palaeographical methodology. Between 2026 and 2030, as national archives and research institutions deploy large-scale automated transcription pipelines to unlock millions of historic folios, mastering document layer stratification is an essential professional requirement.

Whether you preserve illuminated cartularies for public libraries and historical archives or digitize long-term property encumbrance records for notaries and public registries, a computer vision algorithm cannot be permitted to treat physical space as an undifferentiated stream of characters.

The failure of linear reading order in archival documents

As we examined in our study on when OCR joins two newspaper columns into one argument, commercial vision models were engineered around the conventions of modern print culture, where uniform typesetting proceeds predictably down rectangular columns bounded by wide gutters.

In pre-industrial handwritten records, however, marginal white space was not empty canvas; it served as a collaborative workspace:

  1. Authorial corrections and post-scripts: The sender realizes that an essential condition was omitted and drafts an addendum vertically in the margin: “Provided that the cargo arrives before the winter equinox”.
  2. Notarial attestations and registry endorsements: Decades after an initial deed of sale was recorded, a municipal notary adds a marginal apostille noting that a mortgage encumbrance was settled and cancelled.
  3. Reader marginalia and archival docketing: The recipient of the letter places a cross beside a disputed sum, writes the single word “disputed” next to a financial claim, or notes currency conversion rates along the bottom edge.

When a rudimentary system for business digitalisation or a full-text search backend in web apps, dashboards, and archival platforms flattens all of these distinct temporal layers into a single plain .txt file:

  • The recipient’s skeptical rebuttal becomes cited by academic researchers as if it were stated by the original author.
  • The notary’s mortgage cancellation merges with the initial lien definition, triggering severe false positives during title verification audits.
  • The document’s internal chronological evolution evaporates completely.

The scholarly solution: TEI-XML multi-layered encoding

Protecting historical textual integrity does not require abandoning machine learning models; it requires funneling neural predictions into semantic schemas capable of honoring documentary complexity, most notably the guidelines established by the Text Encoding Initiative (TEI-XML P5).

Under the TEI schema, a historical letter is structured not as an arbitrary flat string, but as an explicit tree of hierarchical and spatial elements:

<letter>
  <opener>
    <salute>Right Honorable Sir,</salute>
  </opener>
  <body>
    <p>
      I convey herewith the certified depositions regarding the contested manor,
      awaiting your lordship's prompt adjudication.
    </p>
  </body>
  <postscript>
    <p>We await the courier's return by nightfall.</p>
  </postscript>
  <!-- Marginal endorsement by receiving secretary -->
  <note place="left-margin" hand="#secretary" resp="#recipient">
    <date when="1742-05-18">18 May 1742</date>: Referred to Chancery for audit.
  </note>
</letter>

With this semantic hierarchy:

  • The primary reading view suppresses marginalia to render the core letter cleanly, reflecting the author’s primary composition.
  • The critical diplomatic view renders annotations in their precise physical orientation, color-coding distinct scribal hands (hands).
  • The institutional search index empowers scholars to execute targeted queries: “Find the word ‘manor’ strictly within primary letter bodies” or “Find references to ‘Chancery’ only within marginal receipt dockets”.

PAGE-XML, ALTO and the IIIF annotation architecture

To establish an immutable bridge between the high-resolution photographic scan and the semantic transcription, modern archival workflows employ intermediate formats such as PAGE-XML and ALTO-XML, integrated with the International Image Interoperability Framework (IIIF Presentation API 3.0).

Rather than converting an image directly into floating text, the layout analysis pipeline (using specialized neural tools like Transkribus, Kraken, or eScriptorium) rigorously classifies distinct typographic regions:

  • It bounds the central text block within a dedicated polygon (TextRegion type="paragraph").
  • It bounds side notes within separate geometric enclosures (TextRegion type="marginalia").
  • It isolates nineteenth-century pencil shelfmarks applied by subsequent librarians (TextRegion type="addition"), preventing modern library catalogue codes from contaminating the early modern prose.
  • It tracks the exact baseline coordinates for every line of text (Baseline and Polygon).

When the HTR engine transcribes individual words, each lexical token remains anchored to its coordinates via W3C Web Annotations targeting the IIIF image canvas. When an archivist or researcher clicks on a transcribed sentence in the web viewer, the interface highlights the exact ink strokes on the parchment surface.

Handling cancellations and interlinear insertions

Another severe pitfall of naive OCR tools is their mishandling of scribal strike-throughs and interlinear glosses.

In early draft charters and diplomatic petitions, writers frequently crossed out words and squeezed alternative phrasings into the narrow space above the line. To an experienced human palaeographer, the horizontal stroke canceling a word is obvious. But to a neural network optimizing for textual fluency, the cancellation stroke is often misclassified as an emphatic underline or read sequentially alongside the replacement text, resulting in garbled duplicate statements.

The TEI framework addresses this challenge using the <choice> element, pairing <del rend="strikethrough"> with <add place="above">. Through this structure, digital editions can dynamically toggle between an uncorrected draft view and the author’s intended final reading text.

Professional standards for digital archivists (2026–2030)

To protect cultural heritage and legal records from algorithmic degradation, institutions should implement five non-negotiable standards:

  1. Reject OCR tools that export only unstratified plain text: Any system that processes historic manuscripts into flat text files without spatial bounding coordinates or semantic layer tagging is destroying provenance data. Require PAGE-XML, ALTO, or TEI compliance.
  2. Prioritize layout segmentation training over raw character recognition: The most damaging errors in historical transcription stem from incorrect block ordering rather than misread glyphs. Invest in training layout analysis engines to identify marginalia, headings, and endorsements reliably.
  3. Encode scribal hands in metadata headers: Whenever a document exhibits distinct inks, scripts, or writing instruments, record them in the document header (<handDesc>). This guarantees that subsequent marginal annotations are never conflated with the primary author’s hand.
  4. Deploy layered interactive public reading interfaces: Provide digital viewers that allow patrons to toggle between views: clean reading text, contemporary endorsements, modern archival annotations, and diplomatic transcriptions.
  5. Protect notary signs and official heraldic authentications: In historical registry documents, the public sign of a notary (signum notarii) is frequently misread as visual noise or ink smudges. Classify these marks as sacred graphic elements (<figure type="notary-sign">) to preserve the legal authenticity of the digital surrogate.

Digital humanities engineering exists not to flatten the intricate complexities of the past into convenient modern strings, but to return history to us with all of its authentic layers, voices, and physical textures intact.

[+] On this page 12 topics ▼
FAQ · Common Questions

Frequently Asked Questions

What is document layer flattening in automated manuscript transcription?

It is the error where an OCR or computer vision model merges marginal glosses, reception notes, or notarized endorsements directly into the linear flow of the main letter body.

How does the TEI-XML standard resolve the coexistence of primary text and annotations?

Through explicit semantic tags such as <add place='margin'>, <note>, and <del>, allowing search engines and researchers to toggle between clean reading views and critical diplomatic layers.

Start your project

Need a website that earns trust, ranks in search, and gives your business a stronger digital presence? Start the conversation here.

Official sources used on this page