Implementation of A Chatbot
Implementation of A Chatbot
A
Preliminary Project Report
Submitted by
SUBMITTED TO THE SAVITRIBAI PHULE PUNE UNIVERSITY, PUNE IN THE PARTIAL FULFILMENT FOR THE
REQUIREMENT FOR THE AWARD OD THE DEGREE OF
Certificate
This is to certify that the Preliminary report for Project Entitled
Implementation of A Chatbot
Ms. Anjali Shingavi 2041065
Ms. Priti Sonawane 2041066
Ms. Ishwari Vaidya 2041071
Ms. Zahida Rashid 2041073
is a bonafide work carried out by students under the supervision of Mrs. Gyankamal Chhajed and it
is submitted towards the partial fulfillment of the requirement of Bachlor of Engineering (Computer
Engineering).
Principal
(Dr. R. S. Bichkar)
Acknowledgments
In our effort to complete the project "Implementation of A Chatbot" in the final Year of Engineering in
the stream of Computer Engineering, we greatly thankful to all the people without whose assistance,
guidance and effort we would not be able to complete out our project successfully.
We heartly thanks to our guide ‘Mrs. Gyankamal Chhajed’ who through his experience
encouragement and constant guidance helped us to shape our project to the present stage without his
help our project could not be completed. We are also thankful to our principal ‘Dr. R.S.Bichkar and our
HOD ‘Dr. S.K.Shinde’ for their guidance and support.
This project is centralise on creating a chatbot to be used by students to get their inquires responded
easily from the college website. This chatbot has the ability to make friendly conversation, respond the
course and the faculty details, answer the frequently asked questions and also calculate the fees on the
basis of student input as well as event information of the library.
To build the chatbot, Microsoft Azure Bot service as well as Microsoft Cognitive services namely
Text analytics, LUIS (Language Understanding Intelligent Service) and QnA Maker are used.
There are many chatbot fail to accommodate anything outside of the script. To overcome this
problem this chatbot extend the implementation of current chatbot by adding active learning and
sentimental analysis. As sentimental analysis properly realizes user’s query as positive, negative and
neutral, the system is partially successful in adding empathy to the chatbot. It is because the system
requires the more rigorous data to handle all queries which are off script. For such problems active
learning improves the chatbot performance. The more focus is on the speech recognization feature so that
the user can easily get response by speaking.
ii
Contents
Acknowledgments i
Abstract ii
List of Figures v
1 Introduction..................................................................................................................................... 1
1.1 Problem Definition....................................................................................................................... 1
1.2 Introduction.................................................................................................................................. 1
1.3 How does Chatbot work.............................................................................................................. 2
1.4Motivation……………………………………………………………………………………………………………………………………2
`
3 Software Requirement Specification............................................................................................. 5
3.1 Scope of Project............................................................................................................................ 5
3.2 Project Objective.......................................................................................................................... 5
3.3 Project Constraints....................................................................................................................... 5
4 Functional Requirement................................................................................................................. 6
4.1 Retrieving Input............................................................................................................................ 6
4.2 Output........................................................................................................................................... 6
4.3 System Administrator.................................................................................................................. 6
4.4 User Requirement........................................................................................................................ 6
4.5 Technical Requirement................................................................................................................ 7
5 Non Functional Requirement......................................................................................................... 8
5.1 User Interface............................................................................................................................... 8
5.2 Security.......................................................................................................................................... 8
6 System Requirement..................................................................................................................... 10
6.1 Hardware Requirement............................................................................................................. 10
6.2 Software Requirement.............................................................................................................. 10
CONTENTS
7 Specification 11
7.1 System Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
7.2 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
7.3 Proposed System ................................. 13
7.4 Advantages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
7.5 Disadvantages
7.6 Limitations
7.7 Application ................................. 14
7.8 System at Glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
List of Figures
8 System Design…………………………………………………………………………………………………………… 15
8.1 Gantt Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
8.2 Data Flow Diagram of Level 0. . . . . . . . . . . . . . . . . . . . . . . . . . . 17
8.3 Data Flow Diagram of Level 1. . . . . . . . . . . . . . . . . . . . . . . . . . . 18
8.4 Data Flow Diagram of Level 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
8.5 Use Case diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.6 Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
8.7 Activity Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.8 Sequence Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.9 Component Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8.10Deployment Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
9 Conclusion……………………………………………………………………………………………………………. 26
A Glossary………………………………………………………………………………………………………………. 27
Bibliography………………………………………………………………………………………………………… 28
v
1 Introduction
1.2 Introduction
A chatbot is an artificial intelligence software that can simulate a conversation (or a chat)
with a user in natural language through messaging applications, websites, mobile apps or
through the telephone.
This project is focusing on creating a chatbot to be used by students to get their queries
responded easily from the college website.
A chatbot is a program which can do real conversations with textual and/or auditory
methods.
A Chatbot is a software tool that interacts with users on a certain topic or in a specific
domain in natural, conversational way using text and voice.
For many different purposes, chatbots have been used across wide range of domains,
including marketing, customer service, technical support, as well as educational and training.
Rather than creating a human like smart machine application, it is about creating effective
digital assistants who are able to provide information, answer questions, discuss a specific
topic or perform a task.
1
1.3 How does Chatbot work
This project is focusing on creating a chatbot to be used by students to get their queries
responded easily from the college website. A chatbot is a program which can do real
conversations with textual and/or auditory methods [1]. Using Artificial Intelligence (AI),
chatbots can simulate human conversations. There are two categories of chatbots. One
category is command based chatbots where chatbots rely on a databank of replies and
heuristics. The user must be very specific while asking the questions so that the bot can
answer. Hence, these bots can answer limited set of questions and cannot perform function
outside of the code. The other category is chatbots based on AI or machine learning
algorithms, these bots can answer ambiguous questions which means the user do not have
to be specific while asking questions. Thus, these bots create replies for the user’s queries
using Natural Language Processing (NLP).
Figure show how a chatbot works. Whenever a user asks any query, the bot will
first analyze the request, then identifies intents and entities, builds a response and sends it
back to the user. Now, intents mean intention of the query and entity means details of that
query. For example, if a student wants to know the office hours of a faculty the intent
will be office hours and entity will be name of the faculty in this case.
2
an upper limit which really scales up the operations. Also, if any school or business is
receiving lots of queries, having a chatbot on a website takes off the load from support
team. Having a chatbot clearly improves the response rate compared to human support
team. In addition, since millennials prefer live chats over a phone call, they find a chatbot,
which provide a highly interactive marketing platform, very attractive. Furthermore, a
chatbot can automate the repetitive tasks. There can be some scenarios where a
business or
school receives same queries in a day for many times and support team must
respond to
each query repetitively. Lastly, the most important advantage of having a
chatbot is that it
is available 24/7. No matter what time it is, a user can get a query solved. All these
advantages of a chatbot constitute the motivation to implement a College Enquiry Chatbot.
1.4 Motivation:
To design and develop a bot which will be able to answer questions related to
institute. A bot which will help students to get their inquiries responded easily from
the institute website.
3
Literature Survey
4
Idea of Fifth Paper
In this paper, we proposed a cognitive system to improve the user experience in
searching for academic information with a chatbot.
5
Implementation of A Chatbot VPKBIET, Baramati
Algorithm.
2. A bot which will help students to get their inquiries responded easily from the
institute website.
6
4 Functional Requirement
Chatting
The system shall inform the user about validity of the sentence.
Searching
The system should inform the users to search for information about admissions, tution fees
and accommodation.
4.2 Output
User should be able to leave feedback, which is comprised of a text message and a
rating.
QnA Maker will generate response for query or search response available in KB.
7
If response is not available in Kb then generate the response by using LUIS.
If QnA Maker fail to provide appropriate response then LUIS will generate appropriate
response for query.
5 Non-Functional Requirement
The client user interface should be compatible with all commonly used browsers, such as
Internet explorer, Firefox, Google, Chrome and Safari.
5.2 Security:
The administrative system and database should be protected from unauthorized access.
min.1GB RAM
Specification
9
the bot application on Azure. In addition, Web Apps are used to host the application on
Microsoft Azure. System uses Mongo DB to store the conversations history.
Microsoft Azure
Microsoft Azure provides cloud services to build, manage, and deploy applications on a
cloud network which helps organization to meet their business needs using their favorite tools
and frameworks. College Enquiry Chatbot uses all the services shown in Figure which are
provided by Microsoft Azure.
10
Azure bot service is a service provided by Microsoft Azure which builds and artificial
intelligence (AI) chatbot. It offers the ability to add intelligent agents that can do
conversations with users without having to commit the resources to develop one’s own AI.
I have used Azure web app to host my bot application build by Azure bot service. Azure Web
App are the web applications which are hosted on Microsoft Azure cloud without any
programming language barrier. Since it is hosted on the cloud, infrastructure maintenance is
not needed to host the applications. It also provides various features like auto scaling,
automated deployment and also supports both Windows and Linux environments.
Azure Cognitive services are used to add intelligence to the bots by adding features such as
sentiment analysis and language understanding which help in analyzing user's queries.
These services can be added to an existing bot by adding service calls to the 7 Microsoft's
SDK to get the desired results. College Enquiry Chatbot utilizes Text Analytics, LUIS, and
QnA Maker services which are part of cognitive services and use natural language processing
(NLP) for different purposes.
Text Analytics
Text Analytics is used to perform sentiment analysis on a user’s queries. As shown in Figure,
a text is sent to text analytics and it returns the sentiment of that text.
LUIS
“LUIS stands for Language Understanding Intelligent Services which aims at creating cloud-
based machine learning language understanding (LU) models specific to an application and
without machine learning expertise”.
To implement a College Enquiry Chatbot, I have first created all the possible intents and
entities using LUIS tool. Based on these intents and entities, LUIS have built and train a LU
deep learning model. Then, the created model needs to be pushed to the endpoint on the
cloud.
The queries from the user are passed to the endpoint to get the recognized intent and entities
in JSON format. Based on various flows, response will be sent back to the user. Active
learning is also implemented using LUIS as shown in Figure. LUIS detects the user's query
(utterances) in terms of intents and entities.
It sends back the response to the service code where those utterances are examined based on
the confidence score. Then, College Enquiry Chatbot labels these utterances, re-trains, and
publishes the LU model.
Another method of active learning is also implemented which involves using user’s response
to re-train the model. The endpoint provided by LUIS responds with intents, 8 entities, and a
corresponding confidence score.
A threshold is maintained based on the confidence score and correspondingly prompts are
provided to the user. When the users respond to it, the system keeps track of the responses
and uses it to re-train the model.
11
QnA Maker
For answering simpler queries, instead of detecting intents and entities, College Enquiry
Chatbot uses QnA Maker for structuring answers from a semi-structured document like
FAQs.
This web-based service is useful in incorporating multiple FAQs from an URL,
structured documents, product manuals, or editorial contents; and building the
LU model for natural language processing.
Cosmos DB (Mongo)
12
CHAPTER 7. SPECIFICATION
7.2 Algorithm
1. Step 1: When user submits its question, we store that in a variable “query”.
2. Step 2: After that we bring all the main keywords from question table of the
database.
3. Step 3: Then check if “query” contains any of the main keywords in it.
5. Step 5: If YES then we bring all sub-keyword with its answer of that matching main-
keyword.
6. Step 6: Then we pass “query” through 4 keyword check procedure **4 keyword
check is checking all the 4 sub-keywords are in “query”.
7. Step 7: If any of the entry matches the keyword then we take its answer and then
submit it to the user.
8. Step 8: If does not match then we pass “query” through 3-keyword match algo.
10. Step 10: And if we still don’t get the out-put we say No answer found.
Context Identification
Here pre-processing has been applied to the input text so as to standardize the input. This is
done keeping the system’s requirements in mind.
The recognition of the appropriate context is based on the keywords used in the text.
When the bot receives queries regarding CGPA, attendance etc. the validity of the user is
checked by making them enter their e-mail and password. If found wrong, an appropriate
answer is sent.
If the user is valid, the input text is processed so that the keywords can be extracted. Based on
these keywords, the information is processed and provided to the user.
13
CHAPTER 7. SPECIFICATION
Artificial Intelligence Markup Language is used to map the input to an appropriate pattern. If
the response is available inside the files, then it is sent to the user.
If something does not match the database, then a random response is sent saying” Invalid
Input”.
This application provides information regarding the proceedings of the college. It is known
that the answer will be given to the user if the input matches a pattern in the AIML files. In a
case where the input does not match with the data in AIML files, keywords are fetched.
An algorithm to check the sentence similarity (NLP) is applied to the modified input so that its
similarity can be checked. If a sentence is retrieved with confidence>0.5, the query’s answer
is given. If no questions map to the input, that particular data is stored in the log file for
further improvement by the admin.
Later that query can be included into the various AIML files. The bot, in this case gives the
answer as “Answer not available”.
Context Reset
After the queries of the user are over and the he/she wants to exit the portal, then they have to
just enter “logout” or “bye” or simple exit the portal. When the user exits the application, all
the input parameters are reset.
7.4 Advantages
Reduce cost- As chatbot eliminate the requirement of any manpower during online
interaction.
24/7 availability- Unlike human chatbot once installed can attend queries at any time of day,
student does not have to wait for the college staff to help.
Multiple query handling- Human have the limit to the number of clients they can handle at
once, with the chatbot there is no such issue and they can handle as many queries as
required.
CHAPTER 7. SPECIFICATION
7.5 Disadvantages
Grammatical Errors: It does not recognize
grammatical errors.
7.6 Limitations
Fixed Rule-based
Previous chatbots are built with a fixed set of rules, template-based matching and very simple
machine learning approach.
Grammatical Errors
Predefined or Closed-domain
Most of them are able to answer questions only on closed-domain or based on predefined in
the database.
Ambiguity
The context and meaning of the sentences are unclear or not appropriate meaning with the
word.
7.7 Application
It enables the students to be updated with college activities.
It saves time for the students as well as teaching and non-teaching staffs.
It is providing us a readily available information source without taking any physical efforts.
15
CHAPTER 7. SPECIFICATION
Process: Response generation –> QnA Maker if not –> LUIS –> accurate results.
Expected outcomes:
1.Appropriate feedback.
2.Rating of text message response.
8 System Design
17
CHAPTER 8. SYSTEM DESIGN
To conclude, College Enquiry Chatbot is helpful in guiding students with correct and most up
to date sources of information. It is advantageous for international applicants for queries
such as fee payment and academic matters. Students can get the information at their
fingertips rather than visiting college office. It improves efficiency by taking over tasks for
which humans are not essential.
27
A
B Glossary
Channel -
Channels include your Website, Messenger, Slack, Skype, SMS, email and web chat
windows.
Chat logs –
28
Bibliography
A. AM Rahman1, Abdullah Al Mamun1, Alma Islam2,” Programming challenges
of Chatbot: Current and Future Prospective”IEEE.
29