Verbatim vs Expanded Values in Polly

1 minute read
Content level: Foundational
0

Challenge: The Polly service expands abbreviated measurement values. There are many cases when 25g or 7l isn't intended to be grams or liters. Lets explore ways to work around the full form expansion!

Polly expands abbreviations and assumes context. 25g to Polly means 25 grams, even if you mean 25 G of force. In order to get around this, use single quotes around the portion that should not be interpreted. For example, 25'g' would stop Polly from assuming the g = grams. Wrapping in SSML tags such as <say-as interpret-as="INPUT HERE"> where INPUT HERE is unimportant will also stop this. This is because the Polly service isolates every part of the transcript searching for specific values. The details aren't important in this scenario, the key is that the <say-as interpret-as=> isolates every part of the phrase making it so some context is lost on 25g and 7l which forces verbatim output!

Say-As Polly - https://docs.aws.amazon.com/polly/latest/dg/supportedtags.html#say-as-tag

profile pictureAWS
SUPPORT ENGINEER
published 21 days ago1336 views