overview
Download SVG ↓Messy text, predictable output
Swipe diagram ↔ / 左右滑动查看完整图表
architecture
Download SVG ↓Standard library, small surface
Swipe diagram ↔ / 左右滑动查看完整图表
quickstart
Download SVG ↓Try both helpers, then import
Swipe diagram ↔ / 左右滑动查看完整图表
Put it in your README
These paths assume your README is beside the SVGs. Adjust the prefix when copying into your repository.
Sources, not assumptions
File paths and line ranges were checked. This does not verify meaning or architecture edges. Review all claims and excerpts before publishing; excerpts may contain private data.
overview / input text_utils.py:4–5
def normalize_space(text: str) -> str:
return " ".join(text.split())overview / normalize text_utils.py:4–5
def normalize_space(text: str) -> str:
return " ".join(text.split())overview / slug text_utils.py:7–8
def slugify(text: str) -> str:
return re.sub(r"[^\w]+", "-", normalize_space(text).lower(), flags=re.UNICODE).strip("-")architecture / demo demo.py:1–3
from text_utils import normalize_space, slugify
print(normalize_space(" hello world "))
print(slugify(" Hello World! "))architecture / slugify text_utils.py:7–8
def slugify(text: str) -> str:
return re.sub(r"[^\w]+", "-", normalize_space(text).lower(), flags=re.UNICODE).strip("-")architecture / normalize text_utils.py:4–5
def normalize_space(text: str) -> str:
return " ".join(text.split())architecture / regex text_utils.py:2–8
import re
def normalize_space(text: str) -> str:
return " ".join(text.split())
def slugify(text: str) -> str:
return re.sub(r"[^\w]+", "-", normalize_space(text).lower(), flags=re.UNICODE).strip("-")quickstart / runtime README.md:8–8
Requires Python 3.10+; no installation dependencies.
quickstart / demo README.md:9–10
From this directory, run `python demo.py`. The first output is `hello world`; the second is `hello-world`.
quickstart / import demo.py:1–3
from text_utils import normalize_space, slugify
print(normalize_space(" hello world "))
print(slugify(" Hello World! "))