2

Is there a known way to deal with users writing responses over multiple lines? - is it best to handle this case on the client level? as in checking if the user is still typing and have a delay between responses, or can this be handled on Watson somehow?

An example would be:

Bot:

What's Your Name?

User:

My name is 
Nour

Those are two independent messages by the user over 2 lines.

Nour
  • 777
  • 1
  • 8
  • 25

2 Answers2

1

It is best to always send the full "utterance" to Assistant in one request, because the processing does not work across multiple split calls to Assistant. Otherwise you would need to do some complex logic with context variables, or ask back the user their name if they uttered "my name is" without an actual name.

Generally the client side UI would wait for the user to press Enter before sending the utterance to Assistant. So you can be sure they have entered the full utterance.

But perhaps if they do utter "my name is" you could have an intent which checks for a name and an entity that extracts the name, and a dialog node which if the intent is found has a slot which ensures the entity is also found. In that way, if they do say "my name is" and no name, the bot will ask them for their name.

DSeager
  • 217
  • 1
  • 4
0

DSeager's approach is potentially the right way for the example you gave. The reason being is that within your overall question you have an entity.

What about where there is on real entity? For example:

Two Intents.

  • Pay my speeding fine
  • Pay my parking fine

Here you are using the intents to understand the answer without the need of an entity. Some will argue the Intent->Entity approach, but depending on your solution it can generally not scale as well versus just an intent answer.

So now your user enters the following:

How do I pay my 
parking fine

Entity solution doesn't really work here as you have no context that they want to pay.

So one approach.

1. Send "How do I pay my" to WA. Assuming you have trained the system well it should come back with a low confidence or irrelevant.

2. Before you respond to the user, see if another utterance has been cached to send. If it has, then append with some kind of marker and send. For example:

How do I pay my !! parking fine

This will return the correct answer.


But wait a second, what if they do this?

How do I pay my parking fine?
Where do I pay it?

Both are valid questions, but the second one will fail and you can't append it to the previous.

In this instance, when an answer displays have it set a $anaphora context variable. Then if you get a low confidence/irrelevant response try reasking with the $anaphora value appended.

For example:

Q: How do I pay my parking fine? 
A: <Answer>  $anaphora = "parking fine"
Q: Where do I pay it? 
A: <Irrelevant>
Q: parking fine !! Where do I pay it?

Both of these require some work at the application layer.

Simon O'Doherty
  • 9,259
  • 3
  • 26
  • 54