Collection of text processing utilities — zero dependencies, stdlib only.
pip install texttools| Function | Description |
|---|---|
slugify(text) |
Convert text to a URL-safe slug |
truncate(text, max_len, suffix) |
Smart truncation at word boundary |
strip_html(text) |
Remove all HTML tags |
word_count(text) |
Count words |
reading_time(text, wpm) |
Estimated reading time in minutes |
extract_emails(text) |
Find all email addresses |
extract_urls(text) |
Find all URLs |
mask_sensitive(text, mask_char) |
Mask emails, phones, and SSNs |
table_format(headers, rows, padding) |
Format as aligned text table |
json_safe(text) |
Make text JSON-safe (escape control chars) |
normalize_whitespace(text) |
Collapse multiple whitespace |
camel_to_snake(text) |
Convert CamelCase to snake_case |
snake_to_camel(text) |
Convert snake_case to CamelCase |
count_syllables(text) |
Estimate syllable count for reading level |
fingerprint(text) |
Create fuzzy hash for near-duplicate detection |
from texttools import slugify, truncate, reading_time
slugify("Hello World!") # "hello-world"
truncate("A long text...", 15) # "A long text..."
reading_time("word " * 400) # 2 (minutes at 200 wpm)- Python 3.8+
- No external dependencies
MIT
Built by BigWinner.work — AI Tools & Tax Consulting Join our Discord for community support