Elamur Research

Unsupervised Code-Switching for Multilingual Historical Document Transcription

Paper · 2015 · Dan Garrette, Hannah Alpert-Abrams, Taylor Berg-Kirkpatrick et al.

Summary

A historical book can change languages halfway through a line, and a printer can represent a familiar word with a spelling or abbreviation missing from the texts used to train a reader. Both features make optical character recognition, or OCR, harder. The system has to turn an image into text while working out which character sequences to expect. Garrette and colleagues study books from Primeros Libros, a collection of early books printed in the Americas. Their experiments focus on Spanish, Latin, and Nahuatl.

The authors extend Ocular, an OCR system that learns the appearance of type directly from page images without requiring transcriptions of its training pages. They change the part of the system that predicts the text. Rather than pooling the languages into a single set of character patterns, they give each language its own patterns and let the reader infer which language is active at each word. A switch is possible at a word boundary, but staying in the current language is strongly favored. The language decision and the transcription are made together, so a plausible stretch of text can support a particular reading of an unclear character, and a clear character can help identify the language of its surroundings.

The authors also ask language experts to specify how familiar spellings could appear in period print. They apply these rules to training text so that the character predictor encounters alternative spellings and printer shorthand before it reads a page. A Spanish example illustrates the effect. The same page contains both the full spelling mentira and the abbreviated mẽtira. The baseline produces merita for the abbreviated instance. With the spelling rules, the system can read the abbreviation as it appears in print.

On the five test books, the macro-average character error rate is 12.3 for the adapted Ocular baseline, 11.3 with explicit language switching, and 10.5 when the spelling rules are also used. According to the authors, the relative decrease in character errors averaged 14% and reached 27% for some texts. The full system lowers character and word error rates against the baseline on every test book. The size of the gain varies, and the examples explain some of that variation. Difficult Gothic type can defeat character recognition, spacing in Nahuatl complicates word error counts, and the system still sometimes adds a modern accent where the original has none. The word-level language assignments are part of the output, with transcription error providing the paper's quantitative measure of success.

Deep dive: Unsupervised Code-Switching for Multilingual Historical Document Transcription

How unsupervised OCR reads multilingual historical books by tracking language switches and learning to expect period spellings and printer shorthand. · about 31 minutes to read

The problem and its context

When the language changes inside the page

A reader transcribing a book can use the surrounding text to interpret an indistinct letter. That help depends on having the right expectations about the surrounding text. In a page that moves between Spanish and Nahuatl, a sequence that looks unlikely under Spanish spelling may be ordinary in the other language. A reader that is obliged to interpret the entire page as Spanish can treat an authentic sequence as evidence of a mistake. Training on text from several languages makes more sequences available, but the reader still needs some way to tell when the expectations appropriate to one language should give way to those of another.

The paper uses code-switching for this alternation between languages. In the Primeros Libros books, the language can change across chapters, across sentences, or within a sentence. A language decision for the entire document would therefore be too coarse for the authors' task. Even a language label for each sentence would leave the reader without an account of switches within that sentence. The target is a transcription in which each word can receive its own language assignment, with neighboring words free to share a language for as long as the evidence supports it.

An image gives the reader shapes, positions, and marks. Those observations do not come with a label saying which language produced each word. The same visible letter may belong to several languages, and a single character may say little about the language around it. A sequence of characters is more informative when its combinations are typical of a particular language. Conversely, an unusual character can be especially informative when just one of the candidate languages uses it. The authors want an OCR system that can use both kinds of evidence while choosing what to transcribe.

Primeros Libros supplies a historical setting in which such choices matter. The collection comprises 349 digital facsimiles from the early history of printing in the Americas. The paper describes these books in connection with education, conversion, and religious orthodoxy in the early colonial period. European vernaculars were gaining a place alongside learned languages, while alphabetic writing systems and grammars were being developed for Indigenous languages in the colonies. The authors concentrate on books where Spanish, Latin, and Nahuatl occur together. The presence of several languages is part of how these books were written and printed, so a transcription system needs to preserve the sequences each language contributes.

A historical word can have several printed forms

Language switching explains only part of the mismatch between the recognizer's expectations and the image. The paper also describes spelling, accents, punctuation, and spacing as variable in the books it studies. Writing conventions differed by region, and printing houses worked with the resources available to them. The authors emphasize the situation in the Americas, where those resources were scarce and orthographies for Indigenous languages were still developing. A period form can therefore be appropriate to the document even when it differs from the form a modern reader recognizes most readily.

