简体   繁体   English

Amazon Alexa无法识别号码槽

[英]Amazon Alexa isn't recognizing a number slot

Lets say i have this in my schema: 可以说我的架构中有这个:

 {
  "slots": [
    {
      "name": "number",
      "type": "AMAZON.NUMBER"
    }
  ],
  "intent": "PriceMyProduct"
}

And these utterances: 这些话语:

PriceMyProduct price of {number}
PriceMyProduct {number} price

In my lambda function I have this intent handler 在我的lambda函数中,我有这个意图处理程序

'PriceMyProduct': function(){
        var itemNumber = this.event.request.slots.number.value;
         //DO STUFF
 }

The problem is that "itemNumber" never picks up the number of the product, so it is always undefined. 问题是“ itemNumber”从不提取产品的编号,因此始终是未定义的。

I have tried doing stuff like "price of 133202" or "133923 price", but the number value is never picked up. 我已经尝试过执行“ 133202价格”或“ 133923价格”之类的操作,但是数字值从未被提取。 What could be the problem? 可能是什么问题呢?

Try changing name of your slot from "number" to let say "priceValue". 尝试将广告位的名称从“数字”更改为“ priceValue”。 Something like this: 像这样:

{
  "slots": [
    {
      "name": "priceValue",
      "type": "AMAZON.NUMBER"
    }
  ],
  "intent": "PriceMyProduct"
}

Then update utterances like this: 然后像这样更新话语:

PriceMyProduct price of {priceValue}
PriceMyProduct {priceValue} price

And in lambda use the new name: 在lambda中使用新名称:

'PriceMyProduct': function(){
    var itemNumber = this.event.request.slots.priceValue.value;
     //DO STUFF
 }

Reason: number seems to be a reserved name 原因:数字似乎是保留名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM