2

If a user asks the following sentence:

Intent

For some reason Watson uses the first date for the both $checkin and $checkout variables even though it detects the second date.

You can refer to the "dialog node" screenshot to see how the nodes are setup.

node

How can I get Watson to recognize the first date is the checkin date and the second one is the checkout date. Is there a way I could tell Watson after the first date is used if a second one is detected use it to fill the next slot?

I've found something about the @sys-date range_link entity. But the documentation is not detailed.

larry walker
  • 123
  • 6

1 Answers1

3

This is easy to do, but comes with issues you need to be aware of.

Slots allows you to define variables as they are read. For example.

Slots UI showing two variables to be checked, both sys date.

Will generate this:

Output of settings


The issue is that you are assuming that people will ask in the same order that you need the information. If this doesn't happen then this will fail.

You can mitigate this by shaping how the user may ask the question. For example:

"Please let me know where you are leaving and going to"

The person is more likely to respond with the exit date first.


BETA

This is likely to change and doesn't fully work as you expect. You can enable the beta @sys-date in the options. So I wouldn't recommend relying on this until it is final.

You first need to check for range_link. This will tell you if it detected that two dates are connected to each other.

Then you can do the following:

From Date: <? entities['sys-date'].filter("d", "d.role.type == 'date_from'")[0]?.value ?>
To Date: <? entities['sys-date'].filter("d", "d.role.type == 'date_to'")[0]?.value ?>

What this does is find the exact record that has the role of date_from and returns the value. Likewise for date_to.

You end up with something like this.

enter image description here

enter image description here

Simon O'Doherty
  • 9,259
  • 3
  • 26
  • 54
  • I've read on a new @sys-date entity with range_link, it's suppose to mitigate the issue. I read up on it in IBM documentation but don't understand how to implement it. https://cloud.ibm.com/docs/services/assistant?topic=assistant-beta-system-entities – larry walker Aug 26 '19 at 05:54
  • @larrywalker added beta details. – Simon O'Doherty Aug 28 '19 at 10:49