Printers' abbreviations pose a related problem. A mark over a character can take the place of material that would be written out in another instance of the same word. The abbreviation changes the sequence that a transcription must record. If the training text contains the expanded word and omits the abbreviated spelling, an OCR reader that relies on sequence probabilities may favor a completely different word. Knowing the modern expansion helps a person explain the mark, but faithfully transcribing the page requires the system to recognize the abbreviated form as a possible sequence in its own right.

The age of a text and the spelling of its digital edition are separate considerations. The authors seek material from roughly the same period as the books under study, following earlier work that found period-appropriate training text more effective than modern text. Yet a digital edition of an early work can still standardize spelling for a present-day reader. Its date makes its vocabulary and phrasing relevant while its orthography may differ from the print being decoded. This creates a practical problem for a system that learns character patterns from accessible digital text and applies them to facsimiles.

The paper illustrates that gap by placing an example page image alongside an equivalent modernized rendering. Such a rendering is useful to a person who wants to read the passage, and a recognizer can learn from it. Its treatment of the spelling, however, changes what the recognizer expects to find in an image. A transcription faithful to the print and an edition prepared for fluent modern reading answer different questions. The authors design their OCR procedure around the former objective and discuss how a further processing step could serve the latter.

What Ocular already handled

Ocular was developed for historical OCR, where the typeface often has to be inferred from the document itself. Characters can sit at different heights on a line, their spacing can vary, and ink can fade or spread. A recognizer built around a clean, known font has no direct way to account for all of that variation. Ocular treats these differences as parts of the printing process it is trying to infer. It can learn the appearance of characters from scans whose text has yet to be transcribed.

The baseline combines visual evidence with expectations about which letters tend to follow others. Its fixed character predictor was monolingual in the earlier setup described by the authors, which had been effective on historical English books. It could guide font learning because a plausible transcription helps determine which visual shape to associate with each character. That role becomes especially important when the font itself is unknown. An ill-fitting expectation about the text can affect both what the system reads and which image patterns it associates with the characters in that reading.

One way to adapt that baseline is to train its character predictor on a mixture of Spanish, Latin, and Nahuatl texts. This gives it evidence from all the relevant languages. The remaining issue is how the mixture is used. In a pooled predictor, a history of recent letters leads to a single set of expectations estimated from the combined material. The system has no separate state representing whether it is currently reading a Spanish passage or a Nahuatl phrase. Local character histories may still give it useful clues, but it has no explicit way to carry a language decision forward through a run of text.

The extension keeps Ocular's account of printed appearance and changes how it supplies plausible text. The authors also point to earlier work on identifying languages in code-switched material as a source of possible techniques. They refer to the First Shared Task on Language Identification in Code-Switched Data when discussing more elaborate approaches that might be adapted in the future. Here the immediate problem is joint inference. The reader starts with an image, and both the transcription and its language divisions have to be determined from that image with the aid of text statistics.

The method, step by step

How the page image and the text constrain each other

The easiest way to understand Ocular is to follow its account of how an image could have been produced. A sequence of characters is chosen. The printing process assigns space to those characters, places them relative to a baseline, and gives them differing levels of ink. The resulting marks are the pixels the recognizer observes. Reading reverses that direction of reasoning. Given the marks, the system looks for a character sequence and printing decisions that account for the image while producing plausible text.

A glyph is the printed shape associated with a character. Knowing the intended character helps explain which shapes are plausible, but the system also has to account for how the glyph was printed on a particular occasion. The image region allocated to a glyph may differ in width, its position can be slightly higher or lower, and its ink can make some strokes look weaker or heavier. Ocular uses these possibilities in its account of the observed image. The recognizer can then consider a discrepancy between an image region and its expected shape in light of the variation it already expects from printing.

The character sequence comes from a language model, a probability distribution used here to judge the plausibility of continuations in text. The original reader uses a character n-gram. Such a predictor uses a limited history of recent characters to assign probabilities to the character that follows. A candidate letter earns support when it fits both the marks in the image and the sequence of preceding characters. A visually similar candidate can lose support if the surrounding text makes it an unlikely continuation.

The new design retains that division of labor. It modifies the text predictor so that an active language is selected at each character position. It also changes the text used to estimate character patterns, so that these patterns can include historical spellings. The visual part still accounts for glyphs, their spacing and vertical positions, and the ink from which the observed pixels arise. The language and spelling changes influence which character sequences are favored when the system fits this same account to a page.

From monolingual training text to multilingual page transcription

The steps in order.

From monolingual training text to multilingual page transcriptionStep 1: Assemble separate corpora for the candidate languages1. Assemble separate corpora for the candidate languagesStep 2: Introduce historical spellings and printer shorthand2. Introduce historical spellings and printer shorthandStep 3: Estimate character patterns for each language3. Estimate character patterns for each languageStep 4: Learn type appearance from untranscribed pages4. Learn type appearance from untranscribed pagesStep 5: Infer characters and languages from page images5. Infer characters and languages from page imagesStep 6: Output transcriptions with word-level language assignments6. Output transcriptions with word-level language assignments

The first stages prepare evidence that can be applied to an unfamiliar image. The corpora supply sequences known to belong to the respective languages, and the rewrite rules make these sequences more representative of period spelling. The page images supply evidence about the particular printed volume. The system can learn its typography and adapt its expectation about which languages occur in it. During reading, the observed marks constrain the choices made using this information. The printed characters and their language assignments emerge from the same explanation of those marks.

Choosing a language before choosing a character

In the probability calculation, the current language is chosen before the current character. Each language has a separate character predictor, trained on monolingual material in that language. A language transition component governs when the active predictor can change. The sequence of language labels is latent, meaning that it is inferred as part of the reading. There is no language label alongside each word in the image supplied to the recognizer.

The design represents a language for each character but restricts transitions so that all the characters of a word receive the same language. When the system reaches a position inside a word, it must continue with the previous language. At an eligible boundary it can stay with that language or switch. It uses whitespace to locate these opportunities, considering spaces and page margins, with an exception when the preceding line ends in a hyphen. The exception lets a word divided across lines keep its language across the break.

A visual gap is part of the evidence about where a space belongs. Whitespace is also part of the transcription under consideration, so different candidate readings can imply different opportunities to change language. Supposing a stretch is read as a single word commits that stretch to one language. Supposing it contains a space permits a switch at the next word. This connection follows from the way the authors tie the transition rule to the recognized character sequence. It helps explain why the interpretation of spacing can affect more than the visual presentation of the output.

For a candidate reading, the language choice contributes a probability and the character choice contributes another. The formula in the paper multiplies the two:

P_LANG(ℓᵢ | eᵢ₋₁, ℓᵢ₋₁) · P_CHAR,ℓᵢ(eᵢ | eᵢ₋₁, …, eᵢ₋ₙ₊₁)

Here i is the current character position, eᵢ is the character proposed for that position, and ℓᵢ is its proposed language. The subscript i−1 refers to the preceding position, so eᵢ₋₁ is the preceding character and ℓᵢ₋₁ its language. P_LANG is the probability of choosing the proposed current language given those preceding values. P_CHAR,ℓᵢ is the character predictor associated with the proposed current language. The bar | means “given,” and the centered dot · indicates multiplication. The history in the character term runs from the preceding character back to eᵢ₋ₙ₊₁, with the ellipsis denoting the intervening positions. Here n is the order of the character n-gram, which uses the previous n−1 characters to predict the current one.

The two factors address different questions. The language factor accounts for the previous language and the dinstinction between eligible boundaries and positions inside words. The character factor accounts for the recent text under the current language's probabilities. The formula uses the preceding character history at the current position. It does not introduce a separate operation that erases the history whenever the language changes. A switch changes which predictor supplies the continuation probabilities.

The order of the calculation describes the generative account of the text. At recognition time, the system has the image to help judge both choices. A candidate language can make a reading of the next characters more probable, while a candidate reading can make that language more credible. The system can favor a switch when the image and the ensuing character sequence give it enough support, even though the language transition itself makes switches costly. This is how a change inside a sentence becomes possible without supplying its position in advance.

How strongly the system favors staying in a language

At an eligible word boundary, the transition rule gives the system a choice between continuing deterministically and drawing a language from a document-specific distribution. The draw can return the current language. Thus the chance of invoking the draw and the chance of actually changing languages are different. Continuing with the same language can happen through either route, while changing languages requires the draw to select a different one.

P_LANG(ℓ′ | e, ℓ) = ⎧ (1 − κ) + κ · θℓ′    if e = space and ℓ = ℓ′
                     ⎪ κ · θℓ′              if e = space and ℓ ≠ ℓ′
                     ⎪ 1                     if e ≠ space and ℓ = ℓ′
                     ⎩ 0                     if e ≠ space and ℓ ≠ ℓ′

