Improving chatbots — adding feature to recognise multiple questions in user’s query
This will be a micro blogpost but I hope it will be useful for you moving forward.
In 2016, I started building chatbots using Microsoft bot framework. While developing, I saw an edge case — normally we(humans) don’t ask one question at a time . Sometimes we ask multiple questions. This is where my chatbot was not able to distinguish multiple questions and was failing to answer correctly.
One example can be — hey what time is the event is there a specific dress code
we can see there are two questions but asked at same time. Punctuations are also missing which is making hard for bot to distinguish.
Today, I was playing with an awesome NLP Library called Spacy. I felt above problem might fall under sentence segmentation task of NLP(natural language processing). I gave it a try and results looked promising.
Below is one of the results.
Query from image was : which ground we are playing today did you call alex do you have extra black jersey
Result was array of different questions: which ground we are playing, did you call alex, do you have extra black jersey
I know as a human we can easily recognise different questions but it is little tricky for machines to understand it but sentence segmentation from Spacy is producing magic.
Below is the API which I developed for demo:
I hope you find this micro blogpost useful.
~ Happy Learning.