Alexa Skills Kit (ASK) and Utterances

孤街浪徒 提交于 2019-12-05 05:46:48

Based on the inclusion of an unhandled intent in your approach, it sounds like you are using the Alexa Skills Kit SDK for Node.js. Your issue is not an artifact of the test interface. Yes, something else is happening.

While not yet acknowledged by amazon, this is a recognized issue in the SDK by a number of folks. See this open issue. Speaking from personal experience to the suggestion above, it doesn't matter if you use real words or gibberish, the unhandled intent is never called. Until this is fixed, my suggestion would be to build a handler that is a high level prompt for your skill, and reiterates for the user the valid options they have. Position it to be the catch-all. Hopefully we will see better maintenance of this SDK moving forward.

Instead of typing dsfhfdsjhf (which is not pronounceable in any language Alexa knows), what happens if your utterance is boogie or shake?

In a real-world scenario, I don't think Alexa would ever pass dsfhfdsjhf, so it may be difficult to plan exactly what the behavior would be.

So you'd like to pipe all garbage inputs to a single intent. You're in luck. Here's a few things you should know before proceeding.

In Node.js the unhandled handler is fired within a MODE if the intent returned by the Alexa voice service is not available within the given MODE.
An example MODE would be confirmation mode. Of the many intents that are available yes and no are the only intents that are accepted.

var ConfirmationHandlers = Alexa.CreateStateHandler(states.CONFIRMATIONMODE, {
    'YesIntent': function () {
      this.handler.state = states.CLOSINGCOSTSMODE;
      message = ` So you will be buying this house. Great! `; 
      reprompt = `Please carry on with the other intents found in the house buyer skill.  `;
      this.emit(':ask', message, reprompt);
    },
    'NoIntent': function () {
      this.handler.state = states.GENERALSEARCHMODE;
      message = ` So you won't be buying this house. That's Ok, Continue searching for your dream house in the House buyer skill. !`; 
      reprompt = `Continue searching for your dream house in the House buyer skill.`;
      this.emit(':ask', message, reprompt);
    },
    'Unhandled': function() {
        console.log("UNHANDLED");
        var reprompt = ` All other intents are disabled at this moment.  Would you like to buy this house Yes or No? `;
        this.emit(':ask', reprompt, reprompt);
    }
});

However, before reaching the lambda function the Alexa Voice Service must interpret your utterance and map it to one of the available intents. If your utterance is garbage and does not map to any specific intent it is currently being mapped to the first intent.

Solution: If you would like to add a garbage intent this is something that should be handled by the intent schema not by the unhandled intent. To add a garbage intent you can follow the instructions in this amazon article.

https://developer.amazon.com/blogs/post/Tx3IHSFQSUF3RQP/Why-a-Custom-Slot-is-the-Literal-Solution

Scenario 3: I just want everything. Using custom slot types for grammar as described above typically fulfills this desire and enables you to improve accuracy through NLP training. If you still just want everything, you can create a custom slot called something like “CatchAll” and a corresponding intent and utterance: CatchAllIntent {CatchAll}. If you use the same training data that you would have used for LITERAL, you’ll get the same results. People typically find that adding a little more scenario specific training data improves accuracy.

If you’re still not getting the results, trying setting the CatchAll values to around twenty 2 to 8 word random phrases (from a random word generator – be really random). When the user says something that matches your other utterances, those intents will still be sent. When it doesn’t match any of those, it will fall to the CatchAll slot. If you go this route, you’re going to lose accuracy because you’re not taking full advantage of Alexa’s NLP so you’ll need to test heavily.

Any input that is not mapped to one of your more specific intents, like YES or NO, will very likely map to this CatchAll intent.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!