Skip to content

Clean Up Text

🤖 AI Drafted (Not reviewed)

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

Tool id clean_text
Category llm
Uses a language model yes
Needs a generative model no
Runs over many items yes
Item handling batch
Structured output yes
Human-verified not yet

What it reads

Port Type Required What it is
Text (text) text yes Extracted or transcribed text to clean.
Context (context) any no Previous text/transcription
Metadata (metadata) json no Existing metadata
Documents (documents) json no Document metadata

What it emits

Port Type Required What it is
Text (text) text — Raw text response
Value (value) any — Parsed value
Texts (texts) array — Per-item texts
Values (values) array — Per-item values
Results (results) json — Full results
Records (records) array — Per-document text records [{doc_id, text}, …].
Artifacts (artifacts) json — Artifact IDs

Options

Option Type Default What it does
choices array — Valid choices. (Not shown in the editor.)
chunk_size_chars integer 0 Chunk large input text above this character budget (0=auto).
cleaning_method string programmatic Choose text cleanup method. ‘programmatic’ is deterministic and avoids LLM context overflow. One of: programmatic, llm.
fix_hyphenation boolean yes Rejoin words split across line breaks by hyphens.
fix_ocr boolean yes Fix obvious OCR misrecognitions (e.g. rn→m, 0→o).
match_mode string prefer Match mode. One of: prefer, strict, inform.
max_items integer 10 List max items.
max_tokens integer 8192 Max response.
max_words integer 50 Word limit.
metadata_field string — Save to field.
model_name string — Model name.
normalize_whitespace boolean yes Collapse stray whitespace and runs of blank lines.
output_format string text Response format. One of: text, boolean, choice, number, words, list, json.
prompt string — Custom prompt.
provider_name string — LLM provider. One of: openai, anthropic, google, ollama, lmstudio, groq, together, deepseek, mistral, openrouter, dashscope, xai, perplexity, fireworks, deepl.
quality_gate boolean yes Stop the run if output is unreadable.
reference_values object — Known values to match. (Not shown in the editor.)
reflow_paragraphs boolean yes Join hard-wrapped lines back into paragraphs (book/OCR text). Tables, verse, lists and headings keep their own line structure.
save_to_db boolean yes Save to library.
save_to_file boolean no Export to file.
strip_artifacts boolean yes Remove page headers/footers, page numbers, and scanning stamps that are not part of the document body.
temperature number 0.7 Creativity.
thinking_mode string off Chain-of-thought reasoning depth. One of: off, short, medium, long.

The prompt it sends

This is what the tool asks a model, with every option left at its default. Changing the options above changes this text.

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.