Вы находитесь на странице: 1из 78

CHATBOT FOR MOVIE APPLICATION

Submitted for partial fulfillment of the requirements


for the award of

BACHELOR OF TECHNOLOGY
in
COMPUTER SCIENCE & ENGINEERING
by
N.RESHMA – 15BQ1A05D9
N.LAKSHMI TEJASWI – 15BQ1A05E5
P.GAYATHRI SOWJANYA – 15BQ1A05G4
P.CHARITHA – 15BQ1A05F2

Under the guidance


of Mr.K.Vikas
Assistant Professor

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


(B.Tech Program is Accredited by NBA)
VASIREDDY VENKATADRI INSTITUTE OF TECHNOLOGY
Permanently Affiliated to JNTU Kakinada, Approved by AICTE
Accredited by NAAC with ‘A’ Grade, ISO 9001:2008 Certified
NAMBUR(V), PEDAKAKANI(M), GUNTUR-522 508
Tel no: 0863-2118036, url:www.vvitguntur.com
April 2019
CERTIFICATE

This is to certify that this Project Report is the bonafide work of Ms. N. Reshma, Ms.
N.Lakshmi Tejaswi, Ms. P.Gayathri Sowjanya, Ms.P.Charitha bearing Reg.No.
15BQ1A05D9, 15BQ1A05E5 , 15BQ1A05G4, 15BQ1A05F2 who had carried out the project
entitled “ChatBot for movie application” under our supervision.

Project Guide Head of the Department

(Mr. K. Vikas) (Dr. R. Eswaraiah)

Submitted for Viva voce Examination held on

External Examiner
DECLARATION

We, Ms. N.Reshma, Ms.N.Lakshmi Tejaswi, Ms.P.Gayathri Sowjanya, Ms.P.Charitha here


by declare that the Project Report entitled “ChatBot for movie application” done by us under
the guidance of Mr.K.Vikas, Assistant Professor, CSE at Vasireddy Venkatadri Institute of
Technology is submitted for partial fulfillment of the requirements for the award of Bachelor
of Technology in Computer Science & Engineering. The results embodied in this report have
not been submitted to any other University for the award of any degree.

DATE :

PLACE :

SIGNATURE OF THE CANDIDATE(S)

(N.Reshma)

(N.Lakshmi Tejaswi)

(P.Gayathri Sowjanya)

(P.Charitha)
ACKNOWLEDGEMENT

I take this opportunity to express my deepest gratitude and appreciation to all those people
who made this project work easier with words of encouragement, motivation, discipline, and faith
by offering different places to look to expand my ideas and helped me towards the successful
completion of this project work.

First and foremost, I express my deep gratitude to Mr. Vasireddy VidyaSagar, Chairman,
VasireddyVenkatadri Institute of Technology for providing necessary facilities throughout the
B.Tech programme.

I express my sincere thanks to Dr. Y. Mallikarjuna Reddy, Principal, VasireddyVenkatadri


Institute of Technology for his constant support and cooperation throughout the B.Tech
programme.

I express my sincere gratitude to Dr. R. Eswarariah, Professor & HOD, Computer Science
& Engineering, Vasireddy Venkatadri Institute of Technology for his constant encouragement,
motivation and faith by offering different places to look to expand my ideas.

I would like to express my sincere gratefulness to my guide Mr. K. Vikas for his insightful
advice, motivating suggestions, invaluable guidance, help and support in successful completion
of this project.

I would like to take this opportunity to express my thanks to the teaching and non-teaching
staff in Department of Computer Science & Engineering, VVIT for their invaluable help and
support.

NALLURI RESHMA
NERELLA LAKSHMI TEJASWI
POTHINENI GAYATHRI SOWJANYA
PEDDU CHARITHA
TABLE OF CONTENTS

Ch .No TITLE Page No


Contents i
List of Figures iii
List of Tables iv
ABSTRACT v
1. Introduction 1
1.1 Human computer interaction(HCI) 3
2. Aim & Scope 5
2.1 Existing System 5
2.2 Proposed System 8
2.3 Feasibility Study 8
2.1.1 Technical Feasibility 9
2.1.2 Operational Feasibility 9
2.1.3 Economic Feasibility 9
3. Concepts & Methods 10
3.1 Problem Description 10
3.2 Proposed Solution 10
3.2.1Artificial Intelligence Markup Language 10
3.2.2Natural Language 14
Processing(NLP) 3.2.3Latent Semantic 18
Analysis(LSA)
3.3 System Analysis Methods 20
3.3.1 Use case diagram 20
3.3.2 Activity Diagram 21
3.4 System Requirements 23
3.5 System Design 29
3.5.1 Class Diagram 29
3.5.2 Sequence Diagram 30
3.6 E – R Diagrams 35
4. Implementation 38
4.1 Tools used 38
4.2 Component Diagram 40
4.3 Implementation 43

i
4.4 Deployment Diagram 49

i
4.5 Screenshots 51
5. Testing 56
5.1 Test Cases 56
6. Conclusion 58
BIBLIOGRAPHY 59
PUBLICATION DETAILS

ii
LIST OF FIGURES

Fig no. Figure Name Page No


3.1 Steps In LSA 16
3.2 Working Of Natural Language Processing 17
3.3 Pattern Matching 19
3.4 Pattern Matching 19
3.5 Use Case diagram for chatbot 21
3.6 Activity diagram for chatbot 23
3.7 Class diagram for chatbot 30
3.8 Notation symbol for actor 31
3.9 Lifeline 31
3.10 Self message 33
3.11 Reply message 33
3.12 Found message 34
3.13 Lost message 34
3.14 Sequence diagram for chatbot 35
3.15 E-R diagram for chatbot 37
4.1 Component diagram for chatbot 43
4.2 Deployment diagram for chatbot 50
4.3 Interactive Conversation by user 51
4.4 Interactive Conversation by user 52
4.5 Interactive Conversation by user 53
4.6 Searching for the movie by the user 54
4.7 Response of bot for users delay 55

iii
LIST OF TABLES

Table.No Description Page.No

5.1 Test Cases 56


ABSTRACT

ChatBots are the programs that attempts to simulate the conversation of human being via
text or voice interactions using Artificial Intelligence Markup language(AIML). Artificial
Intelligence Markup Language (AIML) is a way of making a computer-controlled robot, or
a software think intelligently, in the similar manner the humans think. In this paper we
provide the design of a ChatBot for movie application where user can get complete details
for what they are looking for , which provides an efficient and accurate answer for any
query based on the dataset of FAQs using AIML. Template based and general questions like
welcome/greetings will be responded using AIML that will serve user need. Latent Semantic
Analysis(LSA) is one of the component of Natural Language Processing(NLP).LSA is the
ability of a computer program to understand human language as it is spoken. LSA allows
ChatBots to understand the messages and respond appropriately. This ChatBot is prepared to
get movie details and answer FAQs in an interactive fashion.

Key Words: Artificial Intelligence Markup Language, Natural language processing,


Latent Semantic Analysis.

v
CHAPTER-1
INTRODUCTION

Now-a-days people are attracting too much for entertainment by watching movies and due to
time constraints and their busy schedule they are willing to complete all the tasks with in a short
span of time , but searching for different movies in different websites is time consuming and is of
long process .To overcome the above problem we creating an efficient Bot which interact with
the user in friendly manner. This bot for movie application is created with the help of AIML and
LSA which is a part of Natural Language Processing(NLP). AIML is an XML based mark up
language used to create Artificial intelligence applications. Latent semantic analysis is used for
processing the query given by the user and compares with the existing questions present in the
database and helps in retrieving the appropriate answer with minimal response time.

