如何在自定义技能中更改 Alexa 特定单词的发音?

How can I change the pronunciation of a specific word by Alexa in a custom skill?

有时,在开发 Alexa 技能并对来自我的服务的响应进行编程时,Alexa 会读错我回复中的某个单词,从而使用户感到困惑。

例如,如果我想让 Alexa 说一个词,让它成为 live,我怎么能告诉 Alexa 如何正确发音这个词,因为 [=存在两个发音=16=]直播.

有没有办法向 Alexa 口述正确的发音,或者用正确的自定义声音替换它?我是否需要使用额外的标记或 API 调用?

Alexa 支持 SSML,这是一种类似于 XML 的语音标记语言。您可以使用 SSML 响应,而不是从您的服务返回纯文本。 <phoneme> 标签是您特别需要的:

phoneme

Provides a phonemic/phonetic pronunciation for the contained text. For example, people may pronounce words like “pecan” differently.

对于英语单词(尤其是美国英语),如果您给它正确的语音发音,Alexa 应该能够发音:

The following tables list the supported symbols for use with the phoneme tag. These symbols provide full coverage for the sounds of US English. Note that many non-English languages require the use of symbols not included in this list, which are not supported. Using symbols not included in this list is discouraged, as it may result in suboptimal speech synthesis.

来自 Amazon documentation 关于 SSML 的引用。

下面是一个为 Alexa 指定单词发音的示例 live:

<speak>
    <phoneme alphabet="ipa" ph="lɪv">live 1</phoneme>.
    <phoneme alphabet="ipa" ph="laɪv">live 2</phoneme>.
</speak> 

<phoneme>标签支持IPA and X-SAMPA phonetic alphabets. You can typically find IPA spellings for any word on Wiktionary或通过Google。

对于较长的消息,最好使用 <audio> 标签并录制自定义语音:

The audio tag lets you provide the URL for an MP3 file that the Alexa service can play while rendering a response. You can use this to embed short, pre-recorded audio within your service’s response. For example, you could include sound effects alongside your text-to-speech responses, or provide responses using a voice associated with your brand.

引自 <audio> 上的亚马逊文档。