Tesseract joined two words
At 600 DPI, Tesseract returned onthe as one high-confidence token even though the page visibly contains on the.
Case 1 · Detailed incident report
Tesseract made a bad word-boundary proposal. PDFMD’s own replacement adapter then turned that proposal into a duplicated word. The immediate product defect is ours.
Executive verdict
At 600 DPI, Tesseract returned onthe as one high-confidence token even though the page visibly contains on the.
PDFMD applied onthe only to the base token the. It failed to consume the already-existing on, producing on onthe.
Exact retained trace · page 8
carrying on the IES. The green box identifies the target base token the; the 600-DPI candidate extended left across neighboring on.Tesseract PSM 3 emitted separate tokens on and the. The target the had confidence 84.784927%. The phrase was correct.
Tesseract PSM 3 emitted one token, onthe, at confidence 94.499130%. Its box overlapped both base tokens.
Our detector version 1.0 accepted the proposal because overlap with the was 0.9628, confidence exceeded the 87.784927% floor, and edit distance 2 met the allowed limit.
The adapter replaced only the with onthe. The separate base token on survived. Canonical output became carrying on onthe IES.
Source and correct baseline
carrying on the IES
Output after refinement
carryingon ontheIES
The census found the same mechanism three times: on onthe, a aresult, and in inthe. These are word-boundary association failures, not paragraph-joining failures.
Resolution investigation
A PDF does not necessarily have one “original DPI.” PDF pages use physical coordinates—72 points per inch. Vector text is resolution-independent; embedded images have an effective pixel density determined by their pixel dimensions and displayed size. The exact 20-page OCR input in this run is image-only: each A4 page contains one 1-bit grayscale JBIG2 image and no OCR text layer.
The retained OCR configuration requested 216 DPI. PDFMD opened the image-only PDF with pypdfium2/PDFium and used render scale = 216 / 72 = 3 pixels per PDF point. PDFium resampled page 8 into a 1787 × 2527 PNG. Tesseract then received that already-rendered image:
tesseract page-8.png output -l eng --dpi 216 --psm 3 tsv makebox
PSM 3 asks Tesseract to discover page regions, lines, and word boundaries automatically. It correctly emitted separate base words on and the, both with the retained score 84.784927.
PDFMD starts high-resolution refinement when any token on a page has a score below 0.90, contains non-ASCII text, begins with |, or resembles a suspicious ordinal. A low-scoring token therefore triggers another render and another full-page OCR pass. In this retained VNAT run, all 20 pages produced full-page 600-DPI TSV output.
The refinement resolution is a fixed code constant, _REFINEMENT_DPI = 600. It is not read from the PDF, derived from the embedded image’s 200 PPI, or configured separately. PDFMD used render scale = 600 / 72 = 8.3333 pixels per PDF point, producing a 4963 × 7017 PNG.
tesseract page-8-text-refinement.png output -l eng --dpi 600 --psm 3 tsv
The --dpi 600 option does not create the additional pixels; PDFium has already done that. It tells Tesseract the intended density of the supplied bitmap. PSM 3 then performs a new, independent word-segmentation decision. This time Tesseract emitted onthe as one word.
The 216-DPI base words occupied on: x=383…415 and the: x=422…463 pixels. The 600-DPI candidate occupied x=1065…1284. PDFMD converts 600-DPI coordinates back to PDF points by multiplying by 72 / 600 = 0.12:
onapproximately 127.67…138.33theapproximately 140.67…154.33ontheapproximately 127.80…154.08—spanning both base words.For the, the wider candidate had 0.9628 geometric overlap, exceeded the required score floor by 6.714203 points, and met the edit-distance limit. For on, changing to onthe exceeded the edit-distance limit, so on survived. The adapter consequently materialized on + onthe.
The documented design intent was to give weak words, tiny superscripts, and missing gutter numbers a second high-resolution observation. Separate 600-DPI crops can also be read under Tesseract PSM 10 and PSM 13 for special isolated-token cases; this particular the change came from the full-page PSM 3 pass. The retained trace contains no benchmark or rationale establishing that 600 is optimal. The value entered the module as a hard-coded “high-resolution verification” constant.
For this 200-PPI input, 600 DPI could not recover detail that was never captured. It changed the representation and Tesseract’s segmentation. The base Tesseract call took 1.514 seconds; the full-page 600-DPI call took 3.309 seconds. The larger, slower observation then overrode a correct base phrase.
Components and ownership
onthe at 600 DPI.pdfmd/recognition/raster_text_refinement.py selected the candidate using overlap, confidence gain, and edit-distance rules.on onthe.Why this happens in 2026
The error looks ridiculous because a human reads the phrase instantly. The system does not receive “words” from the page. It receives pixels, competing character hypotheses, rectangular regions, confidence scores, and then a sequence of software decisions that must agree on boundaries.
The wrong onthe proposal scored 94.50%, higher than the correct the at 84.78%. The score measures the engine’s preference among its own hypotheses; it does not certify that the source was read correctly.
A 600-DPI render enlarges the available pixels, but it also changes connected components, spacing, and the word boxes chosen by page segmentation. With a 200-PPI source it adds no optical detail and can merge a gap that the 216-DPI pass treated correctly.
Tesseract supplied candidate text and geometry. It did not know PDFMD intended to replace exactly one earlier token. That cross-pass reconciliation is application logic, and in this case it was incomplete.
A second OCR pass helps only when the adoption rule is safer than either pass alone. Here, a higher-confidence but wider candidate overrode a correct baseline and made the final text worse.
Leading vendors and open-source engines are trained for broad recognition quality. They cannot encode every downstream invariant of legal-document reconstruction: exact word conservation, printed labels, note links, style spans, and source provenance.
Using a mature OCR library is sensible; blindly trusting it is not. PDFMD must preserve alternatives, compare complete output with the source, and abstain when geometry does not support a safe replacement.
Current repair status
The earlier association proposal produced no valid source-scored OCR result. The historical gate report (outdated · September 2026) broadens the prerequisite: correct raw text must survive every downstream stage before dictionary, style, or structure work can advance.
Retain the exact source, raw OCR, expected page text, settings, and runtime before examining another candidate.
Trace every selected replacement through refinement and canonical output. A wider candidate must not duplicate or discard source words.
The control must prove both that a legitimate correction survives and that nearby correct words remain unchanged.
Independent review must confirm the exact phrase, complete output, and audit lineage. No new recognition trial has run under this gate yet.
Evidence record
ee83eb5bbb2b05fd762402c8ad8214a54a3b46637925c0dcd8dfe8abc85ecf8418356059d277b4988000adbae0868d904aaff91fac9c8893f01d3ce75c2565a1ev-ocr-token-ee371c2e994f9959 · theev-ocr-token-ca12b01a8c3f2d4f · onthe