There are numerous websites available on World Wide Web which helps to host
our personalized chatbot that can respond intelligently to human queries. These services are used
by many industries, organizations or institutions to service their consumers. One of the most
widely used language for the development of bot is AIML (Artificial Intelligence Markup
Language). This proves to be a deterministic language in terms of development of chat bots.
AIML or Artificial Intelligence Markup Lanuage is an xml base Language used for creating
chatbot (AI),it is always saved with the extension(.aiml). The lack of knowledge can be solved by
providing answers to the questions of what chatbots are, what benefits they bring and how to
create them. An appropriate definition of chatbots can be given by analyzing the fundamental
meaning of the term chatbot and by exploring past and current applications. Use cases of chatbots
can be identified in existing products. Market trends and attributes of media and technology can
be analyzed to find new potential scenarios for the usage of chatbots. Development is best
explained by creating a real chatbot and by using it to present the general principles of the
development process.

Explaining what chatbots are, demystifying what to use them for and presenting how to
create them, will help more people to be able to use and create chatbots, and thereby, accelerate
the development of the chatbot ecosystem. Innovation in technology and the creation of new
solutions can help automating and simplifying more tasks, which gives people the opportunity to
1
focus on more interesting issues and accomplish more things. Chatbots have the potential to do

2
simplify and automate many existing tasks and thereby accelerate the overall technological
progress. The structure of this work follows the three main questions. To begin with, terminology
is defined and applications are explored form a definition and understanding of what chatbots are.
Afterwards use cases of chatbots are identified not only through the collection of existing
examples, but also through the exploration of future potentials by analyzing attributes of the
relevant technologies. The second half of the work is a case study for the development of a
chatbot. The presented example guides through the process of designing user interactions for a
chatbot, and additionally explains architectural decisions and technological choices, which
provide a basis for other developers to build on when creating new chatbots in the future.

The term chatbot consists of two other terms - chat and bot. The meaning can be better
understood by examining the two components separately. The Oxford Dictionary defines chat as
“an informal conversation” and more specifically as “the online exchange of messages in real time
with one or more simultaneous users of a computer network”. As apparent in this definition,
conversations play a central role in chat and therefore chatbots. Other noteworthy aspects of this
definition are the inherent informal format of a chat, and the traits of being online and real time.
Informality does not have to be seen as a strict requirement; however a chat message and, for
example, a classical letter have different degrees of formality. Being online and thereby not bound
to a specific geographic location, device or other physicality can be seen as critical foundation for
determining potential types of systems suitable for such media. The aspect of limiting
communication to real time implies restrictions on possible interactions and sets a baseline for the
expected user experience. This also excludes the usage of certain technologies which do not
support the desired responsiveness.

Bot is defined as being “(chiefly in science fiction) a robot” with the specific
characteristics of representing “an autonomous program on a network (especially the Internet)
which can interact with systems or users, especially one designed to behave like a player in some
video games” . Foremost this provides the information that bots, including chatbots, are
programs. The creation of a chatbot implies the creation of an artifact in the form of a computer
program. Furthermore the aspect of autonomy and the communication over a network can be
connected with the previous described trait of a chat to be online.
1.1 HUMAN COMPUTER INTERACTION(HCI):

The term HCI was adopted in mid-1980s

● Association for Computing Machinery (ACM): “discipline concerned with the design,
evaluation & implementation of interactive computer systems for human use & with the
study of major phenomena surrounding them” (1992)

● Dix: “HCI is study of people, computer technology and the ways these influence each
other. We study HCI to determine how we can make this computer technology more
usable by people” (1998)

● Carroll: “HCI is the study and practice of usability. It is about understanding and creating
software and other technology that people will want to use, will be able to use, and will
find effective when used.” (2002)

What is HCI?

Human: Individual user, a group of users working together, a sequence of users in an organization

Computer: Desktop computer, large-scale computer system, Pocket PC, embedded system (e.g.,
photocopier, microwave oven), software (e.g., search engine, word processor)

User interface: Parts of the computer that the user contacts with

Interaction: Usually involve a dialog with feedback & control throughout performing a task (e.g.,
user invokes “print” command and then interface replies with a dialog box).

Why HCI?

● In the past, computers were expensive & used by technical people only

● Now, computers are cheap and used by non-technical people (different backgrounds,
needs, knowledge, skills)

● Computer and software manufacturers have noticed the importance of making computers
“user-friendly”: easy to use, save people time, etc.
HCI Scope :

Use & Context: Find application areas for computers

Human: Study psychological & physiological aspects e.g., study how a user learns to use a new
product, study human typing speed

Computer: Hardware & software offered e.g., input & output devices, speed, interaction styles,
computer graphics Development: Design, implementation & evaluation.

Goals of HCI :

● Safety

● Utility

● Effectiveness

● Efficiency

● Usability

● Appeal of systems
CHAPTER-2
AIM AND SCOPE

2.1 EXISTING SYSTEM :

Most of the existing chatbots are designed using Naive bayes algorithm. This algorithm is
used for text classification and Natural language processing(NLP). By using this algorithm the
output may not be accurate and correct.

Naive Bayes Algorithm :


It is a classification technique based on Bayes theorem with an assumption of
independence among predictors. In simple terms, a Naive Bayes classifier assumes that the
presence of a particular feature in a class is unrelated to the presence of any other feature. For
example, a fruit may be considered to be an apple if it is red, round, and about 3 inches in
diameter. Even if these features depend on each other or upon the existence of the other features,
all of these properties independently contribute to the probability that this fruit is an apple and
that is why it is known as ‘Naive’.

Naive Bayes model is easy to build and particularly useful for very large data sets. Along
with simplicity, Naive Bayes is known to outperform even highly sophisticated classification
methods. Bayes theorem provides a way of calculating posterior probability P(c|x) from P(c),
P(x) and P(x|c). Look at the equation below:
Above,

● P(c|x) is the posterior probability of class (c, target) given predictor (x, attributes).
● P(c) is the prior probability of class.
● P(x|c) is the likelihood which is the probability of predictor given class.
● P(x) is the prior probability of predictor.

Advantages :

● It is easy and fast to predict class of test data set. It also perform well in multi class
prediction
● When assumption of independence holds, a Naive Bayes classifier performs better
compare to other models like logistic regression and you need less training data.
● It performs well in case of categorical input variables compared to numerical variable(s).
For numerical variable, normal distribution is assumed (bell curve, which is a strong
assumption).

Disadvantages :

● If categorical variable has a category (in test data set), which was not observed in training
data set, then model will assign a 0 (zero) probability and will be unable to make a
prediction. This is often known as “Zero Frequency”. To solve this, we can use the
smoothing technique. One of the simplest smoothing techniques is called Laplace
estimation.
● On the other side naive Bayes is also known as a bad estimator, so the probability outputs
from predict proba are not to be taken too seriously.
● Another limitation of Naive Bayes is the assumption of independent predictors. In real
life, it is almost impossible that we get a set of predictors which are completely
independent.

Some of the existing chatbots are :

A. INTELLIGENT CHATBOT FOR EASY WEB-ANALYTICS INSIGHTS


In this fast-moving data-driven world, it is vital that we draw the accurate insights to
make the right decisions at the right time. In terms of online websites, there are many web
analytics tools that will give us performance reports. This paper compares two widely used
analytic tools based on their ease of use.Once the bot-user types in the query in the chatbot, this
chat bot will identify the category that contains the query pattern. Here the bot-user is expected to
type in the query in a predefined pattern. Once the query pattern is matched, template of the
category that contains the response is sent back to the bot-user. There are 3 query scenarios that
can be considered and the scenarios are domain related,general queries and the one not belonging
to these both.

B. AN INTELLIGENT WEB-BASED VOICE CHAT BOT

It deals with the working of AIML based chat robot. A Java Program is developed which
convert AIML files into database. This program is embedded into website which can in turns help
its customers to develop bots. The major technological enhancement in this research is
integrating speech recognition and text to speech converter. This empowers the bots to respond to
user queries using voice instead of text and humans to chat with bots using voice instead of text
messages.

C. CHATBOT FOR UNIVERSITY RELATED FAQS

It develops an interactive chatbot for University related Frequently Asked Questions


(FAQs), and the workflow of proposed framework. User discussion as a rule begins with
welcome or general questions. User inquiries are first taken care by AIML check piece to check
whether entered inquiry is AIML script or not. AIML is characterized with general inquiries and
welcome which is replied by utilizing AIML formats.

