Elamur Research

Supervised OCR Error Detection and Correction Using Statistical and Neural Machine Translation Methods

Paper · 2018 · Chantal Amrhein and Simon Clematide

Summary

Optical character recognition, or OCR, turns a page image into text that a computer can search. When recognition goes wrong, a search can miss a word that is plainly visible on the page. An omitted space can hide several words inside a single string. Amrhein and Clematide study what can be recovered from an existing transcription when running recognition again is impractical. Their goal is to recover the spelling of the printed document. A historical spelling that differs from current usage can therefore be exactly the right answer.

The authors approach the repair as a form of machine translation. The input is what the recognizer produced, and the target is what a reference transcription says was printed. Both are in the same language, and the systems process them as sequences of characters. This matters because most damaged forms in training occur just once. A learner that works with characters can use what it has seen about a recurring letter confusion even when the exact input word is unfamiliar. The experiments compare statistical and neural translation on English and French books and periodicals from the ICDAR 2017 shared task. The authors also test nearby words, publication dates, training sets enriched with errors, and vectors derived from letter shapes.

The strongest results depend on whether the system is being asked to locate an error or to restore the text. On the internal French periodical test set, averaging predictions from several saved states of an error-focused neural system produced a detection F1 of 65.30. The statistical system supplied with neighbouring words gave a relative edit-distance improvement of 19.64 on the same partition, well ahead of that detector’s correction result. Surrounding words usually helped. Mixing training collections often made performance worse, and training a system to flag more mistakes could lead to less accurate repairs.

The official submission combined statistical and neural outputs. It placed first on correction and recorded a mean detection F-measure of 0.53. The organizers had already marked the errors for the correction task, so the ranking measures how well the systems repair known trouble spots. Cleaning an entire collection also requires decisions about where to intervene and where to preserve the recognizer’s output. The experiments show why those decisions deserve separate measurements and why a setting that works on one collection can behave differently on another.

Deep dive: Supervised OCR Error Detection and Correction Using Statistical and Neural Machine Translation Methods

Amrhein and Clematide compare character-based translation methods for finding and repairing OCR errors in historical books and periodicals. · about 37 minutes to read

The problem and its context

What counts as a mistake in a historical transcription

An OCR error enters the searchable text at the point where a recognizer interprets marks on a page. Historical printing gives it several ways to go wrong. Letter shapes can differ with the typeface. The same language can use different spellings across periods. The condition of the material can make a character hard to distinguish, especially in newspapers. Once an erroneous character is stored as text, an index has the recognized form to work with. A reader looking for the form that was printed may never encounter that passage through a text search. Information retrieval & search

Earlier work discussed in the paper locates possible interventions at three stages. A project can work on the page images before recognition, change the recognition system, or work on the text it has already generated. The last option is post-correction. It is particularly relevant when an existing digitization cannot be run through OCR again. The evidence available at that stage includes the observed string, its surroundings and examples from other transcriptions. The actual shape of a disputed character can remain inaccessible to the correction system.

The target is also narrower than the phrase spelling correction might suggest. The paper cites compleated in a document from 1744 and completed in one from 1894. Each can be a faithful reading of its respective source. A procedure that replaces the older form whenever it sees it would erase a genuine feature of the historical record. The reference transcription supplies the criterion for success in these experiments. It records the reading to recover, including spellings that a reader accustomed to contemporary usage might initially question.

A recognizer can also produce a word that is entirely ordinary in its own right. In the French data, it sometimes reads sont as font. The latter belongs to French vocabulary, so a check for unfamiliar strings would accept it. What makes the reading suspicious is its role in the passage. Near fondés, the intended construction may call for sont. A detector that processes the token alone lacks that evidence about the occurrence it is trying to judge. A list of valid words can identify some apparent mistakes while letting this kind pass.

Spacing errors bring the same issue to the boundaries of the input. A recognized string may contain what the reference treats as adjacent words, or a single printed word can be represented by separate pieces. A correction system therefore needs to be able to change the length and division of a string. If the system begins by assuming that each recognized word corresponds to exactly one reference word, part of the task has already been ruled out by its representation.

These cases explain the paper’s distinction between detection and correction. Detection asks whether a particular OCR token needs attention. Correction asks what sequence should appear at a particular location. A suspicious fragment can be easy to flag and hard to reconstruct. In the other direction, a system can know a good repair for a familiar corruption but apply it only when the input presents sufficiently strong evidence. The distinction matters in both an automatic workflow and a workflow where a person examines candidates. The former exposes the text directly to mistaken changes. The latter can present doubtful cases for a decision.

Approaches the paper builds on

The paper describes earlier work that searches for suspicious strings using dictionaries or statistics about neighbouring units. An n-gram is a sequence of a given length, such as adjacent characters. Its frequency can help gauge whether a sequence is plausible. A lexicon supplies evidence at the level of known forms. The authors discuss TICCL as an unsupervised, corpus-based approach that had been used for multiple languages and that depends on good lexicons. Historical spelling and real-word errors give a sense of what such resources must cover to be effective.

Other methods give proposed repairs a score based on the changes needed to reach them. An edit distance counts operations such as inserting, deleting or replacing a character. A weighted variant can assign some changes a greater cost than others. A noisy-channel approach treats the observed string as the result of a corruption process. A candidate can be plausible because the intended word is likely and because the process could readily have produced the observed error from it. In the comparison by Eger and colleagues that the authors describe, general string-to-string translation procedures did better on OCR data than the weighted-distance and noisy-channel techniques examined there. An Improved Error Model for Noisy Channel Spelling Correction

