Summer Internship — Creating a ChatBot for Course Selection

Dhrumil Dalwadi
6 min readJul 7, 2020

One of the key recommended experience during your time as an undergraduate student is doing an Internship.

Introduction

Amidst the COVID-19 pandemic, Charotar University of Science and Technology did not stop thinking about the growth of their students. They provided a chance for their students to improve their skill set by providing internship opportunities in many domains. As a student of the same university, I successfully completed the summer internship by creating a prototype application which may be implemented by the many universities or even different companies out there.

Basic Info about Chatbots

What is a ChatBot?

ChatBot is a computer program which is able to simulate natural human conversation. It is often describes as one of the most advanced and promising expressions of interaction between humans and machines.[1] Users communicate with a chatBot via the chat interface or by voice, like how they would talk to a real person. ChatBots interpret and processes the user’s words or phrases and give an appropriate response.

Why to use a ChatBot?

There are several tasks which chatBots can do quickly and more efficiently than their human counterparts.

It is necessary to solve the query and problems of the customers or the users to ensure consumer loyalty and trust. ChatBots can become the first point of contact between the customers, providing instant assistance, giving advice and resolving common issues. A ChatBot can work 24/7 for 365 days per year. This also sometimes help fill the lack of a human assistance.[2]

Types of Chatbot

Basically there are two main types of chatBot:

  1. Declarative ChatBot: Declarative ChatBots or Task-Oriented ChatBots are are single-purpose programs that focus on performing one function. These chatBots perform the tasks for a product, or an organization. They can be made using the rules of NLP and very little concept of Machine Learning they generate automated but conversational responses to user inquiries. Such chatBots are applicable to support and serve function, give response to common problems faced by the user or an Interactive FAQ.
  2. Conversational ChatBot: Conversational ChatBots or Data-Driven ChatBots are commonly referred as Virtual assistant or Digital Assistant. Such chatBots are more interactive, sophisticated and personalized than a task-oriented chatBot. With the help of Artificial Intelligence, these chatBots can grow and become more accurate, interactive and are able to answer rather complex questions. Some of these advanced chatBots in the industry like Apple’s Siri, Amazon’s Alexa and Google’s Google Assistant are known to be of consumer-oriented, data-driven, predictive chatBots.[3]

My Work

Overview

The main purpose of the project is to provide basic information of the admission process, give suggestions for the aspiring students and clear the common doubts or queries. This means the chatBot has a particular function or it is designed to perform some particular set of instruction. So the chatBot designed is a Declarative Chatbot.

Implementation

The project is implemented in python and with the aid of inbuilt libraries like nltk (Natural Language Toolkit)[6], tensorflow and tflearn. A chatBot has been created which processes the question asked by the user and predicts the answer of the given question based on the intents on which the chaBot has been trained. The flowchart of the system is given below:

FLOWCHART OF THE SYSTEM

The model which is used in this system is the Bag-of-Words approach. Bag-of-Words is a Natural Language Processing (NLP) technique of text modelling. Whenever we apply any algorithm in NLP, it works on numbers. We cannot use the words directly in our algorithm, so we create a dictionary which contains the number occurrences of different unique words. Such unique words can be identified by performing some pre-processing on the user input like Removal of stop words (Common words like ‘is’, ‘when’, etc.), Stemming of the remaining words (Reducing the inflected words to their root form) and performing spellcheck on the same. This dictionary of words, along with our dataset is then passed into the algorithm where they are passed through different neural network layers to predict the appropriate reply from dataset.[4][5]

Simple Implementation of Bag of Words

When the user asks a query to the chatBot, the input string goes through some processes and the key words from the input strings are compared with the dataset which is trained. As for the training of data, Tensorflow and tflearn are the libraries which come into role. Tflearn is a deep learning python library which is built on top of Tensorflow.[7] It was designed to provide a higher-level API to TensorFlow in order to facilitate and speed-up experimentations, while remaining fully transparent and compatible with it. So the training of the dataset becomes faster and easier. After the training part, the chatBot is ready to use. One thing to note is that the program will ONLY train the dataset IF the model file is not available. If the model file is available then the training is skipped and you can directly use the chatBot.

Result

I was successfully able to create a “ChatBot for Course Selection” and it is able to answer common question regarding engineering courses and admission process (The code is available at the Github link provided at the bottom). As I have previously said that this is a prototype application, it is not the best chatBot out there. Hence it is not able to answer ‘all’ the questions properly and sometimes may generate undesired answer.

Following is a conversation between a user and the chatBot.

Test Conversation

Not only this, but it is able to answer other general questions related to the admission processes and some other inquiries. DO NOTE: Some of the answer provided is vague because this is a prototype ChatBot and it is supposed to be set according to the user

General Inquiry

ChatBots are regarded to be smart but even they have their limits. This ChatBot is not a perfect one and can be improved overtime. As this is a task-oriented ChatBot, it may not be able to answer all the questions users ask, like making predictions. One may even get undesired answers which is due to insufficient data. The only solution as of now is to add more data to the intents.

ChatBot unable to understand the user’s Input

This is rather a small conversation and the chatBot is capable of handling many other such questions. This chatBot can be deployed on the webpage so the aspiring students can interact with the chatbot to know more about the courses offered or clear their doubts regarding admission process and other commonly asked questions.

Conclusion

This journey of creating the chatBot contained more of research and less coding. I believe that before working on some project you need to have a good understanding regarding the technologies which are used. It was a wonderful and worthwhile experience to learn about the different types of model used for chatBot and Neural Networks. I was also able to learn how a AI based chatBot is made where a huge dataset is trained with different parameters and learning rate. ChatBot is a rapidly growing field and has potential to grow more as reduces labour and can be implemented by many organizations to boost their efficiency.

--

--