This will help the student to fetch information like ranking of university, availability of
services, university environment, updates regarding activities happening inside campus and many
more and other academic information.

D. DEVELOPMENT AND IMPLEMENTATION OF A CHATBOT IN A SOCIAL NETWORK

It describes the linking of chat bot with social network. It describes that how a chat bot
can be linked with Twitter to entertain the users. It can also be used for advertisements. The
bot is
linked with Twitter since it part from a simple concept, the exchange of short messages no longer
7
than 140 characters which drastically reduces the amount of information and the way it is
published. The algorithm process in this bot is divided into three different parts:

Message reception.

Message processing.

Generation of a suitable reply.

2.2 PROPOSED SYSTEM :

Chatbots are of different kinds for all the websites, our chatbot is used for movie
applications to know the details of the movie. This works very accurately than compared to other
chatbots.As soon as we enter the information it redirects to the website that they want.In our
chatbot we use Natural Language Processing(NLP)& Latent Semantic Analysis(LSA) by using
these techniques and the keywords provided our chatbot works very accurately.

2.3 FEASIBILITY STUDY :

The feasibility of the project is analyzed in this phase and the proposal is put forth with a
very general plan for the project and some cost estimates. During system analysis the feasibility
study of the proposed system is to be carried out. This is to ensure that the proposed system is not
a burden to the company. For feasibility analysis, some understanding of the major requirements
for the system is essential.
Three key considerations involved in feasibility are:
1. Technical feasibility
2. Operational feasibility
3. Economic feasibility
2.3.1 Technical feasibility :

Technical feasibility study is the complete study of the project in terms of input,
processes, output, fields, programs and procedures. It is a very effective tool for long term
planning and troubleshooting. The technical feasibility study should most essentially support the
financial information of an organization.

8
After knowing the features the chatbot should support, technical requirements can be
extracted and appropriate technology chosen for the implementation.

2.3.2 Operational feasibility:

Operational feasibility refers to the measure of solving problems with the help of a new
proposed system. It helps in taking advantage of the opportunities and fulfills the requirements as
identified during the development of the project. It takes care that the management and the users
support the project.

Our chatbot works very efficiently to give the correct information about details of their
search. Chatbot also solves the problem in accurate time and provides the solution to the user.

2.3.3 Economic feasibility:

Generally, it means whether a business or a project feasible cost wise and logistically.
Economics calculate economic feasibility by analyzing the costs and revenues a business would
incur by undertaking a certain project. There is no need for user to credit the money for accessing
the website the return for investment can be calculated by the number of times website is used.
CHAPTER-3
CONCEPTS AND METHODS

3.1 PROBLEM DESCRIPTION :

Now -a-days people are attracting too much for entertainment. One of the way for
relaxing themselves is by watching movies. Due to time constraints and their busy schedule they
are willing to complete all the tasks within a short span of time, but searching for different
movies in different websites is time consuming and is of long process. The mindset of people will
be like their work should be completed with less effort and the result must be with in seconds.

3.2 PROBLEM SOLUTION :

To overcome the above problem we creating an efficient Bot which interact with the user
in friendly manner. In this the user can search for the movie which they want to watch. When the
user enters the movie name which they want to see then it displays the information like where the
movie is playing at what time the show will be present etc. Failure of getting correct results of
movies for which we are searching for in short span of time in different websites and Failure to
identify the inappropriate context in the text message is the main reason for introducing of this
chatbot for movie application. The proposed system solves these issues by developing a bot using
NLP and LSA .

3.2.1 Artificial Intelligence Markup Language(AIML) :

AIML is an XML based markup language used to create Artificial intelligence


applications. Latent semantic analysis is used for processing the query given by the user and
compares with the existing questions present in the database and helps in retrieving the
appropriate answer with minimal response time.

There are numerous websites available on World Wide Web which helps to host our
personalized chatbot that can respond intelligently to human queries. These services are used by
many industries, organizations or institutions to service their consumers. One of the most widely
used language for the development of bot is AIML (Artificial Intelligence Markup Language).
This proves to be a deterministic language in terms of development of chat bots. AIML or
Artificial
Intelligence Markup Language is an xml base Language used for creating chatbot (AI) it is
always saved with the extension(.aiml). The basic units of an AIML dialogs are called
categories .A category consists of

(i) an user input ,in the form of a sentence

(ii) a response to user input , presented by the chatterbot,

(iii)an optional context. Almost all bots are developed using AIML in which all the possible
queries are enclosed in <pattern> and <template> tags which contains question and answer
respectively.

E.g.

<pattern>HOW ARE YOU</pattern>

<template>Yeah! am fine. How are you?</template>

The patterns and template tags are further enclosed in <category> tags. Thousands of
categories tags are used to develop chatting bots. These categories are saved in database when the
bot is compiled or published. When a user sends a message the query pattern is matched with the
pattern’s stored in database and the corresponding template is sent as a response to the user.

There are three types of AIML classes:

phrase result and would discover an association

1) Atomic categories amongst result and subject and it would react with

2) Default categories a question


3) Recursive Categories

Atomic category : It is a sort of AIML classification The chatbot does not comprehend what it is
stating. It just creates about this situation there was a control connecting family and mother. At
that point it needed to create an answer that would urge the client to prevent another question
with the trust of finding a keyword. But more often than not ELIZA gives standard answers if a
keyword where there in the exact match.

< category >


< pattern >

How are you

< /pattern >

<template>I am fine </template>

< /category >

In the above illustration if the client submits How are you then the chatbot will answer I am fine is
not found.

Default category : It is a kind of AIML class where the utilization of a wild card symbols, for
example, * is utilized to coordinate any info

<category>

< pattern >

Who is * < /pattern >

< template >

He is my brother

< /template >

< /category>

In the event that ALICE does not discover an answer utilizing the main classification it continues
to the next.

Recursive category : It is a type of an AIML classification to persuade the user to be more


particular.

< category >

<pattern>

Can you tell who the * is </pattern>


< template > He is my brother

< srai > Who is * < /srai >

</template>

< /category >

Alice: Hi there! User: How old are you? Alice: I am eighteen in computer years

For such situation the wild symbol * is utilized to decrease User: Who is your father? Alice: I was
programmed by Dr.Richard S. Wallace

the information presented by user.

User: so you are a software program? Alice: Interesting deduction. Thanks and you are a

A. AIML Tags delightful person too. Am I a software program? User: wonderful! So what’s your
favorite food ALICE?

AIML Tags :

Different type of AIML tags are:

• < aiml > tag :

AIML files start with tag < aiml > and ends with < /aiml >. It also contains encoding and
version attributes that describes the basic usage of AIML. Version attribute defines AIML version
and encoding attribute describes the character set that is used for 1526 document.

Example of < aiml > tag

<aiml version=” 1.0.1 ” encoding=”UTF−8”?>

<category>

<pattern> HELLO BOT </ pattern>

<template> Hello my new friend ! </ template>

</ category>
</ aiml>

• < category > tag :

Multiple < category > tag are used under < aiml > tag. Each < category > tag describes
different knowledge base which is bounded within it. Modeling of this tag is done by using <
category > and < /category > tags . This tag should also contain < pattern > and < template > tags

• < pattern > tag :

The < pattern > tag states the possible user entered query. The < pattern > tag appears as a
single tag, and it should be the first most element within < category > tag. Sentences written in
this tag should be separated by unit space. Words within this statement can be replaced by wild
card symbol *.

• < template > tag :

The < template > stores answer to the user’s query. This tag have the scope within <
category > and it should be written just after < pattern >. Almost all of the chatbot data is
bounded within this tag. Also conditional answers and call to other answers are written within
this tag. Above example shows the use of < template > tag where answer (Hello my new friend!)
is written for the selected pattern.

• < srai > tag :

The < srai > tag shows an important characteristic of AIML. By using < srai > we can
target a multiple < pattern > for a single < template > So AIML interpreter will efficiently answer
for different user input having similar meaning. One can make use of < srai > tag in multiple
ways.

