I am trying to make a slot that can capture one word. I just want the whole directive to be one word long, and any English word will trigger the intent. I tried using Amazon.LITERAL but that can capture a whole phrase, which is not what I want. Is there any way to do this in Alexa?
There is not a way currently to limit the number of words returned in a slot.
You can prompt the user in a way that makes it clear that you only expect a single word, and your lambda code can verify that only a single word is provided in the slot.
For example, have Alexa say "tell me a word that ... you can say 'alexa, tell your-skill-name that the word is lucky'". You might say this for example during the LaunchRequest.
You can then verify that only one word was specified in the slot, and reprompt as needed.
The intent for the answer could look something like "MyWordIntent the word is {Word}"
Related
I have this code so far which does not work.
if (member.roles.cache.some(role => role.name.includes === 'Gang '))
basically I have like 9 different roles that all have the word gang in them and instead of checking if a user has each role individually I want to check if they have any of the roles all at once. since it will save space and be less of a headache. is there any way to do this effectively? I'm open to all answers, thanks for the help.
The includes method is defined on the string prototype and takes the search string as argument (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes).
While your current code compares that method to the string literal 'Gang ' you instead want to provide the search string as an argument like this: role.name.includes('Gang ')
I'm developing an Alexa skill and want to pass simple utterances like "How much are five oranges" to it.
My idea was to define utterances like
how much are {amount} {articleName}
with the slots amount of type NUMBER and articleName of type AMAZON.SearchQuery
But AMAZON.SearchQuery cannot be combined with other slot types. Thus, are there other ways to pass simple, non typed-strings like article names to a skill?
You could just use a custom slot type:
Overview of custom slot types
Create your custom slot type for articleName and just add a number of example slot values. This should work for you.
If the slot value can be 1 word as well as 2 words - make sure you add examples for both.
Once you've set this up in the developer console, you could test it (without deploying code), using the utterance profiler.
You can then tweak / revise as needed.
A custom slot type is not the equivalent of an enumeration.
Values outside the list are still returned if recognized by the spoken
language understanding system
Although input to the slot type is weighted towards the values in the list, it is not constrained to just the items on the list.
Ref here.
I have one example.
I create some intent inside Watson Conversation, and I want to knows how I can do some condition for it?
Example:
Watson: Hi, tell me your number
Me: 99999-9999 (and have some regex inside advanced conversation flows, i check wih context variables in the case is number and works fine)
The conversation will only continue if he enters the 9 numbers correctly.
I try it:
check image
Use a regular expression to parse the input and extract the number using syntax similar to
then have a dialog node condition based on the number extracted.
The flowchart I'm making doesn't look right. I've looked in my textbook for examples, but they don't seem to apply to this particular assignment. The pseudocode is right, because the Java is right, but the flowchart just looks wrong.
In this assignment the program is to display an array of items (iPod, Xbox, etc.) by using an array. The program is to ask the user which items they would like to order. The user is to enter the item. The program displays "In Stock". Then the program replaces the item from the array with an empty string. The program asks the user if they would like to make another order. If the user enters in the same item, the message "Out of Stock" is displayed.If the user enters another item, the same process repeats. (While loop) Entering the the word "No" ends the program.
You can see all this in the pseudocode, I just thought writing it all out might be easier. (Or not, maybe it just took extra work reading it.)
(Click image to enlarge)
I'm no flowchart guru, but I see that you have the 2nd WHILE as a conditional diamond with the loop completely under it. How does it ever escape that loop? The flow should always come into the top of the diamond, with the exit options on either side. This means that the first WHILE is wrong too.
Also, the third WHILE only has a single exit. And the same for the IF underneath it.
For all of these test/condition diamonds the flow should come in the top and exit either side.
I'm brand new to VXML (and coding in general) and apparently what I'm trying to do is... not normal, but hopefully it can be done.
I understand the principle concept of DTMF input with VXML where I use:
<grammar mode="dtmf"><![CDATA[ (*|0|1|2|3|4|5|6|7|8|9)<2-31> ]]></grammar>
<prompt>something here</prompt>
<noinput-nomatch-filled>conditions</noinput-nomatch-filled>
What I'm trying to do is take multiple actions to allow DTMF entry of letters based on their placement on the dialpad. You'd achieve this by first dialing the number that the letter is on (2-9), and the placement of that letter (1-4).
For example: "E" would be 3 and 2 on the dialpad.
I'm at a complete loss as to how this would work in VXML. What I'd like to do is this:
1) PROMPT: Please input your THREE letter code. Please enter your first letter.
2) Expect two DTMF inputs the first number between 2 and 9, the second number between 1 and 4. Based on this logic (33 = F, 94 = Z) the letter is set.
3) PROMPT: The letter you have entered is (INPUT). Is this correct? Press 1 for yes, 2 to retry.
4) Retry or go onto the next letter. So on and so forth.
If anyone has resources so I can stumble upon the answer to this myself, that'd be great! If anyone would like a bounty... that's an option, too! Thank you for reading!
The typical approach to this problem is just accept twice the number of tones as you expect or use a pound terminated input. Then use ECMAscript or server side code to translate the tone strings into the desired letters.
There are a couple of a ways to approach this problem:
1) You could just accept all 2 digit numbers in the grammar and do all validation/calculation on the server side.
and/or
2) Do some validation in the <filled> section and letter-decoding-from-number on the server-side (and then come back with the result and check with the user if that was the intended letter).
For the two-digit grammar, you could parameterize the built-in digits grammar as follows (please note that the URI scheme is platform-specific, so you may need to refer to the user manual of your voice browser to be sure of the exact scheme to be used)
<field type="digits?length=2">
<prompt>Please enter the code of the first letter</prompt>
</field>
There are other ways as well, like you could also do letter-decoding on the client-side using a script on the same page, but hopefully the above gives some ideas on what to choose based on your requirement.
(Actually, the OP would probably not be looking for an answer to this question after so long but hopefully it helps others who landed on this page searching for a solution to a similar question)
The best way could be to define a grammar that link each value to the result letter :
<grammar mode="dtmf" root="letter">
<rule id="letter">
<one-of>
<item>32<tag>E</tag></item>
...
</one-of>
</rule>
</grammar>
Another way is to let the user enter the 2 letters and process it with a EcmaScript function, or use the tag .
I am going to plan to add such feature in the Voximal the VoiceXML interpreter for Asterisk.
But are you sure that the users can be able to understand and use this method to enter letters ?