feat(voice): clean non-pronounceable chars from TTS replies#22
Merged
Conversation
Voice responses now strip emojis, URLs, code snippets, bullets, dashes, and markdown symbols (*, #, _, ~, >, |) before synthesis, leaving plain speakable text. Cleaning lives at the synthesize() chokepoint so every caller benefits. Closes #10 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lies The post-hoc cleaner is a safety net; intent belongs at the source. When the model chooses [respond_with_voice], the skill now tells it to write the whole message to be spoken — no emojis, symbols, URLs, code, or bullets — and to fall back to text when content only works on screen. Relates to #10 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10.
Voice replies are now sanitized before TTS so they read cleanly aloud.
What
Added
clean_for_speech()invoice/pipeline.py, applied at thesynthesize()chokepoint (every voice-reply path routes through it). It strips:So)http(s)://…,www.…)```blocks and inline`…`-,*,•, …)e-mail)Test
tests/test_voice_clean.py— 7 asserts covering each rule.make testgreen, ruff clean.🤖 Generated with Claude Code