3.2.2 Natural Language Processing(NLP):


Natural Language Processing (NLP) refers to AI method of communicating with an
intelligent systems using a natural language such as English.Processing of Natural Language is
required when you want an intelligent system like robot to perform as per your instructions,
when you want to hear decision from a dialogue based clinical expert system, etc.

The field of NLP involves making computers to perform useful tasks with the natural languages
humans use. The input and output of an NLP system can be −
● Speech

● Written Text

Components of NLP:
There are two components of NLP as given
Natural Language Understanding (NLU):
Understanding involves the following tasks

● Mapping the given input in natural language into useful representations.

● Analyzing different aspects of the language.

Natural Language Generation (NLG):


It is the process of producing meaningful phrases and sentences in the form of natural language
from some internal representation.

It involves

● Text planning − It includes retrieving the relevant content from knowledge base.

● Sentence planning − It includes choosing required words, forming meaningful phrases,


setting tone of the sentence.

● Text Realization − It is mapping sentence plan into sentence structure.

Steps in NLP:

There are general five steps :

● Lexical Analysis − It involves identifying and analyzing the structure of words. Lexicon
of a language means the collection of words and phrases in a language. Lexical analysis
is dividing the whole chunk of text into paragraphs, sentences, and words.

● Syntactic Analysis (Parsing) − It involves analysis of words in the sentence for grammar
and arranging words in a manner that shows the relationship among the words. The
sentence such as “The school goes to boy” is rejected by English syntactic analyzer.
Fig 3.1 : Steps in LSA

● Semantic Analysis − It draws the exact meaning or the dictionary meaning from the text.
The text is checked for meaningfulness. It is done by mapping syntactic structures and
objects in the task domain. The semantic analyzer disregards sentence such as “hot ice-
cream”.

● Discourse Integration − The meaning of any sentence depends upon the meaning of the
sentence just before it. In addition, it also brings about the meaning of immediately
,succeeding sentence.

● Pragmatic Analysis − During this, what was said is re-interpreted on what it actually
meant. It involves deriving those aspects of language which require real world
knowledge.

How natural language processing works?

Current approaches to NLP are based on deep learning, a type of AI that examines and
uses patterns in data to improve a program's understanding. Deep learning models require
massive amounts of labelled data to train on and identify relevant correlations, and assembling
this kind of
big data set is one of the main hurdles to NLP currently. Earlier approaches to NLP involved a
more rules-based approach, where simpler machine learning algorithms were told what words
and phrases to look for in text and given specific responses when those phrases appeared.

Fig 3.2 : working of natural language processing

Example of natural language processing systems in artificial intelligence:

Communication: Many communication applications such Facebook Messenger are already using
artificial intelligence. On the whole, Facebook looks very interested in AI. Some months ago,
Facebook announced its M service that promises to become your personal assistant (with the
public launch date tbd): “M can do anything a human can.” When you request something that M
can’t do on its own, it sends a message to a Facebook worker and, as they work with the
software, the AI begins to learn. Another interesting application of natural language processing is
Skype Translator, which offers on-the-fly translation to interpret live speech in real time across a
number of languages. Skype Translator uses AI to help facilitate conversation among people who
speak different languages. This is great news! Without language barriers, people can
communicate using the language they are comfortable with, which will in turn speed up a range
of businesses processes
3.2.3 Latent Semantic Analysis(LSA):

Latent semantic analysis (LSA) is a technique in natural language processing, in particular


distributional semantics, of analyzing relationships between a set of documents and the terms
they contain by producing a set of concepts related to the documents and terms. LSA assumes
that words that are close in meaning will occur in similar pieces of text (the distributional
hypothesis). A matrix containing word counts per paragraph (rows represent unique words and
columns represent each paragraph) is constructed from a large piece of text and a mathematical
technique called singular value decomposition (SVD) is used to reduce the number of rows while
preserving the similarity structure among columns. Paragraphs are then compared by taking the
cosine of the angle between the two vectors (or the dot product between the normalizations of the
two vectors) formed by any two columns. Values close to 1 represent very similar words while
values close to 0 represent very dissimilar words.

Latent Semantic Analysis arose from the problem of how to find relevant documents from search
words. The fundamental difficulty arises when we compare words to find relevant documents,
because what we really want to do is compare the meanings or concepts behind the words. LSA
attempts to solve this problem by mapping both words and documents into a "concept" space and
doing the comparison in this space. Since authors have a wide choice of words available when
they write, the concepts can be obscured due to different word choices from different authors.
This essentially random choice of words introduces noise into the word-concept relationship.
Latent Semantic Analysis filters out some of this noise and also attempts to find the smallest set
of concepts that spans all the documents.

Working of LSA consists of three phases:

● The first phase deals with data pre-processing. The result of the first step given as an
input to the second phase.

● The second phase deals with implementation of NLP concepts like the removal of stop
words, stemming, entity recognition, tokenization and parts of speech tagging which
derive keywords from the user typed the message. These keywords compared with user
dictionary to identify irrelevant terms.
● The third phase deals with sending and receiving the messages using the internet and
saving the messages in encrypted form in the real-time database.

Latent Semantic Analysis (LSA), also known as Latent Semantic Indexing (LSI) literally means
analyzing documents to find the underlying meaning or concepts of those documents. If each
word only meant one concept, and each concept was only described by one word, then LSA
would be easy since there is a simple mapping from words to concepts.

Fig 3.3 : Pattern Matching

Unfortunately, this problem is difficult because English has different words that mean the same
thing (synonyms), words with multiple meanings, and all sorts of ambiguities that obscure the
concepts to the point where even people can have a hard time understanding.

Fig 3.4 : Pattern Matching

In this LSA we used count matrix algorithm since naive bayes algorithm does not give the
appropriate results.
3.3 SYSTEM ANALYSIS METHODS :

3.3.1 Use case diagram:


To model a system, the most important aspect is to capture the dynamic behavior.
Dynamic behavior means the behavior of the system when it is running/operating. Only static
behaviour is not sufficient to model a system rather dynamic behavior is more important than
static behavior. There should be some internal or external factors for making the interaction.
These internal and external agents are known as actors. Use case diagrams consists of actors, use
cases and their relationships. The diagram is used to model the system/subsystem of an
application. A single use case diagram captures a particular functionality of a system. A use case
is a methodology used in system analysis to identify, clarify, and organize system requirements.
In this context, the term "system" refers to something being developed or operated, such as a
mail-order product sales and service Website. Use case diagrams are employed in UML (Unified
Modeling Language), a standard notation for the modeling of real-world objects and systems.
System objectives can include planning overall requirements, validating a hardware design,
testing and debugging a software product under development, creating an online help reference,
or performing a consumer- service-oriented task. For example, use cases in a product sales
environment would include item ordering, catalog updating, payment processing, and customer
relations. A use case diagram contains four components.

● The boundary, which defines the system of interest in relation to the world around it.
● The actors, usually individuals involved with the system defined according to their
roles.
● The use cases, which are the specific roles played by the actors within and around the
system.
● The relationships between and among the actors and the use cases.

A Use Case model can be developed by following the steps below.


1. Identify the Actors (role of users) of the system.
2. For each category of users, identify all roles played by the users relevant to the system.
3. Identify what are the users required the system to be performed to achieve these goals.
4. Create use cases for every goal.
5. Structure the use cases.
6. Prioritize, review, estimate and validate the users.

Chatbot system

Fig 3.5 :Use case diagram for chatbot

3.3.2 Activity Diagram :


Activity diagram is another important diagram in UML to describe the dynamic aspects
of the system. Activity diagram is basically a flowchart to represent the flow from one activity to
another activity. The activity can be described as an operation of the system.The control flow is
drawn from one operation to another. This flow can be sequential, branched, or concurrent.
Activity diagrams deal with all type of flow control by using different elements such as fork,
join,
etc Activity diagram is basically a flowchart to represent the flow from one activity to another
activity. The activity can be described as an operation of the system.