Statistical translation had already been used to repair historical French OCR. Afli and colleagues trained a system on more than 60 million tokens and found it stronger than the alternatives based on sequence plausibility that they tested. In a separate experiment with over 90 million training tokens, they reported a slight advantage for word-level over character-level statistical translation. The present paper addresses a substantially smaller corpus, where evidence for an individual damaged word can be sparse. The authors use the earlier work to motivate translation as a repair procedure, then choose the scale of the translation units with their own data in view.

Earlier historical OCR work also tackled specific parts of the problem through specialized methods. One study treated the repair of isolated Finnish words as sequence labelling and implemented it with weighted finite-state techniques. The paper also describes Schulz and Kuhn’s system as combining statistical translation at the token and character levels with components that could split and merge tokens. That architecture illustrates a different way to manage damaged boundaries. Some of the work can be assigned to dedicated components rather than expected to emerge from a single string conversion.

Why use characters as the units of translation?

A word vocabulary makes sense when most inputs resemble the words seen during training. OCR is liable to produce a string that has never appeared before. A longer word can be corrupted in many places, and a familiar underlying word can appear as many different damaged forms. Treating each of those forms as a separate input makes the available supervision thin. Characters give two damaged strings a way to share evidence. If they contain the same misread letter sequence, learning from one may help with the other.

The neural translation literature discussed in the paper offered several approaches to unfamiliar words. A dictionary lookup could help when a system encountered a missing entry. A hybrid system could process familiar words as units and fall back to characters when necessary. Another approach used subword tokenization to build a vocabulary from characters and repeatedly combine pieces into longer units, some of which could be complete words. These were examples of getting useful coverage without making the word vocabulary indefinitely large. Addressing the Rare Word Problem in Neural Machine Translation · Achieving Open Vocabulary Neural Machine Translation with Hybrid Word-Character Models · Neural Machine Translation of Rare Words with Subword Units

The paper also draws on research that produces output characters directly. A character decoder can assemble a word from smaller units and can work without requiring the output to be divided into words in advance. In fully character-based translation, the input also consists of characters. The earlier work described by the authors found that such a system could produce the intended translation despite spelling errors in its input. Recovering the exact original spelling is a different objective, but the ability to process a disrupted sequence is relevant to both tasks. A Character-level Decoder without Explicit Segmentation for Neural Machine Translation · Fully Character-Level Neural Machine Translation without Explicit Segmentation

Sequence-to-sequence learning supplies the broader setup. A system receives an ordered sequence and learns from examples what ordered sequence to produce. Transliteration, spelling-to-pronunciation conversion, historical spelling normalization and language correction for learners can all be studied with paired strings. The historical normalization example is particularly useful for seeing what supervision specifies. A normalization dataset might reward a change away from the old spelling. The OCR pairs reward retaining that spelling whenever it is what the source says. Sequence to Sequence Learning with Neural Networks · Neural Language Correction with Character-Based Attention

The evidence from earlier neural OCR experiments was mixed. In the comparison the paper recounts, Schnober and colleagues trained on 72,000 misrecognized words. A system based on pruned conditional random fields, an established method for predicting corresponding sequences, was stronger than the neural alternatives in that setting. The neural systems with attention did better than plain sequence-to-sequence systems, and on a smaller training set the attention-based approach also surpassed the conditional random field system. Attention lets the decoder draw more strongly on particular parts of the input as it produces an output. The earlier comparison had preselected damaged words. The ICDAR material for Amrhein and Clematide includes the ordinary stretches of text a detector has to pass over as well. Neural Machine Translation by Jointly Learning to Align and Translate

The method, step by step

Read the alignment before extracting examples

The ICDAR files give the authors paired material. Each file contains a paragraph. Its first line is the raw OCR, and the other lines show the recognized text and the reference in a character-by-character alignment. The reference is called the ground truth. It establishes what the system should generate and lets the authors identify where the OCR disagrees with it. The aligned lines give both sequences an explicit position at which an insertion or deletion belongs.

In the paper’s example dated 1860, the run of OCR characters beginning ATRAVELLER lacks a space after A. The aligned OCR inserts @ at the position of that space, and the reference contains a space there. The reverse arrangement is possible too. An OCR character with no counterpart in the reference is paired with @ on the reference side. These symbols are alignment placeholders. When the authors construct sequences for training, the placeholders are discarded and the text on each side retains its actual characters.

A different marker, #, identifies a place where the reference itself could not be read with confidence. The authors exclude unrecognizable material from their internal experimental data. Hyphens receive separate treatment. The references handle them inconsistently, possibly because of how soft hyphens were processed. The training data retain them, while the error analysis and scoring follow the organizers’ policy of ignoring them. Each decision affects a different part of the experiment. The uncertainty marker determines which material can support a supervised comparison. The hyphen policy determines which discrepancies count in that comparison.

The official training material is randomly divided into an internal training portion of 80%, a development portion of 10%, and an internal test portion of 10%. The training portion supplies the examples used to fit the systems. The development portion supplies evidence for choosing systems and combining their predictions. The internal test portion is where the authors report the comparisons among configurations. This leaves the official test set available for the competition evaluation. Both subtasks draw on the same supervised training material.

Make the training units small enough to share

