append a piece of text to user's input before determining it's intent by Watson assistant engine - ibm-watson

I want to append a piece of text to user's input before determining it's intent by Watson assistant engine
for example:
set context variable $subject = "VPN"
user input : "I want to set it up"
add context variable to the input so it becomes :
"I want to set it up $subject" ------> "I want to set it up VPN"
then after doing that watson determines which intent this input belongs to
PS: it doesn't have to be a context variable, I can append some static text

I recommend to split this problem up into intent and entities.
What is the desired action, the intent? Set something up.
What is the object / subject involved, the entity? A VPN, a computer.
That way your chatbot is more flexible and can be extended later on.
If you are already talking about VPN in a dialog, you may branch into a VPN-specific set of dialog nodes.

Related

How to get the number (length) of slot values for Alexa skill

I am trying to generate a random response for my Alexa Skill. I have set it up as:
Intent = myIntent
Slot = mySlot
Slot Type = mySlotType
Slot Values = {A,B,C,D} //the ids are unique numbers 1 - 4
when the user says a word such as A it uses this to create a response. Now I want to add a case for 'random'.
So Slot Values = {random,A,B,C,D}. //ID for random is 0
When the user says random, I want to randomly choose from the other Slot Values and use this to create a response.
Can Slot Value ID be used to return the Slot Value value?
Anybody know a good way to do this? I am a novice so excuse any obvious oversights.
This might be a workaround for your problem. You can get the JSON structure of your interaction model and use it as a constant in your lambda index.js file. I usually use this official tool for generating backend code for my skill
:
https://s3.amazonaws.com/webappvui/skillcode/v2/index.html.
When you'll generate the code through this tool, you'll see that the code generated also has the whole interaction model used as constant. Since you will have the whole JSON schema of the interaction model at your disposal, you can perform any action on it.
Note: If you don't know where to get JSON schema of your interaction model, scroll down on the build tab of your skill on the developer console, you'll find a menu of JSON editor on the left navigation. It will give you the JSON schema of your interaction model.
You can use mySlot as optional value in the intent description. For example you can add few utterances without slot inside them. And on the backend side you can check is the slot filled. If it is not filled you can generate random answer.

How to get Watson Assistant to capture multiple entities in context variables

I'm trying to create a Watson chatbot and I'm running into this issue.
I'm making chatbot that's helping people find organizations that provide food, shelter, drug treatment, etc.
I have a dialog node that asks the user what service they're looking for and storing it as a $service context variable.
This works well if the user says something like "I want food" as "food" gets stored into $service.
But say for instance a user says something like "I want food and drug treatment." I want Watson to then be able to store both of these variables as context variables.
How do I do that?
Its quite simple.
Just use
"service":<?#entityname.values?>
It will store all the input value of this entity in service array.

IBM Watson Slots won't accept 0

I'm trying out the slots feature in IBM Watson Conversations and have hit an issue which I'm not sure how to work around.
I have a use case that is collecting a number of pieces of information from a user so using the Slots feature makes sense. Unfortunately when I add a Slot with #sys-number the system will not accept 0 as a valid input. This slot is in fact required but 0 is a valid value.
Anyone have an idea of how to have a required Slot of type #sys-number that accepts 0 as a value?
The condition #sys-number is in fact a short hand syntax for condition entities['sys-number'].value. When 0 is sent the condition is evaluated to false as 0 is treated as a false by the expression language evaluator in Watson Conversation Service. Now this is not a desired behavior in this case. To prevent this for happening one can use entities['sys-number'] in the condition that will return true every time #sys-number entity is recognized in the input.
When using this in slot one might want to edit what gets stored in the context variable as changing the condition will also change what is stored in the variable. This can be done by a JSON editor - click configure slot gear next to the slot specification and in the window that opens click three dots, open JSON editor and there change what gets actually stored inside the context variable that gets updated by the slot.
Here is a link to system entity section in Watson Conversation Service documentation.
I had a similar problem with recognising zero values in slots and the system entity documentation did not explain it well enough (for me at least).
Further elaborating on Michal's answer above:
Click the "Edit Slot" option (gear icon)
Set the "Check For" attribute on a slot condition as entities['sys-number']
Click the edit slot modal menu options (three bubbles in corner)
Open the JSON editor
Change the context variable value to "<?entities['sys-number'].value ?>"
Result:

Get user information from user input using IBM Watson conversation

I'm Wondering how to extract the username using IBM Watson Conversation within the standard chat:
For example:
bot: What is your name?
User respond: my name is Mike
bot: ok good morning Mike. -> i want this
How to store the name that user type in the chat? so the bot can answer the given name?
EDIT: There is a new feature in WCS that enabled to extract pattern-based entities - in other words, user is able to define entities based on regular expressions. More information in the DOC here:
https://console.bluemix.net/docs/services/conversation/entities.html#creating-entities [30.11.2017]
You can access the user input text by writing <? input.text ?> then two methods supported by WCS might be useful:
<?input.text.matches('regexp')?> return true if the input matches input regexp expression.
and
<?input.text.extract('regexp', 0)?> (second parameter is regexp group number). That extracts part of the input String as specified by regexp and group.
For example this expression on a dialog node context:
"lastword" : "<?input.text.extract('\\w+$', 0)?>" will extract the last word from the input text provided by user.
Note that this is not a perfect solution for your use case, so it might be a good idea to add a dialog flow that confirms whether the parsed string is really a user name...

Website "you can do this" script

I want to create a training path for new users accessing my site. This training path must display info bubbles showing what you can do on every page, but only the first time you access it.
So, for example, if a user enters a page where there's an edit button an info box should appear next to the edit button telling the user that he can edit that page.
I will create the script myself, I just want to know what's the best method to check if the user has already seen that box or not. I was thinking about storing in database a boolean value for each info box which will be set to true if the user has seen the box. To save some queries from the DB I think I can also store the same values in localStorage or in Cookies.
What is the best practice for creating user training paths for a website?
The way I suggest is to store user id (ip or username ? ) and a bit value for each bubble like you say.
PS: for your script you can use this:
http://www.maxvergelli.com/jquery-bubble-popup/documentation/
Jérôme

Resources