The control flow is drawn from one operation to another. This flow can be sequential,
branched, or concurrent. Activity diagrams deal with all type of flow control by using different
elements such as fork, join, etc

Purpose of Activity Diagrams:


The basic purposes of activity diagrams is similar to other four diagrams. It captures the
dynamic behavior of the system. Other four diagrams are used to show the message flow from
one object to another but activity diagram is used to show message flow from one activity to
another.

Activity is a particular operation of the system. Activity diagrams are not only used for
visualizing the dynamic nature of a system, but they are also used to construct the executable
system by using forward and reverse engineering techniques. The only missing thing in the
activity diagram is the message part.

It does not show any message flow from one activity to another. Activity diagram is
sometimes considered as the flowchart. Although the diagrams look like a flowchart, they are
not. It shows different flows such as parallel, branched, concurrent, and single.

The purpose of an activity diagram can be described as -

● Draw the activity flow of a system.

● Describe the sequence from one activity to another.

● Describe the parallel, branched and concurrent flow of the system.


Fig 3.6 :Activity diagram for chatbot

3.4 SYSTEM REQUIREMENTS:

Software Requirements:
Operating system : Windows
Coding Language : JAVA
Tool : Net Beans
SOFTWARE ENVIRONMENT :

JAVA:
Java is a programming language and a platform. It is a high level, robust, object-oriented
and secure programming language. Java is an object-oriented programming language. Everything
in Java is an object. Object-oriented means we organize our software as a combination of
different types of objects that incorporates both data and behavior.

Object-oriented programming (OOPs) is a methodology that simplifies software development and


maintenance by providing some rules.

Platform: Any hardware or software environment in which a program runs, is known as a


platform. Since Java has a runtime environment (JRE) and API, it is called a platform.

Java is very easy to learn, and its syntax is simple, clean and easy to understand. According to
Sun, Java language is a simple programming language because:

● Java syntax is based on C++ (so easier for programmers to learn it after C++).

● Java has removed many complicated and rarely-used features, for example, explicit
pointers, operator overloading, etc.

● There is no need to remove unreferenced objects because there is an Automatic Garbage


Collection in Java.

Types of Java Applications:

There are mainly 4 types of applications that can be created using Java programming:
1) Standalone Application:
Standalone applications are also known as desktop applications or window-based
applications. These are traditional software that we need to install on every machine. Examples of
standalone application are Media player, antivirus, etc. AWT and Swing are used in Java for
creating standalone applications.
2) Web Application:
An application that runs on the server side and creates a dynamic page is called a web
application. Currently, Servlet, JSP, Struts, Spring, Hibernate, JSF, etc. technologies are used for
creating web applications in Java.
3) Enterprise Application:
An application that is distributed in nature, such as banking applications, etc. is called
enterprise application. It has advantages of the high-level security, load balancing, and clustering.
In Java, EJB is used for creating enterprise applications.

4) Mobile Application:
An application which is created for mobile devices is called a mobile application.
Currently, Android and Java ME are used for creating mobile applications.

Java Platforms / Editions:

There are 4 platforms or editions of Java

1) Java SE (Java Standard Edition):


It is a Java programming platform. It includes Java programming APIs such as java.lang,
java.io, java.net, java.util, java.sql, java.math etc. It includes core topics like OOPs, String,
Regex, Exception, Inner classes, Multithreading, I/O Stream, Networking, AWT, Swing,
Reflection, Collection, etc.
2) Java EE (Java Enterprise Edition):
It is an enterprise platform which is mainly used to develop web and enterprise applications.
It is built on the top of the Java SE platform. It includes topics like Servlet, JSP, Web Services,
EJB, JPA, etc.

3) Java ME (Java Micro Edition):


It is a micro platform which is mainly used to develop mobile applications.

4) JavaFX:
It is used to develop rich internet applications. It uses a light-weight user interface API.
Features of Java:

The primary objective of Java programming language creation was to make it portable, simple
and secure programming language. Apart from this, there are also some excellent features which
play an important role in the popularity of this language. The features of Java are also known as
java buzzwords.

1. Object-Oriented

2. Portable

3. Platform independent

4. Secured

5. Robust

6. Architecture neutral

7. Interpreted

8. High Performance

9. Multithreaded

10. Distributed

11. Dynamic

12. Simple

Java is platform independent because it is different from other languages like C, C++, etc.
which are compiled into platform specific machines while Java is a write once, run anywhere
language. A platform is the hardware or software environment in which a program runs.

There are two types of platforms software-based and hardware-based. Java provides a
software-based platform. The Java platform differs from most other platforms in the sense that it
is a software-based platform that runs on the top of other hardware-based platforms. It has two
components:

1. Runtime Environment

2. API(Application Programming Interface)


26
Java code can be run on multiple platforms, for example, Windows, Linux, Sun Solaris,
Mac/OS, etc. Java code is compiled by the compiler and converted into bytecode. This bytecode
is a platform-independent code because it can be run on multiple platforms, i.e., Write Once and
Run Anywhere(WORA).

JAVA SERVER PAGES(JSP):


Java Server Pages (JSP) is a server-side programming technology that enables the
creation of dynamic, platform-independent method for building Web-based applications. JSP
have access to the entire family of Java APIs, including the JDBC API to access enterprise
databases. This tutorial will teach you how to use Java Server Pages to develop your web
applications in simple and easy steps.
JavaServer Pages (JSP) is a technology for developing Webpages that supports dynamic
content. This helps developers insert java code in HTML pages by making use of special JSP
tags, most of which start with <% and end with %>.

A JavaServer Pages component is a type of Java servlet that is designed to fulfill the role of a
user interface for a Java web application. Web developers write JSPs as text files that combine
HTML or XHTML code, XML elements, and embedded JSP actions and commands.

Using JSP, you can collect input from users through Webpage forms, present records from a
database or another source, and create Webpages dynamically.

JSP tags can be used for a variety of purposes, such as retrieving information from a database or
registering user preferences, accessing JavaBeans components, passing control between pages,
and sharing information between requests, pages etc.

JavaServer Pages often serve the same purpose as programs implemented using the Common
Gateway Interface (CGI). But JSP offers several advantages in comparison with the CGI.

 Performance is significantly better because JSP allows embedding Dynamic Elements in


HTML Pages itself instead of having separate CGI files.

 JSP are always compiled before they are processed by the server unlike CGI/Perl which
requires the server to load an interpreter and the target script each time the page is
requested.

27
 JavaServer Pages are built on top of the Java Servlets API, so like Servlets, JSP also has
access to all the powerful Enterprise Java APIs, including JDBC, JNDI, EJB, JAXP, etc.

 JSP pages can be used in combination with servlets that handle the business logic, the
model supported by Java servlet template engines.

Finally, JSP is an integral part of Java EE, a complete platform for enterprise class applications.
This means that JSP can play a part in the simplest applications to the most complex and
demanding.

Java Scripting Elements:

● Scriptlet tag

● Expression tag

● Declaration tag

● Directive tag

1. Scriptlet tag :

Scriptlet tag allows to write Java code into JSP file.JSP container moves statements in
_jspservice() method while generating servlet from jsp. For each request of the client, service
method of the JSP gets invoked hence the code inside the Scriptlet executes for every request.A
Scriptlet contains java code that is executed every time JSP is invoked.

Syntax of Scriptlet tag:

<%java code %>

Here <%%> tags are scriplets tag and within it, we can place java code.

2. Expression tag :

Expression tag is one of the scripting elements in JSP. Expression Tag in JSP is used for writing
your content on client side. We can use this tag for displaying information on client browser. The
JSP Expression tag transforms the code into an expression statement that converts into a value in
the form of string object and insert into the implicit output object.
Syntax of JSP tag:

<%= expression %>

3. Declaration tag :

The JSP declaration tag is used to declare fields and methods. The code written inside the jsp
declaration tag is placed outside the service() method of auto generated servlet. So it doesn't get
memory at each request.

Syntax of JSP declaration tag:

