NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Neural OCR Post-Hoc Correction of Historical Corpora

Lijun Lyu, Maria Koutraki, Martin Krickl, Besnik Fetahu

Abstract

Optical character recognition (OCR) is crucial for a deeper access to historical collections. OCR needs to account for orthographic variations, typefaces, or language evolution (i.e., new letters, word spellings), as the main source of character, word, or word segmentation transcription errors. For digital corpora of historical prints, the errors are further exacerbated due to low scan quality and lack of language standardization. For the task of OCR post-hoc correction, we propose a neural approach based on a combination of recurrent (RNN) and deep convolutional network (ConvNet) to correct OCR transcription errors. At character level we flexibly capture errors, and decode the corrected output based on a novel attention mechanism. Accounting for the input and output similarity, we propose a new loss function that rewards the model's correcting behavior. Evaluation on a historical book corpus in German language shows that our models are robust in capturing diverse OCR transcription errors and reduce the word error rate of 32.3% by more than 89%.

Introduction

Digitizing historical archives presents significant challenges for standard Optical Character Recognition (OCR) systems. Historical documents often suffer from poor scan quality, complex layouts, and the evolution of language over centuries—such as the shift from "vnd" to "und". Furthermore, these texts frequently employ archaic typefaces like Fraktur alongside Antiqua, leading to high error rates in character recognition and word segmentation.

Historical German prints featuring complex layouts and Fraktur script.

Existing post-hoc correction methods often rely on redundancy (multiple scans of the same text), which is frequently unavailable. Standard sequence-to-sequence models also struggle with word segmentation errors—accidentally merging or splitting words—and a "copying bias," where the model learns to simply output the input text because the majority of OCR characters are correct.

Methodology: The CR Architecture

To address these issues, we propose the CR (Correction-RNN/ConvNet) model, a character-level encoder-decoder architecture designed for robust post-hoc correction.

Hybrid Encoder

The model utilizes a hybrid encoder that combines a Bidirectional LSTM (RNN) with a Deep Convolutional Network (ConvNet). While the Bi-LSTM captures global context, the ConvNet is specifically tuned to capture local sub-word and phrase structures. This combination is particularly effective at identifying and fixing segmentation errors, as ConvNets excel at recognizing local patterns like common prefixes or suffixes.

Multi-layer Attention and Weighted Loss

A novel multi-layer attention mechanism allows the decoder to weigh representations from different layers of the ConvNet, enabling it to choose between fine-grained character-level and coarser word-level information.

To combat the "copying trap"—where models ignore the ~10% of errors because the input and output are mostly identical—we introduce a custom weighted loss function. This function dampens the reward for simply copying the input and increases the reward for active, correct modifications, forcing the model to focus on discrepancies.

Dataset and Evaluation

We curated a parallel corpus of 800,000 sentences derived from 12 German books published between the 16th and 18th centuries. This dataset aligns "noisy" OCR output from the Austrian National Library with "clean" ground-truth transcriptions from the Deutsches Textarchiv.

Comparison of average sentence length between OCRed and Transcribed text across the 12-book corpus.

The corpus reflects high initial error rates (up to 30% Character Error Rate) and diverse layouts. As shown in Figure 5, discrepancies in sentence length between OCRed and transcribed text highlight the prevalence of segmentation errors that the CR model must resolve.

Results and Analysis

The CR model demonstrates a massive reduction in error rates. On a randomized test set, it reduced the Word Error Rate (WER) from 32.3% to 3.59%, representing a relative improvement of over 89%.

The model significantly outperformed standard LSTMs, Transformers, and rule-based baselines. While Transformers achieved competitive Character Error Rates (CER), the CR model was consistently superior at fixing word-level and segmentation errors. Evaluation across different centuries (testing on unseen time periods) confirmed that the model learns the underlying "grammar" of OCR errors and historical spelling shifts rather than merely memorizing vocabulary.

Conclusion

The proposed hybrid neural approach provides a robust solution for the post-hoc correction of historical OCR. By addressing the specific challenges of typography, language evolution, and segmentation through architectural innovations and a specialized loss function, we enable significantly higher quality access to digital historical archives. Future work may explore simultaneous language normalization alongside error correction.

Summary updated

BibTeX
@article{lyu2021neural,
  author = {Lijun Lyu and Maria Koutraki and Martin Krickl and Besnik Fetahu},
  title = {{Neural OCR Post-Hoc Correction of Historical Corpora}},
  journal = {Trans. Assoc. Comput. Linguistics},
  year = {2021},
  url = {https://openreview.net/forum?id=RzBe-vMTBnM},
}
Figure