Photo by rawpixel on Unsplash

Design of a chatbot assistant to support the operator in flight and accommodation searches.

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:

  • easily automate asking questions in natural language,
  • enable a more natural way of interaction like voice commands or a wide array of chat services i.e Facebook Messanger, Slack, Skype, Google Assistant, Alexa etc.,
  • are available 24h without additional cost,
  • can automate repetitive work,
  • not only facilitate communication (with a different degree of automation) but they also help to understand the written text, for example, they generate automatic responses to suit the context of a given text.

Creating a chatbot

The creation process of a bot based on revealing intents and entities (parameters, that describe an intent) can be divided into the following steps:

Step 1

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.

Step 2

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.

Step 3

Extraction of entities, that will be served as deliverables to intents.

Step 4

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.

Step 5

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

Photo by rawpixel on Unsplash

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.

Accommodation intent with entities
Flights intent with entities

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 f.e. “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 ahead of us:

  • wit.ai doesn’t support some language-specific aspects i.e. inflexion of geographical names. It can’t correctly identify all dates (eg. “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.