<%! field or method declaration %>

4. Directive tag:
Directives can have a number of attributes which you can list down as key-value pairs and
separated by commas. The blanks between the @ symbol and the directive name, and between
the last attribute and the closing %>, are optional.

Syntax of JSP directive tag:

<%@ directive attribute =”value” %>

3.5 SYSTEM DESIGN :

3.5.1 Class Diagram :

Class diagram is a static diagram. It represents the static view of an application. Class
diagram is not only used for visualizing, describing, and documenting different aspects of a
system but also for constructing executable code of the software application.

Class diagram describes the attributes and operations of a class and also the constraints
imposed on the system. The class diagrams are widely used in the modeling of object oriented
systems because they are the only UML diagrams, which can be mapped directly with object-
oriented languages.

Class diagram shows a collection of classes, interfaces, associations, collaborations, and


constraints. It is also known as a structural diagram.
The purpose of the class diagram can be

● Analysis and design of the static view of an application.


● Describe responsibilities of a system.
● Base for component and deployment diagrams.
● Forward and reverse engineering.

Fig 3.7 :class diagram for chatbot

3.5.2 Sequence Diagram :


A sequence diagram simply depicts interaction between objects in a sequential order i.e.
the order in which these interactions take place. We can also use the terms event diagrams or
event scenarios to refer to a sequence diagram. Sequence diagrams describe how and in what
order the objects in a system function. These diagrams are widely used by businessmen and
software developers to document and understand requirements for new and existing systems.

Sequence Diagram Notations –

Actors – An actor in a UML diagram represents a type of role where it interacts with the
system and its objects. It is important to note here that an actor is always outside the scope of the
system we aim to model using the UML diagram.
Fig 3.8 : Notation symbol for actor
We use actors to depict various roles including human users and other external subjects. We
represent an actor in a UML diagram using a stick person notation. We can have multiple actors
in a sequence diagram.

Lifelines – A lifeline is a named element which depicts an individual participant in a sequence


diagram. So basically each instance in a sequence diagram is represented by a lifeline. Lifeline
elements are located at the top in a sequence diagram. The standard in UML for naming a lifeline
follows the following format – Instance Name : Class Name

Fig 3.9 : Lifeline

We display a lifeline in a rectangle called head with its name and type. The head is located on top
of a vertical dashed line (referred to as the stem) as shown above. If we want to model an
unnamed instance, we follow the same pattern except now the portion of lifeline’s name is left
blank.

Difference between a lifeline and an actor – A lifeline always portrays an object internal to the
system whereas actors are used to depict objects external to the system. The following is an
example of a sequence diagram
Messages – Communication between objects is depicted using messages. The messages appear in
a sequential order on the lifeline. We represent messages using arrows. Lifelines and messages
from the core of a sequence diagram.
Messages can be broadly classified into the following categories :
A sequence diagram with different types of messages

Synchronous messages – A synchronous message waits for a reply before the interaction can
move forward. The sender waits until the receiver has completed the processing of the message.
The caller continues only when it knows that the receiver has processed the previous message i.e.
it receives a reply message. A large number of calls in object oriented programming are
synchronous. We use a solid arrow head to represent a synchronous message.

Asynchronous Messages – An asynchronous message does not wait for a reply from the
receiver. The interaction moves forward irrespective of the receiver processing the previous
message or not. We use a lined arrow head to represent an asynchronous message.

Create message – We use a Create message to instantiate a new object in the sequence diagram.
There are situations when a particular message call requires the creation of an object. It is
represented with a dotted arrow and create word labelled on it to specify that it is the create
Message symbol.
For example – The creation of a new order on a e-commerce website would require a new object
of Order class to be created.

Delete Message – We use a Delete Message to delete an object. When an object is deallocated
memory or is destroyed within the system we use the Delete Message symbol. It destroys the
occurrence of the object in the system. It is represented by an arrow terminating with a x.
For example – In the scenario below when the order is received by the user, the object of order
class can be destroyed.

Self Message – Certain scenarios might arise where the object needs to send a message to itself.
Such messages are called Self Messages and are represented with a U shaped arrow.
Fig 3.10 : self message

Reply Message – Reply messages are used to show the message being sent from the receiver to
the sender. We represent a return/reply message using an open arrowhead with a dotted line. The
interaction moves forward only when a reply message is sent by the receiver.

Fig 3.11 : Reply message

Found Message – A Found message is used to represent a scenario where unknown source sends
the message. It is represented using an arrow direct towards a lifeline from an endpoint. For
example: Consider the scenario of a hardware failure.
Fig 3.12 : Found message

Lost Message – A Lost message is used to represent a scenario where the recipient is not known
to the system. It is represented using an arrow directed towards an end point from a lifeline. For
example: Consider a scenario where a warning is generated.

Fig 3.13 :Lost message


Sequence Diagram for Chatbot:

Fig 3.14 :sequence diagram for chatbot

3.6 E-R DIAGRAM:


An Entity–relationship model (ER model) describes the structure of a database with the
help of a diagram, which is known as Entity Relationship Diagram (ER Diagram). An ER model
is a design or blueprint of a database that can later be implemented as a database. The main
components of E-R model are: entity set and relationship set.

An ER diagram shows the relationship among entity sets. An entity set is a group of
similar entities and these entities can have attributes. In terms of DBMS, an entity is a table or
attribute of a table in database, so by showing relationship among tables and their attributes, ER
diagram shows
the complete logical structure of a database. Let’s have a look at a simple ER diagram to
understand this concept.

Here are the geometric shapes and their meaning in an E-R Diagram.

Rectangle: Represents Entity sets.

Ellipses: Attributes

Diamonds: Relationship Set

Lines: They link attributes to Entity Sets and Entity sets to Relationship Set

Double Ellipses: Multivalued Attributes

Dashed Ellipses: Derived Attributes

Double Rectangles: Weak Entity Sets

Double Lines: Total participation of an entity in a relationship set.

An ER diagram has three main components:

1. Entity

2. Attribute

3. Relationship.

1. Entity :

An entity is an object or component of data. An entity is represented as rectangle in an ER


diagram.

Weak Entity:

An entity that cannot be uniquely identified by its own attributes and relies on the relationship
with other entity is called weak entity. The weak entity is represented by a double rectangle.

2. Attribute:
An attribute describes the property of an entity. An attribute is represented as Oval in an ER
diagram. There are four types of attributes:

1. Key attribute

2. Composite attribute

3. Multi valued attribute

4. Derived attribute

3. Relationship:

A relationship is represented by diamond shape in ER diagram, it shows the relationship


among entities. There are four types of relationships:

1. One to one

2. One to many

3. Many to one

4. Many to many

ER diagram for chatbot :

Fig 3.15:E-R diagram for chatbot


CHAPTER-4
IMPLEMENTATION

4.1 TOOLS USED :

Net Beans:

NetBeans is an open-source integrated development environment (IDE) for developing with


Java, PHP, C++, and other programming languages. NetBeans is also referred to as a platform of
modular components used for developing Java desktop applications. NetBeans is coded in Java
and runs on most operating systems with a Java Virtual Machine (JVM), including Solaris, Mac
OS, and Linux.

NetBeans manages the following platform features and components:

● User settings

● Windows (placement, appearance, etc.)

● NetBeans Visual Library

● Storage

● Integrated development tools

● Framework wizard

NetBeans uses components, also known as modules, to enable software development. NetBeans
dynamically installs modules and allows users to download updated features and digitally
authenticated upgrades.

NetBeans IDE modules include NetBeans Profiler, a Graphical User Interface (GUI) design tool,
and NetBeans JavaScript Editor.

