i have an intent with two slots: 1 custom slot called "name" and one called "number" of type AMAZON.NUMBER.
Now for some names the number is required and for others it isn't.
How can i make alexa ask for the number if one of those names is given without a number?
Can i use the CanFulFillIntentRequest for that?
If so, all the sites about it say that i have to enable it under interfaces, but i can't find it there. Has it been removed?
btw, i'm using alexa sdk v2 for node.js in my lambda function
If you CanFulFillIntentRequest for both slots the intent will hit lamdba only if 2 slots are filled.You can make CanFulFillIntentRequest for necessary one (name) and in the backend(lambda) you can check for number.If name that requires number is required give necessary response for number.
One way to do this that can be updated without having to change the code is:
Create a JSON with the names that are required to have a number and store it in S3.
Make your Lambda function to retrieve it.
Make your Lambda function check the value of the Name Slot is among those in the JSON or not.
If so, then take control of the Dialog then. I strongly suggest you to check this
If not, then just continue.
Seems a bit complex mostly because of taking control of the dialog yourself. The other option is making the number required and let Alexa do the Dialog Management the thing is what to do when the number is not required.
If you know which names are required to have a number I would use a different slot for those and make the number required and let Alexa do the dialog management, the downside of this solution is that you will need to update manually those names (or use Bulk operations).
I think any of those 2 solutions can workout.
I hope you find this useful.
Related
I'm currently working through my A Level computer science controlled assessment, and am making an application designed to help Scout Leaders manage their group. This is my first time working in Java, SQLite, Android Studio and XML so I've run into a few problems along the way. At this point in time, I'm in the process of creating a login system, part of which involves editing login details. I was wondering if there's a way of loading multiple values from one record into different EditTexts at once, so the user only needs to edit the already-existing username and password, rather than type it in again with a slight edit? Thanks in advance. I didn't think it necessary to include any code in this question, as I'm only looking for an example, however if it would help please don't hesitate to ask - I just couldn't find a guide on this anywhere else.
You retrieve the data into a Cursor via a query that selects the required columns.
You then move to the appropriate row (record) in the Cursor (probably the first and only row).
For each EditText you set the text, using the setText method with the data from the respective column using an appropriate get???? method passing the column offset to the method (e.g. your_cursor.getString(<the_column_offset>)).
Rather than calculating and hard coding an offset, it is more reliable and flexible to use the getColumnIndex(<the_column_name_as_string>) method.
After all have been set you then close the Cursor
Note and would be replaced with respective values specific to the App.
I would like to make a simple game where Alexa picks 7 animal names at random and says them to a user. The user has to repeat the names in the reverse order.
I could use the AMAZON.Animal built-in slot type to listen for the animal names the user is saying.
But is there any way I can use this list to have Alexa randomly pick the animal names that the user has to repeat?
The documentation offers some sample values for every slot type.
Is there a more complete list for the AMAZON.Animal slot type?
I understand that the list can never be exhaustive as Amazon's must surely continuously expand it. I would just like to have a list of animal names that I can be sure of Alexa will understand.
At the moment, you can't see the full list of slot values for Amazon built-ins. Instead, I recommend creating your own animal slot type. This way you will be able to randomly choose from that set of animal names. It will function exactly like the built in and you can modify it as you see fit.
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.
Looking for guidance on how to achieve something in ASP.NET Web Form - the behaviour is a bit like that seen in ASP.NET AutocompleteExtender, but I can't find anything that gives the flexibility I need. Here is what I am trying to do:
2 TextBox fields on the form,
CompanyName and CompanyRef
(CompanyRef an abbreviated unique
Company identifier)
User types in the CompanyName
As soon as there are 3 characters in the
CompanyName an internal webservice is
called (AJAX?)
Webservice checks what has been entered so far and
evaluates a 3 character representation of it - for instance
"Stack" would be returned as STA0001.
If there is already an STA0001 in the db it would return STA0002 and so on
The value returned would be targetted at the
CompanyRef TextBox
User needs to be able to edit the CompanyRef if they so wish
I'm not looking for code per se, more high level guidance on how this can be done, or if there are any components available that I am missing that you may be able to point me in the direction of. Googling and searching on SO has returned nothing - not sure if I'm looking for the right thing though.
Generating the CompanyRef is easy enough. There are lots of articles etc which cover combining say an autonumber or counter with a string. The difficulty I have with your approach is that you intend to let users fiddle with the ref, and make their own up. What for?
[EDIT - Follow up to comment]
The comment box didn't allow for enough characters to answer your comment fully (and I'm still getting used to the conventions in place here....)
You could use AJAX to call the web service and return currently available values, and then use javascript to update the field. The problem with this is that once a user has decided he or she likes one, it may no longer be available when it is passed back to the database. That means you will have to do one final check, which may result in a message to the user that they can't now have the value they were told was available when they started the process. Only you know the likelihood of this happening. It will depend on the number of concurrent users you have.
I've done an article on calling web services etc using jQuery which should give you a starting point for the AJAX part: http://www.mikesdotnetting.com/Article/104/Many-ways-to-communicate-with-your-database-using-jQuery-AJAX-and-ASP.NET
I guess it's quite a common problem in databinding scenarios.
What do you usually do, if you are running a batch update and want to avoid that a propertychanged-dependend calculations/actions/whatever are executed for every single update?
The first thing which usually comes to my mind, is to either introduces a new boolean or unhook/hook the eventhandler, ...
What I don't like about this approaches is:
they introduce new complexity (has to be maintained, ...)
they are error prone, because you have to make sure that a suppressed notifications are sent afterwards
I'm wondering if somebody addressed this problem already in a more convenient way that is more easy to handle?
tia
Martin
Edit: not to missunderstand me. I know about the things .NET provides like RaiseListChangedEvents from BindingList, ... They are all addressing the problem in more/less the same way as I described, but I'm searching for a different way which doesn't have to listed drawbacks.
Maybe I'm on the wrong track, but I though I give it a try here...
There isn't a single one-size-fits-all solution, unfortunately. I've applied or seen the following solutions:
There are two singals. One signal is emitted when the change comes from a user action, the other always fires. This allows to distinguish between changes in the UI and updates by code.
A boolean to protect code
The property event framework stops propagating events automatically when a value didn't really change.
A freeze/thaw method on the signal or the signal manager (i.e. the whole framework)
A way to merge signals into a single one. You can do N updates and they get collected into M signals where M <= N. If you change the same property 100 times, you still only get 1 signal.
Queuing of signals (instead of synchronous execution). The queuing code can then merge signals, too. I've used this with great success in an application that doesn't have a "Save" button. All changes are saved to the database as you make them. When you change a text, the changes are merged over a certain time (namely until the previous DB update returns) and then, they are committed as a single change.
An API to set several values at once; only a single signal is emitted.
The signal framework can send signals at different levels of granularity. Say you have a person with a name. When you change the name, you get two signals: One for the name change and one "instance field changed". So if you only care "has something changed", then you can hook into the instance instead of all the fields.
What platform? The post makes me think .NET.
What is the underlying objects? For example, BindingList<T> as a source allows you to disable notifications by setting RaiseListChangedEvents to false while doing the update.
Other than that (or similar); yes, disconnect the binding during big updates
The easiest route to take is to use the BindingSource component for your data binding. Instead of binding your controls to a particular object (or IList), use that object as the DataSource for the BindingSource, then bind the controls to the BindingSource.
The BindingSource class has SuspendBinding() and ResumeBinding() functions.