question

Bonafide avatar image
Bonafide asked ·

Intent triggering without utterance match

While playing around with the Alexa Skills Kit demos (java), I noticed that Alexa seems to be triggering a slot-less intent as long as the utterance does not match any of the utterances belonging to other intents. For example, in the wiseguy sample, the intents are: "intents": [ { "intent": "TellMeAJokeIntent" }, { "intent": "WhosThereIntent" }, { "intent": "SetupNameWhoIntent", "slots":[ { "name": "SetupName", "type": "LIST_OF_SETUP_NAMES" } ] }, { "intent": "AMAZON.HelpIntent" }, { "intent": "AMAZON.StopIntent" }, { "intent": "AMAZON.CancelIntent" } ] The defined utterances for WhosThereIntent include the expected variations of "who's there" . However, when executing the wiseguy app, in the "WhosThere" stage, the user can make almost any utterance and the "WhosThereIntent" is triggered. The WhosThereIntent utterances do not seem to be used. As long as the user does not speak an utterance belonging to one of the other intents, the WhosThereIntent is triggered. Is this the intended behavior? If so, how does Alexa decide which slot-less intent is triggered as a "default"? To prevent this, I guess I could create a slot and add all of the utterances to the slot values, but this does not seem to fit the intended model. So, is there any check that can be performed when the intent is triggered to determine if it was triggered because of an utterance match instead of an assumed intent? (i.e what is the. probability of utterance match that triggered this intent) Thanks

alexa skills kitvoice-user interface
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered ·
There is no way to set a default intent. Alexa matches as best as it can. (And sometimes it can be pretty wonky.) If it can't match anything at all, it drops the session. What you are probably seeing is it deciding that what you said was closest to some utterance. The utterances are just hints. The logistics of Alexa digest those down into candidate cases. When it attempts to render text from your speech, it does a confidence match against the phrase profiles and picks whichever one comes up highest.
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bonafide avatar image
Bonafide answered ·
What you described is also my understanding of how intent matching is supposed to work. However, even the samples (wiseguy, history buff) are triggering the intent on [u]any phrase[/u]. The Flow is: 1: User: 'Alexa, ask wise guy to tell me a knock knock joke' 2: Alexa: 'Knock, Knock' 3: User: 'I like pink bunnies and watermelons' 4: Alexa: boo The utterances for step 3 are supposed to be limited to, "yes, sure, yes please," and similar affirmatives. As I mentioned, I don't know how to check the confidence match level, but I think pink bunnies and watermelons are pretty far off. I've thrown a lot of responses at it and they all trigger the intent. I do think you are right about it picking the phrase that comes up highest ... it is just that the others are all low and my phrases must be the least low of all of them. Seems like there should be a minimum match confidence threshold. May be interesting to see what happens if I throw in some other dummy slot-less intents and utterances. Still would like to know if the Alexa team believes this is the intended behavior.
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

justin avatar image
justin answered ·
Hi Bonafide, There are a few things to keep in mind when doing this error handling, and I will try to expand a bit below: As stated, your sample utterances are the key driver to which intent is being invoked, so providing a breadth of examples and variations for each intent is critical when dealing with complex skills. Let's use WiseGuy as an example. By iterating each stage in a linear fashion like you've described, we can set a session.attribute.stage attribute equal to the current step in the process -- in this case, the "who's there" stage would be stage 3. With your [b]whosThereIntent[/b] intent schema pointing to a Custom Slot ([b]whosThereWords[/b]), you can then validate at the beginning of the [b]whosThereIntent[/b] if the following criteria is met: 1) Your application matches the appropriate session.attributes.stage of 3 that you've declared (your [b]knockKnock[/b] function should have incremented to this value at the end of it's invocation). 2) The custom slot values in your sample utterance, which triggered the [b]whosThereIntent[/b] to fire also match the intent of the user. This is where Custom slots can be used for the validation, either through strict or partial matching. At this time, this is handled on the developer's end, so you will need to choose which method you'd like to incorporate. If you are trying to use strict matching, you would essentially duplicate the values of your custom slot into an array. In this case, whosThereWords. You can then check against what Alexa heard by setting this value to a variable, such as: [code]var interpretedValue = intent.slots.whosThereWords.value;[/code] From there, you would simply iterate through the array to see if that value exists. An example using 'indexOf': [code] // These are copied from your custom slot values var whosThereSlotWords = ["who","who's there","who is there","who is it", "who's that", "what", "what's that"]; // Check if the interpretedValue is in that array, a -1 means no match if (interpretedValue != undefined && whosThereSlotWords.indexOf(interpretedValue > -1) { // output = "an impatient cow. "; } else { // output = "sorry, i don't understand what you were saying. "; } [/code] To perform a fuzzy match, you'd need to provide an algorithm, like Levenstein's, to determine if it's 'close enough', as discussed here: https://forums.developer.amazon.com/forums/thread.jspa?threadID=10165 Recap: Sample Utterances point to your intent. Check to make sure your intent knows what stage your skill is currently in to avoid mismatched/missing information to the user. Use Custom Slots to further check and validate the user's spoken intent. Thanks, Justin
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