P_LANG denotes the transition probability, ℓ is the preceding language, ℓ′ is the proposed next language, and e is the preceding character. As in the first formula, | means “given.” κ is the probability of making a fresh draw at an eligible boundary. θℓ′ is the probability that this draw selects language ℓ′. The brace introduces the cases, = denotes equality, and ≠ means that two values differ. The minus sign gives the complementary chance of continuing directly, the plus sign adds the two ways to stay in the same language, and the dot denotes multiplication. Away from a boundary, 1 gives certainty to staying and 0 rules out a change. The formula uses space for the boundary case. The operational definition also allows margins, subject to the exception for a word continued after a line-end hyphen.

The authors set κ to 10⁻⁶ throughout the experiments. This value expresses a strong preference for continuing a language. It encourages the system to explain a span in a coherent language whenever doing so accounts for the characters and image. An isolated ambiguous glyph consequently has to compete with the surrounding run of text and the cost of switching. Clear evidence for a different language can still favor a switch, because the choice is made in the context of the prospective transcription.

The probabilities collected under θ serve a different purpose. They determine which language the draw favors, and the authors learn them without language labels for the input document. The values allow the transition component to adapt to that document's language proportions. The fixed κ controls the inclination to attempt a fresh choice, whereas the learned distribution influences the destination of that choice. A language being common in a particular book can therefore affect the prior preference for it when switches are being considered.

The separation between corpus training and document adaptation matters. Each monolingual predictor obtains its character patterns from a corpus whose language is already known. The adaptation uses the book under transcription to learn its language mixture. “Unsupervised” describes the inference of the document's font and language structure without annotated training pages. The system starts with known candidate languages and material from them, and it uses spelling guidance from people familiar with the languages.

Which characters each language may use

With separate predictors, each language can have a character inventory derived from its corpus. The inventory constrains the candidate characters that can be proposed while reading in that language. A distinct character provides stronger evidence when a language can generate it and another cannot. It can rule out a candidate language for a word if the recognizer is confident enough about the printed character. For ordinary characters used by several languages, the probabilities of sequences and the persistence of language across words remain important.

The inventories also affect the search. Allowing every character under every language would make the reader consider combinations that the authors can exclude using the training material. A restricted inventory removes some of those combinations before they compete as readings of the image. This is separate from using the n-gram to rank possible sequences. A character absent from a language's inventory is unavailable under that language. An available character can still receive a low probability in a particular context.

The authors supplement the inventories with punctuation found in historical print. They include symbols such as ¶ and § for all the languages even though the symbols are absent from the text corpora used for training. These marks illustrate what a corpus-based inventory could otherwise miss. Their presence in a book need not point to a particular language, and the recognizer still needs a way to include them in its output. The paper uses the shared additions to keep historically relevant marks available across language assignments.

Preparing spelling evidence before training

The authors assemble monolingual training material for Spanish, Latin, and Nahuatl. Their search for text from the same broad period brings them to Project Gutenberg material from the 15–17th centuries. The Spanish and Latin collections each contain more than one million characters. Because Nahuatl material is less plentiful, they expand the Nahuatl corpus using a private collection of colonial document transcriptions. Those corpora provide text from which to estimate character probabilities. The page scans provide a different kind of evidence, including the appearance of each book's type.

Period texts in modernized editions can provide a great deal of useful language data while leaving specific historical forms rare or absent. The authors make use of that data by introducing variants before estimating the character probabilities. They gather separate banks of rules for Latin, Nahuatl, and Spanish. Language experts inspect sample pages from Primeros Libros, identify spellings that differ from familiar forms, and describe how to produce those spellings. The authors also use information from paleographic textbooks, which help them identify conventions of historical writing.

A rule operates in the direction from the available corpus spelling to a variant that may appear in the print. The paper's Spanish examples include transformations that remove an accent or represent sequences such as que and per with shorthand. Another example replaces en with ẽ at some occurrences. The relevant effect is that the training corpus now gives the character predictor examples of the abbreviated sequence in context. A rule can introduce a pattern that may occur in several words, so the character predictor can acquire evidence beyond a single dictionary entry.

The paper illustrates selective rewriting with an example in which every nth occurrence of en is eligible for replacement. Rewriting some occurrences allows the corpus to contain ordinary and abbreviated patterns. The authors' image of both spellings of mentira on the same page shows why it is useful for the predictor to give both forms support. If all instances were brought to one spelling, the predictor would get a consistent input at the expense of the variation that the OCR system encounters in print.

The rewrite step comes before training the individual language predictors. It changes the counts from which they learn how letters combine, including the contexts in which an uncommon marked character can appear. During OCR, the recognizer can then give the visible shorthand a plausible transcription without expanding it to the modern form. The image still has to support the glyphs in that reading, and the language assignments still have to fit the surrounding text. The rules make a reading available and better supported by the corpus. They do not dictate the transcription of a particular image.

