Python Chatbot: Oriental Institute of Science & Technology, Bhopal
Python Chatbot: Oriental Institute of Science & Technology, Bhopal
Bhopal
Python Chatbot
Project Work
Submitted as Minor Project in Partial fulfillment for the award of Graduate Degree in
Bachelor of Engineering in Computer Science & Engineering.
Submitted to
Submitted By—
Zeeshan Khan – 0105CS181127
Nandani Choudhary – 0105CS181066
Zoheb Siddiqui - 0105CS181065
Under the Guidance of--
Prof. Manjari Ma’am
(Department of Computer Science & Engineering)
OIST Page 1
Oriental Institute of Science & Technology, Bhopal
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
JAN-JUN 2021
Certificate
This is to certify that the project entitled “Title” being
submitted by Zoheb Siddiqui(0105CS181065) student of
6th Semester, B.Tech in Computer Science & Engineering
have done their work as MINOR PROJECT for Partial
fulfillment of the B Tech degree from RGPV, Bhopal
(M.P.) is a record of bonafide work carried out by him
under our supervision.
OIST Page 2
TABLE OF CONTENTS
ABSTRACT
LIST OF FIGURES
LIST OF TABLES
LIST OF ALGORITHMS
__________________________________________________________
1.1 Overview
OIST Page 3
CHAPTER 4:- DESIGN
OIST Page 4
CHAPTER-1
INTRODUCTION
OIST Page 5
1.1. OVERVIEW
OIST Page 6
initially began in the 1960s to determine whether a chatbot
could be portrayed as a human. This is a chatbot you can
create through interaction as it will learn from previous
interactions to create its knowledge base.
OIST Page 7
1.2. PROJECT OBJECTIVE & SCOPE
Main Objectives :-
OIST Page 8
The bot should be able to pick topics to talk about rather
than waiting on user input.
OIST Page 9
CHAPTER-2
BACKGROUND & LITERAL SURVEY
OIST Page 10
s/w Requirement Specification
Software and Hardware Specification
OIST Page 11
2.2. FEASIBILITY
Technical Feasibility:
It determines that work for the project is done with the
present equipment and existing software technology,
such as:
Operational Feasibility:
It covers mainly two aspects. It determines that how the
proposed system will fit in the current operation and
OIST Page 12
what if the job retraining and restructuring may be
needed at the end of the implementation of the system.
It is operational feasible also because it does not affect
the other applications running on the system nor does it
affects the network traffic in any way. Besides being a
web based application it requires only limited resources
as it is license free so it does not affect the working of
other software on the system.
OIST Page 13
self and asking the user to
introduce himself or herself.
This enables the Chatbot to keep
record of the user name
and conversation period (starting
time, ending time and
duration of the conversation).
Programming Concepts The
Python-Bot provides de-
tail explanation of Python
programming concepts in-
cluding Data Types, Expressions,
Control Statements,
Strings, Text Files, Lists,
Dictionaries, Tuples, Problem
Solving, and Algorithms.
Python-Bot can also discuss
algorithms that are free of
OIST Page 14
programming language syntax.
Examples of the some content
shared by Python-Bot to assist
novice programmers in
understanding the grammatical
structure of if statements is:
IF (logical condition(s)) THEN
Statement block 1
ELSE
Statement block 2
END IF
Python-Bot proceeds to explain to
the user the
process of writing or constructing
an algorithm. For
instance, to write an algorithm to
find the average
OIST Page 15
of two numbers. It displays an
explains these steps:
Algorithm: Find the Average of
Two Numbers
Step 1: Add the two numbers and
save this
result in a variable.
Step 2: Divide this new number by
the
number or constant ‘‘two’’
This section summarises the scope
of Python-Bot’s
operations covering main Chatbot
functionalities; including
how it introduces itself to students,
shares programming
concepts and provides support
capability.
OIST Page 16
Introduction Python-Bot begins by
first introducing it-
self and asking the user to
introduce himself or herself.
This enables the Chatbot to keep
record of the user name
and conversation period (starting
time, ending time and
duration of the conversation).
Programming Concepts The
Python-Bot provides de-
tail explanation of Python
programming concepts in-
cluding Data Types, Expressions,
Control Statements,
Strings, Text Files, Lists,
Dictionaries, Tuples, Problem
Solving, and Algorithms.
OIST Page 17
Python-Bot can also discuss
algorithms that are free of
programming language syntax.
Examples of the some content
shared by Python-Bot to assist
novice programmers in
understanding the grammatical
structure of if statements is:
IF (logical condition(s)) THEN
Statement block 1
ELSE
Statement block 2
END IF
Python-Bot proceeds to explain to
the user the
process of writing or constructing
an algorithm. For
OIST Page 18
instance, to write an algorithm to
find the average
of two numbers. It displays an
explains these steps:
Algorithm: Find the Average of
Two Numbers
Step 1: Add the two numbers and
save this
result in a variable.
Step 2: Divide this new number by
the
number or constant ‘‘two’’
This section summarises the scope
of Python-Bot’s
operations covering main Chatbot
functionalities; including
how it introduces itself to students,
shares programming
OIST Page 19
concepts and provides support
capability.
Introduction Python-Bot begins by
first introducing it-
self and asking the user to
introduce himself or herself.
This enables the Chatbot to keep
record of the user name
and conversation period (starting
time, ending time and
duration of the conversation).
Programming Concepts The
Python-Bot provides de-
tail explanation of Python
programming concepts in-
cluding Data Types, Expressions,
Control Statements,
OIST Page 20
Strings, Text Files, Lists,
Dictionaries, Tuples, Problem
Solving, and Algorithms.
Python-Bot can also discuss
algorithms that are free of
programming language syntax.
Examples of the some content
shared by Python-Bot to assist
novice programmers in
understanding the grammatical
structure of if statements is:
IF (logical condition(s)) THEN
Statement block 1
ELSE
Statement block 2
END IF
Python-Bot proceeds to explain to
the user the
OIST Page 21
process of writing or constructing
an algorithm. For
instance, to write an algorithm to
find the average
of two numbers. It displays an
explains these steps:
Algorithm: Find the Average of
Two Numbers
Step 1: Add the two numbers and
save this
result in a variable.
Step 2: Divide this new number by
the
number or constant ‘‘two’’
This section summarises the scope
of Python-Bot’s
operations covering main Chatbot
functionalities; including
OIST Page 22
how it introduces itself to students,
shares programming
concepts and provides support
capability.
Introduction Python-Bot begins by
first introducing it-
self and asking the user to
introduce himself or herself.
This enables the Chatbot to keep
record of the user name
and conversation period (starting
time, ending time and
duration of the conversation).
Programming Concepts The
Python-Bot provides de-
tail explanation of Python
programming concepts in-
OIST Page 23
cluding Data Types, Expressions,
Control Statements,
Strings, Text Files, Lists,
Dictionaries, Tuples, Problem
Solving, and Algorithms.
Python-Bot can also discuss
algorithms that are free of
programming language syntax.
Examples of the some content
shared by Python-Bot to assist
novice programmers in
understanding the grammatical
structure of if statements is:
IF (logical condition(s)) THEN
Statement block 1
ELSE
Statement block 2
END IF
OIST Page 24
Python-Bot proceeds to explain to
the user the
process of writing or constructing
an algorithm. For
instance, to write an algorithm to
find the average
of two numbers. It displays an
explains these steps:
Algorithm: Find the Average of
Two Numbers
Step 1: Add the two numbers and
save this
result in a variable.
Step 2: Divide this new number by
the
number or constant ‘‘two’’
This section summarises the scope
of Python-Bot’s
OIST Page 25
operations covering main Chatbot
functionalities; including
how it introduces itself to students,
shares programming
concepts and provides support
capability.
Introduction Python-Bot begins by
first introducing it-
self and asking the user to
introduce himself or herself.
This enables the Chatbot to keep
record of the user name
and conversation period (starting
time, ending time and
duration of the conversation).
Programming Concepts The
Python-Bot provides de-
OIST Page 26
tail explanation of Python
programming concepts in-
cluding Data Types, Expressions,
Control Statements,
Strings, Text Files, Lists,
Dictionaries, Tuples, Problem
Solving, and Algorithms.
Python-Bot can also discuss
algorithms that are free of
programming language syntax.
Examples of the some content
shared by Python-Bot to assist
novice programmers in
understanding the grammatical
structure of if statements is:
IF (logical condition(s)) THEN
Statement block 1
ELSE
OIST Page 27
Statement block 2
END IF
Python-Bot proceeds to explain to
the user the
process of writing or constructing
an algorithm. For
instance, to write an algorithm to
find the average
of two numbers. It displays an
explains these steps:
Algorithm: Find the Average of
Two Numbers
Step 1: Add the two numbers and
save this
result in a variable.
Step 2: Divide this new number by
the
number or constant ‘‘two’’
OIST Page 28
This section summarises the use and innovation of Python-
Bot’s
OIST Page 29
shared by Python-Bot to assist novice programmers in
Statement block 1
ELSE
Statement block 2
END IF
result in a variable.
in a variable.
OIST Page 30
Step 3: Provide this number (result from
OIST Page 31
The Required level of interaction
If the chatbot is going to deliver a menu driven
approach that has a simple set of rules and uses pre-
defined options for the user to select, the cost would
be low. But if the chatbot incorporates a natural
language processor (NLP) which recognizes the underlying
tone and emotions underneath the sounds, gestures and
words provided by the user will lead to higher costs
due to further development time required. And the more
you try to accommodate the different tones, the more
complex and costly it becomes.
OIST Page 32
CHAPTER 3:- PROCESS MODEL
OIST Page 33
of AI in Education is changing the
learning process [10].
Students learn and absorb
information through AI tools
like Chatbot [33, 47]. Today’s
teachers are able to offer
the learners with a customized
learning environment thanks
to AI. Researchers have developed
a number of learning
tools to improve the Education
system [48]. Chatbots,
as conversational agents, act as
game changers in the
innovative learning world [10, 49],
and are built to enhance
the interaction and collaboration
among the students and
OIST Page 34
their courses [50, 51].
Technology offers many learning
opportunities, and the
internet has tremendous potential
[46]. The introduction
of AI in Education is changing the
learning process [10].
Students learn and absorb
information through AI tools
like Chatbot [33, 47]. Today’s
teachers are able to offer
the learners with a customized
learning environment thanks
to AI. Researchers have developed
a number of learning
tools to improve the Education
system [48]. Chatbots,
OIST Page 35
as conversational agents, act as
game changers in the
innovative learning world [10, 49],
and are built to enhance
the interaction and collaboration
among the students and
their courses [50, 51].
Technology offers many learning
opportunities, and the
internet has tremendous potential
[46]. The introduction
of AI in Education is changing the
learning process [10].
Students learn and absorb
information through AI tools
like Chatbot [33, 47]. Today’s
teachers are able to offer
OIST Page 36
the learners with a customized
learning environment thanks
to AI. Researchers have developed
a number of learning
tools to improve the Education
system [48]. Chatbots,
as conversational agents, act as
game changers in the
innovative learning world [10, 49],
and are built to enhance
the interaction and collaboration
among the students and
their courses [50, 51].
In this work, we have developed an interactive chatbot
using the Flask framework in python, and the workflow
of the proposed framework is shown in Fig. User
discussion, as a rule, begins with the simple welcome
or general questions. User inquiries are first taken care
of by AIML check, to check whether the entered
inquiry is AIML script or not. AIML is characterized by
OIST Page 37
general inquiries, queries, and welcome which is
replied by utilizing AIML formats.
OIST Page 38
3.2 Project Plan
Technical Details-
The application will be written using python chatterbot to
develop the responses to queries from the user. The AIML
is interpreted by the python library and outputted to the
web-based application. When search functionality is
OIST Page 39
implemented the application will use Google to source its
data. Other websites may come into play depending on
what topic is being discussed in the conversation for
example if the user asks the weather, the data could be
pulled from a weather forecast website. The application
will be able to store user details like Name, gender, age
and possibly some other information depending on the
conversation. This data will be stored for conversation
enhancement and will be stored securely.
Evaluation-
The system will be evaluated by test cases for each
functional requirement. The system will be evaluated to
the end user by having a mock conversation and testing
each of the functional requirements.
OIST Page 40
ongoing, interesting and enriched conversation featuring
looked up information from Google.
Main Objectives-
Basic functionality – ability to respond to basic
words/phrases
Advanced logic – be able to talk about different topics
Pull data from Google. E.g What’s the weather like etc,
current news events
The bot should be able to pick topics to talk about rather
than waiting on user input Background Most Chat Bots
imitate conversation in a usually rather empty matter and
the conversation lacks any substance.
OIST Page 41
searches. For example, football results from last night.
Technical Approach- The application will be developed
using Python library, it is an Cpython language that is used
for creating natural language software agents. I will
combine this with Java to run the application. Special
resources required- No special resources required.
OIST Page 42
CHAPTER-4
DESIGN
OIST Page 43
4.1 Use case diagram
OIST Page 44
OIST Page 45
4.2 E-R Diagram
OIST Page 46
4.3 Class Diagram
OIST Page 47
The class diagram shown in Figure given below
illustrates the classes required to implement the
chatbot. This will act as a guide for implementing the
chatbot however other classes may be identified or
modified during development to meet the
requirements.
OIST Page 48
4.4 Data flow diagram
OIST Page 49
4.5. Sequence Diagram
OIST Page 50
OIST Page 51
4.6. ACTIVITY DIAGRAM
OIST Page 52
Fig :- Activity Diagram
OIST Page 53
4.7 Standard Chatbot Architecture
OIST Page 54
CHAPTER 5:- TECHNICAL DETAILS
OIST Page 55
5.1 Software and hardware requirements
Deciding upon an appropriate methodology is vital for the
overall development of any software application to ensure a
realistic timeframe is established for each stage of the
project and requirements are clearly outlined. Various
development methodologies will be discussed and
considered for the development and design of this software.
This section will highlight the development methodology
that is best suited to this project.
5.2 Software and Hardware Specification
• the problem the project is overcoming.
• the design methodologies considered for implementation.
• functional and non-functional requirements.
• software and hardware utilised to implement the project.
Hardware Requirement:-
- 8 GB RAM or above
- 20GB hard disk
- 10 MBPS speed of internet
- Intel core i5 8th generation processor atleast
Software Requirement:-
- Pycharm IDE - Python Libraries
- Python version 3.7.4
OIST Page 56
CHAPTER 6:- CODING
OIST Page 57
OIST Page 58
OIST Page 59
OIST Page 60
OIST Page 61
OIST Page 62
CHAPTER 7:- TESTING
OIST Page 63
7.1. TEST PLAN
Test coverage
Test coverage in the test plan states what requirements will
be verified during what stages of the product life. Test
Coverage is derived from design specifications and other
requirements, such as safety standards or regulatory codes,
where each requirement or specification of the design
ideally will have one or more corresponding means of
verification. Test coverage for different product life stages
may overlap, but will not necessarily be exactly the same
for all stages. For example, some requirements may be
verified during Design Verification test, but not repeated
during Acceptance test. Test coverage also feeds back into
the design process, since the product may have to be
designed to allow test access.
OIST Page 64
Test methods
Test methods in the test plan state how test coverage will
be implemented. Test methods may be determined by
standards, regulatory agencies, or contractual agreement, or
may have to be created new. Test methods also specify test
equipment to be used in the performance of the tests and
establish pass/fail criteria. Test methods used to verify
hardware design requirements can range from very simple
steps, such as visual inspection, to elaborate test procedures
that are documented separately.
Test responsibilities
Test responsibilities include what organizations will
perform the test methods and at each stage of the product
life. This allows test organizations to plan, acquire or
develop test equipment and other resources necessary to
implement the test methods for which they are responsible.
Test responsibilities also includes, what data will be
collected, and how that data will be stored and reported
(often referred to as "deliverables"). One outcome of a
successful test plan should be a record or report of the
verification of all design specifications and requirements as
agreed upon by all parties.
OIST Page 65
7.2. TEST FIXTURE
Example of fixtures:
Loading a database with a specific, known set of data
Erasing a hard disk and installing a known clear
operating system installation
Copying a specific known set of files
OIST Page 66
Use of fixtures
Some advantage of fixture include separation of the
test initialization from the testing, reusing a known
state for more than one test, and special assumption by
the testing framework that the fixture set up works.
OIST Page 67
CHAPTER 8:- SCREEN LAYOUTS
OIST Page 68
OIST Page 69
OIST Page 70
CHAPTER 9:- FUTURE ENHANCEMENTS
OIST Page 71
9.1. FUTURE ENHANCEMENT
The chatbot could also be developed to be multilingual.
From observing the users interact with the chatbot during
user testing, there were numerous suggestions to
integrate the chatbot across other popular platforms such
as Amazon Echo or Dot, this would increase the availability
of the chatbot and the integration of the Dialog Flow API
allow the chatbot to be easily exported Amazon Alexa.
There are limitations to what has been currently
achieved with chatbots. The limitations of data
processing and retrieval are hindering chatbots to
reach their full potential. It is not that we lack the
computational processing power to do so. However,
there is a limitation on “How” we do it. One of the
biggest examples is the retail customer market.
Retail customers are primarily interested in
interacting with humans because of nature of their
needs.
From researching into the area of intelligent chatbots,
we’ve noticed that there are a lot of startups setting up
with the objective of creating chatbots for businesses
and organizations, allowing their customers to tailor
the chatbot to their needs.
OIST Page 72
9.2. CONCLUSION
OIST Page 73
CHAPTER 10:-
REFRENCES & BIBLIOGRAPHY
OIST Page 74
https://www.python.org/downlo
ads/
https://www.geeksforgeeks.org/
https://chatterbot.readthedocs.io
/en/stable/
https://pypi.org/project/pyttsx3/
https://pypi.org/project/SpeechR
ecognition/
https://docs.python.org/3/library
/tkinter.html
https://docs.python.org/3/library
/threading.html
OIST Page 75