How to set the default intent? - alexa-skills-kit

I find that if I have just one intent (in addition to the built-in intents), no matter what utterance is spoken, it will always invoke the endpoint with request.intent.name matching the name of that one intent.
If I have more than one intent configured, if the utterance spoken does not match any of the sample utterances of any of the intents, one of the intents will be selected. It seems to be always the same one for each build. I don't know how this "default" intent is selected.
How do I select one intent to be the default, or make it go to AMAZON.HelpIntent?

as far as I understand, what happens is that the triggered intent is chosen like the best candidate, based on the utterances that are pretty close to what Alexa understood.
Not sure if you have, for example, a FallBackIntent. Also you can try adding an ExceptionHandler.
There is no way to select a default intent.
I hope this shines a light on the right path to clarify your doubt.

Related

Watson Conversation supports nested Intents?

Does anyone have a good example of nested Intents especially where #yes and #no are child nodes. The situation i am getting is that the API is returning with Intent value but the output text from "Anything else"!
There is an undocumented feature that if the confidence is <0.2 then it will automatically jump to the Anything Else node.
So to get it to go to the right intent node, you will need to train the intents a bit better.
Alternatively for dealing with multiple intents you can access the intents array using the intents object.
Example:
intents[0].matches('yes|no')
OR
intents[1].matches('yes|no')
From a coding point of view you can set the flag alternate_intents and then review the returned intents array.

Amazon Alexa - One intent enable utterances

In Amazon Alexa is there a way to have one intent initialize a set of utterances?
I ask because I need to identify models of cars in addition to times and places. Adding slots for cars/places seems ridiculous as there would probably be 8000+ possibilities.
ex:
valetService.prototype.launch = fucntion(intent, session, response){
if(intent.slots['vehicleType'] === 'car'){
response.ask('Which vehicle?', *activate utterance*);
}
};
If this isnt possible, could I create a series of functions that handle each piece of information necessary and then change the target function for a single-word-intent each time?
You don't need to do what your question is aimed at. What you're trying to avoid --not defining a Custom Slot Type-- is actually the answer to your problem.
You can use a Custom Slot Type for what you want. I agree that it would be ridiculous to list all the possible options, but that's the catch: you don't have to!
All you have to do is to define a Custom Slot Type, perhaps add a few values, because I'm not sure you can get away without and you're done. Alexa WILL SEND the value for the slot to your skill, even if it is not in the list. In Amazon words:
Note that a custom slot type is not the equivalent of an enumeration. Values outside the list may still be returned if recognized by the spoken language understanding system. Although input to a custom slot type is weighted towards the values in the list, it is not constrained to just the items on the list. Your code still needs to include validation and error checking when using slot values. See the “Handling Possible Input Errors” section of Handling Requests Sent by Alexa.
You can find all about it here.

'If' arguments involving the player in Inform 7 causing contradictions

I'm trying to make a game in Inform 7 and have encountered a major problem, the answer to which apparently can't be found with a google search.
I'm using an 'if' argument to change certain situations based on what room the player is in. Instead of seeing what I have written as an 'if' argument, it has assumed 'If the player' to be an entity of itself.
This is the error message:
You wrote 'If the player is in Reception' , but also 'If the player is in
the Corner Table' : that seems to be saying that the same object (If
the player) must be in two different places (Reception and Corner
Table). This looks like a contradiction.
This is my code in both places:
If the player is in the Corner Table;
Understand the command "leave" or "exit" as something new.
Understand "leave" or "exit" as northwest.
If the player is in Reception;
Understand "key" as the Janitor's Key.
So, uh... can anybody help me?
There are several issues with the code you posted:
You can't have an if phrase out of context. You must write a rule for when the if phrase is considered.
Conversely, you can't use understand phrases in context. More specifically, if ...: understand "..." as ... isn't possible. Understand phrases must always be standalone.
The if phrases should end in a colon, not a semicolon.
"northwest" by itself is not an action; "going northwest" is.
You apparently want this instead:
Instead of exiting when the location is the Corner Table:
try going northwest.
This redirects the exiting action (which includes the commands "leave" and "exit") to the going northwest action in that particular room.
For the second if phrase, firstly if you have an object called "Janitor's Key" the game already understands "key" as referring to this object unless you've specifically made the object privately-named. Secondly, why have the game recognize "key" only in one location? Built-in scoping already makes sure that you can't refer to things that are not in the same room as the player.
So if the object is privately-named, and there's a reason why the key should be referred as such only in one location, the code for that is:
Understand "key" as the Janitor's Key when the location is the Reception.
But, as said, this is necessary only in very specific situations and most likely it's best to let the standard library handle it and leave it out altogether.