This design joins two interventions at different points. Splitting the character statistics by language changes how the system uses them while decoding. Rewriting the corpora changes the statistics it has available when it gets there. A word can benefit from one intervention if the crucial problem is identifying the language, from the other if the language is clear but the spelling is rare, or from both if the two uncertainties arise together. The comparisons in the paper add language switching first and spelling rules on top of it.

Experiments and results

The books and the training split

The evaluation uses five Primeros Libros books identified by author and publication year: Gante, 1553, Anunciación, 1565, Sahagún, 1583, Rincón, 1595, and Bautista, 1600. The selection varies the authors, printers, presses, and typefaces, and the books contain switching among Spanish, Latin, and Nahuatl. A line from each book illustrates the diversity of the material. The differences among books matter because the method has to infer the typography as well as explain the language and spelling on the page.

For each book, the system trains a font on ten pages without transcriptions. The evaluation uses ten manually transcribed pages set aside as a separate test set. The font training and evaluation pages thus differ, while both sets come from the book whose type the system is learning. This tests whether it can learn enough about the appearance of the print to transcribe further pages of the same volume. The language corpora are used to supply character statistics, and the manually transcribed evaluation pages supply the reference for scoring.

The authors compare against an adapted Ocular baseline. The original OCR system handled English alone, so they extend it to handle other alphabets, including diacritics and ligatures, and use a corpus pooling Spanish, Latin, and Nahuatl to train one character predictor. This baseline can use evidence from all the relevant languages and represent marks beyond the original English inventory. Its central distinction from the switching system is that the evidence goes into a pooled predictor with no explicit language segmentation. Hyper-parameter settings are kept consistent with the earlier Ocular work.

The next configuration replaces the pooled predictor with the explicit switcher. Its component predictors are trained separately, and it makes language assignments during transcription. The full configuration adds historical spelling and shorthand through the corpus rewrites. The sequence of comparisons gives a view of what changes when the system switches among separate predictors and what changes when the predictors also receive historically adapted text. The image generation machinery is common to those comparisons.

Reading the error measures

The authors report character error rate, or CER, and word error rate, or WER. CER measures disagreement with the reference at the level of individual characters. WER evaluates the output at the level of words. For example, a wrongly read letter may affect both measures. A misplaced space can have a much larger effect at the word level because it changes which characters count as a word. This matters in the test books, where visual spacing and the reference transcriber's word divisions can be difficult to reconcile.

The principal WER scores exclude punctuation. The authors give an additional macro-average WER including punctuation, which measures performance with those marks counted in the scoring. That extra measure is useful because punctuation is part of the record the OCR system is trying to recover, and some punctuation symbols received special treatment in the character inventories. It also makes clear that the inclusion of marks changes the reported word-level error, even when it leaves the underlying output of the recognizer the same.

The averages in the paper are macro averages across the books. This form of aggregation gives each book influence as a unit, so unusually large or small books do not dominate simply by contributing different amounts of reference text. The averages describe performance across the selection, while the scores for individual books show where the improvements are substantial, modest, or mixed. The paper reports rates for the held-out pages and separately summarizes relative reductions. The rates and the relative reductions answer different questions about how large the errors are and how much the method reduces them.

The aggregate comparison

Macro-average character error rate on the Primeros Libros test books

Explicit switching lowers character error, and spelling adaptation lowers it further.

Macro-average character error rate on the Primeros Libros test booksOcular with pooled language data: 12.3Ocular with pooled language data12.3Ocular with explicit language switching: 11.3Ocular with explicit language switching11.3Ocular with switching and spelling adaptation (this paper): 10.5Ocular with switching and spellingadaptation (this paper)10.5
The numbers
System or settingCER %
Ocular with pooled language data12.3
Ocular with explicit language switching11.3
Ocular with switching and spelling adaptation (this paper)10.5

The first change favors distinct language stretches during recognition, and the second makes historically plausible spellings more available within each language. The aggregate character rates improve at both stages. The authors describe the overall result as a 14% average relative character error reduction against Ocular, with relative reductions reaching 27% on particular texts. Those figures concern the observed transcription errors, including decisions where the right reading depends on a combination of character shapes and textual context.

Macro-average word error rate excluding punctuation on the Primeros Libros test books

The system with switching and spelling adaptation has the lowest word error.

