7
votes

I am developing a simple, custom skill for Alexa. I have it up and running, and hosting the handler on AWS Lambda. It's working fine except...

In the test UI, if I enter a valid utterance, e.g., help, cancel, swim, run (two custom utterances), everything works well; however, if I enter a nonsense utterance, e.g., dsfhfdsjhf, the Alexa service always maps the nonsense to the first valid intent in the intents schema.

In my lambda code, I have a handler for handling unknown intents; however, the intent is never unknown. Is this an artifact of the test interface? Something else happening?

Thanks, John

3
I can't answer the question, but I've experienced similar discrepancies when using the test UI vs actual device. +1 for asking the question. I was going to steer you toward the Alexa Skills Kit Dev forum, but it looks like you have already posted the question there too. :-)TimHayes
I'm thinking this is an artifact of the test interface. Have you tried testing this on your device?Mike Lane
@John have you found the solution for this?Dhaval Panchal

3 Answers

2
votes

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.

0
votes

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.

0
votes

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.