Skip to content

Clean Up Text

🤖 AI Drafted (Not reviewed)

Transcribe each file (reusing any existing text layer), then clean the extracted text with an LLM: fix OCR noise, normalize whitespace and hyphenation, and strip page headers/footers and scanning artefacts — preserving the original meaning. The cleanup behaviour (aspect toggles, prompt, and model) is fully editable on the Clean Up Text node. The LLM node uses the $small model alias — set your default small model in Settings → AI Defaults.

Folder /Clean Up
Steps 3
Tags preset, cleanup, text, ocr, small

Steps, in run order

1. Files

Tool: Files — Pass through input files from workflow context

2. Transcribe each file

Tool: Transcribe — Extract text from images (OCR)

Settings this step uses:

Option Value
language auto
update_page_content yes
vision_mode auto

What this step asks the model:

Transcribe the text visible on this image.

Language: transcribe in the language of the source. Do not translate, and do not assume the document is in English.

Rules:
- Output ONLY the transcription. No headings, no preamble, no commentary,
  no summary, no notes, no explanations, no observations about quality or
  legibility, no descriptions of seals or images, no language about the
  difficulty of the handwriting.
- Preserve original layout, line breaks, and paragraph structure.
- Preserve original spelling and capitalisation, including ALL CAPS
  headers if they appear that way.
- Preserve orthography exactly as written, including all diacritics
  and accent marks (e.g., keep "Chocó" as "Chocó", never "Choco";
  keep "Ramón" as "Ramón", never "Ramon").
- Do not strip accents, tildes, cedillas, or umlauts. If a mark is
  visible, keep it.
- Include every visible text element — headers, body, marginalia, stamps,
  signatures (transcribe the signed name as written), printed labels,
  handwritten annotations.
- For text you cannot confidently read, use explicit uncertainty markers:
  [ilegible] for unreadable text and [uncertain] for plausible-but-low-
  confidence readings. Place the marker inline at the uncertain span.
  Do not guess. Do not fill in.
- Do NOT invent dates, numbers, names, or words that are not legibly
  present. Do not normalise dates ("23/7/1999" stays "23/7/1999", not
  "1999-07-23").
- Do NOT repeat any portion of the transcription. Output each visible
  passage exactly once.
- If the image contains no legible text, output the single token
  [sin texto].

3. Clean Up Text

Tool: Clean Up Text — Clean extracted or transcribed text: fix OCR noise, normalize whitespace and hyphenation, strip page headers/footers and scanning artefacts — preserving the original meaning.

Settings this step uses:

Option Value
fix_hyphenation yes
fix_ocr yes
normalize_whitespace yes
provider_name $small
strip_artifacts yes

What this step asks the model:

Clean up the following text. Apply ONLY these fixes:

- Correct obvious OCR misrecognitions (e.g. 'rn'→'m', '0'→'o', 'l'→'I') only when the intended word is unambiguous.
- Rejoin lines that were hard-wrapped mid-sentence back into paragraphs. Keep tables, verse, lists and headings on their own lines.
- Rejoin words split across line breaks by a trailing hyphen (e.g. 'exam-\nple' → 'example').
- Normalize whitespace: collapse repeated spaces, trim trailing spaces, and reduce runs of blank lines to a single blank line. Keep paragraph breaks.
- Remove text that is not part of the document body: running page headers/footers, standalone page numbers, and library or date stamps.

Preserve the original meaning, wording, spelling, capitalisation, and the
order of the content. Preserve any [ilegible] / [uncertain] markers and
original accents / diacritics verbatim. Do NOT summarize, paraphrase,
translate, reorder, or add any new information or commentary.

Output ONLY the cleaned text, with no preamble or explanation. Return
PLAIN TEXT: no markdown formatting, no trailing spaces on lines, and no
added blank lines beyond the original paragraph breaks.