Macro-average word error rate excluding punctuation on the Primeros Libros test booksOcular with pooled language data: 43.6Ocular with pooled language data43.6Ocular with explicit language switching: 41.5Ocular with explicit language switching41.5Ocular with switching and spelling adaptation (this paper): 38.2Ocular with switching and spellingadaptation (this paper)38.2
The numbers
System or settingWER %
Ocular with pooled language data43.6
Ocular with explicit language switching41.5
Ocular with switching and spelling adaptation (this paper)38.2

Including punctuation, macro-average WER moves from 56.6 for the pooled Ocular baseline to 53.5 with explicit switching and 51.0 with both changes. The ordering of the systems holds under both treatments of punctuation. The paper reports relative word error reductions as high as 29%. Word error rates remain substantial even in the better configurations. A recognizer can recover much of a line at the character level while still disagreeing with the reference on several word forms or word divisions.

How the results differ from book to book

On the Gante test pages, baseline CER is 13.7. The switching system reaches 12.8 and the full system reaches 13.5. For WER excluding punctuation, the corresponding rates are 55.9, 55.0, and 55.3. The full configuration beats the pooled baseline on both measures, while switching alone gives the lowest rates among the configurations for this book. The aggregate benefit from spelling adaptation therefore describes a pattern across books. It does not describe the direction of the incremental change in Gante.

On the Anunciación test pages, CER moves from 15.7 for the baseline to 14.6 with switching and 14.1 with spelling adaptation. WER excluding punctuation is 53.6 for the baseline, 53.8 for switching alone, and 51.6 for the full system. The character and word measures give different judgments about the first change on this book. With both changes in place, the result improves over the baseline on both measures. Gante and Anunciación are also the books for which the authors call attention to Gothic fonts and especially difficult capitals.

On the Sahagún test pages, the baseline CER of 10.8 is followed by 9.6 with switching and 8.4 with both changes. WER excluding punctuation similarly moves from 44.3 to 38.7 and then 34.9. Both measures support the same ordering, and the separate increments show that the final result improves beyond what switching alone achieves. In the aggregate comparison, books with improvements at both stages contribute to the full system's advantage even though the spelling increment goes the other way in Gante.

On the Rincón test pages, the baseline, switching, and full configurations give CER values of 11.6, 10.7, and 9.5. Their WER values excluding punctuation are 38.4, 35.4, and 31.0. The paper notes that Rincón and Bautista have relatively less Nahuatl, which matters to how the authors interpret differences in word error among the books. In these volumes, the test scores are less affected by the Nahuatl spacing issues the authors observe elsewhere in the evaluation.

On the Bautista test pages, CER goes from 9.7 to 8.8 and then 7.1. WER excluding punctuation goes from 25.7 to 24.5 and then 18.2. The full configuration has the lowest character and word rates of the results reported for the individual books. Comparing these rates with those for the older Gothic volumes gives a sense of how different the input conditions are across the evaluation. The paper's setup tests whether a common recognition approach can make gains across that range, while each book presents its own combination of typography, language content, and spelling.

What the ablations show

Giving language a state of its own

The first comparison changes the text component from a single predictor trained on mixed data to separate predictors with explicit transitions. CER improves on every book when that change is made. The macro-average WER also improves, with Anunciación the exception to the per-book direction on WER excluding punctuation. This supports the paper's argument that giving the recognizer an active language can help it read characters, even when the baseline already has text from every language in its training material.

The comparison tests the switching design as implemented. That design includes language-specific character statistics, transitions tied to word boundaries, a strong preference for language continuity, and separate character inventories. The scores show the performance of that combination. There is no independent score for the contribution of the inventories, for instance, or for the effect of changing the switch parameter. Those distinctions matter if the question is which internal mechanism produces the gain. The baseline comparison answers the broader question of whether the explicit switching system improves on pooling the same kinds of language material.

The paper also shows a passage in which the output distinguishes Spanish from Nahuatl. The assignment changes within the passage: Spanish words introduce material the reader marks as Nahuatl, and the transcription includes a later return to Spanish. The passage makes the idea of an inferred language region concrete. The system can associate a run of distinct words with a language and transition within a line of print. The demonstration is an example of the kind of output the method supports. The controlled comparison measures the accompanying transcription performance, while the example shows the language labeling qualitatively.

A language switch can be supported by a span, even if the first letter of that span is shared by both languages. This is a consequence of comparing readings as sequences. Multiple character choices can collectively make one predictor better suited to an image region. The transition penalty gives the language choice persistence, so there is a reason to search for a coherent account beyond the immediate character. The sample output is consistent with that account of how the method works, although the paper gives no breakdown of how often switches depend on cumulative sequence evidence or on a distinctive character.

