Skip to main content

TextPraline is a text normalization and refinement engine designed to prepare raw extracted content for reliable downstream processing. It cleans and stabilizes text coming from: PDF extractors , OCR pipelines, HTML scrapers. Praline removes structural noise and invisible corruption without altering meaning.

Project description

TextPraline Logo

TextPraline 🍬

TextPraline is the layer used after text extraction to "sweeten" the extracted lines. Perfect before a RAG ingestion 😉


What is TextPraline?

TextPraline is a deterministic, extraction-agnostic text refinement layer designed to run after:

  • PDF text extraction
  • OCR pipelines
  • Vision encoders
  • HTML scrapers
  • Any raw text source

Its goal is simple:

Turn unstable, noisy, extraction-level text into clean, ingestion-ready text.

TextPraline does not rewrite content.
It stabilizes and refines it.

Supported Python versions: 3.10+

Why does this matter?

Raw extracted text is often:

  • polluted with invisible Unicode artifacts
  • broken by layout issues (PDF column noise, vertical text)
  • full of repeated headers/footers
  • corrupted by glyph artefacts or (cid:123) markers
  • unstable in whitespace formatting
  • inconsistent in punctuation normalization

These artifacts degrade:

  • embedding quality
  • chunking accuracy
  • retrieval performance
  • downstream reasoning

TextPraline ensures that what gets embedded is structurally stable and semantically clean.


What TextPraline Does

Universal Cleaning

  • Unicode normalization (NFKC)
  • Removes:
    • control characters
    • zero-width characters
    • BOM
    • soft hyphen
    • variation selectors
    • Private Use Area (PUA)
    • replacement/noncharacters (�)
  • Normalizes typographic quotes and dashes
  • Stabilizes list markers

Extraction-Aware Cleaning (auto-detected)

  • Removes glyph<...> artifacts
  • Removes (cid:NNN) markers
  • Unescapes HTML entities
  • Collapses excessive blank lines
  • Drops layout-noise blocks (PDF axis garbage / vertical text runs)
  • Removes repeated header/footer lines (frequency-based)
  • Removes common boilerplate patterns

Profiles

  • safe → preserves structure, canonical bullet
  • markdown_safe → markdown-friendly -
  • strict → aggressive whitespace collapsing

Monitoring

debug=True returns a PralineReport with metrics about:

  • layout noise removed
  • repeated lines removed
  • ToC lines removed
  • etc.

Future Perspective

TextPraline currently focuses on post-extraction refinement.

A natural evolution would be:

  • optional native PDF extraction adapters
  • OCR integration modules
  • multimodal-aware extraction helpers
  • structured text reconstruction utilities

However, extraction is intentionally kept out of scope for now to preserve:

  • modularity
  • composability
  • separation of concerns

Contributing

TextPraline is built with real-world ingestion in mind.

If you encounter:

  • extraction edge cases
  • layout patterns not properly handled
  • PDFs that break the heuristics
  • corpus-specific artifacts

Please open an issue or propose a pull request.

We actively encourage improvements, new heuristics, and robustness enhancements.

Let’s make ingestion sweeter 🍬

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

textpraline-0.1.1.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

textpraline-0.1.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file textpraline-0.1.1.tar.gz.

File metadata

  • Download URL: textpraline-0.1.1.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for textpraline-0.1.1.tar.gz
Algorithm Hash digest
SHA256 066a44943dd4fac197d54a68aaaf30545507e29135cbcc3bdf910620ba03be61
MD5 7440ae8d4dcfb2519bcdd22588e806e3
BLAKE2b-256 986ea1a18e14d2ddd147ad6c744247df87fac94cfe487ca906372d7cf3505cf1

See more details on using hashes here.

File details

Details for the file textpraline-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: textpraline-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for textpraline-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f1d419b8491a756d8c3e6bdedb0710079a1e1f938cf0bddfe41cb572e013f4c9
MD5 3b6ae01caea913766d42244719ab8958
BLAKE2b-256 25fdbb564211ea4534577df6cac8ce914e6ebd0ab691441d6beaebfe48d82773

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page