fix: preserve SSML tags in clean_text_for_tts#34
Open
Sanjays2402 wants to merge 1 commit into
Open
Conversation
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
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.
Description
clean_text_for_tts()removed every angle-bracket tag withre.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 parametrizedtest_preserves_other_ssml_tags, andtest_strips_html_around_ssmltotests/test_utils.py. They fail on the current code (6 failures) and pass with the fix; the wholetests/test_utils.pysuite is green (67 passed).Screenshots (if appropriate):
N/A
Types of changes
Checklist