The simplest configuration works on a span with no surrounding words. To make paired spans, the preprocessing starts a new training line wherever the alignment has a space on both sides. At those positions, OCR and reference agree about a boundary. A space that occurs on only one side stays inside the span. In the example with ATRAVELLER, this gives the target room to contain the missing boundary. A rule that cut independently at every space on each side could divide the same passage differently and lose the useful pair.

The resulting units are frequently individual words. They can also be longer runs where recognition has moved or removed a boundary. The paper illustrates the format with an OCR segment in which the gaps around the counterpart of course are missing. On the reference side, the training sequence includes the intended spaces. The system thus sees a concrete example of a source and target with different internal divisions.

The next operation makes the translation software treat a character as a unit. The authors insert separating whitespace around the characters in the training representation so that what software would ordinarily read as a word-sized token is a single character. This is a tokenization decision, where tokenization means dividing text into the units a system processes. The separators used to present characters to the software are part of the representation. Actual boundaries in the source or target text must still be recoverable from it. The distinction is especially important for this task, because a missing boundary is itself a form of damage.

From aligned paragraphs to OCR repair decisions

The steps in order.

From aligned paragraphs to OCR repair decisionsStep 1: Read paired OCR and reference lines1. Read paired OCR and reference linesStep 2: Cut spans at agreed spaces2. Cut spans at agreed spacesStep 3: Represent each span as characters3. Represent each span as charactersStep 4: Include neighbours or metadata in selected runs4. Include neighbours or metadata in selected runsStep 5: Train statistical and neural translators5. Train statistical and neural translatorsStep 6: Generate possible readings of the OCR6. Generate possible readings of the OCRStep 7: Use candidate changes to flag or repair tokens7. Use candidate changes to flag or repair tokens

Fit the statistical and neural translators

The statistical system, abbreviated SMT, uses the Moses toolkit. The authors use GIZA++ to learn character correspondences within the prepared pairs and minimum error rate training, abbreviated MERT, to tune the system. The operation performed by GIZA++ is a step of statistical translation training. The supplied paragraph alignment had an earlier purpose, namely to make it possible to extract a suitable pair of sequences from the corpus.

The statistical setup includes a 10-gram component throughout the experiments. This component evaluates the plausibility of target sequences in the character-level representation. Evidence from correspondences can support a particular change to the OCR, while target probabilities help assess the sequence that the change would produce. A frequent confusion is useful evidence, but it can point to several repairs. Scoring the target sequence gives the system another basis for choosing among them. Language model

For neural machine translation, abbreviated NMT, the authors first try the convolutional framework discussed in the earlier character-level work. The preliminary results lead them to use Nematus for the subsequent experiments. They can give Nematus the same character-separated lines used for Moses. It learns to generate a target sequence from the OCR sequence, with unchanged examples teaching it that often the correct output is a copy of the input. Examples containing errors teach it where modifications can be warranted. Nematus

The neural experiments share a set of base training choices. The authors explore these on French periodicals because the subset is relatively small and because preliminary statistical experiments had indicated difficulty with correcting it. Training can take several hours even on fast graphics processors, so this choice makes the exploration more manageable. The settings chosen there serve the broader comparison.

An embedding is a vector of numbers that represents a character inside the neural system. The authors try vector sizes of 32 and 512 as well as 256 and select 256. They generally tie the input and output embeddings. Tying means that the same character shares its vector on the OCR and reference sides. This lets a character reuse a representation across the two roles it plays in the training pair. The untied alternative gave better detection and worse correction in the authors’ trials. They chose the tied setup for its faster training.

The dropout setting is 0.2. Dropout temporarily withholds some internal units during training, which reduces dependence on any particular set of signals and can help control overfitting. A batch, the group of examples used to compute a training update, contains 100 examples in the chosen setup. The authors also tried batches of 50 and 200. They retain the Nematus defaults for hidden layer size, 1000, and for the Adadelta optimizer, which governs the update of learned parameters. They also keep the gradient clipping threshold of 1 and the learning rate of 0.0001. The former limits the gradient used to guide an update. The latter is a setting for the scale of updates.

The authors set the maximum sequence length to 23 in the isolated setting and to 53 in the setting with neighbouring words. They report that the limits cover 99.99% of training examples. The longer allowance for context accommodates the extra characters the system has to read and generate. Length is part of the experimental design because including neighbouring words changes the size of both sides of the translation pair.

Put the focus word inside a window

The context-sensitive representation gives the translator two words on the left of a focus word and one on its right. Consider the occurrence of font near principes and fondés. The immediate passage gives the system a basis for preferring sont that would be unavailable if it received only the four recognized letters. As the window advances, the same token can appear once as a focus and elsewhere as part of another token’s context. The translation assigned to a particular focus word comes from the window centered on that decision.

A reserved symbol indicates the word boundaries within a window. Its role is to keep the structure of the generated sequence legible when the individual characters have already been separated for the translation software. The authors train the system to reconstruct the complete target window, including the neighbours. They report that this worked better than supplying the same context and asking for only the focus word on the target side. Predicting the surrounding words expands the amount of training material in this representation and makes training slower.

A well-formed translation contains the boundary marker 3 times, so the focus can be located by its position. The authors also need an answer when a translation does not have the expected shape. When that happens, they choose whichever output word is closest to the original focus word by edit distance. This fallback uses resemblance to recover a candidate from the generated string. It is separate from the usual choice of which character should come next during translation.

Vary the training pool and describe its origins

The authors begin with separate pools for the language and document-type combinations. In the setting they call medium, they add the other document type within the language. Newspaper or periodical material can therefore share training with monographs. The large setting also pools across languages. Similar letter shapes in the common script give the authors a reason to expect that the additional examples could be useful. They had also noticed examples of language switching, which means that a collection labelled by one main language can contain strings from another.

