How to Fix OCR Line Breaks and Hyphenation Before Translation
Repair wrapped OCR text without deleting real hyphens, paragraphs, lists, or verse. Use a reversible workflow and twelve downloadable cleanup examples.

To fix OCR line breaks, first identify the text that belongs to one paragraph. Replace only its unwanted line endings with spaces. For a word split across lines, decide separately whether to remove the hyphen or retain it: trans- followed by lation becomes translation, but well- followed by known becomes well-known. Keep a change log and compare uncertain joins with the original page.
Do not run “remove all line breaks” or “delete all hyphens” over a whole book. A cleaned extract can look more fluent while losing a paragraph, joining two list items, or changing a technical identifier. The goal is a trustworthy reading or translation copy—not the smallest number of newline characters.
This guide starts after text recognition. If copying a PDF gives wrong letters or numbers, first diagnose its text layer. Changing line breaks cannot turn an incorrectly recognized B-2O4 into the intended B-204.
Decide what each line break represents
Keep the original scan and raw extract unchanged. In a working copy, turn on the editor's display of whitespace or paragraph marks. Resize the editor: a line that reflows without a stored newline is simply wrapping on screen; there is nothing to delete.
Stored newlines need a different check. Compare one continuous paragraph, a heading, a list, and any distinctly different page layout with the page image. Do not infer the whole document's structure from its title page.
| What the break represents | Appropriate action | Evidence needed |
|---|---|---|
| A visual wrap between words inside one paragraph | Replace the stored break with one space | Both lines belong to the same paragraph in the source |
| A split inside one word | Join the fragments, usually removing the layout hyphen | Intended spelling, source context, and any language-specific rule |
| A wrap after a genuine compound hyphen | Remove the break, keep the hyphen | The word retains that hyphen outside line-end formatting |
| A paragraph, heading, list item, or verse boundary | Preserve the boundary | Source structure, not just sentence punctuation |
| A column or page transition of uncertain order | Leave unresolved and inspect the page | Continuation, column order, captions, and footnotes |
Blank lines and indentation can help find paragraphs, but they are clues rather than guarantees. A heading may have no blank line after it. An indented line may be a list continuation, not a new paragraph. A short line ending in a period may be either the last line of a paragraph or a sentence midway through one.
If OCR exports provide layout or block information, keep it while checking the text. A plain-text export alone may discard the evidence you need to reconstruct those boundaries.
Separate split words from genuine hyphens
Three visually similar cases require different edits:
trans- → translation
lation
well- → well-known
known
trans\u00ADlation → translation in a verified reading copy
The final line uses \u00AD to make an otherwise difficult-to-see character explicit. Unicode distinguishes U+00AD SOFT HYPHEN, a discretionary intraword break marker, from a visible hyphen such as U+2010 HYPHEN. These are not interchangeable characters. Unicode's line-breaking specification also describes language-dependent spelling changes at a break; deleting a visible hyphen and concatenating the letters is not always sufficient.
For ordinary prose, removing a verified discretionary marker can produce a useful reading copy. For an archival transcription, retain the original separately: removing a marker changes the encoded text even if the word looks unchanged.
Use a dictionary in the source language to check a candidate spelling, then return to the passage. A dictionary entry is supporting evidence, not permission to overwrite a name, an identifier, or historical spelling. Repeated occurrences in the document also help, but an OCR error can repeat consistently.
For example, our German sample is:
Die Auf-
gabe ist klar.
The intended word in this authored example is Aufgabe; Duden's entry lists its division as Auf|ga|be. Joining Auf- and gabe is justified here. That single example is not a general German dehyphenation rule, and modern dictionary spelling should not silently replace an older edition's orthography.
Treat URLs, catalog codes, chemical names, negative values, and other technical tokens as separate review cases. Whether a dash or hyphen survives must follow the source and the token's meaning, not an English-word heuristic.
What twelve controlled examples show
We built a downloadable cleanup demonstration containing twelve original strings. Their intended words and structure were defined when we authored them; we then inserted selected line breaks and hyphenation artifacts. These are synthetic text examples, not output from an OCR engine or scans of a book.
The deliberately blunt baseline performs three replacements: remove hyphen-plus-newline, replace remaining newlines with spaces, and remove soft hyphens. A second path applies only individually approved changes to exact text. It makes no attempt to recognize paragraphs or decide word spelling automatically.
| Sample | Blunt baseline | Approved decision |
|---|---|---|
| English prose wrap | Correctly joins the two lines | Replace the verified wrap with a space |
trans- / lation | Correctly produces translation | Remove the inserted hyphen and break |
well- / known | Produces wellknown | Keep the genuine hyphen |
German Auf- / gabe | Correctly produces Aufgabe | Join only this verified spelling |
| Embedded U+00AD | Removes the discretionary marker | Remove it in this authored reading copy |
| French ellipsis, then a new paragraph | Merges the paragraphs | Keep the author-defined boundary |
| Numbered list, verse, code, and heading | Flattens distinct structures | Preserve their newlines |
| Two paragraphs without a blank line | Joins them into one | Preserve the author-defined paragraphs |
| Unreviewed page marker | Flattens the page transition | Leave it untouched until order is checked |
On October 3, 2026, running the fixture with Node.js 25.2.1 produced reference-matching text for 4 of 12 examples under the blunt baseline. The approved path matched all twelve references and restored all twelve inputs through undo. It also rejected stale inputs, non-unique matches, and missing matches.
Those results test exact patch application against known authored references. They do not estimate real-world accuracy: the approved decisions already contain the answers, and the corpus was deliberately chosen to expose failure cases. We did not test a commercial cleaner, OCR engine, translation model, or BookTranslator upload. There were no retries or excluded samples.
Download the actual input/output and patch log and reproduction instructions. The JavaScript runs locally without dependencies or network calls and prints the results; it does not rewrite your files. Its checks protect an approved edit from being applied to different text. They cannot tell you whether an edit is linguistically correct.
Clean one verified block at a time
Start with a short prose block whose reading order and paragraph boundaries you can establish. Do not begin with an entire chapter containing captions, quotations, lists, and footnotes.
- Save a raw copy and record the source location. Keep the filename, page number, paragraph or block, and language with each reviewed passage.
- Mark structural boundaries first. Separate headings, list items, verse, tables, and code from ordinary prose. Preserve page references outside the reading text if you later remove their markers.
- Join ordinary interword wraps within that block. Replace each confirmed break with a space. Check that words did not concatenate and that an existing space did not become a distracting duplicate.
- Review split words separately. Show the full token and surrounding sentence. Record “remove layout hyphen,” “keep genuine hyphen,” or “unresolved.” Do not treat an unresolved candidate as an approved change.
- Inspect the diff before accepting it. Compare each removed boundary or hyphen with its source. Save the cleaned version under a new filename, along with the decisions.
- Reopen and copy from the saved result. Check the actual file you will use, not just the editor's preview.
For a small extract, manual edits with tracked changes or a before/after comparison may be sufficient. For a longer extract, a patch list should record the exact original substring, replacement, location, reason, and reviewer. A source checksum helps prevent applying old approvals after the input changes.
If your editor offers a paragraph-preserving cleanup mode, test that mode on the difficult blocks—not merely on flowing prose. Preserving double newlines will not recover a paragraph boundary that OCR represented with a single newline. Do not delete indentation or collapse all spaces before investigating tables and code.
Know when to return to the page image
French punctuation illustrates why sentence-end detection is not paragraph detection. In our authored sample, Il attend… and Le lendemain, il part. belong to separate paragraphs. The ellipsis alone does not establish that boundary. The Office québécois de la langue française's guidance on points de suspension describes uses including interruption or an incomplete idea; use the page structure to decide whether to join the following line.
Make source-image review mandatory for these candidates:
| Candidate | Why text alone is insufficient | What to compare |
|---|---|---|
| Heading immediately followed by prose | No blank line may survive extraction | Typeface, alignment, spacing, and section role |
| A passage crossing a page or column | A header, caption, or footnote may interrupt it | Last source line, continuation, and reading order |
| A name, code, quantity, or unfamiliar term | A plausible join can still change the value | Every character, including dash type and digits |
| A historic-language split | Spelling at a printed break may differ from the unsplit word | Edition, source spelling, and an appropriate language reference |
| Verse, lists, tables, or code | Line endings can encode meaning or structure | Lineation, item boundaries, cells, and indentation |
| Ellipsis, abbreviation, or short final line | Punctuation does not prove paragraph position | The complete paragraph and its surrounding blocks |
If several pages show the same problem, search for that pattern throughout the document and review the matches. If source letters, reading order, or whole passages are wrong, stop normalization and revisit recognition or extraction. For recognition across multiple languages, use the separate mixed-language PDF OCR workflow.
Verify the cleaned source before translating it
Compare an edited block with the original page, then check a different block and every different structural type present in the extract. Keep known failures in the review set. Sampling supplies evidence about checked passages; it does not certify the rest of the book.
- Confirm that names, numbers, dates, and codes still match the source.
- Check every removed hyphen and any spelling reconstructed across a break.
- Compare paragraph, heading, list-item, and verse-line boundaries.
- Confirm that first and last lines survived each page transition.
- Search for unresolved candidates and keep them visible in the review log.
- Ensure that the final saved version is the one your next workflow receives.
If all you needed was searchable text or notes, this verified extract may be the endpoint. You do not need translation to repair it.
If you need the document in another language, prepare the verified content in a supported document format and use the complete-document translation workflow. BookTranslator's OCR Mode rebuilds a translated PDF from recognized content rather than reproducing the original page layout; it is not an external text-cleanup editor or proof that every source break was interpreted correctly. The scanned PDF guide explains when recognition is needed.
Keep the original pages and cleanup log for the final PDF translation QA pass. A fluent target sentence cannot tell you that the source should have contained a genuine hyphen—or that two apparently continuous sentences were separate paragraphs.
Related Posts





