首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Alexa Skill + Lambda + Js中使用SSML

如何在Alexa Skill + Lambda + Js中使用SSML
EN

Stack Overflow用户
提问于 2017-05-08 18:04:17
回答 1查看 1.7K关注 0票数 1

我正在尝试在我的Alexa技能中使用SSML。我使用Lambda作为我的服务端点,并使用Js对其进行编程。现在我的问题是,我如何在我的技能中正确地实现这一点?我使用以下函数来使用SSML:

代码语言:javascript
复制
function buildSSMLSpeechletResponse(title, output, repromptText, shouldEndSession) {
    return {
        outputSpeech: {
            type: "SSML",
            ssml: output
        },
        card: {
            type: "Simple",
            title: "SessionSpeechlet - " + title,
            content: "SessionSpeechlet - " + output
        },
        reprompt: {
            outputSpeech: {
                type: "SSML",
                text: repromptText
            }
        },
        shouldEndSession: shouldEndSession
    };
}

我的代码:

代码语言:javascript
复制
function onLaunch(launchRequest, session, callback) {
    console.log("onLaunch requestId=" + launchRequest.requestId
        + ", sessionId=" + session.sessionId);

    var cardTitle = "Hello, World!";
    var speechOutput = { type: "SSML",
    ssml: "<speak>Welcome to Hubo help. <amazon:effect name='whispered'>You can ask questions like</amazon:effect>: 'How do I paint a wall?'. Now what can I help you with?.</speak>", };
    callback(session.attributes,
        buildSSMLSpeechletResponse(cardTitle, speechOutput, "", true));
}

我想我在回拨的时候搞错了?提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2017-05-08 20:37:39

如果您使用的是Alexa Skills Kit SDK for Node.js,那么只需在要发出的文本中包含SSML标记即可。

例如:

this.emit(':tell', 'Sometimes when I look at the Alexa skills you have all taught me, I just have to say, <say-as interpret-as="interjection">Bazinga.</say-as><break time="0.3s"/><amazon:effect name="whispered"> I love it. </amazon:effect>')

this.emit(':tell', '<say-as interpret-as="interjection">Oh boy</say-as><break time="1s"/> this is just an example.')

它将包含在README.md文件中,现在已经有了this PR

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43844826

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档