Making historical spellings probable

The next comparison adds corpus rewriting to the switching configuration. On the macro averages, both error measures improve, including the WER measure that counts punctuation. The per-book scores tell a more qualified story. Most books improve over switching alone, while Gante moves in the opposite direction. The result supports using the spelling rules in the tested configuration across this collection. It leaves open which kinds of rules are most valuable, how well the same rule banks would work for another selection of books, and whether the changes would help a pooled system to the same extent.

The strongest explanation of what the spelling change can do is the example involving mentira. The paper's illustration shows the full form and mẽtira in the same page of print. The ordinary form is present in the corpus. The shortage of evidence concerns the shorthand form, in which the mark on the vowel stands in for the following n. A recognizer that rarely sees such sequences in its training text can interpret the image as a more familiar combination of characters. In this instance the baseline returns merita, a different word.

When the rules introduce relevant instances into the training data, the new recognizer can give higher support to sequences with ẽ. The abbreviation then becomes a reading that fits both the marks and the text statistics. The result illustrates a cascade: trouble interpreting one historical convention can pull multiple character choices towards the wrong word. Improving the probabilities around the marked character can recover the whole printed form. The method therefore has a way to benefit from an expert's knowledge of a recurring convention without having that expert label the particular evaluation line.

The example also distinguishes recognizing a shorthand form from expanding it. The expected output keeps mẽtira as printed. The training rewrite moves towards that form so the reader can recognize it. Had the desired output been normalized spelling, the system would need an additional choice after recognition about how to render the recovered word. In this experiment the abbreviation is part of the character sequence to be evaluated, which is why learning its contexts helps.

Where the authors look for residual errors

The authors offer three kinds of analysis for the uneven results: hard-to-recognize letter shapes, uncertain word division, and a bias towards modern spellings. The Gothic capitals in Gante and Anunciación illustrate the first. Language statistics can supply clues to an unclear glyph, but the authors describe some of these capitals as scarcely recognizable by the system. This is an issue in the visual evidence and its interpretation. The language and spelling changes operate alongside that evidence, so large residual errors can remain when the type itself is difficult.

Nahuatl spacing illustrates why two error measures can tell different stories. Reference word boundaries may diverge from the recognizer's boundaries even where it gets the letters right. The authors discuss inconsistency both in the printed books and in the digitized Nahuatl corpora. They contrast that difficulty with cases such as the Spanish sequence ypara, where the system needs to separate words even if the printer left little visible space. The same physical feature of a page, a small gap, can thus require different treatment depending on the text being read and the conventions used to transcribe it.

The tendency to supply a modern accent illustrates a third source of errors. The paper gives the example of numero being read as número. The accented form can be well supported by contemporary spelling conventions while still misrepresenting the visible original. The error shows the limits of the corpus adaptation. Adding known historical variants makes those alternatives more probable in familiar contexts, but some modern patterns can remain strong enough to draw the recognition away from the page.

These explanations differ from separate controlled experiments. The book-level scores show where performance varies, and the authors use features of the texts and particular instances of output to account for possible sources of that variation. They do not rerun the books with Gothic capitals replaced, spacing standardized, or accents treated separately. The observations therefore help identify which decisions the recognizer is struggling with. The incremental system comparisons supply the direct evidence for the performance changes caused by the configurations.

Limitations

Limits the authors identify

The authors describe the visual difficulty of the oldest books in the test set. Their Gothic type presents a different recognition problem from the spelling and language problems addressed by the extension. A stronger character prior can sometimes help choose among plausible readings of a hard-to-see letter. It cannot guarantee that the inherited OCR machinery will form a useful account of a difficult capital. The high error rates in those books remain part of the result, including where the complete system improves on the baseline.

The authors also identify a limit in the interpretation of word error. In Nahuatl, they describe variation across the original printed books, the available digital text corpora, and the judgments of modern scholars about where spaces belong. The metric still compares the output to a particular reference transcription. A disagreement can indicate that the system has read the wrong word, but it can also register a division that differs while the letters themselves are correct. The paper's numerical word results need to be read with that ambiguity in mind, especially when comparing volumes that contain different amounts of Nahuatl.

Modernized spelling in the output remains a separate limitation the authors observe directly. Corpus rewrites supply examples of known variants, and the full system nonetheless produces some spellings favored by modern usage. Faithful transcription is the target. Accent insertion shows a case where a convention learned from available text can compete successfully with the spelling of the source. Other historical spellings would need support from the available corpus or the rules to be comparably plausible during reading.