Simply mixing examples tells the learner nothing explicit about their origins. The factored neural setup adds categorical information to the source characters. A factor can indicate the document type, the language or an interval of publication years. Nematus embeds each factor as a vector and concatenates it with the character representation. Concatenation places the values next to one another so the input carries both the character and the metadata. The output is still a textual sequence in the reference spelling. Linguistic Input Features Improve Neural Machine Translation

For dates, the paper gives the following rule for the label.

YYYY // 50

YYYY is the publication year, and 50 is the width in years of each interval. The operator // means integer division. It drops the fractional part of the quotient for the publication years at issue. The paper illustrates the factor with label 36 for material dated from 1800 through 1849. In the example, a vertical bar | introduces each factor in the input format. The text-type and time values for the example accompany every source character.

The publication label gives the system a way to condition its response to a character sequence on the period it came from. A familiar shape confusion can be a common source of OCR damage in one period and a much weaker sign in another. A genre or language label can serve a related purpose when examples have been pooled. There is an implementation detail that matters for interpreting the comparison. Nematus did not support the authors’ use of tied embeddings with factors, so the factored systems use separate source and target embeddings.

Give visual similarity and error frequency separate tests

The glyph experiment starts from the idea that OCR confusions can be caused by similar printed shapes. A glyph is a particular drawn form of a character. The authors have no original page images for the dataset, so their approximation uses characters rendered in Helvetica. Each character is represented by grey levels on a grid of 16 by 16 pixels. The authors normalize the values to the range from -1 to 1 and scale them by 0.01, following the scale used for random initialization in Nematus. These values initialize the embedding for the character.

A visual initialization supplies a different basis for similarity than shared linguistic context. Two characters may occupy quite different contexts in text and still resemble each other on a printed page. The glyph experiment gives the learner some representation of that resemblance at the start of training. The same rendering is used regardless of which publication produced an observed character. What varies from case to case is the recognized text. This design puts the usefulness of a general visual starting point to the test.

The error-focused experiment alters the examples instead of the character representation. Most recognized text is correct, so a learner sees many pairs in which copying is rewarded. The authors randomly remove examples without errors to increase the share of training cases that demonstrate a repair. Their initial mixture is 75% error tokens and 25% non-error tokens. They adjust the error share for monographs to 50% for French and 37.5% for English, where the material contains fewer errors to begin with.

Removing correct examples makes errors more prominent while retaining the corrections supplied by the original pairs. It also gives the learner fewer opportunities to practice preserving plausible text. The expected benefit is greater willingness to flag a difference. The corresponding concern is over-correction, where the system makes unwarranted changes or chooses inferior candidates when it does intervene. The paper therefore evaluates this shift against the detection and correction objectives separately.

Combine predictions at two stages

The authors first combine neural predictions during decoding, the process that produces an output sequence. Their ensemble averages the probability distributions supplied by the participating systems. A distribution represents how much support a system gives to the possible next characters. Averaging lets support from several sources contribute before a finished translation has been chosen. All of these decoding experiments use the context-sensitive format.

The authors study two ways to get the distributions. The first combines the best saved state from a training run with the two previous saved states. It is called a single ensemble because its members come from the same run. The paper tests this for the ordinary contextual setup and for the error-focused one. The second, called a multi ensemble, takes the strongest saved states from different training configurations. It draws on the ordinary contextual system, the glyph-initialized system and the error-focused system. Here the members have had access to different training evidence as well as arriving at different parameter values.

The competition entry also combines completed translations, a separate operation from averaging probabilities during decoding. The members can include both statistical and neural systems. For detection, the authors choose five systems for the partition with their combined behaviour on the development data in mind. One test flags the token when the member with the lowest development-set edit distance suggests changing it. Another flags it when the most frequent proposal among the selected systems differs from the original OCR. A separate vocabulary check looks for the original token in reference material from training and development for both document types.

The remaining detection rule looks for an erroneous split. If the current token and its neighbour are absent from the training vocabulary individually but their concatenation is present, the algorithm can flag them for a merge. Translated and original versions can contribute to the check. The rule provides evidence from the surrounding recognized text even in a case where the problem becomes clear only after joining strings. The detector processes the full OCR text because the error positions are unknown for that subtask.

For correction, the organizers supply the error positions. The system uses proposals from five candidates-producing systems selected by development-set edit distance. When the member with the lowest distance proposes a change, the algorithm uses its proposal as the sole repair. Otherwise, it considers the changed forms proposed by the group and assigns weights from the frequency of those proposals. Unchanged outputs do not contribute to that distribution of alternatives. The resulting candidates support a single top choice or a ranked set, depending on the competition scenario being evaluated.

Experiments and results

What goes into the comparison

The material comes from the AmeliOCR corpus and was distributed for the ICDAR 2017 OCR post-correction shared task. English and French are equally represented in a collection of 12M recognized characters with aligned transcriptions. The official training portion contains 10M characters, reported as 83% of the data. The official test portion contains 2M, reported as 17%. The internal experiments use the split made inside the official training portion.

The documents come from the BnF and the British Library and span publication years from 1654 to 2000. Of the documents whose publication date is known, 92% come from the nineteenth century. The source collections differ in document condition and in the recognition and correction processes that produced the data. The collection therefore gives the authors a range of OCR conditions inside a common evaluation, with a sizeable concentration in one period.

