NLP Mini Project Report
NLP Mini Project Report
NLP Mini Project Report
A DISSERTATION REPORT ON
“CHATBOT”
SUBMITTED IN PARTIAL FULFILMENT
DEGREE
BACHELOR OF ENGINEERING
IN
COMPUTER ENGINEERING
GROUP MEMBERS
UNIVERSITY OF MUMBAI
2022-2023
DECLARATION
We declare that this written submission represents my ideas in my own words
and where other’s ideas or words have been included, I have adequately cited
and referenced the original sources. I also declare that I have adhered to all
principal of academic honesty and integrity and have not misrepresented or
fabricated or falsified any idea/data/fact/source in my submission. I understand
that any violation of the above will be cause for disciplinary action by the
Institute and can also evoke penal action from the sources which have thus not
been properly cited or from whom proper permission has not been taken when
needed.
Date:
Place: SHELU
CERTIFICATE
This is to certify that the project entitled “CHATBOT” is a bonafide work of
“Sonali Alhate (01), Suraj Bind (03), Rajshree Borkar (04), Himanshu
Dumbre (09)” submitted to the University of Mumbai in partial fulfillment of
the requirement for the award of the degree of “BE” in “Bachelor of
Computer Engineering”.
TABLE OF CONTENTS
Abstract
List of Figures
List of Tables
Chapter 1 Introduction 1
Chapter 9 Conclusion 16
Reference 17
2
Abstract
3
List of Figures
1 System Architecture 8
4
List of Tables
1 Tools 9
5
Chapte
r1
Introdu
ction
1.1 Motivation:
The idea of this project was not to create some chatbot with exceptional cognitive skills
but just to utilize and test my Python skills. This was one of my very first projects,
created when I just stepped into the world of NLP and I thought of creating a simple
chatbot just to make use of my newly acquired knowledge. A chatbot is a typical
example of an AI system and one of the most elementary and widespread examples of
intelligent Human-Computer Interaction (HCI). It is a computer program, which
responds like a smart entity when conversed with through text or voice and understands
one or more human languages by Natural Language Processing (NLP) . In the lexicon,
a chatbot is defined as “A computer program designed to simulate conversation with
human users, especially over the Internet”. Chatbots are also known as smart bots,
interactive agents, digital assistants, or artificial conversation entities. Chatbots can
mimic human conversation and entertain users but they are not built only for this. They
are useful in applications such as education, information retrieval, business, and e-
commerce . They became so popular because there are many advantages of chatbots for
users and developers too. Most implementations are platform-independent and instantly
available to users without needed installations. Knowledge in the use of one chatbot is
easily transferred to the usage of other chatbots, and there are limited data
requirements. Communication reliability, fast and uncomplicated development
iterations, lack of version fragmentation, and limited design efforts for the interface are
some of the advantages for developers too
Cost and Time Effective ~ Humans cannot be active on-site 24/7 but chatbots can and
the replying power of chatbots is much fast than humans.
Cheap Development cost ~ with the advancement in technology many tools are
developed that help easy development and integration of chatbots with little
investment.
Human Resource ~ Today Chatbots can also talk with text o speech technology so it
gives the feel as a human is talking on another side.
Business Branding ~ Businesses are changing with technology and chatbot is one out
1
of them. Chatbot also helps in advertising, branding of organization product and
services and give daily updates to users.
2
Chapter 2
Problem
Statement
2.2 Features
1. Easy customization
Every business is built different. They have different integrations, different apps,
different workflows and require customized solutions for everything.
Our platform is just built for that. Pick and chatbot, any domain, any industry - our
chatbots are ready to be deployed. And we’ll do quick customizations for you and get
your bot up and running in less than a week.
chatbot flow builder helps you determine the path and the flow of the chatbot conversations.
3
3.Easy live chat
Your chatbots can handle around 80% of your customer queries without human
intervention. And for the complex conversation, you can switch or direct the
interactions to live agents to serve them better.
With so many data breaches, your chatbot must be secure. It’s a good idea to have
a fully transparent policy regarding the data bots, such as what they collect and
exactly what it is used for.
2.3 Objectives
NLP chatbots today are bridging the gap between consumer expectation and brand
communication. NLP makes any chatbot better and more relevant for contemporary
use, considering how other technologies are evolving and how consumers are using
them to search for brands.
One of the major reasons a brand should empower their chatbots with NLP is that it
enhances the consumer experience by delivering a natural speech and humanizing the
interaction.
They are a great tool for market research and analysis in-house.
4
A Chatbot refers to a chatting robot. It is a communication simulating computer
program. It is all about the conversation with the user. The conversation with a
Chatbot is very simple. It answers to the questions asked by the user. During
designing a Chatbot, how does the Chatbot speak to the user? And how will be the
conversation with the user and the Chatbot is very important.
Chat – Chat is a class that contains complete logic for processing the text data which
the chatbot receives and find useful information out of it.
After importing the libraries, First, we have to create rules. The lines of code given
below create a simple set of rules. the first line describes the user input which we have
taken as raw string input and the next line is our chatbot response. You can modify
these pairs as per the questions and answers you want.
After creating pairs of rules, we will define a function to initiate the chat process. The
function is very simple which first greet the user, and ask for any help. And the
conversation starts from here by calling a Chat class and passing pairs and reflections
to it.
We have created an amazing Rule-based chatbot just by using Python and NLTK
library. The nltk.chat works on various regex patterns present in user Intent and
corresponding to it, presents the output to a user. Let’s run the application and chat
with your created chatbot.
5
Chapter 3
Literature Review
Chatbots are used in many organizations instead of humans when this is possible.
Most of the time systems like that are based on the ways ELIZA or ALICE communicates.
1.ELIZA: the first chat bot developed was ELIZA. It was developed by joseph weizenbaum
using a keyword matching technique. The idea was to read the user input and search for
certain keywords, if a keyword was found then the answer was retrieved. If a keyword was not
present then ELIZA would try, according to specified rules, to get more information from the
user to keep the conversation going. The chatbot doesn't understand what it is saying. It only
produces results according to rules.
2.A.L.I.C.E : ALICE was implemented by richard wallace in 1995. It uses pattern matching
and stores the information in artificial intelligence mark-up language, or else known as AIML,
files. An AIML file is similar to an XML file that was developed to store pattern knowledge
for chatbots.
6
Chapter 4
Objective and
Scope
Objective:
NLP chatbots today are bridging the gap between consumer expectation and brand
communication. NLP makes any chatbot better and more relevant for contemporary
use, considering how other technologies are evolving and how consumers are using
them to search for brands.
One of the major reasons a brand should empower their chatbots with NLP is that it
enhances the consumer experience by delivering a natural speech and humanizing the
interaction.
Scope:
7
They can also be used in the field of medical to solve health related problems. Chatbots
are going to explode and can be really dominating in future. Chatbots can provide a
new and flexible way for users.
8
Chapter 5
Proposed
Methodology
9
Chapter 6
System Architecture
10
Chap
ter 7
Tools
11
Chapter 8
Implementation
screenshot
Program code-
import nltk
from nltk.chat.util import Chat, reflections
reflections = {
"i am" : "you are",
"i was" : "you were",
"i" : "you",
"i'm" : "you are",
"i'd" : "you would",
"i've" : "you have",
"i'll" : "you will",
"my" : "your",
"you are" : "I am",
"you were" : "I was",
"you've" : "I have",
"you'll" : "I will",
"your" : "my",
"yours" : "mine",
"you" : "me",
"me" : "you"
}
pairs = [
[
r"my name is (.*)",
["Hello %1, How are you today ?",]
],
[
r"hi|hey|hello",
["Hello", "Hey there",]
],
[
r"what is your name ?",
["I am a bot created by G.V.Acharya Student. you can call me cr
azy!",]
],
[
12
r"how are you ?",
["I'm doing goodnHow about You ?",]
],
[
r"sorry (.*)",
["Its alright","Its OK, never mind",]
],
[
r"I am fine",
["Great to hear that, How can I help you?",]
],
[
r"i'm (.*) doing good",
["Nice to hear that","How can I help you?:)",]
],
[
r"(.*) age?",
["I'm a computer program dudenSeriously you are asking me this?
",]
],
[
r"what (.*) want ?",
["Make me an offer I can't refuse",]
],
[
r"(.*) created ?",
["Rajshree, Sonali, Suraj and Himanshu created me using Python'
s NLTK library ","top secret ;)",]
],
[
r"(.*) (location|city) ?", ['Indore, Madhya Pradesh',]
],
[
r"how is weather in (.*)?",
["Weather in %1 is awesome like always","Too hot man here in %1
","Too cold man here in %1","Never even heard about %1"]
],
[
r"i work in (.*)?",
["%1 is an Amazing company, I have heard about it. But they are
in huge loss these days"]
],
[
r"(.*)raining in (.*)",
["No rain since last week here in %2","Damn its raining too muc
h here in %2"]
],
[
13
r"how (.*) health(.*)",
["I'm a computer program, so I'm always healthy ",]
],
[
r"(.*) (sports|game) ?",
["I'm a very big fan of Football",]
],
[
r"who (.*) sportsperson ?", ["Messy","Ronaldo","Roony"]
],
[
r"who (.*) (moviestar|actor)?", ["Brad Pitt"]
],
[
r"i am looking for online guides and courses to learn data scie
nce, can you suggest?", ["Crazy_Tech has many great articles with each
step explanation along with code, you can explore"]
],
[
r"quit",
["Bye take care. See you soon :) ","It was nice talking to you.
See you soon :)"]
],
]
def chat():
print("Hi! I am a chatbot created by G.V.Acharya Students for your
service")
chat = Chat(pairs, reflections)
chat.converse()
if __name__ == "__main__":
chat()
14
Output-
Fig 1
Fig 2
15
Fig 3
Fig 4
16
fig 5
fig 6
17
Chapt
er 9
Concl
usion
Minimal human interference in the use of devices is the goal of our world of
technology. Chatbots can reach out to a broad audience on messaging apps and be
more effective than humans are. At the same time, they may develop into a capable
information gathering tool. They provide significant savings in the operation of
customer service departments. With further development of AI and machine learning,
somebody may not be capable of understanding whether he talks to a chatbot or a real-
life agent. The Chatbot must be simple and conventional.
A chatbot is one of the simple ways to transport data from a computer without
having to think for proper keywords to look up in a search or browse several web pages
to collect information; users can easily type their query in natural language and
retrieve information. In this paper, information about the design, implementation of the
chatbot has been presented. From the survey above, it can be said that the
development and improvement of chatbot design grow at an unpredictable rate due to
variety of methods and approaches used to design a chatbot. Chatbot is a great tool
for quick interaction with the user. They help us by providing entertainment, saving
time and answering the questions that are hard to find.
18
References
1. Bansal, H., Khan, R.: A review paper on human computer interaction. Int. J. Adv. Res.
Comput. Sci. Softw. Eng. 8, 53 (2018).
https://doi.org/10.23956/ijarcsse.v8i4.630
2. Khanna, A., Pandey, B., Vashishta, K., Kalia, K., Bhale, P., Das, T.: A study of today’s
A.I. through chatbots and rediscovery of machine intelligence. Int. J. u- e-Serv. Sci.
Technol. 8, 277–284 (2015). https://doi.org/10.14257/ijunesst.2015.8.7.28
4. Abu Shawar, B.A., Atwell, E.S.: Chatbots: are they really useful? J. Lang. Technol.
Comput. Linguist. 22, 29–49 (2007)
5. Klopfenstein, L., Delpriori, S., Malatini, S., Bogliolo, A.: The rise of bots: a survey of
conversational interfaces, patterns, and paradigms. In: Proceedings of the 2017
Conference on Designing Interactive Systems, pp. 555–565. Association for Computing
Machinery (2017)
7. Weizenbaum, J.: ELIZA—a computer program for the study of natural language
communication between man and machine. Commun. ACM 9, 36–45 (1966).
https://doi.org/10.1145/ 365153.365168
8. Brandtzaeg, P.B., Følstad, A.: Why people use chatbots. In: Kompatsiaris, I., et al. (eds.)
Internet Science, pp. 377–392. Springer,
Cham (2017). https://doi.org/10.1007/978-3-319- 70284-1_30
19