NetBeans framework reusability simplifies Java Swing desktop application development, which
provides platform extension capabilities to third-party developers.
Glass fish server : Glass Fish is an open-source application server project started by Sun
Microsystems for the Java EE platform and now sponsored by Oracle Corporation. The supported
version is called Oracle GlassFish Server. GlassFish is free software, dual-licensed under two
free software licences: the Common Development and Distribution License (CDDL) and the
GNU General Public License (GPL) with the classpath exception. GlassFish is the reference
implementation of Java EE and as such supports Enterprise JavaBeans, JPA, Java Server Faces,
JMS, RMI, Java Server Pages, servlets, etc. This allows developers to create enterprise
applications that are portable and scalable, and that integrate with legacy technologies. Optional
components can also be installed for additional services. Built on a modular kernel powered by
OSGi, GlassFish runs straight on top of the Apache Felix implementation. It also runs with
Equinox OSGi or Knopflerfish OSGi runtimes. HK2 abstracts the OSGi module system to
provide components, which can also be viewed as services. Such services can be discovered and
injected at runtime. GlassFish is based on source code released by Sun and Oracle Corporation's
TopLink persistence system. It uses a derivative of Apache Tomcat as the servlet container for
serving Web content, with an added component called Grizzly which uses Java New I/O (NIO)
for scalability and speed.

Notepad: Notepad is a simple text editor for Microsoft Windows and a basic text-editing
program which enables computer users to create documents. It was first released as a mouse-
based MS-DOS program in 1983, and has been included in all versions of Microsoft Windows
since Windows 1.0 in 1985. Notepad is a common text-only (plain text) editor. The resulting files
—typically saved with the .txt extension—have no format tags or styles, making the program
suitable for editing system files to use in a DOS environment and, occasionally, source code for
later compilation or execution, usually through a command prompt. It is also useful for its
negligible use of system resources; making for quick load time and processing time, especially on
underpowered hardware. Notepad supports both left-to-right and right-to-left based languages.
Historically, Notepad did not treat newlines in Unix- or classic Mac OS-style text files correctly.
However, on 8th May 2018, Microsoft announced that they had fixed this issue.[11] Notepad offers
only the most basic text manipulation functions, such as finding text. Only newer versions of
Windows include an updated version of Notepad with a search and replace function.
4.2 COMPONENT DIAGRAM :
The purpose of a component diagram is to show the relationship between different
components in a system. For the purpose of UML , the term "component" refers to a module of
classes that represent independent systems or subsystems with the ability to interface with the rest
of the system.

There exists a whole development approach that revolves around components: component-
based development (CBD). In this approach, component diagrams allow the planner to identify
the different components so the whole system does what it's supposed to do.
More commonly, in an OO programming approach, the component diagram allows a senior
developer to group classes together based on common purpose so that the developer and others
can look at a software development project at a high level.
Benefits of component diagrams
Though component diagrams may seem complex at first glance, they are invaluable when it
comes to building your system. Component diagrams can help your team:

● Imagine the system’s physical structure.


● Pay attention to the system’s components and how they relate.
● Emphasize the service behavior as it relates to the interface.

How to use component diagrams:

A component diagram in UML gives a bird’s-eye view of your software system.


Understanding the exact service behavior that each piece of your software provides will make
you a better developer. Component diagrams can describe software systems that are implemented
in any programming language or style.

UML is a set of conventions for object-oriented diagrams that has a wide variety of
applications. In component diagrams, the Unified Modeling Language dictates that components
and packages are wired together with lines representing assembly connectors and delegation
connectors.

How to use component shapes and symbols


There are three popular ways to create a component's name compartment. You always need
to include the component text inside the double angle brackets and/or the component logo. The
distinction is important because a rectangle with just a name inside of it is reserved for classifiers
(class elements).

As with the class notation, components also have an optional space to list interfaces, similar to
the way you add attributes and methods to class notation. Interfaces represent the places where
the groups of classes in the component communicate with other system components. An
alternative way to represent interfaces is by extending symbols from the component box. Here is
a quick rundown of the most commonly used symbols.

Provided interfaces: A straight line from the component box


with an attached circle. These symbols represent the interfaces
where a component produces information used by the required
interface
of another component.
Required interfaces: A straight line from the component box
with an attached half circle (also represented as a dashed arrow
with an open arrow). These symbols represent the interfaces
where a component requires information in order to perform
its proper
function.

In UML, a component diagram visually represents how the components of a software system
relate to one another. To build one, try using Lucidchart custom component diagram shape
library. Component diagrams should communicate:

● The scope of your system


● The overall structure of your software system
● Goals that the system helps human or non-human entities (known as actors) achieve
Component Diagram for chatbot :

Fig 4.1 : Component diagram for chatbot

4.3 IMPLEMENTATION:

Chatbot.java

