Sayuri Mizuguchi
Sayuri Mizuguchi

Reputation: 5330

Conversation - using entities values/size as a condition

I'd like to know how to use the values from the entity as a IF bot recognizes condition on Watson Conversation.

I have one menu for the users choose one option. And all of these options are inside one Entity called @optionsNumbers with the values: 1, 2, 3, 4, 5.

And I want to make one condition that will verify if user chooses more than one option.

E.g:

Watson: Hello, welcome to the Official Virtual Assistant from the Company XX. You can choose this options above: 1. About products 2. About Services 3. Exit

User: I want the option 1 and 2

So, the entity @sys-number have 2 values, and not just one, like I need.

As you can see, the user types 2 values of the entity @option. And I'd like to know how to recognize if the user typed more than one value for this particular entity, also @sys-number, cause the user can type just ONE option (business rules).

I'm enthusiast about Watson and pretty sure I read all documentation. So, what I have tried and does not work (I saw these methods with Intents examples):

if bot recognizes entities.sys-number[1].value
if bot recognizes entities['sys-number'].size > 1

And I know that I can create two conditions, but if my Options menu have more than 20 options? That's why my asking.

Upvotes: 1

Views: 668

Answers (1)

Christophe Willemsen
Christophe Willemsen

Reputation: 20185

First, you could use the system number entity built-in type provided by Watson :

Entities > System Entities > Enable System Number

Your intent should now be able to recognize it easily by default, let's check the following intent :

enter image description here

And you test it with the sandbox, it works as expected

enter image description here


EDIT: Using Dialog to add a condition on sys-number

Create new dialog node for matching the intent :

enter image description here

Then enable the Multiple Responses for this node ( click Customize ) :

enter image description here

Add your conditions as part of the responses :

enter image description here

Then test your dialog :

enter image description here

Upvotes: 1

Related Questions