Contemporary chatbots don’t only support conversations but can also assist a human operator. They allow for parallel analysis of conversions, searching for answers in the background and suggesting answers that significantly shorten the response time of the operator.
Their expansion has been triggered by the emergence of commercial platforms such as Dialogflow or wit.ai, which, in a quick and easy way, allow for the extraction of knowledge hiding complex Natural Language Processing (NLP) processing algorithms.
Chatbots are gaining popularity for many reasons. They:
The creation process of a bot based on revealing intents and entities (parameters, that describe an intent) can be divided into the following steps:
Communication with the chatbot should be similar to communication with people (with regard to the bot-type limits) and provide valuable information. Therefore, the first step should always be to design a conversation.
Extraction of intents. Intents are the main actions that the chatbot is able to serve. The most important step is to extract some abstract actions that the user will be able to invoke by asking the question in natural language.
Extraction of entities, that will be served as deliverables to intents.
Training a bot by asking it questions in natural language. It is not about the quantity but the diversity of questions i.e. rephrasing questions about the same intent.
Testing and training. The next step is to test the matching of intents and entities while having a bigger number of users. In this stage integration with more communication channels e.g. Slack, Skype, Facebook Messenger might be crucial. Content gathered in such a way will serve test purposes and improve a bot.
Our challenge was to design a bot that helps in search of accommodation and flights. There is already a number of similar bots created by flight and hotel search companies, but we wanted to design a bot that uses the Polish language.
At the moment, it is not supported by Dialogflow. We used wit.ai that supports recognition of some units in Polish (beta version) i.e date or location. We distinguished two main INTENTS: search_flight and accomodation_search.
The next step is to create training databases — the corpus — containing different sentences that will be related to intents. To train the most successful model that would match the intent, a need for diversity not only the number of sentences must be emphasized. Providing additional channels of communications (Slack, Facebook Messanger) facilitates smooth questioning of chatbot by many different users.
At this stage, the bot doesn’t return any sensible answer. It only returns the result of an intent processing and indicates a probability of its accuracy, which allows the user to assess the accuracy of returned results and test other possibilities. Wit.ai collects sentences and adds them to the training database — it improves the training of recognition model.
The model trained in such a way could sufficiently support the operator. It allowed for a prompt aggregation of databases containing intents and entities.
Examples of processing results:
1. “I am looking for a hotel for two people in Warsaw for the weekend”
2. “I am looking for an all-inclusive hotel on the Canary Islands in May”
3. “I am looking for a flight from Warsaw to Berlin tomorrow at 8:00 p.m.”
Precision and recall — also known as sensitivity — training result of intents:
For comparison (chart below), the result of training the same intentions with the first ineffective method.
The ascending strategy was very unsuccessful. It consists of the identification of intents from short sentences e.g., “I am looking for a hotel” to longer ones: “I am looking for a double room in a hotel in Kolobrzeg.” The increase of the sentence database didn’t improve the result of adjusting intent. This strategy failed in providing good training for the model. Eventually, we performed the training without the short sentences in the database.
As a result, we were able to better identify intents and entities.
Despite the challenges mentioned above, the chatbot prepared in such a way can easily handle tracking and suggesting answers or evoking complex background queries. We managed to partially automate the work of the operator, which allows for the addition of other communication channels such as Facebook Messenger, Slack, Skype and Google Hangout.
Thanks to Kamil Klukowski.