Abstract
Digital libraries like HathiTrust and Project Gutenberg contain millions of volumes digitized using legacy Optical Character Recognition (OCR) technology, resulting in significant textual noise. We describe a pipeline developed by researchers at Stony Brook University that leverages duplicate scans to train modern language models (LMs) for "blind" error detection and correction. By aligning multiple versions of the same text, the system identifies canonical versions and corrects errors with high precision, significantly improving the quality of digitized historical corpora without requiring access to original page images.
Introduction
For decades, massive digitization efforts have sought to preserve the world's literature. However, the reliance on older OCR technology has left many digital archives "dirty"—riddled with typos, character substitutions, and structural inconsistencies. These errors pose a significant challenge for downstream Natural Language Processing (NLP) tasks and digital humanities research. This paper explores a novel approach to cleaning these texts by treating OCR correction as a sequence-to-sequence problem, utilizing the inherent redundancy in digital libraries as a source of self-supervision.
The Challenge of Legacy OCR
Libraries often contain multiple scans of the same book, each containing unique errors. For example, a word like "home" might be misread as "hone" in one scan but correctly identified in another. The primary challenges are twofold: identifying the most accurate version among duplicates (canonical selection) and correcting errors in books where no clean alternative exists. Traditional OCR correction often requires the original scanned image to resolve ambiguity, a process that is computationally expensive and often impossible for large-scale legacy datasets.
Methodology: Alignment and Correction
The proposed pipeline operates in several stages, beginning with deduplication and alignment.
Deduplication and Alignment
To handle the massive scale of HathiTrust and Project Gutenberg, the researchers used a 5-gram overlap metric to identify duplicate volumes. Once identified, texts are aligned at the token level using an "anchor token" strategy. By identifying unique words that appear only once in a volume, the system creates synchronization points that make the Longest Common Subsequence (LCS) algorithm computationally feasible for full-length novels.
Error Detection and Correction
For books without a duplicate partner, a RoBERTa-large model is employed as a token classifier to flag potential OCR errors. Once flagged, a T5 (Text-to-Text Transfer Transformer) model generates corrections. The model is trained on millions of examples generated by aligning "clean" Project Gutenberg texts with "dirty" HathiTrust scans, allowing it to learn common OCR failure patterns purely from linguistic context.
Experimental Results
The effectiveness of the pipeline was evaluated using a "Golden Dataset" of 6,694 paired books.
Canonical Selection
Using GPT-2 to score sentence likelihood, the system achieved 85.3% accuracy in identifying the cleaner sentence in a pair, significantly outperforming a dictionary-based baseline of 71.2%.
Correction Performance
The T5-based correction model proved to be highly effective and conservative. Analysis shows that the model corrects significantly more errors than it introduces, maintaining the historical integrity of the text while removing noise.
Analysis revealed that books digitized by Google generally exhibited higher OCR quality than those from the Internet Archive, though quality in both sources was heavily correlated with the age of the physical book.
Discussion and Future Directions
While the pipeline is highly effective, it faces challenges with intentional non-standard English. Language models occasionally mistake 19th-century vernacular or dialect for OCR errors. Furthermore, distinguishing between semantic changes (e.g., synonyms) and structural corrections remains a hurdle; a model might suggest a linguistically plausible word that was not in the author's original vocabulary.
Future work will focus on refining models to better handle historical dialects and releasing the "scrubbed" versions of these massive corpora to the broader research community. This work demonstrates that modern LMs are now powerful enough to rescue digitized history from the limitations of legacy technology.
Summary updated