package com.inst.mychatbot;
import java.io.File;
import org.alicebot.ab.Bot;
import org.alicebot.ab.Chat;
import org.alicebot.ab.History;
import org.alicebot.ab.MagicBooleans;
import org.alicebot.ab.MagicStrings;
import org.alicebot.ab.utils.IOUtils;
public class Chatbot {
private static final boolean TRACE_MODE = false;
static String botName = "super";
public static void main(String[] args)
{ try {
String resourcesPath = getResourcesPath();
System.out.println(resourcesPath);
MagicBooleans.trace_mode = TRACE_MODE;
Bot bot = new Bot("super", resourcesPath);
Chat chatSession = new Chat(bot);
bot.brain.nodeStats();
String textLine = "";

while(true) {
System.out.print("Human : ");
textLine = IOUtils.readInputTextLine();
if ((textLine == null) || (textLine.length() < 1))
textLine = MagicStrings.null_input;
if (textLine.equals("q")) {
System.exit(0);
} else if (textLine.equals("wq")) {
bot.writeQuit();
System.exit(0);
} else {
String request = textLine;
if (MagicBooleans.trace_mode) {
} else {
System.out.println("STATE=" + request + ":THAT=" + ((History)
chatSession.thatHistory.get(0)).get(0) + ":TOPIC=" + chatSession.predicates.get("topic"));
}
String response = chatSession.multisentenceRespond(request);
while (response.contains("&lt;"))
response = response.replace("&lt;", "<");
while (response.contains("&gt;"))
response = response.replace("&gt;", ">");
System.out.println("Robot : " + response);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}

private static String getResourcesPath() {


File currDir = new File(".");
String path = currDir.getAbsolutePath();
path = path.substring(0, path.length() - 2);
System.out.println(path);
String resourcesPath = path + File.separator + "src" + File.separator + "main" +
File.separator + "resources";
return resourcesPath;
}

AIML CODE:

<category><pattern>LIKE TO SEE MOVIE</pattern>


<template>can you please enter the place</template>
45
</category>
<category><pattern>LIKE TO WATCH MOVIE</pattern>
<template>can you please enter the place</template>
</category>
<category><pattern>LIKE TO WATCH MOVIES</pattern>
<template>can you please enter the place</template>
</category>
<category><pattern>LIKE TO SEE MOVIES</pattern>
<template>can you please enter the place</template>
</category>
<category><pattern>want to see movie</pattern>
<template>can you please enter the place</template>
</category>
<category><pattern> MOVIE</pattern>
<template>can you please enter the place</template>
</category>
</category><category><pattern>guntur</pattern>
<template>enter moviename</template>
</category>
<category><pattern>hyderabad</pattern>
<template>we are out of service we will reach you soon with our service</template>
</category>
<category><pattern>vijayawada</pattern>
<template>we are out of service we will reach you soon with our service</template>
</category>
<category><pattern>tenali</pattern>
<template>we are out of service we will reach you soon with our service</template>
</category>
<category><pattern>vizag</pattern>
<template>we are out of service we will reach you soon with our service</template>
</category>
<category><pattern>mangalagiri</pattern>
46
<template>we are out of service we will reach you soon with our service</template>
</category>
<category><pattern>JESSIE</pattern>
<template><oob><url>https://in.bookmyshow.com/guntur/movies/kesari/ET00063382
</url></oob></template>
</category>
<category><pattern>KESARI</pattern>
<template><oob><url>https://in.bookmyshow.com/guntur/movies/kesari/ET00063382</url></oo
b></template>
</category>
<category><pattern>PULI-JOODHAM</pattern>
<template><oob><url>https://in.bookmyshow.com/guntur/movies/puli-
joodham/ET00098865</url></oob></template>
</category>
<category><pattern>DRAGON</pattern>
<template><oob><url>https://in.bookmyshow.com/guntur/movies/how-to-train-your-dragon-the-
hidden-world-3d-telugu/ET00098869</url></oob></template>
</category>
<category><pattern>118</pattern>
<template><oob><url>https://in.bookmyshow.com/guntur/movies/118/ET00090018</url></oob
></template>
</category>
<category><pattern>CAPITAL-MARVEL</pattern>
<template><oob><url>https://in.bookmyshow.com/guntur/movies/captain-marvel-3d-
telugu/ET00097734</url></oob></template>
</category>
<category><pattern>VINARA-SODARA-VEERA-KUMARA</pattern>
<template><oob><url>https://in.bookmyshow.com/guntur/movies/vinara-sodara-veera-
kumara/ET00098127</url></obb></template>
</category>
<category><pattern>ADHRUSHYAM</pattern>
<template><oob><url>https://in.bookmyshow.com/guntur/movies/adhrushyam/ET00099364</ur
l></oob></template>
</category>
<category><pattern>F2</pattern>
<template><oob><url>https://in.bookmyshow.com/guntur/movies/f2/ET00073063</url></oob>
</template>
</category>
<category><pattern>VISWASAM</pattern>
<template><oob><url>https://in.bookmyshow.com/guntur/movies/viswasam-
telugu/ET00097300</url></obb></template>
</aiml>

Adding AIML files:


package com;
import java.io.File;
import org.alicebot.ab.Bot;
import org.alicebot.ab.MagicBooleans;
public class AddAiml {
private static final boolean TRACE_MODE = false;
static String botName = "super";
public static void main(String[] args) {
try {
String resourcesPath = getResourcesPath();
System.out.println(resourcesPath);
MagicBooleans.trace_mode = TRACE_MODE;
Bot bot = new Bot("super", resourcesPath);
bot.writeAIMLFiles();

} catch (Exception e)
{ e.printStackTrace();
}
}
private static String getResourcesPath() {
File currDir = new File(".");
String path = currDir.getAbsolutePath();
path = path.substring(0, path.length() - 2);
System.out.println(path);
String resourcesPath = path + File.separator + "src" + File.separator + "main" +
File.separator + "resources";
return resourcesPath;
}
}

4.4 DEPLOYMENT DIAGRAM:

Deployment diagrams are used to visualize the topology of the physical components of a
system, where the software components are deployed. Deployment diagrams are used to
describe the static deployment view of a system. Deployment diagrams consist of nodes and
their relationships. Deployment diagrams are used to visualize the topology of the physical
components of a system, where the software components are deployed. Deployment diagrams
are used to describe the static deployment view of a system. Deployment diagrams consist of
nodes and their relationships.

Purpose of Deployment Diagrams:

The term Deployment itself describes the purpose of the diagram. Deployment diagrams are
used for describing the hardware components, where software components are deployed.
Component diagrams and deployment diagrams are closely related.Component diagrams are used
to describe the components and deployment diagrams shows how they are deployed in hardware.
Most of the UML diagrams are used to handle logical components but deployment
diagrams are made to focus on the hardware topology of a system. Deployment diagrams are
used by the system engineers.

49
Deployment Diagram for chatbot :

Fig 4.2 :Deployment diagram for chatbot

50
4.5 SCREENSHOTS :

Fig 4.3 Interactive conversation by user


Fig 4.4 Interactive conversation by user
Fig 4.5 Interactive conversation by user
Fig 4.6 Searching for the movie by user
Fig 4.7 Response of bot for users delay
CHAPTER-5
TESTING

A test case is a specification of the inputs, execution conditions, testing procedure, and expected
results that define a single test to be executed to achieve a particular software testing objective,
such as to exercise a particular program path or to verify compliance with a specific requirement.
Test cases underlie testing that is methodical rather than haphazard. A battery of test cases
can be built to produce the desired coverage of the software being tested. Formally defined test
cases allow the same tests to be run repeatedly against successive versions of the software,
allowing for effective and consistent regression testing.
A test case is also defined as a set of conditions or variables under which a tester will determine
whether a system under test satisfies requirements or works correctly. The process of developing
test cases can also help find problems in the requirements or design of an application.

5.1 Test cases :

Table 5.1 Test cases

Input Actual output Expected output Result


Greeting messages Bot greets user Bot greets user Accepted

Ask for movies Gives results based on Gives results based on Accepted
place place
Enters irrelevant Displays error Expects answer for the Rejected
query message entered query
User willing to watch Bot askes to enter Get answer to that Accepted
movie place query as to enter place
User enters the Bot askes for movie Askes to enter the Accepted
location name movie name
User enter the location Bot gives the answer Expected for asking Rejected
for which bot do not as we are out of location
provide service service we will reach
you soon with our
service
User provides the Gives link to reach to Get the link to reach the Accepted
movie name. the movie website movie website
CHAPTER-6
CONCLUSION

A chatbot is a rising trend and chatbot increases the effectiveness of business by


providing a better experience with low cost. A simple chatbot is not a challenging task as
compared to complex chatbots and developers should understand and consider the stability,
scalability and flexibility issues along with high level of intention on human language. In short,
Chatbot is ecosystem and moving quite fast and with the passage of time new features are added
in the existing platform. It provides an effective and efficient way of communication. Our project
provides information about movies who are searching for the details in different websites.
BIBLIOGRAPHY

[1]. Naive bayes algorithm, https://www.analyticsvidhya.com/blog/2017/09/naive-bayes-explain

[2]. Ramya Ravi,” Intelligent Chatbot for Easy web analytics design”

[3]. Salomon Jakobus du Preez, Manoj Lall and Saurabh Sinha, An Intelligent Web-Based Voice
Chat Bot, in EUROCON 2009, EUROCON '09. IEEE, 2009, p. 386.

[4]. Bhavika R. Ranoliya , Nidhi Raghuwanshi and Sanjay Singh,” Chatbot for University Related
FAQs”

[5]. Salto Martínez Rodrigo, Jacques García Fausto Abraham, Development and Implementation
of a Chat Bot in a Social Network, in Ninth International Conference on Information Technology
- New Generations, 2012, p. 751.

[6]. Karthick S1 , R John Victor2 , Manikandan S3 , Bhargavi Goswami4,” Professional Chat


Application based on Natural Language Processing”

[7] AM Rahman1 , Abdullah Al Mamun1 , Alma Islam2,” Programming challenges of Chatbot:


Current and Future Prospective”, IEEE Region 10 Humanitarian Technology Conference (R10-
HTC),2017

[8] Yoko Nishihara, Masaki Ikuta, Ryosuke Yamanishi, and Junichi Fukumoto,” A Generation
Method of Back-channel Response to Let a Chatting bot Be a Member of Discussions in a Text-
based Chat”, 6th IIAI International Congress on Advanced Applied Informatics,2017

[9] D. De Orlando and F. Giovanni, "An integrated system, with natural language management,
for the monitoring activities in e-Iearning environments," in Complex, Intelligent and Software
Intensive Systems, 2008. CISIS 2008. International Conference on. IEEE, 2008, pp. 965970.

[10] F. Mikic, J. C. Burguillo, M. Llamas, D. Rodrfguez, E. Rodrfguez et aI., "Charlie: An aiml-


based chatterbot which works as an interface among ines and humans," in EAEEIE Annual
Conference, 2009. IEEE, 2009, pp. 1-6.

[11] S. du Preez, M. Lall, and S. Sinha, "An intelligent web-based voice chat bot," in EUROCON
2009, EUROCON'09. IEEE. IEEE, 2009, pp. 386-391.
[12] A. Augello, G. Pilato, A. Machi, and S. Gaglio, "An approach to enhance chatbot semantic
power and maintainability: Experiences within the frasi project," in Semantic Computing (ICSC),
2012 IEEE Sixth International Conference on. IEEE, 2012, pp. 186-193.

Вам также может понравиться