rasa-travel-chatbot
Here is my Senior Design Project that I implemented to graduate from Computer Engineering. It is a chatbot made in RASA and helps the user to plan their vacation in the Turkish language. In order to plan the user's vacation, it provides reservations by asking various questions for hotel, flight, or event.
How to Run the Project?
- Create a virtual environment of python 3.6 or greater.
- Navigate to the rasa directory. Run the command: rasa train
- After the model is trained, launch the rasa core server: rasa run -m models --enable-api
- Launch the rasa actions server in another terminal: rasa run actions
- Navigate to the chatbot/backend. Run the command: python route.py
- Launch the frontend on the local python http server under the interface directory: python -m http.server
Interface
Here is an example conversation for booking an event in Turkish.
In this figure, the chatbot is trying to learn which event the user wants to go to after the greeting.
After that the chatbot asks for how many tickets the user wants and tries to make the reservation by asking for an e-mail.
Finally, the chatbot tells the user how many tickets it has bought and sent to which e-mail address and asks if the user wants to take another action. If the user says no, chatbot finishes the conversation by saying goodbye.
Turkish Dataset
Due to the small number of chatbots in the Turkish language, Turkish datasets are also less. For this reason, we prepared a Turkish dataset from scratch while doing this project. In order to do this, we translated the English datasets into Turkish using the Google API. In the end, we have 93 intents 29 entities in total, and an average of 7 sentences for each intent.
RASA
Rasa is an open source python library for constructing conversational software with minimal (or no) initial training data. It consists of two parts: Rasa NLU and Rasa Core. Dialogue management problem can be handled as a classification problem. At each iteration, Rasa Core predicts which action to take from a predefined list. On the other hand, Rasa NLU is a tool for natural language understanding. It combines a number of natural language processing and machine learning libraries in a consistent API.
First a message is received and passed to Rasa NLU to extract the intent, entities, and the other structured information. Then the conversation state saved in the tracker which receives a notification that a new message has been received. In step 3, the policy receives the current state of the tracker and chooses which action to take next. Then chosen action is logged by the tracker and executed. If the predicted action is not ‘listen’, go back to step 3. After the first step all the remaining steps are performed by Rasa Core.
Here is an example of intent classification and entity extraction for a possible input sentence that chatbot can receive from user in this project.
Best Configuration
We used pre-trained language model BERT for our pipeline. We compared three different pipeline configurations: a light configuration, a configuration using ConveRT, and a heavy configuration that included BERT. In each case we’re training a DIETClassifier for combined intent classification and entity recognition for 200 epochs, but in the light configuration we have CountVectorsFeaturizer, which creates bag-of-word representations for each incoming message at word and character levels. In the end, we chose config-light as the configuration of the chatbot.
Results of the Configurations
In the images below, there are confusion matrices created by each configuration for intent classification and entity extraction in turn.