The initial error rates show how different the partitions are. For the internal English periodical test set, the raw OCR has a character error rate of 3.47% and a token error rate of 11.28%. For English monographs the corresponding rates are 1.79% and 6.38%. In the French periodical partition the rates are 3.41% and 11.85%, while French monographs have rates of 1.61% and 6.18%. Character rates describe discrepancies at the level of the text’s constituent characters. Token rates reflect how much of the word-level material is affected. Both ways of looking at the internal data give periodicals the higher starting error rate.

The training statistics also describe several kinds of damage. The paper’s alignment-based analysis counts insertions, deletions and substitutions and finds more required character edits in periodicals. The French periodical training total for those edits is 3.43%, against 1.64% for French monographs. On the English side the totals are 3.77% for periodicals and 1.81% for monographs. The paper counts unrecognizable material separately and observes that it is more prevalent in the English data. Those figures describe training material, whereas the raw OCR rates above refer to the internal test sets.

The untouched OCR is the reference point for correction improvement. The learned baselines are the statistical and neural systems with isolated inputs, trained on the corresponding collection. In comparisons within each family, the authors can then examine what changes when they add context, pool data, adjust training or combine predictions. For each internal configuration they average the scores of three realizations trained with the same settings. This is the macro-average reported in the detailed tables. It reduces the influence of the performance of any particular run.

How detection and repair are measured

Detection is evaluated at the token level. Precision is the proportion of flagged tokens that actually require correction. Recall is the proportion of tokens requiring correction that were flagged. A detector can be selective and achieve high precision while finding only a modest share of the errors. A more permissive one can catch additional errors while adding mistaken flags. The paper reports precision and recall and combines them in the harmonic mean.

F₁ = (2 × P × R) / (P + R)

F₁ is the detection F1 score. P denotes precision and R denotes recall. 2 is the constant in the harmonic mean of these measures. × denotes multiplication, + forms the sum of the two measures, and / divides the numerator by that sum. The parentheses group the numerator and denominator, and = gives the value of the score. The harmonic mean is sensitive to a low value on either side. The internal tables display F1 on a percentage scale, while the official results give F-measure as decimal fractions.

For correction, the paper measures how many character edits separate the candidate and the reference. Ordinary Levenshtein distance is the minimum number of insertions, deletions or substitutions that turns one string into the other. The implementation used in the competition also allows the exchange of adjacent characters. That makes it Damerau–Levenshtein distance, even though the shorter name appears in the competition report and tables. The authors average distance over the evaluated tokens and report improvement relative to the raw OCR. They also report the share of translated words that match the reference exactly.

Distance and exact agreement answer different questions about a candidate. A repair that resolves some damaged letters can be closer to the reference even while leaving the word incorrectly spelled. Exact agreement gives credit only for the complete restoration. Results measured in these ways can consequently favour different configurations. The original OCR has a reported relative improvement of 0%, since it is the point of comparison. A negative improvement figure indicates that the evaluated answers have moved farther from the reference by the distance measure.

For the internal results, each output has one correction candidate. The official scoring script also supports a scenario with ranked candidates and confidence weights. In that scenario it adds the candidate distances after weighting them by their assigned probabilities. The official improvement figures discussed for the submission use the leading candidate. The error locations for the official correction subtask are supplied to the entrants.

Detection and correction across the internal partitions

French periodicals illustrate the difference between the families even before adding context. On the internal test, the isolated neural baseline scores 58.21 on detection F1, while the isolated statistical baseline scores 49.62. For relative correction improvement, the statistical baseline gives 16.54 and the neural baseline gives 13.53. At this point neither family has access to adjacent words in the individual example. The comparison shows that choosing the better baseline depends on which decision it is being asked to make.

The context-sensitive statistical system gives the French periodical partition a relative correction improvement of 19.64. The neural ensemble across configurations reaches 19.08, the strongest neural correction result shown for that partition. For detection, the neural ensemble of error-focused checkpoints achieves 65.30 on the same internal test. Its relative correction improvement is 1.40. The ensemble selected for detecting errors would therefore give up much of the correction quality available from other settings.

Relative edit-distance improvement on the internal French periodical test set

The statistical translator with neighbours leads, closely followed by the neural ensemble across training configurations.

Relative edit-distance improvement on the internal French periodical test setIsolated neural baseline: 13.53Isolated neural baseline13.53Isolated statistical baseline: 16.54Isolated statistical baseline16.54Contextual neural translator: 17.32Contextual neural translator17.32Neural ensemble across configurations: 19.08Neural ensemble across configurations19.08Contextual statistical translator (this paper): 19.64Contextual statistical translator (thispaper)19.64
The numbers
System or settingrelative edit-distance improvement %
Isolated neural baseline13.53
Isolated statistical baseline16.54
Contextual neural translator17.32
Neural ensemble across configurations19.08
Contextual statistical translator (this paper)19.64

In the internal English periodical results, the error-focused neural checkpoint ensemble also supplies the highest detection F1 in the detailed tables, at 72.99. For correction, the context-sensitive statistical system records a relative improvement of 41.83. Its reported average edit distance is 0.1339, against 0.1898 for the original OCR. The context-sensitive neural system gives a relative improvement of 34.95, and the neural ensemble across configurations gives 38.68. The latter configuration narrows the correction gap while preserving a strong detection result, one reason the neural variants can be useful members of a combined entry.

