A page that mixes two languages, such as English body text with French quotations, needs both language packs in the OCR run. Running OCR with only one language misreads the other language’s words, and the errors hide inside otherwise clean text.
What you need
- OCRmyPDF installed
- Language packs installed for both languages on the page
- A scanned PDF page that mixes two languages
- A terminal
Step 1: Identify the two languages on the page
Read the page and note which parts are in each language, such as the main text in English and the quotations in French.
Step 2: Run OCRmyPDF with both languages
Run OCRmyPDF with the language list covering both languages, for example -l eng+fra, and let it write a searchable PDF.
Step 3: Check each language block against the page
Open the OCR text and read the English blocks and the French blocks separately against the page. Mark any word that is misread in either language.
Worked example: synthetic mixed-language OCR check on one page
The table below is a synthetic example. It shows the expected result of the OCR comparison; no OCR was run.
| Block | Language | OCR result |
|---|---|---|
| Body text | English | Clean |
| Quotation | French | Clean |
| Caption | French | One word misread |
| Total | 3 blocks | 1 error to correct |
Expected result (UNTESTED). the English body text and the French quotation read cleanly, but one word in the French caption is misread and must be corrected. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- Language packs must be installed for all languages specified, or OCRmyPDF will not run.
- A page that mixes languages inside one sentence is harder for the recognizer than separate blocks.
- Proper names can be misread in either language, so check names with extra care.
