Amazon Alexa skill: Is there a way to have some intents not be allowed or listened for on a page in a skill?

43 Views Asked by At

I want to have Alexa ignore some intent phrases when on a certain page. Is there a way to do this? Like maybe structuring the en-us.json with the intents in a different way? (I am running into an issue where a longer worded intent contains a shorter intent in the wording, and Alexa will do the shorter intent.) Example of my intents.

{
  "interactionModel": {
    "languageModel": {
      "invocationName": "katie elder tree test",
      "intents": [
        {
          "name": "archive",
          "samples": ["archive", "go to archive", "open archive"]
        },
        {
          "name": "back",
          "samples": ["back", "go back", "back to"]
        },
        {
          "name": "toggle_debug",
          "samples": ["Turn on Debug Mode", "Turn off Debug Mode"]
        },
        {
          "name": "toggle_fullscreen",
          "samples": ["Fullscreen", "Turn on fullscreen", "Open Fullscreen", "Fullscreen mode", "exit fullscreen", "no more fullscreen", "turn off fullscreen", "toggle fullscreen", "full screen"]
        }
      ]
    }
  },
  "version": "7"
}
1

There are 1 best solutions below

0
Dave Curley On

In cases where two or more intents are very similar you can try adding LOTS more samples to distinguish them, but you might still not get the accuracy you want.

Intents for on/off settings like debug mode and fullscreen could be restructured so that the utterance becomes e.g. "turn debug on".

samples:

"switch {settableOption} {newValue}"
"turn {newValue} {settableOption}"
"turn {newValue} {settableOption}"

newValue is a custom slot with values ["on", "off"]. settableOption is a custom slot with values ["debug", "fullscreen"].

In your handler, just unpack the (already validated) slots, toggle the setting and respond accordingly.