English monographs favour another setting for detection. The contextual neural system with a time factor reaches 58.94 F1 on the internal test, whereas the base contextual neural system reaches 54.92. In French monographs, the neural ensemble across configurations scores 58.91. The detection scores of the strongest systems are thus close across the monograph partitions, although the variants giving those scores differ. The time factor is particularly relevant to the distribution of English monograph errors, which the paper examines separately.

The compact table of winners and the detailed results disagree on some monograph correction entries. For French monographs, the compact table pairs a relative improvement of 24.0 with statistical translation using context. The detailed table gives 24.00 to the isolated statistical baseline and 22.15 to the contextual statistical system. The contextual system has the higher exact-correction percentage, at 58.47 against 55.04. For English monographs, the compact table labels its 32.8 result as the statistical baseline. The detailed table records 32.87 for the ordinary neural checkpoint ensemble and 32.25 for context-sensitive statistical translation. Taken together, the detailed results support a general statistical advantage on correction, with the English monograph comparison qualifying any claim that statistical translation leads under every configuration.

How the entry did in the official competition

The submitted Char-SMT/NMT system uses combinations chosen on the internal development material. Some promising configurations in the internal evaluation, including the error-focused checkpoint ensembles, were unavailable at submission time. The competition outcome therefore measures a particular assembled entry, rather than the collection of strongest internal results. Other entrants used approaches including noisy-channel correction, recurrent processing over characters and tokens, and combinations of statistical translation or spelling checks.

The authors’ entry places first in correction. The paper reports that it leads across the official partitions on relative improvement from the top-ranked candidate. Its improvement on English monographs is 43%. On French monographs it records 44%, compared with 23% for EFP and 3% for MMDT. On French periodicals it records 29%. Some submissions produce deterioration in particular partitions, and some comparisons have missing or malformed entries. The correction lead is a result for the submitted repairs at the marked locations.

Detection has a different ordering. The authors’ combination records a mean official F-measure of 0.53. WFST-PostOCR leads the official table at 0.66. EFP scores 0.54 and CLAM scores 0.52. The detection leader uses a noisy-channel approach with vocabulary and sequence statistics from Google Books n-grams. The authors train their own translation systems using the official material. Their competition standing shows what the combination can achieve with those data, while the comparison to the detection leader also incorporates differences in both the resources and the method.

Mean detection F-measure across the official ICDAR partitions

The combined entry scores near EFP and CLAM, with WFST-PostOCR ahead of all three.

Mean detection F-measure across the official ICDAR partitionsWFST-PostOCR: 0.66WFST-PostOCR0.66EFP: 0.54EFP0.54Char-SMT/NMT (this paper): 0.53Char-SMT/NMT (this paper)0.53CLAM: 0.52CLAM0.52
The numbers
System or settingF-measure
WFST-PostOCR0.66
EFP0.54
Char-SMT/NMT (this paper)0.53
CLAM0.52

The official accuracy and recall breakdown gives a more specific view of the detection result. For English monographs, Char-SMT/NMT has accuracy of 0.98 and recall of 0.51 on the measures reported there. Its French monograph figures are 0.74 for accuracy and 0.19 for recall. WFST-PostOCR has recall of 0.82 and 0.59 on those respective partitions. The authors highlight the accuracy of their entry, while the recall values show that it leaves a considerable share of error locations undiscovered.

The paper separately reports that the submitted corrections yield a net improvement on 102 documents. This document count answers a different question from the mean token detection score. It records how widely the benefits of the corrections are felt when the competition supplies the locations. For a workflow that asks reviewers to inspect proposed errors, the detection recall still matters because it governs how much of the damaged text reaches a reviewer in the first place.

What the ablations show

More examples can change what the system learns to expect

The pooling experiments change the composition of the training pool. The test partition stays fixed, so the comparison can reveal whether the additional material helps with the target collection. The premise for pooling is plausible: a stem, letter shape or recurring substitution can appear in more than one collection. The risk is that the extra material changes what the system learns about which errors are common and which inputs typically deserve to be copied.

The English periodical test gives a clear example. For the isolated statistical system, detection F1 falls from 71.17 with the original pool to 61.94 with the same-language pool and 56.47 with the bilingual pool. Relative correction improvement similarly moves from 40.96 to 29.96 and then 25.71. The isolated neural system shows the same direction of change on this partition. Its detection F1 values are 70.61 with the original pool, 61.53 with the same-language addition and 58.04 with the bilingual addition. The extra examples are useful only to the extent that what they teach carries over to the intended collection.

There are exceptions to the overall decline. For French periodicals, the medium statistical setting raises detection F1 to 52.87 from the baseline’s 49.62, while relative correction improvement goes from 16.54 to 16.06. The reverse direction of the measures illustrates what is being pooled. Extra examples can support a better decision about whether a form is suspicious while assigning less useful evidence to the particular repair that should follow. The authors interpret the broader results as a sign that the error distribution of the target text type matters to supervised training.

Labelling the pooled examples sometimes recovers correction quality. For internal French monographs, the large factored neural setting gives relative improvement of 20.11. The isolated large-pool neural setting gives 13.66, and the isolated neural baseline gives 15.00. The result establishes that the large pool can be useful inside a different configuration. The factored setup has several differences from the isolated one, so the comparison supports the combined configuration. The paper also reports that language labels on the full pooled data fail to produce a general gain.

What the errors themselves say about the representation

The data analysis counts how often a particular damaged form appears. After punctuation is excluded, 87.2% of wrong English training tokens and 90.2% of wrong French training tokens occur just once. An approach that associates a whole observed word with a whole repaired word would have little evidence for many of those associations. Character-level translation makes it possible for those examples to reinforce one another if they share a smaller edit.

