【问题标题】:How to use SSML in Alexa Skill + Lambda + Js如何在 Alexa Skill + Lambda + Js 中使用 SSML
【发布时间】:2017-10-06 06:57:00
【问题描述】:

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

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
    };
}

我的代码:

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));
}

我认为我在回调中犯了一个错误?提前致谢!

【问题讨论】:

    标签: java aws-lambda alexa-skills-kit


    【解决方案1】:

    如果您使用的是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, &lt;say-as interpret-as="interjection"&gt;Bazinga.&lt;/say-as&gt;&lt;break time="0.3s"/&gt;&lt;amazon:effect name="whispered"&gt; I love it. &lt;/amazon:effect&gt;')

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

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

    【讨论】:

      猜你喜欢
      • 2017-06-06
      • 1970-01-01
      • 2019-05-09
      • 2019-01-03
      • 1970-01-01
      • 1970-01-01
      • 2018-05-05
      • 2017-05-31
      • 2019-11-09
      相关资源
      最近更新 更多