Post-OCR Correction of Digitized Swedish Newspapers with ByT5
Paper · 2024 · Viktoria Löfgren and Dana Dannélls
Summary
Optical character recognition, or OCR, turns a scan into text that readers can search and researchers can analyze. When faded type, stains or ink from another page interfere with recognition, the resulting text can hide words that a reader can still make out in the scan. There is another difficulty in historical Swedish newspapers. A spelling that seems unusual today may faithfully represent the original printing. Löfgren and Dannélls investigate whether a correction stage can repair the recognition errors while retaining the text that actually appeared in the newspaper.
For their work, the authors rely on the pretrained ByT5 system, which takes in and generates text in byte sequences. A damaged or unfamiliar word still reaches the system with its surviving letters intact. To teach ByT5 the task, the authors match short stretches of machine-read text with human transcriptions of the same material. They compare newspaper-only training with two mixtures, one supplemented by Swedish literature and the other by older blackletter texts. All three versions are evaluated on reserved newspaper passages from the period 1818–2018. The inputs come from Tesseract and Abbyy Finereader.
Across the full newspaper evaluation set, the blackletter mixture brings character error rate down from 3.20% for raw OCR to 2.04%, a reported reduction of 36%. Training on newspapers alone gives the lowest word error rate, 7.17% against 13.21% before correction, a reported reduction of 46%. The version trained with literature has the highest overall error rate among the corrected versions at both levels. Some of the clearest improvements occur in the earliest newspapers, where the starting text also has the most recognition errors.
Even the version with the lowest overall character error rate increases that rate in 7.7% of evaluation samples. In one passage, a promising restoration of a word about the king appears alongside an incorrect repair elsewhere in the same fragment. The system works from the OCR string, so the confidence the recognition engine assigned to individual characters is unavailable to it. The authors made the blackletter version freely available with a demonstration and announced plans to incorporate it into Språkbanken Text’s automatic processing pipeline.
Deep dive: Post-OCR Correction of Digitized Swedish Newspapers with ByT5
Löfgren and Dannélls test ByT5 on Swedish newspaper OCR and find that blackletter training helps most at the character level. · about 31 minutes to read
The problem and its context
What has to survive digitization
The useful output of OCR is a sequence of characters that represents the printing. For information retrieval and search, that representation determines whether the words on a page can be found through its transcription. If a recognizable word in the scan ends up as an unrelated sequence of characters, a search that relies on the expected spelling may miss the page. The same discrepancy has consequences when the plain text is read on its own or used as input to natural language processing. An error made during recognition can affect any later operation that depends on those characters.
The paper identifies familiar sources of recognition trouble in old documents. Printed strokes may have faded, marks on the paper can interfere with the letter shapes, and ink from another page can show through. The newspaper collection also spans changes in typography. Much of its earlier material was set in blackletter, which the authors associate with lower recognition accuracy and error patterns that differ from those of modern typefaces. A correction stage applied to the resulting text encounters the effects of all these conditions in the same form. It receives whatever characters the recognition engine chose to output.
Accuracy also has a historical meaning. The authors identify the reforms of 1889 and 1906 as important in settling contemporary Swedish spelling. The newspapers contain forms from before and after those reforms, including hvad and vad for ‘what’, and qvarn and kvarn for ‘mill’. If qvarn is what the source says, producing kvarn changes a faithful transcription. A procedure that treats familiar present-day spelling as the safest output would have trouble with cases like this. The human reference supplies the criterion that matters in this experiment, namely the form associated with the particular passage. This distinction matters when spellings themselves are evidence for historical linguistics and language change.
The difficulty is particularly clear when a genuine historical form and a recognition error occur in the same stretch of text. Unfamiliarity offers a weak guide to which characters need attention. An older word can arrive intact, and a common word can arrive with stray punctuation or unusual capitalization. Recognition can also produce a perfectly possible Swedish word in a place where the newspaper used another one. The correction problem includes deciding when the input already deserves to be preserved. A successful training pair can demonstrate that decision by having the same form at the corresponding position in the OCR and the reference.
What earlier Swedish work tried
The Swedish studies discussed by the authors drew evidence from several places. Persson combined a word list with a support vector machine, a classifier used to identify and correct recognition errors in material from the seventeenth through nineteenth centuries. The word list supplied information about attested forms, while the classifier helped decide how to handle an apparent error. This gave the procedure an explicit way to work with candidate words in a collection whose vocabulary and spellings differed from modern usage.
Dannélls and colleagues explored a way to improve recognition by merging readings from different OCR engines. Two engines processing the same print can disagree about its characters. If one preserves a word that the other damages, the second reading gives the merging procedure evidence it would otherwise lack. That earlier project also produced the newspaper reference material used by Löfgren and Dannélls. In the ByT5 study, each OCR reading becomes an input example in its own right. The human transcription links the readings to a common target, while generation proceeds from the particular reading supplied to the system.
Lundberg and Torstensson investigated whether the newspaper reference material could support training a recurrent system from scratch. They used an LSTM, which processes a sequence with a state that carries information forward as it reads. The reference collection proved too small to give satisfactory results with their approach. This is a practical constraint in historical digitization. Machine output can be abundant, but each example that directly teaches a repair requires a corresponding reference. The paper uses this earlier experience to motivate starting OCR training with a system that has already learned from other text.
Other Swedish work combined convolutional processing with recurrent sequence processing in a CNN–LSTM hybrid. As described by Löfgren and Dannélls, Drobac and Lindén obtained strong historical newspaper results in Finnish and Swedish with this family of techniques. Brandt Skelbye and Dannélls used a related hybrid to improve the character recognition component inside a Swedish OCR engine. The position of that intervention matters when reading the literature. Changes inside the engine affect how a page first becomes a string. The ByT5 procedure takes that string as its starting point, which lets the authors ask how much improvement a separate stage can deliver after recognition.
Why learn from pairs of strings?
The paper frames correction as an application of the input-to-output setup familiar from machine translation. In this application, a faulty Swedish reading is the input and a faithful Swedish transcription is the desired output. The resemblance lies in learning a transformation from paired sequences. The two strings frequently share much of their content. A system can draw on nearby words to interpret a damaged form while learning that the surrounding text frequently needs to pass through as it stands. The paired examples specify the target for those choices without requiring a manually written rule for each type of corruption.
The authors point to neural translation approaches to OCR repair in Icelandic, English and Finnish. The Finnish study also considers spelling normalization, a task with a target that can deliberately differ from the historical form. The winning approach at the 2019 ICDAR post-correction competition was trained on a set of European languages that excluded Swedish. These studies established reasons to try sequence generation for repair, while leaving the question of its performance on Swedish newspaper material open. An Unsupervised Method for OCR Post-Correction and Spelling Normalisation for Finnish
The survey cited by the paper reports that neural translation approaches often perform well but can depend on substantial training data. Pretraining changes what the paired examples have to teach. A system that has previously processed large quantities of text arrives with parameters already adapted to patterns in language. The newspaper pairs can then specialize those parameters for a job with specific input defects and output requirements. Löfgren and Dannélls chose a system built on the Transformer and attention architecture. The paper presents that family of systems as a promising response to the data constraint encountered in earlier Swedish work. Attention Is All You Need
Why the size of the input unit matters
The choice of ByT5 also concerns tokenization, the way text is represented as units for processing. The paper illustrates the issue with HandelstidniDgens, a newspaper name distorted by recognition, and hvalfisken, an older spelling. A word-level vocabulary may lack both strings. If the representation assigns an identical unknown-word token to every absent entry, the strings become indistinguishable at those positions. In the first case, that would discard letters that could point to a repair. In the second, it would discard the historical spelling the system may need to reproduce.
Subword tokenization can retain more of a word by dividing it into smaller pieces. The illustration in the paper uses whole words, sub-words and individual characters to show the difference in granularity. ByT5 takes the finer-grained approach down to the bytes of the encoded text. Whatever the status of a particular word in Swedish, its observed bytes can still be represented. This makes the surviving details of a corrupt word available when the system generates the output. It also gives an intact rare form an exact representation. Sequences expressed this way are longer than sequences in which whole words or groups of letters can each occupy a position.
The paper cites earlier uses of ByT5 or its fine-grained approach in transliteration, in mapping written forms to speech sounds, in recovering diacritics and in Sanskrit OCR correction. Those tasks share a dependence on distinctions within words. In the Swedish study, the authors combine that representation with evidence from newspaper passages whose reference readings are known. The same choice of representation applies to every version they test. The main experimental choice is which sources of paired text to show ByT5 while it learns the correction task.
The method, step by step
The input and the target
During training, ByT5 receives a short extract of OCR output and is trained to generate the matching transcription. During evaluation it receives the OCR alone. The transcription is retained independently so that the generated string can be scored. This arrangement gives a straightforward interpretation to a gain. The output is closer to a reference reading of the same printed passage than the uncorrected OCR was. It also makes preparation important, because the intended comparison makes sense only if each input and reference cover corresponding text.
The unit presented to ByT5 can contain both readable and damaged material. Generation gives the system room to change the length of the output as well as its individual characters. A missing character can be supplied, a spurious mark can disappear, and an intact phrase can be reproduced. A loose pairing would turn that flexibility into a problem for learning. An extra line in the reference could look like text the system was supposed to supply from context. Line alignment gives the authors a way to construct pairs in which disagreements can serve as evidence about recognition errors.
From newspaper OCR to a scored correction
The steps in order.
The newspaper material and the supplements
The newspaper reference material was drawn from a portion of the National Library of Sweden’s digitized holdings that had been transcribed by hand. The underlying collection covers 400 newspaper pages printed over 1818–2018. Layout analysis identified almost 44,000 text segments on those pages. This is the stage that locates portions of text on the page and supplies material for later pairing. The authors report OCR produced by Tesseract and Abbyy Finereader for each original segment. A segment can therefore have two machine readings with different mistakes and a reference against which either reading can be checked.
The publication span brings a variety of printing and spelling into the data. This is relevant to supervision because training examples can contain old spellings as intended output, and the system can encounter OCR errors on several kinds of print. It is also relevant to evaluation. Newspaper passages from widely separated dates may pose different problems, even though they are all part of the same collection. The authors preserve that temporal distinction in their results by reporting separate publication bands alongside the full-set numbers.
The Swedish Literature Bank supplied 79 titles, covering 1836–2001. The paper describes this collection as about 7.3M characters. Its dates overlap much of the newspaper range, which is why it was selected to provide further examples of Swedish writing, particularly for the nineteenth and early twentieth centuries. The authors report substantially cleaner OCR for the literature and suggest that printing quality and simpler layout may account for it. For the correction task, this means the supplement offers examples of Swedish from relevant periods with a different distribution of recognition problems.
The other supplement combines Swedish fraktur and Then swänska Argus. The former contains material from 199 pages in the collections of Gothenburg University Library and spans 1626–1816. The latter covers 1732–1734 and contains 25 issues of Olof von Dalin’s periodical. Both pair OCR with a reference reading and use blackletter print. Including them was intended to give the system further examples of errors associated with that kind of type. Their dates precede the newspapers in the evaluation, so the reason for including them was the recognition problem they might share with the oldest newspaper material.
These supplementary sources were chosen with different kinds of relevance in mind. Suppose a training example gives the system an attested sequence of Swedish words from a time close to the target newspapers. It can contribute a plausible reference phrase even when its OCR input is already quite good. An example with several blackletter recognition errors may instead demonstrate the transformation from a damaged sequence to a faithful reading. Both fit the same training format. The expectations for what they would add came from their dates, source material and OCR quality.
Matching lines before cutting passages
The starting OCR and reference text cannot simply be assumed to correspond at every line break. The authors use an adaptation of Myers’ difference algorithm to match lines. A difference algorithm ordinarily finds correspondences across sequences and identifies where they diverge. In this adaptation, exact equality is relaxed when the elements being compared are lines. The procedure can accept a line from the OCR and one from the reference as corresponding when the character error rate for the comparison falls below a threshold. The authors adjust this threshold manually for each dataset.
Character error rate, abbreviated CER, expresses the number of character edits needed to reach the reference in relation to the number of characters in that reference. A character edit can replace an incorrect character, remove a surplus one or add one that is missing. Judging line correspondence by this measure allows many of the useful imperfections to survive alignment. An OCR line can be recognizable as the reading of a particular printed line even if several of its letters are wrong. That correspondence is what makes the imperfect reading useful as an input.
The choice involves a balance within the preparation procedure. A strict line-matching criterion can exclude genuine pairs when the OCR has badly damaged the line. A permissive one can allow lines with different content to be treated as counterparts. In the latter case, training can reward generation that removes or supplies textual material for reasons unrelated to character recognition. The matching procedure is meant to identify lines present on both sides so that subsequent short extracts have a meaningful common scope.
The aligned material is cut at line breaks into passages that are typically 1-2 lines long. A short pair gives the system some neighboring words while keeping the correspondence between OCR and reference manageable. The result is a different unit from the layout segments that describe the original collection. A layout segment can contain material for more than one short passage, and the same underlying text has readings from both engines. The prepared sample counts describe the records supplied to training or scoring, whereas the earlier counts describe the pages and segments that supplied the text.
After segmentation, each candidate pair must satisfy separate filters. Each side has to contain at least four characters. CER must be below 50%, and the reference must be free of @, the mark used for illegible text. The length rule sets a minimum amount of material for each string. The error filter removes pairs with very large differences. The illegibility rule excludes material for which the reference itself signals uncertainty. The CER rule at this stage is a filter on complete short pairs. The dataset-specific threshold used earlier decides when lines count as corresponding for alignment.
Dividing up the examples
The authors randomly divide the newspaper samples into train, test and evaluation splits, with shares of 70%, 15% and 15%, respectively. The reported counts are 125,637 training samples, 26,456 test samples and 26,960 evaluation samples. One deliberate grouping rule concerns the two OCR versions. The Tesseract and Abbyy Finereader readings of the same newspaper sample go into the same split. Otherwise the procedure could encounter one representation of a passage while training and be evaluated on another representation with substantially the same target text.
The evaluation split supplies the main measurements in the paper. The separately named test split belongs to the dataset breakdown. The published newspaper error rates discussed below are calculated on the evaluation split, which has gone through the same alignment and filtering procedure as the training material. This keeps the task comparable on both sides of the split. It also means the scores pertain to the selected kinds of passages that the preparation can match and admit.
The literature and combined blackletter material are each divided into train and test, with 85% assigned to training and 15% to test. The resulting literature splits contain 63,867 and 11,271 samples, respectively. The corresponding blackletter counts are 4,881 and 861. The evaluation holds its target fixed on newspapers. A contribution from literature or blackletter is therefore judged by whether a version trained with that supplement produces more accurate newspaper text. The experiment consequently gives the supplemental sources the role of training evidence for the newspaper task.
Encoding and fine-tuning
All versions start from byt5-small. ByT5 was pretrained on mC4, a large multilingual collection derived from the web. That stage supplies the shared starting parameters for this experiment. The subsequent fine-tuning teaches the system to produce the kind of transcription paired with damaged OCR. The paper cites the mT5 work in connection with the multilingual collection used for pretraining. mT5
ByT5 represents the input and output with UTF-8 bytes. Bytes and written characters are distinct units in this encoding. Some characters fit in one byte, while Swedish letters such as å, ä and ö take more than one. This distinction matters at both ends of the experiment. The size of the text presented to ByT5 is governed by bytes, while the main fine-grained score is calculated on characters. A change involving a Swedish accented letter can therefore occupy multiple byte positions during generation and still be assessed as a character change when comparing decoded strings.
The maximum input length and maximum output length are each 128 UTF-8 bytes. In Swedish, the actual amount of text that fits depends in part on which letters occur. Two passages can have the same number of written characters and require different numbers of bytes. The length setting thus defines how much of a passage can be presented in one input and how long an output the system can produce under the setup. The neighboring text available to guide a repair comes from the short, aligned sample within that budget.
The authors use the Trainer API in Hugging Face’s Transformers library. Training runs for three epochs, with an epoch representing a pass through the training data. They use Adafactor to update the trainable parameters and set a constant learning rate of 0.001. The learning rate governs the scale of those updates and remains fixed during fine-tuning. The paper describes these choices as following earlier fine-tuning practice for ByT5 and T5. Transformers, Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
A batch contains 32 examples. The paper expresses the byte-token capacity implied by the batch size and the sequence limit as follows.
128 · 32 = 2¹²
Here 128 is the maximum length of a sequence in UTF-8 bytes and 32 is the number of examples in a batch. The centered dot means multiplication. The equals sign relates that product to the capacity written on the right, where 2 is the base and the raised ¹² is its exponent. The equation uses the configured maximum length. Individual passages can be shorter than that limit.
The three training mixtures and the decoding step
The first version uses newspaper training passages alone, described in the paper’s account of fine-tuning as 126,000 samples. The second keeps that material and adds the literature supplement, for a stated training size of 190,000 samples. The third keeps the newspapers and adds the blackletter supplement, for a stated size of 131,000 samples. These are the training totals as presented in the discussion of the three variants. The split counts specify how many examples each source contributes. All versions retain the same newspaper training material, so the experiments compare each addition with the same starting collection.
On evaluation, the system generates a proposed transcription by greedy decoding. At each step it selects the available token with the highest probability, using the input and progress through the output to decide what follows. That token becomes part of the generated text as decoding continues. Greedy decoding commits to each local choice as it goes. Its probability judgment comes from training and the passage in front of it. The reference remains outside the generation process so that it can supply a separate check of what the system produced.
The complete generated sequence is then compared with the reference text. The Python library jiwer supplies the character and word error calculations. Using the same scoring procedure for the original OCR and for each corrected output makes it possible to ask both whether post-correction helps and which training mixture performs best. Since generation can make changes throughout a passage, the score covers the full output, including the text that the engine had already recognized faithfully.
Experiments and results
What the two measures count
The baseline is uncorrected OCR on the reserved newspaper passages. For a given input, the evaluation compares that original reading and each of the generated alternatives with the same human transcription. This is the direct test of the post-processing stage. Its starting point is the OCR an archive already has, and its measured outcome is how closely the proposed text agrees with the reference. The evaluation covers 26,960 prepared samples, from newspaper material dated 1818–2018, and includes the readings made by both engines.
CER registers edits at the character scale. Word error rate, abbreviated WER, counts the corresponding edits when the units are words. In both cases, the count is expressed relative to the reference length in the unit being scored. Complete words and individual characters provide different views of the repair. A corrupted word may become much closer to the reference through changes to several letters and still require a word replacement to match it exactly. A repair that completes a nearly correct word may have a large effect for that word’s status while changing very little at the character level.
The measures also treat additions and omissions as part of accuracy. This matters for a system that generates a new sequence from the OCR rather than choosing among fixed substitutions at positions supplied in advance. It can restore a missing part of a word, but it can also introduce extraneous text or change word boundaries. Character and word comparisons register the effects at their respective scales. Neither rate by itself identifies which parts of the text were important to a reader or why a particular edit was made.
Results across the newspaper collection
Every version lowers full-set CER compared with the raw OCR rate of 3.20%. The lowest error is 2.04%, from the training mixture that includes blackletter, and the authors describe the change relative to the baseline as a reduction of 36%. Newspaper-only training comes close at 2.06%. With literature added, the rate is 2.20%. The ordering puts the smallest supplemental training source first on the character measure. Newspaper-only training also accounts for substantial improvement over raw OCR, which is evident in the proximity of its result to the best observed score.
Character error on the full Swedish newspaper evaluation set
The blackletter mixture has the lowest character error, with newspaper-only training close behind.
The numbers
| System or setting | CER % |
|---|---|
| Original OCR | 3.20 |
| Newspaper training | 2.06 |
| Newspaper and literature training | 2.20 |
| Newspaper and blackletter training (this paper) | 2.04 |
The overall word scores favor newspaper-only training. Its WER of 7.17% compares with 13.21% for the original texts, a decline that the paper reports as 46%. The blackletter mixture scores 7.23%, followed by 7.42% for the literature mixture. Thus all three variants improve word accuracy across the collection, and the strongest result at this scale comes from specializing on the target domain. The blackletter version remains close enough in the reported results that the criterion for choosing between the variants deserves to be stated explicitly. It was the character error criterion that favored the version the authors released.
Word error on the full Swedish newspaper evaluation set
Newspaper-only training leads on word error, and both supplemental mixtures improve on the original OCR.
The numbers
| System or setting | WER % |
|---|---|
| Original OCR | 13.21 |
| Newspaper training (this paper) | 7.17 |
| Newspaper and literature training | 7.42 |
| Newspaper and blackletter training | 7.23 |
The paper relates the magnitude of the Swedish gains to previously reported historical Icelandic results obtained with byt5-base, a larger ByT5 variant. The authors take that comparison as an indication that the smaller starting point can be sufficient for this application. The figures for Sweden come from a common evaluation of the three training variations and their raw inputs. The connection to Icelandic is contextual. The Swedish experiment has no size comparison on those same passages, and the earlier results concern a different language and collection.
The earliest newspapers
The evaluation band dated 1818–1859 has the highest baseline errors. Raw OCR in that band reaches 8.39% CER and 32.46% WER. The blackletter mixture gives the lowest character error, at 4.30%, followed by newspaper-only training at 4.39% and the literature mixture at 4.63%. By character error, this is the period in which the improvement most closely matches the original motivation for adding blackletter examples. The earliest material starts out more damaged than any of the later bands, so even the best corrected character score for this group leaves appreciable differences from the references.
For those same passages, newspaper-only training gives the lowest WER, at 15.34%, followed by blackletter at 15.54% and literature at 15.80%. The paper’s full-set division between the best character score and the best word score therefore also appears in this early band. A reader interested in faithful whole words would choose a different winner from a reader comparing edits at the character level. This result supplies an example of why the overall change in OCR quality is easier to characterize when both rates are reported.
The picture shifts in 1860–1899. The original OCR has a CER of 4.04% and a WER of 16.51%, and the newspaper-only version ranks first on both measures, with 2.29% CER and 8.06% WER. The blackletter mixture reaches 2.38% CER and 8.22% WER, and the literature mixture reaches 2.61% CER and 8.63% WER. These observations give an important boundary to the earliest-period finding. Newspaper-only training leads in the next chronological group, even though the nineteenth-century collection contains much of the blackletter printing that motivated the supplement.
The twentieth century and the most recent material
The original OCR in the 1900–1939 evaluation band has 2.60% CER and 11.24% WER. Here the blackletter mixture ranks first on both measures, reaching 1.92% CER and 6.99% WER. The literature variant reaches 1.97% CER and 7.08% WER, while newspaper-only training gives 2.01% CER and 7.03% WER. The closeness of the corrected figures shows that a small change in ranking can coexist with improvement over the same raw text for each system. It also makes this band an example in which the literature version has a competitive character result in spite of its weaker full-set showing.
The 1940–1979 period has a raw CER of 1.46% and WER of 6.45%. The blackletter mixture again gives the lowest values, with 1.29% CER and 4.39% WER. Newspaper-only training reaches 1.39% CER and 4.43% WER. An exception to the character-level improvement appears with the literature mixture. It has 1.49% CER, higher than the raw OCR for that period, even as its WER improves to 4.54%. A period can consequently show a measurable word benefit alongside a character setback for the same corrected output. The scores establish the directions of the changes without identifying the particular repairs that produced them.
The 1980–2018 band begins with the cleanest OCR of the publication bands, at 0.83% CER and 3.74% WER. Newspaper training alone gives the lowest CER, 0.67%. The corresponding rates with literature and blackletter are 0.75% and 0.73%. The three corrected outputs each have a reported WER of 2.67% for this period. The word comparison is tied at the precision shown in the paper. Character scoring still distinguishes the settings. In practical terms, the low starting rates indicate that much of the job in this band consists of carrying already faithful material into the output.
Taken together, the period results show that correction brings large practical changes to the early material and can still lower errors on recent newspapers with better initial recognition. The authors suggest that older OCR mistakes may follow patterns that are easier to learn. They also consider it plausible that historical Swedish was sparsely represented in pretraining. The period findings are compatible with both ideas. The experiment measures agreement with references across dates. It leaves the frequency and predictability of error patterns, and the historical composition of the pretraining material, unmeasured.
A repair judged word by word
The paper illustrates the choices made during generation with a passage about the king’s recovery. The relevant word in the raw OCR appears as ko»unqen«. The reference has konungens. The version trained with blackletter recovers the letters of that word in Konungens, leaving a capital initial where the reference has lower case. The other versions produce different forms. The example distinguishes a striking recovery of the underlying word from full agreement with the reference. A human reader can recognize the repair, and a character comparison still has a remaining disagreement to register.
Elsewhere in the same fragment, the form alk corresponds to att. The newspaper-only and literature variants recover att. The blackletter version gives all, retaining a different word from the intended one. The same system that handles the severely damaged form referring to the king can therefore make a worse decision at another nearby location. A training mixture’s error rate summarizes many such local decisions. Its ranking gives the overall balance of the edits and cannot predict that it will make the better choice at each point in a particular sentence.
The passage also includes an OCR reading of sä where the reference has så. Newspaper-only training produces få in that position. The output is a plausible Swedish word whose meaning differs. Since the correction is generated from a passage, fluency or familiarity can accompany a departure from the printed source. This is one reason the authors judge the output against a transcription. The short sample provides a concrete instance of competing repairs without supplying evidence about how often the same substitutions occur elsewhere.
The authors find that the blackletter version raises CER in 7.7% of the newspaper evaluation samples. This is a count of passages moving in the wrong direction on the character measure, expressed as a share of samples. The full-set CER describes the amount of remaining character error over the evaluation material. A passage can enter the group with worse CER after a small deterioration, while a large repair elsewhere makes a larger contribution to the collection-wide reduction. The two measures capture different consequences of applying correction to every eligible passage.
What the ablations show
The data mixture is the controlled change
The paper’s closest counterpart to an ablation is its comparison of alternative fine-tuning data. The starting ByT5 version, training settings, decoding procedure and final evaluation collection are shared. Each supplemented training set retains the newspapers, which lets newspaper-only training serve as the comparison for either addition. The question is how the whole procedure responds when the authors provide another source of aligned OCR and reference text. The experiment offers direct evidence about the three mixtures used in the paper.
Adding literature was intended to give ByT5 further exposure to Swedish from periods represented in the newspaper collection. The resulting variant lowers both overall error rates below the raw baseline and trails the other corrected variants on both. Its relatively good character score in 1900–1939 indicates that the outcome varies with the subset. In 1940–1979 its character score exceeds the raw OCR error rate while its word score improves. The data therefore support a specific conclusion about the addition as tested. Extra literary text from an overlapping time range did not produce the strongest overall correction of newspaper OCR.
Adding the much smaller blackletter source yields the best observed CER overall and in 1818–1859. This fits the idea that examples of blackletter OCR mistakes can help with early newspaper transcription. Newspaper-only training still gives the best WER in that earliest band and across the full evaluation. The next nineteenth-century band favors newspaper-only training at both scales. The blackletter variant also leads in bands extending into the twentieth century. Those observations support some value for the added material under the chosen training setup, while leaving the distribution of that value across actual blackletter passages unresolved.
What else changes when material is added
The experimental change combines the source and amount of training data. Literature adds 63,867 training samples and blackletter adds 4,881. With the training duration set in epochs, the versions consequently work through different quantities of material. The corpora also differ in typography, publication period and typical OCR quality. The paper has no equal-sized comparison in which each of these properties varies independently. Evidence for the performance of a mixture is therefore stronger than evidence about which characteristic of its supplement caused the performance.
Cleaner literature OCR is one plausible part of the story. Pairs with few recognition errors frequently offer examples of text that should be carried over, alongside the linguistic exposure provided by the reference. Pairs with more difficult recognition can give the system different examples of what to change. The authors suggest that the large non-newspaper component may help explain the literature variant’s weaker scores. The experiment gives no separate estimate for the contribution of OCR quality or of the amount of literature. A mixture with another balance would pose a different experimental question.
There is a corresponding issue with the blackletter hypothesis. Publication date is the variable used to group the evaluation. Date and typeface are related in this collection, but a chronological band can include variation in type, physical condition and the kinds of OCR errors present. A low error rate in the earliest band is evidence about passages dated to that band. Extracting a typography-specific effect would require scoring directly by the relevant printing characteristic. The paper’s breakdown establishes that the blackletter mixture is competitive across times and especially strong in character accuracy for the oldest material.
What the inspections add
The authors’ inspection of corrections did not reveal a clear qualitative difference among the versions. The example of the king’s recovery shows how local comparisons can favor different versions inside the same passage. An editor checking the first difficult word could prefer one output, then prefer another at the infinitive marker. This is compatible with the small differences among the versions’ full-set scores. The paper gives neither a systematic inventory of the types of repairs each one makes nor a rate for the particular behaviors illustrated by the fragment.
Other design choices remain fixed throughout. The byte representation motivates the architecture choice, but the paper does not compare a byte-based version with one trained on the same pairs using another representation. It also does not train the same system from scratch or run a separate decoding comparison. Earlier results provide the rationale for the choices, and the Swedish evaluation tests their combined use. The authors raise another decoding strategy as a possibility because the outputs sometimes contain avoidable errors. The published inspection identifies that failure mode without measuring whether a different search through possible outputs would reduce it.
Limitations
Limits the authors identify
The authors identify the text-only interface as both a capability and a restriction of the approach. Since it accepts OCR as a string, the procedure does not depend on the output format of a particular recognition engine. It can use the textual evidence available in a Tesseract reading or an Abbyy Finereader reading. It cannot consult the confidence score an engine may assign to an individual character. When two otherwise identical input strings come from different recognition judgments, that difference in confidence is outside the information ByT5 receives.
This matters especially when there are grounds in the language for making an edit to a correctly recognized form. A familiar phrase can suggest a likely replacement. The OCR engine’s confidence could provide another reason to keep or reconsider the original character. The system evaluated here has access to the character sequence and the neighboring text in its input, so its learned behavior has to decide the issue from those clues. The paper identifies missing confidence information as a limitation and gives no quantitative estimate of what incorporating it would achieve.
The authors also explicitly acknowledge the introduction of new errors. The finding that 7.7% of evaluation samples deteriorate in CER under the blackletter variant gives this problem a measured extent on the prepared set. It provides no scale of deterioration for that group, and a fraction of affected passages cannot by itself tell an archive whether a particular correction will be safe to accept. The authors propose pursuing changes that use context to curb unwanted edits and studying the error types on newly digitized material. They also suggest an alternative to greedy decoding could help. Those possibilities remain open at the end of the study.
Limits that follow from the setup
The first boundary of the evaluation is set during data preparation. A passage needs a usable reference, and its OCR and transcription must align closely enough to supply an eligible short pair. The rules exclude pieces below the minimum length, passages at or above the 50% CER threshold and references that mark illegibility with @. For a badly degraded page, some of the regions most in need of help may belong to these excluded categories. The results directly describe the material that survives the preparation. The accuracy of correction when alignment fails or when the source is too damaged for a reliable reading remains open.
The experiment also begins after layout analysis has identified text segments. Its task is to regenerate a string corresponding to a selected passage. If layout processing omits a region of the page, none of the generated scores measures recovery of that region. A page whose columns or fragments have been assembled in the wrong order would raise a related problem that calls for evidence about spatial organization. Acceptance of short text strings makes the procedure straightforward to apply downstream of OCR. Its evidence about digitization quality is consequently specific to transcription within the selected text.
The amount of context available to the system is another boundary. The samples generally contain 1-2 lines, and the input is subject to the 128-byte limit. A word near an edge of the sample can depend on a phrase outside it. A name repeated in another part of an article could help resolve an uncertain reading, but it need not appear in the short passage presented for correction. Likewise, the image could settle an ambiguity between a historical spelling and a plausible modern word. The study evaluates decisions made with the text supplied in the short input, without a measure of what these additional kinds of evidence would contribute.
The random split protects against leakage through alternate engine readings by keeping corresponding versions together. The paper does not describe holding out entire titles, pages or publication periods as its evaluation design. That distinction matters for generalization. A held-out passage from the sampled collection can share publishing conditions, vocabulary or genre with passages available during training. Evaluation on a new archive or across an entirely withheld publication period would ask how well correction transfers when more of that background changes. The reported error rates characterize the sample-level split that the authors constructed.
The presence of more than one recognition engine supports applicability to the two sources of text in the collection. The reported full-set and publication-band scores pool the results, so they leave open whether the improvement is the same for both engines. An engine with a different pattern of errors can present a different challenge even when its raw character error rate looks similar. The system’s input format can accommodate another engine’s text. Its accuracy on that output remains a matter for evaluation. The same distinction applies to the supplementary collections. Literature and blackletter training are tested through newspaper performance, which leaves their value for correcting their own source collections undetermined.
There is also uncertainty about how finely to read the ordering of the variants. Some full-set and period values are close, and the paper provides no uncertainty estimates or repeated-run variation for these comparisons. The lowest observed character and word error rates can be identified from the reported scores. The stability of those rankings under another split or training run is beyond the measurements. The large improvement relative to the raw OCR and the smaller differences among corrected versions are distinct observations, both relevant when judging what the reported experiment establishes.
Finally, CER and WER measure transcription accuracy, the outcome most directly tied to the available human references. The paper’s motivations include better reading, search and analysis. A filename, a common word, and a rare personal name can have different consequences for a search even if an edit count treats their character discrepancies alike. Similarly, the collective score cannot say how often historical spellings have been inadvertently modernized, because it does not classify errors by their linguistic effect. Measurements of search success, reading quality or the preservation of historical forms would each call for evidence directed at that particular outcome.
What came after
The authors made the newspaper and blackletter version freely available and provided a demonstration. Its selection follows the lowest CER observed on the newspaper evaluation. They announced plans to integrate the correction into Språkbanken Text’s automatic processing pipeline, which handles modern and historical written material. The results in the paper come from the held-out newspaper experiment. The outcome of applying the system through that pipeline was still prospective.
The authors also proposed further work on the errors introduced during correction. Their plans included using context to reduce harmful edits and examining the mistakes that arise on newly digitized resources. Those directions follow from a practical question left by the results. A correction stage can improve the collection substantially while making some previously recognized passages less faithful. The paper leaves open what extra evidence would let the stage distinguish those cases before committing to a change. No subsequent study is identified as having tested those proposals or extended the newspaper experiment.
Cite
Cite as Viktoria Löfgren and Dana Dannélls. 2024. Post-OCR Correction of Digitized Swedish Newspapers with ByT5. Proceedings of the 8th Joint SIGHUM Workshop on Computational Linguistics for Cultural Heritage, Social Sciences, Humanities and Literature (LaTeCH-CLfL 2024).
@inproceedings{lofgren2024post,
title = {{Post-OCR Correction of Digitized Swedish Newspapers with ByT5}},
author = {Viktoria Löfgren and Dana Dannélls},
booktitle = {Proceedings of the 8th Joint SIGHUM Workshop on Computational Linguistics for Cultural Heritage, Social Sciences, Humanities and Literature (LaTeCH-CLfL 2024)},
year = {2024},
doi = {10.18653/v1/2024.latechclfl-1.23},
url = {https://doi.org/10.18653/v1/2024.latechclfl-1.23}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/lofgren-2024-post-ocr-correction-digitized-swedish/