Frequent reference words illustrate how widely their recognized forms can vary. The paper finds 275 distinct OCR variants of English the and 214 of French de. Several of the most frequent English word errors happen to be different corruptions of the. Seeing many examples of that underlying word does not guarantee seeing a particular corruption repeatedly. The authors also examine recurrent substitutions directly from the alignments. Many are consistent with visual resemblance, and their frequencies vary with language and document type. The two levels of analysis help explain why a recurring character confusion may be learnable even when a complete damaged word is unfamiliar.

The same character evidence has a limit when the damaged form is an acceptable word. The window experiment shows what the neighbourhood contributes. On the internal French periodical test, the statistical system’s detection F1 goes from 49.62 in isolation to 53.71 with context. Its relative correction improvement goes from 16.54 to 19.64. For the corresponding neural comparison the values move from 58.21 to 59.01 for detection F1 and from 13.53 to 17.32 for relative correction improvement. The experiment changes the context on both sides of the training pair. It measures the benefit of reading more of the passage and learning to reconstruct that passage jointly.

Context can also change the pattern of partial and exact repairs. On French monographs, the contextual statistical system’s F1 is 54.18, compared with 52.52 for the isolated baseline. The contextual system has a somewhat worse relative edit-distance result and a better exact-correction percentage. A collection can contain cases where nearby words make the right restoration possible and others where a changed decision leaves more distance to the reference. The paper’s window comparison measures the net result of those effects using each metric.

Dates help when the error profile varies with time

To examine change over time, the authors group English monographs into intervals of 30 years and plot frequent error types. They normalize the counts by the number of files in an interval. The most frequent error around 1800 is reported to occur 1,000 times less often around 1830. Other early errors are also rare in later material. This exploratory analysis uses different intervals from the date factor used in training. Its purpose is to show how unevenly common errors are distributed in time.

A date category can let the learner pick up on those differences. Much of the English monograph material requires relatively little correction, but the authors observe a higher burden of errors in earlier documents around 1800. A system trained without dates must learn one general response to the mixture. A factored system has a way to respond differently given the publication interval. In the internal contextual English monograph comparison, recall is 39.93 without the time factor and 45.04 with it. Precision is 87.97 without it and 85.31 with it. F1 rises from 54.92 to 58.94.

On the same partition, relative correction improvement is 31.27 for the contextual base and 28.77 with the time factor. The paired outcomes support the authors’ interpretation that dates can alter how readily a system tries to correct the text. A willingness to act on an earlier document gives the detector a chance to flag a larger share of its errors. The quality of the new suggestions still depends on what the system has learned about the individual strings. The time factor also changes the embedding setup, which limits how specifically the outcome can be attributed to the date feature alone.

Visual initialization has a modest effect

The glyph experiment tests a readily available approximation to printed shapes. The authors report small gains for monographs over random initialization and slightly weaker results for periodicals. The internal French monograph table gives a sense of the scale. Detection F1 is 57.00 in the glyph setting and 56.85 for the ordinary contextual setup. The corresponding relative correction improvements are 18.73 and 18.26. On French periodicals, the glyph setting has an F1 of 58.03 and a relative correction improvement of 16.45, compared with 59.01 and 17.32 for the ordinary contextual variant.

The result addresses Helvetica pixel values used as initial character vectors. A historic page may contain the same encoded character in a shape far from that rendering. Many of the confusions the method is supposed to explain depend on the shape at the time of recognition. The authors suggest that a more representative typeface or a different way of incorporating the shape vector could change the outcome. The mixed comparison gives a limited measure of the tested initialization, with room for a different treatment of visual information.

Focusing on errors changes detection and correction together

Sub-sampling correct examples has pronounced effects in periodicals. On the internal French periodical test, the ordinary contextual neural system has recall of 44.26 and precision of 88.53. With error-focused training, recall is 60.72 and precision is 67.47. The detection F1 rises from 59.01 to 63.91. Relative edit-distance improvement goes from 17.32 to -1.32. The training change improves the combined detection score by finding a much larger share of errors, while the resulting repair candidates as scored by distance are worse than the raw OCR.

For English monographs, the same broad training intervention gives a different detection outcome. Recall on the internal test reaches 50.81 with error-focused training, compared with 39.93 for the ordinary contextual system. Precision falls from 87.97 to 50.51. Accordingly, detection F1 is 50.60 in the error-focused setting and 54.92 in the ordinary one. The close values for precision and recall in the error-focused setting illustrate that balance alone does not guarantee a stronger harmonic mean. The levels at which the two measures meet matter.

This comparison also changes the number of examples available to the learner. Removing a correct pair both raises the share of errors and takes away evidence about which forms to preserve. The experiments show what this joint change does at the chosen training proportions. They provide a reason to treat the proportion as a setting to investigate separately for a new collection, particularly when the original OCR is already relatively clean.

Ensembling usually improves the candidates available

Averaging predictions from different checkpoints of the same training run frequently improves correction. The paper suggests that the checkpoints can offer complementary candidates. For the error-focused French periodical system, the checkpoint ensemble raises internal detection F1 from 63.91 to 65.30. Its relative correction improvement is 1.40, compared with -1.32 for the individual setup. The combination recovers some quality lost through error-focused training, while ordinary contextual candidates remain stronger on correction.

