Creating a Chatbot Assistant
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.
Implementing a Flight and Accommodation Booking Chatbot
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.
Challenges with the Chatbot Assistant Algorithm
- wit.ai doesn’t support some language-specific aspects e.g., inflexion of geographical names. It can’t correctly identify all dates (e.g., “at the end of August”) or seasons (“in the spring”). Some of these defects can be avoided by, amongst others, implementing standardization of geographical names.
- wit.ai’s tools and other similar (based on the identification of intent and entities) don’t allow for generating responses in natural language. It might be a significant problem in the case of inflected languages that require different inflexion of parts of speech.
- tools that we use don’t allow for generating an appropriate answer that would fit the context, age of a user, register etc.
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.
Supporting companies in becoming category leaders. We deliver full-cycle solutions for businesses of all sizes.