-1

Alexa Skill Kit (ASK) 内在意图“AMAZON.NUMBER”,将数字单词(“五”)转换为数字(例如“5”)。如何将 Alexa AMAZON.NUMBER 转换回数字单词(“五”)以便 Alexa 说出它?

试:

    "CheckNumberIntent": function (intent, session, response) {
    var numberSlot = intent.slots.Number,
        numberName;
    speech = "Dude you said" + numberSlot + "we should hang out";
    var speechOutput = {
            speech: speech,
            type: AlexaSkill.speechOutputType.PLAIN_TEXT
        };
    response.tellWithCard(speechOutput, "Greeter", "Hello World!");

这导致:

   "response": {
    "outputSpeech": {
      "type": "PlainText",
      "text": "Dude you said[object Object]we should hang out"
    },
4

1 回答 1

1

numberSlot是一个对象,这就是您[object Object]在输出中看到的原因。 根据文档,您需要引用该value成员。此外,您需要在数字周围有空格,否则您最终会得到

伙计,你说我们应该出去玩

这是更正后的代码:

"CheckNumberIntent": function (intent, session, response) {
var numberSlot = intent.slots.Number,
    numberName;
speech = "Dude you said " + numberSlot.value + " we should hang out";
var speechOutput = {
        speech: speech,
        type: AlexaSkill.speechOutputType.PLAIN_TEXT
    };
response.tellWithCard(speechOutput, "Greeter", "Hello World!");
于 2016-03-16T11:25:24.220 回答