It's a mess in my head right now. I've seen this video tutorial to understand Wit.ai logic : https://www.youtube.com/watch?v=yLAHVPaHWFA
It's a really good video for basic training. But I can't still understand the logic.
I want to create a story like that Human(H) / Robot(R):
(H) Hello
(R) Hello human, you can choose A action or B action
(H) A action
(R) Ok human, this is A action
It's really simple but I don't know what to declare in "understanding" section.
1 - Do I have to create a "Say Hello" intent
2 - If yes, Do I have to create an "hello" entity and feed it with other salutations like "Hi", "yo", "What's up?", ...
3 - Do I have to create a "choose action" intent or it's just one intent for one story ? This is exactly what I don't understand.
4 - If yes, A&B action are free-text like ("An hotel", "a restaurant"). How can I teach the bot to recognized them ?
I just need some enlightening about those points ! It's really hard for me to translate and understand correctly. Thank you for you help !
You may declare a "greeting" intent(Intents are just user-created entities). After that, you can validate(feed) it with many other words like "Hey buddy, Sup bud, Hellloooo, Hi bot, etc". Also, you can give values to that intent such as Negative or Positive values.
For instance:
" Hey dumb f* " >> "greeting" Intent + Negative value ❌
" Hi brother! " >> "greeting" Intent + Positive value ✅
So that you can decide between:
"Language, please... Anyway. Hey {user_name}"
or
"Hey {user_name} ! :) Really nice to see you here ! "
to respond to the user's simple hi text.
Other than that:
(R) Hello human, you can choose A action or B action
(H) A action
(R) Ok human, this is A action
This type of interaction needs the usage of /converse API
https://wit.ai/docs/recipes#converse-link
In this above link go down to the "Handle yes/no answers" section.
Also, you can use Quick Replies for letting the user choose between the A Action or B Action. Quick Replies are really useful for this type of interactions.
https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies
Related
I am using dialog flow to make a chat bot, but gets stuck.
I have an if-else condition which consists of 14-15 question.
How to handle condition type of question in dialog flow. until now, maybe fulfillment works, but how?
Please provide more details. Give an example of such question.
You don't need to use filfillments, you can solve it with input/output contexts.
// some example intents
study.start (output-context: study.yes & study.no)
study.no (input-context: study.no)
study.yes (input-context: study.yes, output-context: study.howlong.good &
study.howlong.bad)
> Did you study for the test? No -> You need to study!
> Did you study for the test? Yes -> For how long?
> For how long? 1 hour -> Study more!
> For how long? 5 hours -> Good!
You simply write example phrases which will match given the active contexts. Remember to only set a lifespan of 1 for your output contexts.
I am trying to implement to read user input from one action and to read in other screen, like:
user: xx
Bixby: who's there?
user: yyy
Bixby: yyy who?
I am able to read user input yyy but unable to pass in different actions to display yyy who.
can you please help or guide what I am doing wrong or what will be best approach to do this kind of capsules?
Thanks in advance.
This is how I would model the behavior of what you are probably trying to achieve.
Concepts
- Joke
- JokeQuestion (posed by 'Bixby')
- JokeAnswer (answered by User)
Views
- JokeResultView
- JokeAnswerInputView
Layouts
- JokeLayout
- JokeQuestionLayout
- JokeAnswerLayout
Action (all of these Actions take Joke as input AND output the Joke back)
- GetJokeAnswerFromUser (get an Answer concept from the user and update the Interaction concept)
- ShowJokeQuestionToUser (show the next JokeQuestion to the user)
Other Actions as needed?
With this arrangement, you always have access to both the JokeQuestion(s) and JokeAnswer(s) through the Joke Concept. The JokeResultView will drive what the user sees on the screen and you can build some sort of logic in your implementation to signal the beginning and the end of the Joke etc.
Try this out and see if it helps.
I'd like to make Alexa to listen for special number - words like for example:
one two three,
one two,
five, six,
eight, nine, ten,
eleven
So I created this intent with the slot-type AMAZON.NUMBER:
Can I make Alexa to just trigger this intent if the input words are on a specific list? ( Just trigger the intent if the input is "one two three" or "five six" and not if the input is e.g. "nine eleven")
How can I capture the words on my node.js server like capturing "one two three" instead of the automatic result "123" = "onehundredtwentythree"?
skill.intent("numeric_input", function(request, response) {
let inputID = request.slot("input").toLowerCase();
response.shouldEndSession(false)
console.log(inputID); // is "123"
})
Any help would be really appreciated.
If you know how many numbers your input could have I would create utterances, such as: {input}, {input}{input}, {input}{input}{input}. Of course this will only work if you know, that number sequences are up to three numbers long.
To change numbers to words, you will have to use some sort of package or write it yourself to convert them, because alexa doesn't have any such functionality.
I have one more suggestion. If you know, that user can only say 1-9 numbers. That is not a lot and you can create custom slot with these values. In this case, alexa will return words to your code and you can block off certain numbers, that you don't want to get, f.e. eleven.
As you did, you have to use AMAZON.Number slot type.
Can I make Alexa to just trigger this intent if the input words are on a specific list?
When you create a custom slot type, a key concept to understand is that this is training data for Alexa’s NLP (natural language processing). The values you provide are NOT a strict enum or array that limit what the user can say. This has two implications
1) words and phrases not in your slot values will be passed to you,
2) your code needs to perform any validation you require if what’s said is unknown.
It's always a good idea to validate the slot values at your backend. If the numbers are something which you don't support, respond back with a proper error message like
"Sorry I can proceed wiht Nine eleven, please give the correct number"
This way you will let your users know that they have to use a different number. If there is number input, any number can come in. So validate and guide.
How can I capture the words on my node.js server like capturing "one
two three" instead of the automatic result "123" =
"onehundredtwentythree"?
If you use AMAZON.Number slot type, the values will come as 123.
"numberSlot": {
"name": "numberSlot",
"value": "123",
"confirmationStatus": "NONE"
}
You can easily validate 123 or convert it to any form as you need.
automatic result "123" = "onehundredtwentythree"?
I really didn't understand this. 123 is not automatically convereted to onehundredtwentythree. If you are pointing to the outspeech, or how Alexa speaks 123, then its a different case. Use <say-as interpret-as="digits">123</say-as> in you output SSML to spell each digit separately.
1.Create custom slot
2. Go to bulk edit of custom slot created and insert numbers in letters. You can get help from this link. Numbers in letters (Filter the numbers you don't want)
3.Create custom intent using the custom slot
Can anyone suggest me , how to allowed scope of questions in api.ai? i.e. I want to ask user "how many book can you carry at a time ?" : user can reply any positive integer number. Then my bot reply: "good , you can still better than others!". now, without any reference if user directly write "any positive integer number" at starting then also bot reply : "good , you can still better than others!" , instead of "I didn't get"(or default response.). This answer come only when previous question has been asked.How can I do this?
==== case : 1 ====
Bot: how many book can you carry at a time ?
User:5
Bot:good , you can still better than others!
=== case : 2 ===
(without any reference if users gives inputs at very starting of conversation)
User: 5
Bot: good , you can still better than others!
Thanks In Advance.
You should make a required parameter instead of putting numbers in User says:
In your intent configure your action to have one required parameter numBooks. Have the prompt for that parameter be "how many book can you carry at a time ?". Then for that intent, have the response be, "good , you can still better than others!". Finally, in the User says section, add anything you want the user to say to trigger the intent, for example: "hi". Save your intent. Now whenever a user says "hi" the bot will ask the question and the conversation will begin. But if the user randomly sends a number, it will respond with fallback intent.
Is it possible to specify some kind of "OR" (alternative) clause in Cucumber?
I.e. if I have two valid responses to some event I would like my test to pass if either of them happens.
Something like that:
"When I press a button"
"Then I should see the text 'Boo'"
"Or I should see the text 'Foo'"
My particular scenario is a login screen. When I try to log in with some random password, I should see an error message "invalid password" if the server is working or a message "network error" if it is not.
You can't really define OR functionality using the Gherkin but you can pass in a list and check that one of the values in the list matches what was returned.
Define list:
Then the greeting service response will contain one of the following messages
|Hello how are you doing?|
|Welcome to the front door!|
|How has your day been?|
|Come right on in!|
Check list:
#Then("the get messages service response will contain one of the following messages")
public void text_matching_one_of_the_following(List<String> greetingMessages){
boolean success = false;
for(String message : greetingMessages){
assertTrue(textMatchesResponse(message));
}
}
OR is not supported. You can use Given, When, Then, And and But. Please refer to http://docs.behat.org/en/v2.5/guides/1.gherkin.html
But perhaps you could make use of the But keyword to achieve what you are looking for.