Guiding NLU based on conversation state?

I’ll ask the question first, and then expand:

Is it possible to use conversation state to guide NLU?

As an example, let’s say I’m building a pizza ordering bot. I’ve got the pizza details and now need to get the customer’s address: so the bot asks what's your postcode? (postcode == zip code)

The user is most likely to give a context-free response, e.g. W1A 4WW. However, getting NLU to successfully recognise the phrase and do entity extraction on one word utterances is hard (see this question). It usually needs some context from the user, e.g. my postcode is W1A 4WW. But it’s unrealistic to expect users to enter that extra context.

I assume this is largely down to NLU being independent of conversation state: i.e. it doesn’t know the story context. So interpreting single word answers is difficult. Lookups can help, as can a pre-trained corpus (e.g. cities in spacy). But both are still subject to synonym misinterpretation.

It seems that conversation state is a significant predictor of subsequent intent. So if the story is expecting a postcode, then it would be valuable for that to influence nlu selection of intent. However I’m not aware that it’s possible to do this. So 3 questions:

  1. Is it possible to influence nlu based on story state?
  2. If not, I’m interested in why. Is it a technical point (difficult to do / just not implemented yet) or are there more fundamental reasons?
  3. Assuming it’s not possible, any further tips on successfully handling single-word responses where the word/phrase is an entity?

Thanks.

1 Like

The question you referenced here was put by me. If you look at the answer from @akelad you can get a fair idea of how to do this using newer version of NLU.

However, I have found another solution which might help you here. The problem here is that, if user gives one word answer to any question lets say

  • BOT>what is your pincode
  • User>411007

here we already know that bot is asking for pincode slot to be filled by user. But there is no way of associating this action ask_pincode to pincode slot, which we can map it at the backend and directly fill the value as slot bypassig NLU.

Since, I am rasa ui to provide user a platform to build all training data. I am providing user option to associate a slot name to the response (the way we do it for buttons eg. /intent_name{“slot_name”:“slot_value”}). This way I already know what bot is asking and if user gives one word answer I directly fill the slot at backend using slotset or if user response is more than one word or a phrase the usual course of NLU take place which will extract the entity to be filled as slot.

I haven’t implemented this approach as of now. It on TODO list right now. Hope it will help you

Thanks for the reply @anupam20sep

A few clarifications please:

Since, I am rasa ui to provide user a platform to build all training data.

Do you mean you’re using the Rasa Platform for training? And that it provides facilities for associating a slot to the response?

This way I already know what bot is asking and if user gives one word answer I directly fill the slot at backend using slotset or if user response is more than one word or a phrase the usual course of NLU take place which will extract the entity to be filled as slot.

Are you handling this with a custom action? (I haven’t seen Rasa Platform so don’t know what’s presented).

Thanks, Scott.

@sfinnie have you found a solution for your problem? I think having context to influence the intent classification is very reasonable, especially in cases like the one you mentioned. I am experiencing the same thing now. How should one word sentences be handled?