Skip to content

fix: preserve SSML tags in clean_text_for_tts#34

Open
Sanjays2402 wants to merge 1 commit into
jumping2000:mainfrom
Sanjays2402:fix/preserve-ssml-tags-tts
Open

fix: preserve SSML tags in clean_text_for_tts#34
Sanjays2402 wants to merge 1 commit into
jumping2000:mainfrom
Sanjays2402:fix/preserve-ssml-tags-tts

Conversation

@Sanjays2402

Copy link
Copy Markdown

Description

clean_text_for_tts() removed every angle-bracket tag with re.sub(r'<[^>]+>', '', text), which also stripped valid SSML markup such as <voice name="Giorgio">. Tag removal is now name-aware: known SSML tags (speak, voice, prosody, break, say-as, emphasis, lang, phoneme) are preserved, every other tag is stripped exactly as before.

Motivation and Context

Closes #32 — SSML voice tags never reached the TTS service, so Alexa always used its default voice.

How has this been tested?

Added test_preserves_ssml_voice_tag, a parametrized test_preserves_other_ssml_tags, and test_strips_html_around_ssml to tests/test_utils.py. They fail on the current code (6 failures) and pass with the fix; the whole tests/test_utils.py suite is green (67 passed).

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

clean_text_for_tts() stripped every angle-bracket tag, so valid SSML
markup such as <voice name="..."> was removed before the message reached
the TTS service and Alexa fell back to its default voice.

Tag removal is now name-aware: known SSML tags (speak, voice, prosody,
break, say-as, emphasis, lang, phoneme) are kept, all other tags are
still stripped as before.

Closes jumping2000#32
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.

clean_text_for_tts() strips valid SSML <voice> tags, breaking custom Alexa voice selection

1 participant