I am using rasa NLU and Rasa core to build a chatbot. I face problems when user gives a single word in response and it needs to be tagged as an entity. Following is the example which will make more clear.
Lets say we have a weather bot and folloing is the typical conversation
less realistic conversation
user-How is the weather in my city
bot- Please mention you city
user- my city is Delhi
(I have trained rasa nlu model with such patterns )
more realistic conversation
user-How is the weather in my city
bot- Please mention you city
user- Delhi
Now Delhi should be extracted as an entity (city) and filled as a slot. Even if I give Delhi in nlu training data it might pick up Delhi as city but it fails when user gives some other city lets say Sydney, which is not in training data. It doesn’t seems feasible on user’s part to respond back with some long expression, like “My city is Delhi”. User will always give anwers in just one word for any followup question from bot.
Having said this, now my question is how to train NLU for such scenarios. if I tag every single word as city entity and there is another entity type which also can expect a single token response,in that case entity extraction will fail.
One solution I can think of is having a dictionary lookup together with crf/spacy (dictionary lookup exraction with first priority) and set slots at backend. Is there anyway we can achieve this in NLU or spacy.
I can do that but how at the backend ill come to know which slot to fill. I may have 5 more slots. Is there any way I can send slot key to fill.
eg.
action->utter_ask_city
user-> Delhi
using custom action I can pick Delhi to be slot value, but at backend I dont have that info which slot to fill. in tracker i get only user text and action text , not the slot key
making custom actions for all kind of slots doesnt seem to be a feasible solution. I want more generic solution
yes it has slots, but there is no way of knowing which slot to fill with user message which is just one word. What I am currently doing is , appending single word response from user with previous action response from bot. eg.
user- how is weather in my city?
bot-please mention city?
user-Delhi
at backend after appending user response with previous action response , user message will be “please mention city Delhi”. It seems to be working fine but I think it is not logical solution. I need to give nlu training data as menion city Delhi, please mention city sydney… and so on.
How much training data do you have? Have you tried using ner_spacy for extracting cities? Also the new lookup table functionality we merged might help you: https://github.com/RasaHQ/rasa_nlu/pull/1312
For places you shouldn’t face an issue if your’e using ner_spacy as it captures almost all cities.
Like @akelad said try adding more training data to NLU, it really helps capture the single word responses.
@akelad: How would you go about it if I had a generic search intent. For example something like this:
## User search
* search{"query": "abc"}
- action_search
## User search
* search
- action_ask_what
* inform{"query": "abc"}
- action_search
The issue is that in the second story, the message that should be treated as an inform intent could look like this:
## intent:inform
- [Shoes](query)
- [Baseball](query)
- I'm looking for [cars](query)
- Lookup [New York City](query)
- ...
Especially because the answer is often just a single word or just the query term, I haven’t found a good solution to write a story with a good accuracy.
Any ideas / solutions for this quite common issue (e.g. also mentioned here, here, and here)?