1
votes

I have two queries related to using the slots feature.

  1. I created a slot that prompts the user to enter a number. so i used @sys-number and created a context variable $number to capture it. However i want to also check that the number enter by user is exactly 5 digits. is there a way to perform this validation?

  2. in another scenario i have to prompt the user to provide 2 numbers – customer id and order id. both are numbers. so i again created 2 slots with @sys-number and created 2 context variables to capture customerId and orderId. now my problem is how to figure out order of these numbers in the user input. so let’s say that if the users writes “please give me status of my order with id 100”, how can i ensure that 100 is interpreted as the orderId and not customerId. At present because my first slot is customerId, watson assumes that the number provided is customerId and not orderId and it again prompts the user to provide customerId. is there a way to design it in a better way. i was hoping that if i can get answer to Point 1, may be i can put some check on number of digits and do something.

Looking forward for some tips here. thanks !

2

2 Answers

1
votes

The first problem you can resolve as informed by chughts , using entities as a pattern (regex).

For the second problem, is a little more complex, but if the client does not inform customerid + orderid on the same input, then you can create a new entity with values like "order" and "customer" and use conditions to enter the slot or in the found of the slot, something like "if @sys-number && @type:order && !@type:customer". But the best solution would vary based on how things are asked and on how your clients respond.

If you need to treat inputs with but informations and there is no way to separate, the questions or reconfirm some information, the only thing i can imagine would be to use the positions of the entity to define for what information the @sys-number refer.

If the customerid and the orderid have different patterns (ex customerid have 6 numbers and orderid have 10 numbers), it's easier, you can just use patterns.

Personally, when i need to work with the system entities, i prefer to use single nodes or a "check for" that would never match, so i can test aways force to enter in the slot and test everything on the not found, but it depends on the needs.

0
votes

Create a regex defined entity and use that instead of @sys-number.