doriancoder3 avatar image
doriancoder3 answered ·
Seeing utterance matching issues as well. While not as complex as the example above, all I have been trying to do is match exact sample utterances (no slots), and it is getting it wrong. I know that sample utterances are said to only serve as examples, but it doesn't even try an exact match first?
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

justin avatar image
justin answered ·
Hi doriancoder3, It certainly should try to match the exact first. Could you share any of your sample utterances and intent schema? Please feel free to write and ask for me directly in Contact Us if you would like to keep this data private. Please provide your skill's app-id for us to further evaluate your issue. https://developer.amazon.com/appsandservices/support/contact/contact-us Thanks! Justin
1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I have the same issue. I develop a skill, one intent is to get the wifi password. the sample utterance "what is wifi password", "How to connect to internet". But in simulator, when I type "mur mur", the intent is triggered rather than the unhandled Intent. It also happens with devices.

0 Likes 0 ·
jorgehjr84 avatar image
jorgehjr84 answered ·

I am having the same utterance issues. If I say or type an utterance in the testing environment, for example blah blah blah or whats up, my 'gettasks' intent runs. Which is not even close. So I striped out all custom intents and left the AMAZON.HELP intent in, the problem then went away. So I added back in one of my intents, a different one from 'gettasks' and type blah blah blah, and it triggers that intent. So it seems like any custom intent I have in my application gets triggered when Alexa does not recognize my utterance. This would be ideal if it were triggering the AMAZON.HELP intent every time to inform the user of what utterances need to be spoken, but that is not the case. Any help on this would be appreciated.

1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Since Alexa matches on a confidence basis, if you only have one intent it's always going to have the highest confidence level, so it's always going to match. I've asked a number of times for Amazon to do what Watson Speech To Text does and return the confidence level of what it matched so we can make a quality decision and returned multiple interpretations with the confidence level of each. I've been playing with Watson Conversations recently and they have a nifty feature where you can group a collection of intents together into a Dialog. You rank the intents from top to bottom, and you can have a special "everything else" intent that matches if the confidence isn't high enough on the other intents. Amazon would do well to copy this if it isn't patented (and license it, if it is).

2 Likes 2 ·
nuukee avatar image
nuukee answered ·

I am having the same / similar issue.

As soon as I have one of my intents in, in always defaults to one of them if there should be no match.

For example my intent was something like "who lives here" and it would match it even if I ask "what is the weather like"

I found out that in my case it would always default to the intent which had most sample utterances.

So the reasoning seems to be that if Alexa cannot match an intent it chooses the one with the most utterances as there is the highest chance of matching.

My circumvention right now is to have a "DidNotUnderstand" intent and feed it many many utterances with only gibberish.

It will now default to this intent, which is my intended behavior, and my lambda code will now have a response like "I did not understand you".

Hope this helps.

3 comments
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

This is really very helpful.

1 Like 1 ·

thanks mate, this resolve the problem, I hope that amazon add this new feature for defaultIntents

0 Likes 0 ·

Thank you so much. It's worked for me.

0 Likes 0 ·
newuser-058f9dc6-12fc-430a-a7be-9930adc7550a avatar image
newuser-058f9dc6-12fc-430a-a7be-9930adc7550a answered ·

Hi ,

I also have a similar issue.I am developing a "Memory Test" in which User will tell a word and alexa will add another word to that word.And it continues. But after saying some words it is going to unknown intent.Why is it so? i am stuck with the problem..Please Help me

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

foobrew avatar image
foobrew answered ·

I'm having similar issues with Alexa picking one of my custom intents which has no slot values whenever the user enters complete gibberish. I'm shocked that the SDK doesn't allow for a default intent when the matching confidence is low. It would be nice to be able to provide a "I have no idea what you just said but here's some help" type of intent which could be triggered when the utterance doesn't even remotely resemble any of the sample utterances.

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.