chat
chat
chat
A
MINI PROJECT
REPORT ON
CREATING A CHATBOT USING PYTHON AND
MACHINE LEARNING
In partial fulfillment of the requirements for the award of the degree of
Bachelor of Technology in
CERTIFICATE
This is to certify that this is the bonafide record of the mini project
entitled “Creating A Chatbot Using Python And Machine Learning”
submitted by S.Bhavani (18UP1A05A3), Sainikhitha (18UP1A0599)
and R.Ridhima (18UP1A0598) of B.Tech in the partial fulfillment of
the requirements for the degree of Bachelor of Technology in Computer
Science and Engineering during the year 2020-2021. The results
embodied in this mini project report have not been submitted to any
other university or institute for the award of any degree or diploma.
External Examiner
DECLARATION
We, hereby declare that the results embodied in this dissertation entitled
“Creating A Chatbot Using Python And Machine Learning” is carried
out by us during the year 2021-2022 in partial fulfillment of the award of
Bachelor of Technology in Computer Science and Engineering from
VIGNAN’S INSTITUTE OF MANAGEMENT AND TECHNOLOGY
FOR WOMEN is an authentic record of our work carried under the
guidance of Mr. CH. Sunil (Assistant Professor),Department of Computer
Science and Engineering. We have not submitted the same to any other
university or organization for the award of any other degree.
S. Bhavani (18UP1A05A3)
Sainikhitha (18UP1A0599)
R.Ridhima (18UP1A0598)
ACKNOWLEDGEMENT
S. Bhavani (18UP1A05A3)
Sainikhitha (18UP1A0599)
R.Ridhima (18UP1A0598)
ABSTRACT
Chatbots in Python have become wildly popular in the tech and business sectors.
Chatbots is a present new way for individuals to interact with computer systems.
Traditionally, to get a question answered by a software program involved using a
search engine, or filling out a form. A chatbot allows a user to simply ask questions
inthe same way that it would address a human. Chatbots are currently being take up at
a high rate on computer chat platform. Chatbot applications are streamline interactions
between people and services, enhancing customer experience. From e-commerce
firms to healthcare institutions, everyone seems to be leveraging this nifty tool to
business benefits. At the same time, it offer companies for a new opportunities to
improve operational efficiency by reducing the cost of customer service.
INDEX
3.1 Architecture 10
5 Results 17
6.1 Conclusion 18
7 References 19
LIST OF FIGURES
1 Architecture of Chatbot 11
2 Sequence Diagram 12
4 Importing Libraries 16
5 Chatbot Result 17
1. INTRODUCTION
Technology plays a solid role in the industry and in daily routine task. It serves a
variety of purposes and is applied in a different way in different parts of the world.
Recently, the public has been fantasized by Artificial Intelligence. To be more
precise and closely related to humans, the AI Chatbots are now replacing human
responses with this software. A Chatbot is a computerized program that acts like a
chitchat between the human and the bot, a virtual assistant that has become
exceptionally popular in recent years mainly improvements in the areas like artificial
intelligence, machine learning and other underlying technologies.
Machine Learning
About Chatbot
Artificial intelligence (A.I.) has grown in popularity for conversations between bots
and humans, particularly on mobile platforms. Chatbot experiences can happen
through textor voice interactions. The number of chatbot apps on mobile has steadily
grown, as number of chatbot functions that live in communication platforms like
Facebook Messenger, Slack, Telegram, and Skype.
Existing System
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 communicates.
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.
• Consider the following example,
• Then the chatbot would identify the keyword mother and would find a
connection between mother and family and it would respond with a question.
• Disadvantages:
1) Chatbots sound too Mechanical: Chatbots are not human and so obviously it
cannot interact as a human with customers. It sound’s too mechanical and
can only give answers to problems that they have been programmed with. It
cannot answer a customer according to the context.
2) Chatbots can only handle basic Questions: Chatbots are still a basic
Artificial Intelligence technology and so it can only answer the basic
questions of customers and provide general information that is already
available to it.
3) Chatbots are Difficult to Create: Chatbots are created using Natural
Language Processing which is extremely popular for customer support.
3
Proposed System:
Creating a chatbot using twitch as an online platform that provides a chatbot
platform to the online clients. Using chatbots may provide faster customer service
overall, but these aren’t perfect. Simple ones may have only limited responses for
customers. Therefore, not all customers will get the answers they are searching for.
The chatbot using Python are programmed to take in the information you provide
it and then analyze it with the help of complex AI algorithms, and provide us with a
written or verbal response. It also helps, if the user wants to have any query or he
wants to enquire about something.
Problem Definition
All the companies want the clients to know about them and company can get more
projects or sell their products. So the most primary way to do this is to have a good
interactive website in the advanced world of digital marketing. But in this advanced
world, just having a website is not enough as it does not cover all the details and can
not solve the queries of the clients. Maybe a comment section is an answer, but it's
slow work, and 'time is money' client will not wait too long for response. And
humans cannot be assigned to answer everyone at the same time twenty-four by
seven.So for that, there is need of a chatbot, not a normal one "An Intelligent
ChatBot” with Artificial Intelligence technology. “Artificial intelligence chatbot is a
technology that makes interactions between man and machines using
natural language possible. A chatbot can give different responses from the same
input given by the user according to the current conversation issue". By using this
"Intelligent ChatBot" issues can overcome and there is no need of human to do
manual work.
Objectives of project
The Rule-based approach trains a chatbot to answer questions based on a set of pre-
determined rules on which it was initially trained. These set rules can either be very
simple or very complex. While rule-based chatbots can handle simple queries quite
well, it usually fail to process more complicated queries/requests.
The Self-learning bots are chatbots that can learn on their own. These leverage
advanced technologies like Artificial Intelligence and Machine Learning to train
themselves from instances and behaviour.
A retrieval-based chatbot is one that functions on predefined input patterns and set
responses. Once the question/pattern is entered, the chatbot uses a heuristic approach
to deliver the appropriate response. The retrieval-based model is extensively used to
design goal-oriented chatbots with customized features like the flow and tone of the
bot to enhance the customer experience.
B) Generative Chatbots:
2. REQUIREMENT ANALYSIS
Software requirements deal with software and hardware requirements deal with
resources that need to be installed on a server that provides optimal functioning for
the application. These software and hardware requirements need to be installed before
the packages are installed. These are the most common set of requirements defined by
any operating system. These software and hardware requirements provide compatible
support to the operating system in developing an application.
Software Requirements
Python
Pandas
Pandas is a library for data manipulation and analysis. The library provides
data structures and operations for manipulating numerical tables and time series.
Mlpy
Scientific Libraries. Mlpy provides a wide range of machine learning methods for
supervised and unsupervised problems and it is aimed at finding a reasonable
compromise between modularity, maintainability, reproducibility, usability and
efficiency.
Matplotlib
NumPy
NumPy is the fundamental package for scientific computing with Python, adding
support for large, multi-dimensional arrays and matrices, along with a large library
of high-level mathematical functions to operate on these arrays.
Scikit-learn
Supported languages to start developing in Python with Jupyter Notebook first step is
to download and install Python from python.org depending on respective platform.
Besides, in the Professional edition, one can develop Django, Flask, and Pyramid
applications. Also, it fully supports HTML (including HTML5), CSS, JavaScript, and
XML, these languages are bundled in the IDE via plugins and are switched on for by
default.
Complex dialogues
It can identify the intent of a question to provide an accurate answer and suggest
options to confirm or resolve the issue.
The best chatbots have advanced conversation features and can proactively search
for information and ask clarifying questions even if the conversation is not linear.
By using Knowledge Graphs, data can be structured and modelled, which in turn
helps to generate new knowledge.
Moreover, the integration of company data or external data sources extends the
functions of chatbot software enormously.
The chatbot can capture, read and process large amounts of data to gain insights
from relevant data and to quickly solve customer problems.
Multi-channel capability
For a seamless experience, data and context can be stored over several channels. If a
customer shares order, email address or other information with the bot, it can use this
input for further actions on other channels. Also interesting Thing is it Improves
Customer Experience With The Help Of Voice Assistants.
Fast onboarding
Plug & Talk solutions that make a chatbot ready to go in 2-4 weeks are therefore
very beneficial for companies.
Easy handling
Well-designed user interfaces and experiences (UI / UX), both on the company and
customer side, are essential.
It has to be possible to edit corporate identity settings, change and add content
quickly, send notifications to employees and have a clear and structured overview of
conversations.
In addition, the chatbot software has to be able to handle the huge amount of data
without any problems and GDPR settings have to be taken into account.
Ongoing optimization
3. SYSTEM DESIGN
Systems design is the process or art of defining the architecture, components, less
interfaces, and data for a system to satisfy specified requirements. One could see it
as a application of systems theory to product development. There is some overlap
and synergy with the disciplines of systems analysis, systems architecture and
systems engineering.
Architecture
In this section, describe the system and/or subsystem(s) architecture for the project.
References to external entities should be minimal.
10
Sequence Diagram
The sequence diagram represents the flow of messages in the system and is also
termed as an event diagram. It helps in envisioning several dynamic scenarios. It
portrays the communication between any two lifelines as a time-ordered sequence of
events, such that these lifelines took part at the run time. In UML, the lifeline is
represented by a vertical bar, whereas the message flow is represented by a vertical
dotted line that extends across the bottom of the page. It incorporates the iterations as
well as branching.
The steps for volume control is been represented using Figure 4 which consists
of five steps such as video stream, share image, hand detection, gesture
recognition and then finally volume control.
11
In the Unified Modeling Language (UML), a use case diagram can summarize the
details of system's users (also known as actors) and their interactions with the system
as shown in Figure. This chart contains the course of action of use cases, performing
pros and their relationship.
In Figure it can observed the interaction between user, system and server. To build
one, set of specialized symbols and connectors are used. An effective use case
diagram can help team discuss and represent:
12
A use case diagram doesn't go into a lot of detail—for example, don't expect it to
model the order in which steps are performed. Instead, a proper use case diagram
depicts a high-level overview of the relationship between use cases, actors, and
systems. Experts recommend that use case diagrams be used to supplement a more
descriptive textual use case.
13
4. IMPLEMENTATION
Pre-requisites
14
Import NLTK and run nltkdownload().This will open the NLTK downloader
from where you can choose the corpora and models to download. You can also
download all packages at once.
The main issue with text data is that it is all in text format (strings).
However, Machine learning algorithms need some sort of numerical feature
vector to perform the task. So before we start with any NLP project, we need
to pre- process it to make it ideal for work. Basic text pre-processing includes:
Converting the entire text into uppercase or lowercase so that the algorithm
does not treat the same words in different cases as different.
Tokenization: Tokenization is just the term used to describe the process of
converting the normal text strings into a list of tokens, i.e., words that we want.
A sentence tokenizer can be used to find the list of sentences, and a Word
tokenizer can be used to find the list of words in strings.
The NLTK data package includes a pre-trained Punkt tokenizer for English.
Removing Noise: i.e., everything that isn’t in a standard number or letter are
removed.
Removing Stop words: Sometimes, some extremely common words that appear
to be of little value in helping select documents matching a user need are
excluded from the vocabulary entirely. These words are called stop words.
15
The corpus.txt file and convert the entire corpus into a list of sentences and a list of
words for further pre-processing.
Keyword Matching
Define a function called Lem Tokens which will take as input the tokens and
return normalized tokens. Next, define a function for a greeting by the bot, i.e., if a
user’s input is a greeting, the bot shall return a greeting response. ELIZA uses a
simple keyword matching for greetings.
Generating Response
To generate a response from our bot for input questions, the concept of document
similarity will be used. So we begin by importing the necessary modules.
16
5.RESULT
The ROBO responds to user input. It won’t fool anyone, and for a production
system. It is a very simple bot with cognitive skills.
17
Conclusion
Consumers of today are always on the lookout for the best and most
personalized customer experience. It may be thought as an impossible task to
fu1lfill demands. However, there is one solution primed to satisfy the modern
customer, and that is a chatbot. Chatbots or smart assistants with artificial
intelligence are dramatically changing businesses. There is a wide range of chatbot
building platforms that are available for various enterprises, such as e-commerce,
retail, banking, leisure, travel, healthcare, and so on.
To summarize it, this system has accomplished several objectives in this project:
Chatbots can reach out to a large audience on messaging apps and be more
effective than humans and also organizations can easily offer high-quality
support and conflict resolution any time of day, and for a large quantity of
customers simultaneously.
Future Enhancement
18
7. REFERENCES
[1] Bhaumik Kohli , Tanupriya Choudhury, Shilpi Sharma, Praveen Kumar,” A
Platform for Human- Chat bot Interaction Using Python”, IEEE , 2018.
[2] Tussanai Parthornratt, Pasd Putthapipat, Dollachart Kitsawat , Prapap
Koronjaruwat,” A Smart Home Automation via Facebook Chatbot and Raspberry
Pi”, IEEE, 2018.
[3] Parth Thosani ,Manas Sinkar ,Jaydeep Vaghasiya, Radha Shankarmani,” A Self
Learning Chat-Bot from User Interactions and Preferences”, IEEE , 2020.
[4] Prakhar Srivastava, Nishant Singh,” Automatized Medical Chatbot (Medibot)”,
IEEE, 2020.
[5] Jitendra, Purohi, Aditya Bagwe, Rishbh Mehta, OjaswiniMangaonkar , Elizabeth
George, “Natural Language Processing based Jaro-The Interviewing Chatbot” ,
IEEE, 2019.
[6] Bhavika R. Ranoliya , Nidhi Raghuwansh and Sanjay Singh , “Chatbot for
University Related FAQs”,IEEE, 2017.
[7] Ankil Shah, Bhargav Jain, Bhavin Agrawal, Saurabh Jain, Simon Shim, “Problem
Solving Chat bot for DataStructures”, IEEE, 2018.
[8] Falguni Patel, Riya Thakore,Ishita Nandwani , Santosh kumar Bharti, “Combating
Depression in Students using an Intelligent Chat Bot: A Cognitive Behavioral
Therapy”, IEEE ,2019.
[9] Nitirajsingh Sandu , Ergun Gide, “Adoption of AI- Chatbots to Enhance Student
Learning Experience in Higher Education in India”, IEEE ,2019.
Neelkumar P. Patel, Devangi R. Parikh, “AI and Web-Based Human-Like
Interactive University Chat bot (UNIBOT)”, IEEE,2019.
[10] Urmil Bharti, Deepali Bajaj, Hunar Batra, Shreya Lalit, Shweta Lalit,
Aayushi Gangwan, “Med bot: Conversational Artificial Intelligence Powered Chat
bot for Delivering Tele-Health after COVID-19”, IEEE , 2020.
[11] Urmil Bharti, Deepali Bajaj, Hunar Batra, Shreya Lalit, Shweta Lalit,
Aayushi Gangwan, “Med bot: Conversational Artificial Intelligence Powered Chat
bot for Delivering Tele-Health after COVID-19”, IEEE , 2020.
[12] Chatbot Magazine (2019). A Visual History of Chatbots. Retrieved March 9,
2019 from: https://chatbotsmagazine.com/a-visual-history-of-chatbots-8bf3b31dbfb2
[13] Egencia (2018). What is a Chatbot and How does it work? Retrieved March
9, 2019 from: https://www.youtube.com/watch?v=38sL6pADCog
19