Skip to content

feat: add speech normalization for md files#30

Merged
StuBehan merged 2 commits into
mainfrom
feat/speech-normalization
Jul 8, 2026
Merged

feat: add speech normalization for md files#30
StuBehan merged 2 commits into
mainfrom
feat/speech-normalization

Conversation

@StuBehan

@StuBehan StuBehan commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds stackvox.text — a reusable speech-text normalization mechanism that turns real-world text (Markdown, Claude responses, prose) into something that sounds right when synthesized. Two consumers (behan.codes read-aloud and stackone-speaklast) had grown separate, diverging copies of this pre-step; this extracts the shared mechanism into StackVox while leaving each caller's pronunciation dictionary as per-consumer config. See docs/speech-normalization.md for the full proposal and API contract.

Changes

  • New stackvox/text.py module with normalize_for_speech() as the primary entry point, plus each stage exposed for composition/testing: markdown_to_paragraphs, strip_emoji, strip_thousands_separators, decimals_to_words, expand_units, apply_pronunciations, shape_pauses, ensure_terminal_stop.
  • Markdown → prose reduction (headings/list items become their own paragraphs), locale-keyed unit/symbol expansion (£1.63 → "1.63 pounds"), decimals → words (1198.9 → "1198 point 9"), pause shaping, emoji stripping, and caller-supplied pronunciation dictionaries.
  • Backward compatible — existing speak/synthesize behaviour is unchanged; normalization is opt-in.
  • Export normalize_for_speech from the package root (stackvox/__init__.py).
  • Add docs/speech-normalization.md proposal.

Testing

Ran the full CI-equivalent suite locally, all green:

ruff check .            # All checks passed!
ruff format --check .   # 20 files already formatted
mypy                    # Success: no issues found in 18 source files
pytest -q               # 141 passed

Related issues

@StuBehan StuBehan force-pushed the feat/speech-normalization branch from c51bad3 to 6261b76 Compare July 7, 2026 23:29
@StuBehan StuBehan force-pushed the feat/speech-normalization branch from 4db2d9b to 265bc56 Compare July 8, 2026 23:02
@StuBehan StuBehan merged commit f7afddf into main Jul 8, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant