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 🍬
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file textpraline-0.1.0.tar.gz.
File metadata
- Download URL: textpraline-0.1.0.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
449b32ec3312031d17393e07d2e5674f53ac2819d8bbc3fcc4892961954cdf76
|
|
| MD5 |
6755a019baa305edf66cc50f728ba8f9
|
|
| BLAKE2b-256 |
017d5c51e68abf6c6bd3e51945d62e33800ba91dbaf05cfdca8514c29974d353
|
File details
Details for the file textpraline-0.1.0-py3-none-any.whl.
File metadata
- Download URL: textpraline-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3dbdd49800b161adf5234c5d18b88f0d7c8c1bbb8298adb7c57a435c3ee4b7a
|
|
| MD5 |
e967a7ca1918cb3c1999b5561b6c6af1
|
|
| BLAKE2b-256 |
c8a4d6ed26d81156bb3f8b47c471c07bb7e3e8d6243bfb09e170919aa48e5224
|