Is there (or has there been considered) anything like 'merge' or 'batch' setting in Firebase?

In doing a bit more programming with Firebase today, I found myself wishing for a couple of features:
1) Merge set:
Say I have a firebase ref that has the value {a:1,b:2,c:3}.
If I do something like ref.set({a:-1,b:-2}) the new value will (unsurprisingly) be {a:-1,b:-2}.
Instead, imagine ref.mergeSet({a:-1,b:-2}) which would have a result in the value of the ref being {a:-1,b:-2,c:3}.
Now, I realize that I could do something like ref.child("a").set(-1) and ref.child("b").set(-2) to achieve this result, but in at least some cases, I'd prefer to get only a single call to my .on() handler.
This segues into my second idea.
2) Batch set:
In my application I'd like a way to force an arbitrary number of calls to .set to only result in one call to .on in other clients. Something like:
ref.startBatch()
ref.child("a").set(1)
ref.child("b").set(2)
....
ref.endBatch()
In batch mode, .set wouldn't result in a call to .on, instead, the minimal number of calls to .on would all result from calling .endBatch.
I readily admit that these ideas are pretty nascent, and I wouldn't be surprised if they conflict with existing architectural features of Firebase, but I thought I'd share them anyway. I find that I'm having to spend more time ensuring consistency across clients when using Firebase than I expected to.
Thanks again, and keep up the great work.
UPDATE: We've added a new update() method to the Firebase web client and PATCH support to the REST API, which allow you to atomically modify multiple siblings at a particular location, while leaving the other siblings unmodified. This is what you described as "mergeSet" and can be used as follows:
ref.update({a: -1, b: -2});
which will update 'a' and 'b', but leave 'c' unmodified.
OLD ANSWER
Thanks for the detailed feature request! We'd love to hear more about your use case and how these primitives would help you. If you're willing to share more details, email support#firebase.com and we can dig into your scenario.
To answer your question though, the primary reason we don't have these features is related our architecture and the performance / consistency guarantees that we're trying to maintain. Not to go too deep, but if you imagine that your Firebase data is spread across many servers, it's easier for us to have stronger guarantees (atomicity, ordering, etc.) when modifying data that's close in the tree than when modifying data that's far away. So by limiting these guarantees to data that you can replace with a single set() call, we push you in a direction that will perform well with the Firebase architecture.
In some cases, you may be able to get roughly what you want by just reorganizing your tree. For instance, if you know you always want to set 'a' and 'b' together, you could put them under a common 'ab' parent and do ref.child('ab').set({a:-1, b:-2});, which won't affect the 'c' child.
Like I said, we'd love to hear more about your scenario. We're in beta so that we can learn from developers about how they're using the API and where it's falling short! support#firebase.com :-)

How to determine if a profile data member has ever been set?

I've asked this before but I'm resurrecting it because I didn't get a satisfactory response.
I have a profile variable, and when I load it then it is assigned default values. I need to check to see if it has ever been assigned. Typically I'd use an is null comparison but that won't work.
It was suggested I use the FindProfilesByUserName which seems backward. Regardless this method wont work as it only tells me if the user has any profile created but not for the specific member data I'm interested in. (It seems backwards because the whole purpose of the profiles was to make it easy to access the current user profile data. This seems like a bad design unless I'm missing something.)
The last option I can see is assigning bits to every object to see if they were dirtied or set. I don't want to do this unless required though.
Here is the FindProfilesByUserName sample :
ProfileInfoCollection profileInfo = ProfileManager.FindProfilesByUserName(ProfileAuthenticationOption.All, Membership.GetUser().UserName);
if (profileInfo.Count > 0)
{
if (profileInfo[Membership.GetUser().UserName] != null)
One last idea I've had is storing collections because I think I've read they are nullable. In my case I don't really need a collection but that might be the easiest solution. Look forward to suggestions.. I feel like I must be missing something obvious on this matter.
To be clear
this doesn't work (if http.context.profile.mydata != null)
Okay, I'm surprised no one has experienced this problem: makes me think I'm missing something basic. I'm going to add a group and a dirty flag for the group. If anyone can provide another solution I will give credit for the answer. Or a dirtied flag to the object..
Simply set a default value that represents null. e.g. for an int field, set default to -1.
The requirement that you are describing is, in my opinion, an edge case and in any case is easily fulfilled using the strategy described above.
Your assertion that it is an oversight or shortcoming of the profile model is premature, i think.
Good luck.

Resources