A shared tendency to over-correct can survive this procedure. For internal English monographs the individual error-focused system gives -6.01 relative edit-distance improvement, and its checkpoint ensemble gives -6.31. The neural distributions being averaged come from training on the same sub-sampled material. Their agreement can reflect the same bias toward making a change. The result shows that the benefit depends on what differences the saved states actually contribute.

Mixing neural configurations gives the ensemble another source of variation. The English periodical multi ensemble reaches 72.30 for detection F1 and 38.68 for relative correction improvement. The base contextual neural system gives 71.46 and 34.95, respectively. The statistical system with context still gives a higher correction improvement of 41.83. At the competition stage, combining completed candidates made it possible to use the strengths of statistical and neural systems together. The paper tests the outcome of the assembled entry. The individual contribution of each voting, vocabulary or merging rule remains unresolved.

Limitations

Limits stated by the authors

The organizers’ correction task begins with known error locations. The paper calls attention to the distance between that setup and an ordinary digitization workflow. In unmarked OCR, a system first has to decide which parts to change. A wrong decision can damage text that was recognized correctly, and a missed decision leaves real errors in the collection. First place on correction consequently establishes performance conditional on supplied locations. The separate detection results indicate one of the constraints on using the submitted approach for a complete pass.

The competition comparison also leaves a question about resources. The leading detector uses external sequence statistics, while the authors’ translation systems use the official training data. The authors suggest that external material could help detection. The leaderboard compares whole systems, so it cannot determine how much of the detection leader’s advantage came from the extra material. A further issue is the relationship of external evidence to the repair target. Evidence that a word looks unusual can help identify a candidate location while still taking the system only part of the way to restoring the historical form.

The authors describe building and tuning multiple candidate-producing systems as laborious. They simplify the design in a post-submission experiment, and they acknowledge that the combinations of techniques were not exhaustively searched. They also propose reducing the supervision systematically in future comparisons. Their pooling experiments add examples from different origins. A study of shrinking the training portion would answer a different practical question, how the same approach behaves as the supply of aligned examples decreases.

The paper identifies several unresolved choices inside the system. The error-enriched training proportions could be tuned more carefully. The context experiment studies one allocation of preceding and following words. The authors propose investigating other representations of context and using glyphs closer to the historical typefaces. They also suggest training on narrower date ranges, giving 1800 to 1850 as an example. These proposals follow from the variation they observe, rather than from measured gains for those further alternatives.

Limits implied by the experimental setup

The internal comparison uses a random division of the official training data. Its estimates therefore describe held-out performance inside the ICDAR collection. A test that held out a source collection, recognition engine or particular publication period as a unit would address a different kind of transfer. The different partitions in the paper establish that the same design can perform unevenly within the available material. They leave performance on a wholly unfamiliar collection open.

Date, language, genre, typeface and collection history can vary together. The English monograph time plots show that the characteristic errors change with publication date. The absence of page images means that the authors cannot connect those changes to particular fonts or document conditions. A date factor can pick up regularities associated with publication years without giving a causal account of those regularities. The required shift to untied embeddings means that the factor experiment also changes the input and output representations along with the information supplied to the translator.

Removal of unrecognizable text sets a boundary on what the scores cover. The comparisons use passages for which the reference can support a correction decision. Hyphen discrepancies are likewise outside the scores, although hyphens are in the training material. Such decisions make the reference more consistent for evaluation. They also leave open how the systems behave on the underlying problems of uncertain readings and inconsistent punctuation in a full digitization workflow.

Finally, the hyper-parameter exploration is concentrated on French periodicals, and the internal tables report averages from repeated training. This makes the comparisons feasible and reduces the influence of individual runs. It leaves uncertainty about whether the small differences between some settings would recur with another division of the data or after equally extensive tuning on another partition. Larger shifts, such as the recall changes under error-focused training, show a clearer change in behaviour within the experiment. They still belong to the particular data and proportions used to obtain them.

What came after

The authors report a follow-up experiment conducted after the competition submission. They wanted a configuration that could be built for a new dataset without assembling the full set of systems used in the official entry. Within each language, they pooled periodicals and monographs and used the contextual representation. They attached document type and publication interval as factors so that the single configuration could still respond differently to material from different sources. This brought together the ideas that had shown promise individually in the internal experiments.

The simpler system scores 0.52 for mean detection F-measure on the official data, close to the competition entry’s 0.53. Its relative improvement from the top correction candidate on English monographs is 18%, compared with 43% for the assembled submission. On French monographs it reaches 40%, while the submitted combination has 44%. The practical cost of simplification therefore varies across the test partitions. It is especially visible on English monographs, even as the overall detection measure remains close.

That experiment is the follow-up result documented here. Subsequent citing studies are unrepresented, so there is no later empirical result to report on whether narrower date ranges, different context representations or richer visual information improved the approach.

Cite

Cite as Chantal Amrhein and Simon Clematide. 2018. Supervised OCR Error Detection and Correction Using Statistical and Neural Machine Translation Methods. LDV-Forum/Journal for language technology and computational linguistics.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.21248/jlcl.33.2018.218

@article{amrhein2018supervised,
  title = {{Supervised OCR Error Detection and Correction Using Statistical and Neural Machine Translation Methods}},
  author = {Chantal Amrhein and Simon Clematide},
  journal = {LDV-Forum/Journal for language technology and computational linguistics},
  year = {2018},
  doi = {10.21248/jlcl.33.2018.218},
  url = {https://doi.org/10.21248/jlcl.33.2018.218}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/amrhein-2018-supervised-ocr-error-detection-correction/