Skip to main content

wordtidy

Small, dependency-free text helpers for Python 3.8+.

Installation

pip install wordtidy

Usage

from wordtidy import slugify, word_count, truncate, is_palindrome, squeeze_spaces

slugify("Hello, World!")                 # "hello-world"
word_count("one two three")              # 3
truncate("hello world", 8)               # "hello..."
is_palindrome("A man, a plan, a canal: Panama")  # True
squeeze_spaces("  a   b  ")              # "a b"

API

Function Description
slugify(text) Lowercase, hyphen-separated, ASCII-only URL slug
word_count(text) Number of whitespace-separated words
truncate(text, length, suffix="...") Shorten to at most length characters; raises ValueError if length is shorter than suffix
is_palindrome(text) Palindrome check, ignoring case and punctuation
squeeze_spaces(text) Collapse repeated whitespace and trim ends

Development

pip install -e ".[dev]"
pytest

See CONTRIBUTING.md.

License

MIT, see LICENSE.

Metadata

Release files for wordtidy 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wordtidy 0.1.0
File Size Uploaded
wordtidy-0.1.0.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wordtidy 0.1.0
File Interpreter ABI Platform
wordtidy-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / wordtidy-0.1.0.tar.gz

Download URL wordtidy-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
531b1e9f30611a108c8551e9fc1c20682b3d4440388817688534fd58e3a001d7
BLAKE2b-256 checksum
How to use checksums
bdb94297f0ffc086ca32a0ece17d4170f8b9ce2474a72c162dc403a27ab854b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / wordtidy-0.1.0-py3-none-any.whl

Download URL wordtidy-0.1.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9c88410cf1e1cb8d4f62ce83290aab9e9b9f7ccda7707874c2a4d822429fd42
BLAKE2b-256 checksum
How to use checksums
8830264da5dde08abd47dacb900b4ac88a22aac3b48f504b4cf08f96d3abb75f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page