The authors discuss a normalized output for search and indexing as a possible further use of their rules. Their suggestion is to run the rewrites in reverse after transcription, so historical variants can be associated with canonical forms. The reported error rates concern the recognition task. They do not establish the quality of any normalized text or of search over that text. A further suggestion is to bootstrap the discovery of spelling variants and involve experts in an active learning process, where the system could seek targeted help. The reported spelling adaptation instead uses the expert-supplied rules.

The paper also draws attention to what the change of medium leaves behind. A character transcription cannot carry every feature of how letters were arranged and printed, or every trace of what later happened to the physical book. The authors connect this loss to questions about how Indigenous languages were represented in writing during the colonial period. For researchers concerned with those choices, a readable transcription offers access to the text, while the image preserves material evidence that the character sequence cannot express. The paper treats the distinction as part of the humanities context for using historical OCR.

Limits that follow from the evaluation

The results are for a particular set of multilingual books from a single collection, using Spanish, Latin, and Nahuatl. The experiment shows gains across different presses, printers, typefaces, and authors within that selection. It gives no transfer scores for other language combinations or collections, and the pipeline assumes access to some text for the candidate languages. Scarcity already affects how the Nahuatl corpus is assembled, so access to a relevant corpus is a practical condition of applying the same method elsewhere.

The font is learned separately for each book and tested on other pages of that same book. That split tests whether a document can supply enough untranscribed pages to learn its own appearance and then read held-out pages. It leaves open how well a font learned on one book would serve an unfamiliar volume, or how well the method performs when the input offers less evidence for acquiring the type. The result fits the problem the authors set themselves, in which learning from the book under transcription is an available step.

The language outputs are illustrated without a separate quantitative evaluation of label accuracy. CER and WER compare text with manual transcriptions. Identical character sequences could receive different language labels while obtaining identical transcription scores. A better transcription can accompany better segmentation, but the reported measures do not tell how reliably an individual word gets the intended label, how well boundaries are located, or how frequently ambiguous words are assigned consistently. The proposed downstream use of language labels depends on those qualities, which the paper leaves unmeasured.

The transition design also defines what can count as a switch. It assigns a single language within a word as determined by its boundary rules, so the paper's claims concern word-level alternations. Where a space is difficult to see or conventions vary, the choice of word division can affect language assignment as well as WER. The fixed value of κ is successful in the reported setup, with no sweep showing how a different preference for continuity would affect a book with a different pattern of alternation.

Finally, the experiments compare the complete switching design with the pooled baseline and add spelling adaptation to the switching design. There is no corresponding corpus-rewrite result for the pooled baseline. The individual classes of spelling rules also receive no separate scores. This leaves open whether the two changes reinforce each other, whether one can make up for shortcomings in the other, and which expert interventions drive the gain. The paper gives the direction of the observed increments and demonstrates a concrete use for shorthand rules. It stops short of attributing the entire improvement to a single part of either change.

What came after

The Second Shared Task on Language Identification in Code-Switched Data overview cites the historical OCR paper. Its stated task centers on identifying languages in code-switched data. Garrette and colleagues put that decision inside a larger recognition problem. Their system must infer the words from images as well as assign languages to them, because the language of a word can help resolve which characters were printed. The later overview places the OCR paper in a discussion where the language assignment is itself the central task.

That citation continues a connection the authors had already drawn to shared-task work. They proposed exploring more elaborate ways to recognize code-switching after finding that a simple language-transition rule helped their OCR system. The later overview establishes a citation between the two lines of work. It does not establish that the shared task adopted Ocular's transition rule, spelling rewrites, or historical documents, or that it evaluated the accuracy of the language divisions found in the Primeros Libros books.

Cite

Cite as Dan Garrette, Hannah Alpert-Abrams, Taylor Berg-Kirkpatrick and Dan Klein. 2015. Unsupervised Code-Switching for Multilingual Historical Document Transcription. Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.3115/v1/n15-1109

@inproceedings{garrette2015unsupervised,
  title = {{Unsupervised Code-Switching for Multilingual Historical Document Transcription}},
  author = {Dan Garrette, Hannah Alpert-Abrams, Taylor Berg-Kirkpatrick and Dan Klein},
  booktitle = {Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies},
  year = {2015},
  doi = {10.3115/v1/n15-1109},
  url = {https://doi.org/10.3115/v1/n15-1109}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/garrette-2015-unsupervised-code-switching-multilingual-historical/