0% found this document useful (0 votes)
95 views

Chatbot Report

This document describes a project report for developing an AI-powered chatbot to provide university information. The proposed chatbot will allow users to ask questions and get responses related to the university anytime from anywhere. It uses concepts of artificial intelligence and machine learning to understand user queries and respond appropriately. The chatbot will be integrated with the university website to enhance the student experience. The report outlines the objectives, literature review, existing systems, proposed system, system requirements, design, implementation and results.

Uploaded by

Reema Joseph
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views

Chatbot Report

This document describes a project report for developing an AI-powered chatbot to provide university information. The proposed chatbot will allow users to ask questions and get responses related to the university anytime from anywhere. It uses concepts of artificial intelligence and machine learning to understand user queries and respond appropriately. The chatbot will be integrated with the university website to enhance the student experience. The report outlines the objectives, literature review, existing systems, proposed system, system requirements, design, implementation and results.

Uploaded by

Reema Joseph
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

AI AND WEB-BASED HUMAN LIKE INTERACTIVE

UNIVERSITY CHATBOT

A project report submitted to APJ Abdul Kalam Technological University in


partial fulfillment of the requirements for the award of the degree of

BACHELOR OF TECHNOLOGY IN COMPUTER SCIENCE & ENGINEERING

By

ANGEL MARIYA (LIES16CS023)

REEMA JOSEPH (IES16CS015)

SRUTHI K.S (IES16CS019)

STEENA STEPHEN (IES16CS020)

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


IES COLLEGE OF ENGINEERING, CHITTILAPPILLY,
KERALA - 680551 MAY 2020
IES COLLEGE OF ENGINEERING, CHITTILAPPILLY
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CERTIFICATE
This is to certify that the project report entitled

AI AND WEB-BASED HUMAN LIKE INTERACTIVE UNIVERSITY


CHATBOT
Submitted by
ANGEL MARIYA (LIES16CS023)
REEMA JOSEPH (IES16CS015)
SRUTHI K.S (IES16CS019)
STEENA STEPHEN (IES16CS020)

in partial fulfillment of the requirements for the award of Degree


BACHELOR OF TECHNOLOGY IN COMPUTER SCIENCE
& ENGINEERNG

to APJ Abdul Kalam Technological University is a record of bona fide work done by
him/her under my supervision and guidance and this work has not been submitted
elsewhere for any degree or diploma.

Guided by
Dr. G. KIRUTHIGA
LAKSHMI RAJAGOPAL Head of department
Asst. Professor Department of Computer Science &
Department of Computer Science & Engineering
Engineering IES College of Engineering Chittilappilly,
IES College of Engineering Thrissur
Chittilappilly,
Thrissur
Department of Computer Science & Engineering Project Report 2019-20

ACKNOWLEDGMENT

Here we gladly present this report on AI AND WEB-BASED HUMAN LIKE


INTERACTIVE UNIVERSITY CHATBOT as the part of the eighth semester project
of B.Tech , Computer Science & Engineering. At the time of submitting this report, we
use this opportunity to mention those people who were with us along the work.
We are very thankful to Dr. S. BRILLY SANGEETHA, Principal, IES College
of Engineering, Chittilappilly, who gave us an opportunity to present this project.
We are also grateful to Dr. G. KIRUTHIGA, Head of the Department, Computer
Science and Engineering, for her timely suggestions, kind guidance and valuable support
during the project period.
We would like to place on deep sense of gratitude to our project guide
Ms. LAKSHMI RAJAGOPAL, Asst. Professor, Department of computer science and
Engineering , for her valuable guidance, help and suggestions in this project.

We are also thankful to Ms. LILLY RAFFY CHEEROTHA , Asst. Professor,

Department of computer science and Engineering, for their immense support in the
successful completion of the project.
We would like to express my sincere thanks to my parents for the love, support
and encouragement they provided me throughout the project. We also extend my heartfelt
thanks to all my friends who helped me directly and indirectly through their valuable
support for our project.
Above all we would like to acknowledge the lord almighty, the foundation of all
wisdom who has been wonderfully guiding us step by step.

i
Department of Computer Science & Engineering Project Report 2019-20

ABSTRACT

Most of the time, Students have to visit universities or colleges to collect various
information like Tution fees, Term Schedule, etc. during their admission process or as per
their daily needs. This process is very tedious and time consuming, also it requires
manpower in providing required information to visitors. Hence, to overcome the problems
a chatbot can be developed. The project is about interaction between users an chatbot
which can be accessed from anywhere anytime. The chatbot can be easily attached with
any university or college website with few simple language conversions. Chatbot provides
various information related to university or college and also students-related information.

The chatbot can be used by anyone who can access the university’s website. The
project uses the concept of Artificial Intelligence and Machine Learning. User can ask
university-related questions, then the query is applied as an input to algorithm, which
processes the message and displays the corresponding response to the user. The Project
GUI is similar to a Messaging Application.

Keywords—Artificial Intelligence; Chatbot; Human-like interactive; Machine Learning;


University Chatbot

ii
Department of Computer Science & Engineering Project Report 2019-20

CONTENTS

ACKNOWLEGMENT i
ABSTRACT ii
CONTENTS iii
CHAPTER 1
INTRODUCTION 1
1.1 GENERAL 1
1.2 OBJECTIVES 1
CHAPTER 2
LITERATURE SURVEY 2
2.1 ARTIFICIALLY INTELLIGENT CHATBOT 2
2.2 A TOOL OF CONVERSATION: CHATBOT 2
2.3 AN INTELLIGENT BEHAVIOUR SHOWN BY 3
CHATBOT SYSTEM FOR BANKING IN VERNACULAR
LANGUAGES
2.4 COLLEGE ENQUIRY CHATBOT USING A.L.I.C.E 4
2.5 CHATBOT FOR UNIVERSITY RELATED FAQs 4
CHAPTER 3
EXISTING SYSTEM 6
3.1 DISADVANTAGES OF EXISTING SYSTEM 7
CHAPTER 4
PROPOSED SYSTEM 8
CHAPTER 5
SYSTEM REQUIREMENTS 9
5.1 HARDWARE REQUIREMENTS 9
5.2 SOFTWARE REQUIREMENTS 9
CHAPTER 6
SYSTEM DESIGN 10
6.1 ARCHITECTURAL DIAGRAM 10
6.2 MODULE DESCRIPTION 12
6.2.1 TRAINING MODULE 12
6.2.2 PREPROCESSING MODULE 13
6.2.3 TESTING MODULE 13
CHAPTER 7
SYSTEM IMPLEMENTATION 14
7.1 LANGUAGE DESCRIPTION 16
CHAPTER 8
RESULTS 18
8.1 SCREENSHOTS 19
CHAPTER 9

iii
Department of Computer Science & Engineering Project Report 2019-20

CONCLUSION 19
REFERENCES 20
ANNEXURES 21
ANNEXURE 1: DATAFLOW DIAGRAM 21
ANNEXURE 2: SAMPLE CODE 22

iv
Department of Computer Science & Engineering Project Report 2019-20

LIST OF FIGURES

Fig.No Figure Name Page No


6.1.1 System design 10
6.1.2 Database design 11
6.2.1 Training module database 12
7.0.1 Process flow diagram 14
7.0.2 Logic adapter working 15
8.1.1 Unibot App 18
8.1.2 Chat by text 18
8.1.3 Chat by voice 18
A1 Data flow diagram 21

v
Department of Computer Science & Engineering Project Report 2019-20

LIST OF ABBREVIATIONS

Acronyms Description
GUI Graphical user interface
AI Artificial intelligence
FAQ Frequently asked questions
AIML Artificial intelligence markup language
LSA Latent semantic analysis
IDE Integrated development environment
API Application programming interface
CI Continuous integration
JSON Javascript object notation

vi
Department of Computer Science & Engineering Report Project 2019-20

CHAPTER 1
INTRODUCTION

1.1 GENERAL

The project deals with user’s request in form of question based message and processes it to
deliver a desired response in form of message. It solves the process of visiting colleges and
gathering related information as per the needs, as it is time consuming. Also, the user can
communicate to admin office with telephone number provided but doesn’t receive a positive
feedback. The project is a web-based chatbot. Graphical User Interface (GUI) is much similar to
messaging application, which provides a friendly environment to the user as they are much
aware of operating messaging applications. The user types a question and on performing submit,
the message is preprocessed and the most relevant information from the database is provided as a
response in similar way of messaging. Developing a chatbot solves the problems that can arouse
in gathering required information. It can be accessed from anywhere at anytime. In various
websites, users are not able to find the required information on website which in turn end up
closing the websites, which can be fulfilled by using chatbot.

1.2 OBJECTIVES

• Guide the user through the conversation not to let him wonder what he should do or
say.

• Cover all possible answers and questions for core bot use cases.

• Support various small talk intents, the more the better!

1 IES college of engineering,chittillapilly


Department of Computer Science & Engineering Report Project 2019-20

CHAPTER 2

LITERATURE SURVEY

2.1 Artificially Intelligent Chatbot


As Nowadays Technology is getting smarter day by day and helping Humans to solve
their queries. Today Artificial Intelligence is playing a major role in a variety of fields ranging
from industries in product manufacturing, to customer care in public relations. As there are many
online Artificial Intelligence (AI) system or chat bots are in existence that help people solve their
problems. So, our team is going to implement a system (a virtual assistant) based on AI that can
solve any college related query. This will work as a College Oriented Intelligence Machine. This
system is like an Interaction with virtual human and this is strictly for college oriented. This
virtual machine will respond the queries of students on college related issues, and If in the
process of responding answer if the answer is found invalid, the system will declare that the
answer is invalid and further this invalid answer can be deleted or modified by the admin on the
system. As this will help students in fetching the information without visiting the college or to
stand in queue. Students can use this chat bot to get the answers to their queries in a very easy
and fast way.
A chat bot (also known as a talk bot, Bot, chatterbox, Artificial Conversational Entity) is
an android application whose conversation done by auditory or textual methods . Such Android
application are often designed to communicate easily and simulate how a human would behave
as a conversational partner, thereby passing the Turing test. This android application namely
Chat bots are typically used in dialog systems for various practical purposes including customer
service or help desk. Chat bots are used into the conversational system.
This type of android applications like Chat Bot project will be built using artificial
intelligence algorithms that will analyze user’s queries and understand user’s message. This
android application will provide answers to the queries of the students. Students will just have to
select the category for the department queries and then ask the query to the bot that will be used
for chatting.

2.2 A Tool of Conversation: Chatbot


Chatbot is widely popular now-a-days and catching speed as an application of computer
communication. Some programs respond intelligently like human. This type of program is called
a Chatbot. This paper addresses the design and implementation of a Chatbot system.

2
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

In today’s world computers play an important role in our society? Computers give us
information, they entertain us and help us in lots of manners. A chatbot is a program designed to
counterfeit a smart communication on a text or spoken ground. But this paper is based on the text
only chatbot. Chatbot recognize the user input as well as by using pattern matching, access
information to provide a predefined acknowledgment. For example, if the user is providing the
bot a sentence like “What is your name?” The chatbot is most likely to reply something like “My
name is Chatbot.” or the chatbot replies as “You can call me Chatbot.” based on the sentence
given by the user. When the input is bringing into being in the database, a response from a
predefined pattern is given to the user. A Chatbot is implemented using pattern comparing, in
which the order of the sentence is recognized and a saved response pattern is acclimatize to the
exclusive variables of the sentence. They cannot register and respond to complex questions, and
are unable to perform compound activities. Chatbot is relatively a new technology. The
application of a Chatbot can be seen in various fields in the future.

2.3 An Intelligent Behaviour Shown by Chatbot System for Banking in Vernacular


Languages
A Chabot is a software that is used to interact between a computer and a human in natural
language. Chabot are extended in real life, such as help desk tools, automatic telephone
answering system, business, e-commerce, service provided companies Chabot is in essence, a
piece of robotic software used to imitate human conversation through text chats. In this paper
proposal is carried on to explain the design of a Chabot that specifically tailored as resolving the
query about banking system in two languages. Chatbots are actually a stateful services,
remembering commands in order to generate solution for it. When Chabot technology is
integrated with popular web services it can be utilized securely by an even larger audience.

Chabot are extremely valuable for businesses and this value will only increase as time
goes by. On obvious area of Chabot implementation is customer service. Waiting on hold may
soon be a thing of the past as they become advanced enough to deal with basic level customer
services queries and this had made their technical support much more responsive and immediate.
This has resulted in significant cost reduction.

The ability to identify the user’s intent and extract the data and relevant entities contained
in the user’s request is the primary condition and the most relevant step at the core of a Chabot.
If Chabot are not able to correctly understanding the user request, it won’t be able to provide
correct answers. The Chabot must identify the user context to manage the conversation state,

3
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

flow and branching. The proposed Chabot identify the user context that helps to trigger the
particular intent alone for generating response to the user.

2.4 College Enquiry Chatbot Using A.L.I.C.E


In this paper, a proposal is carried on to explain the design of a chat bot specifically
tailored as an application which is going to help new students to solve all the problems they face
and the questions which arises in their mind during and after the admission. In particular, the
proposal investigates the implementation of ALICE chat bot system as an application named as
college enquiry chat bot. A keywords-based human-computer dialog system makes it possible
that the user could chat with the computer using a natural language, i.e. in English.

A.L.I.C.E. (Artificial Linguistic Internet Computer Entity) is an award-winning free


natural language artificial intelligence chat robot. The software used to create A.L.I.C.E. is
available as free ("open source") Alicebot and AIML software. Try talking to A.L.I.C.E. just like
a real person, but remember you are really chatting with a machine! A.L.I.C.E.'s Alicebot engine
utilizes AIML (Artificial Intelligence Markup Language) to form responses to your questions and
inputs. Unlike other commercial chat robot software costing thousands of dollars, the Alice bot
engine and AIML are freely available under the terms of the GNU General Public License (used
by GNU/Linux and thousands of other software projects). The A.L.I.C.E. project includes
hundreds of contributors from around the world. We worked with A.L.I.C.E (Artificial Linguistic
Internet Computer Entity) to develop our chatterbots system.

2.5 Chatbot for University Related FAQs


Chatbots are programs that mimic human conversation using Artificial Intelligence (AI).
It is designed to be the ultimate virtual assistant, entertainment purpose, helping one to complete
tasks ranging from answering questions, getting driving directions, turning up the thermostat in
smart home, to playing one’s favorite tunes etc. Chatbot has become more popular in business
groups right now as they can reduce customer service cost and handles multiple users at a time.
But yet to accomplish many tasks there is need to make chatbots as efficient as possible. To
address this problem, in this paper we provide the design of a chatbot, which provides an
efficient and accurate answer for any query based on the dataset of FAQs using Artificial
Intelligence Markup Language (AIML) and Latent Semantic Analysis (LSA). Template based
and general questions like welcome/ greetings and general questions will be responded using
AIML and other service based questions uses LSA to provide responses at any time that will

4
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

serve user satisfaction. This chatbot can be used by any University to answer FAQs to curious
students in an interactive fashion.

5
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

CHAPTER 3

EXISTING SYSTEM

A few chatbots with useful applications in our system are presented. We begin by discussing the
ELIZA chatbot system architecture and the working. Then we continue discussing about other
systems like ALICE and Siri.

ELIZA:

• It was one of the first chatbots, designed in 1966.

• It acts like a therapist by rephrasing statements of the user and posing them back as
questions.

• ELIZA works by simple parsing and substitution of key words into reframed phrases.

• People get emotionally caught up by ELIZA’s confident replies forgetting that it’s a
machine .

• ELIZA was written at MIT by Joseph Weizenbaum between 1964 and 1966.

ALICE:

• ALICE (Artificial Linguistic Internet Computer Entity)is inspired by ELIZA.

• It is a natural language processing chatbot—a program that engages in conversation


with a human by applying some pattern matching rules to the user's query and then
generating an appropriate response.

• ALICE is consists of two parts,Chatbot engine and Language Model. Language model is
stored in AIML (Artificial Intelligence Mark-up Language)files.

SIRI:
• Siri was developed by Apple.
• Siri is a computer program that works as a virtual personal assistant and knowledge
navigator.
• The feature uses a natural language user interface to answer questions, give suggestions, and
perform actions by using a set of Web services.
• The software adapts to the user's individual language usage and individual searches with
continuous use, and returns results that are personalized.

6
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

3.1 DISADVANTAGES

The issues of the existing systems:


• After the close observation of ALICE chatbot systems it is apparently clear that
1. ALICE does not save the history of conversation and
2. does not truly understand what user said.

• After the close observation of voice-to- text agents like SIRI ,it is clear that
1. At times SIRI can’t understand what we told her to do due to language
differences.
2. It cannot answer for complex queries.

7
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

CHAPTER 4

PROPOSED SYSTEM

• We propose a system which will work as an application and give users information about
different kinds of sports present in the world.
• This application will work using a pattern matching algorithm using depth first search
(DFS).
• It will also convert user’s queries from speech to text using a speech-to-text converter
and back to speech as an output to the user.
• Firstly, the user will speak his/her query out loud; the application will convert this query
from speech into text.
• The system finds out what the user actually wants by retrieving the semantic meaning of
the query.
• Then the system will pass on this semantic text as input to the pattern matching
algorithm.
• The pattern matching system will make use of knowledge that is already fed into the
databases in order to generate a response.

Once this response is generated we will convert it back into speech and the application will read
the content out.

8
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

CHAPTER 5

REQUIREMENT ANALYSIS

5.1 HARDWARE REQUIREMENTS

• i3 Processor Based Computer :

• Available in multiple speeds, ranging from


1.30 GHz upto 3.50 GHz.

• Features either 3mb or 4 mb of cache.

5.2 SOFTWARE REQUIREMENTS

• Any operating system :


System software that manages hardware and the software resources and provides
common services for computer programs.
• Android Studio (3.6):
Integrated Development environment (IDE) for android application development.

• JAVA
Used for backend app development.

• XML
Used for frontend app development.

9
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

CHAPTER 6

SYSTEM DESIGN

6.1 ARCHITECTURAL DIAGRAM

Fig 6.1.1 System design


• The user will speak out his query on his/her phone using the application system.
• The application sends this speech as input to the speech recognition module which will
convert the speech into text.
• This will be implemented using Google speech recognition API.
• There are two ways to do so, using Recognizer Intent or by creating an instance of
Speech Recognizer .
• The spoken language understanding module will understand the meaning of the query
using semantic representation.
• This is done so the application system can recognize what the user actually wants.
• Semantic representation of a query will help the system realize the
connotation as well as denotation of the query.
Database Design

10
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

• The database is the most important part of any system. The table is created as below and
the data is entered in such a way that if a question has more than one answers, then they
are stored in Answer 2 and Answer 3 fields.
• Also, the Question only contains keywords rather than particular natural language
question as shown in Table I.
• Unibot provides details such as departmental syllabus, events, admission procedure and
fees, basic university details, class timetable, important circulars,etc

Fig 6.1.2 Database design

11
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

6.2 MODULE DESCRIPTION


There are three main modules :
• Training
• Preprocessing
• Testing

6.2.1 TRAINING MODULE

Bot includes tools that help simplify the process of training a chat bot instance. UniBot’s training
process involves loading example dialog into the chat bot’s database. This either creates or
builds upon the graph data structure that represents the sets of known statements and responses.
When a chat bot trainer is provided with a data set, it creates the necessary entries in the chat
bot’s knowledge graph so that the statement inputs and responses are correctly represented.

Fig 6.2.1 training module database

Several training classes come built-in with UniBot. These utilities range from allowing
you to update the chat bot’s database knowledge graph based on a list of statements representing
a conversation, to tools that allow you to train your bot based on a corpus of pre-loaded training
data.

12
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

6.2.2 PREPROCESSING MODULE


UniBot’s preprocessors are simple functions that modify the input statement that a chat
bot receives before the statement gets processed by the logic adaper.

Preprocessor functions

UniBot comes with several built-in preprocessors.

• unibot.preprocessors.clean_whitespace(statement)
Remove any consecutive whitespace characters from the statement text.

• unibot.preprocessors.unescape_html(statement)
Convert escaped html characters into unescaped html characters. For example:
“&lt;b&gt;” becomes “<b>”.

• unibot.preprocessors.convert_to_ascii(statement)
Converts unicode characters to ASCII character equivalents. For example: “på fédéral”
becomes “pa federal”.

6.2.3 TESTING MODULE

UniBot”s Unit testing


• UniBot’s built in tests can be run using nose. See the nose documentation for more
information.
nosetests
• Note that nose also allows you to specify individual test cases to run. For example, the
following command will run all tests in the test-module tests/logic_adapter_tests
nosetests tests/logic_adapter_tests

13
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

CHAPTER 7

SYSTEM IMPLEMENTATION

An untrained instance of UniBot starts off with no knowledge of how to


communicate. Each time a user enters a statement, the library saves the text that they
entered and the text that the statement was in response to. As UniBot receives more input
the number of responses that it can reply and the accuracy of each response in relation to
the input statement increase.

The program selects the closest matching response by searching for the closest
matching known statement that matches the input, it then chooses a response from the
selection of known responses to that statement.

Process flow diagram

Fig 7.1 process flow diagram

14
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

Logic Adapters

Logic adapters determine the logic for how UniBot selects a response to a given input
statement.

How logic adapters select a response

• Creating a new logic adapter

The logic adapter that your bot uses can be specified by setting the logic_adapters
parameter to the import path of the logic adapter you want to use.

It is possible to enter any number of logic adapters for your bot to use. If multiple
adapters are used, then the bot will return the response with the highest calculated
confidence value. If multiple adapters return the same confidence, then the adapter that is
entered into the list first will take priority.

Fig 7.2 logic adapter working

• Common logic adapter attributes


15
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

Each logic adapter inherits the following attributes and methods.

A confidence value and the selected response statement should be returned. The confidence
value represents a rating of how accurate the logic adapter expects the selected response to be.
Confidence scores are used to select the best response from multiple logic adapters.

The confidence value should be a number between 0 and 1 where 0 is the lowest confidence
level and 1 is the highest.

• Best Match Adapter

A logic adapter that returns a response based on known responses to the closest matches to the
input statement.The best match adapter uses a function to compare the input statement to known
statements. Once it finds the closest match to the input statement, it uses another function to
select one of the known responses to that statement.

• Time Logic Adapter

The TimeLogicAdapter returns the current time.The TimeLogicAdapter identifies statements in


which a question about the current time is asked. If a matching question is detected, then a
response containing the current time is returned.

• Mathematical Evaluation Adapter

The MathematicalEvaluation logic adapter parses input to determine whether the user is asking a
question that requires math to be done. If so, the equation is extracted from the input and
returned with the evaluated result.

• Specific Response Adapter

If the input that the chat bot receives, matches the input text specified for this adapter, the
specified response will be returned.

7.1 LANGUAGE DESCRIPTION


➢ JAVA

Java is a general-purpose programming language that is class-based, object-oriented, and


designed to have as few implementation dependencies as possible. Great dev tools for Java -
IDEs, build systems, CI tools, Containers, Databases both SQL and NoSQL, REST service
frameworks, JSON parsers. This reduces your staffing risks for development and maintenance.
Global availability of Java skills also allows you to outsource if you need to.

16
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

➢XML

Extensible Markup Language (XML) is a markup language that defines a set of rules for
encoding documents in a format that is both human-readable and machine-readable. Developers
uses the XML files for following purposes: Storing the data for some application such as menu
data or data for some comobox., to generate the dynamic content by applying different Style
sheets. XML is also used to develop the content management systems.

17
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

CHAPTER 8

RESULTS

8.1 SCREENSHOTS

Fig 8.1.1 Unibot App Fig 8.1.2 Chat by text

Fig 8.1.3 Chat by voice

18
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

CHAPTER 9
CONCLUSION

AI chatbot is the best tool which provides quick way to interact with the users. It is very
helpful to the users as it allows to enter questions in natural language and desired information
is obtained easily to the user. In this presentation, details about design, algorithm used and
implementation of the Unibot is presented. The user doesn’t need to gather information by
visiting websites or colleges.

19
IES college of engineering,chittillapilly
Department of Computer Science & Engineering Report Project 2019-20

REFERENCES

Drishti Malik, Vibhor Sharma, Monika Goyal, "An intelligent behaviour shown by chatbot
system", International Journal of New Technology and Research, 2017.

Balbir Singh Bani, Ajay Pratap Singh, "College Enquiry Chatbot Using A.L.I.C.E", International
Journal of New Technology and Research, 2017.

Nitesh Thakur, Akshay Hiwrale, Sourabh Selote, Abhijeet Shinde, Namrata Mahakalkar,
"Artificially Intelligent Chatbot" in , Nagpur:Department of Computer Science & Engineering,
Priyadarshini Institute of Engineering & Technology.

M. Dahiya, "A tool of conversation: Chatbot" in , Janakpuri, India:Dept. of Computer Science,


Maharaja Surajmal Institute, 2017.

Tracy A. Tindall, Michael G. Makar, Dynamic chatbot.

B. R. Ranoliya, N. Raghuwanshi, S. Singh, "Chatbot for University Related FAQs", 2017


International Conference on Advances in Computing Communications and Informatics
(ICACCI), 2017.

20 IES College of Engineering, Chittilappilly


Department of Computer Science & Engineering Report Project 2019-20

ANNEXURES

ANNEXURE 1: DATA FLOW DIAGRAM

Fig A1 Flow chart of proposed algorithm

21 IES College of Engineering, Chittilappilly


Department of Computer Science & Engineering Report Project 2019-20

Figure indicates algorithm of proposed system. User can ask university-related questions,
then the query is applied as an input to algorithm, which processes the message and displays the
corresponding response to the user.

ANNEXURE 2: SAMPLE CODE


MainActivity.java
package com.example.upendra.myapplication.Activity;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.provider.CalendarContract;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
22 IES College of Engineering, Chittilappilly
Department of Computer Science & Engineering Report Project 2019-20

import android.widget.Toast;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.RetryPolicy;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.example.upendra.myapplication.Model.Message;
import com.example.upendra.myapplication.R;
import com.example.upendra.myapplication.Util.Config;
import org.json.JSONArray;
import org.json.JSONObject;
import org.xml.sax.Parser;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.realm.Realm;
import io.realm.RealmResults;
import static android.R.id.message;
public class MainActivity extends AppCompatActivity {
private String name="";
SharedPreferences prefs;

23 IES College of Engineering, Chittilappilly


Department of Computer Science & Engineering Report Project 2019-20

private Button btnSend;


private EditText inputMsg;
private ListView listViewMessages;
Realm realm;
Context context;
RequestQueue queue;
LayoutInflater inflater;
private MessagesListAdapter mAdapter;
private ArrayList<Message> messageList;
public static final String TAG = "MainActivity";

Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSend = (Button) findViewById(R.id.btnSend);
inputMsg = (EditText) findViewById(R.id.inputMsg);
listViewMessages = (ListView) findViewById(R.id.list_view);
context = getApplicationContext();
queue = Volley.newRequestQueue(context);
inflater = getLayoutInflater();
messageList = new ArrayList<>();
prefs = getSharedPreferences("userId", 0);
if(prefs.getInt("userId", 0) != 0){
name = prefs.getString("firstname","");
}
realm = Realm.getInstance(context);
RealmResults<Message> results = realm.where(Message.class).findAll();
if(results.size()>0)
{
realm.beginTransaction();

24 IES College of Engineering, Chittilappilly


Department of Computer Science & Engineering Report Project 2019-20

for (int i = 0; i < results.size(); i++) {


messageList.add(results.get(i));
}
realm.commitTransaction();
}
mAdapter = new MessagesListAdapter(this, messageList);
listViewMessages.setAdapter(mAdapter);
btnSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendMessage();
}
});
}

Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSend = (Button) findViewById(R.id.btnSend);
inputMsg = (EditText) findViewById(R.id.inputMsg);
listViewMessages = (ListView) findViewById(R.id.list_view);
context = getApplicationContext();
queue = Volley.newRequestQueue(context);
inflater = getLayoutInflater();
messageList = new ArrayList<>();
prefs = getSharedPreferences("userId", 0);
if(prefs.getInt("userId", 0) != 0){
name = prefs.getString("firstname","");
}
realm = Realm.getInstance(context);

25 IES College of Engineering, Chittilappilly


Department of Computer Science & Engineering Report Project 2019-20

RealmResults<Message> results = realm.where(Message.class).findAll();


if(results.size()>0)
{
realm.beginTransaction();
for (int i = 0; i < results.size(); i++) {
messageList.add(results.get(i));
}
realm.commitTransaction();
}
mAdapter = new MessagesListAdapter(this, messageList);
listViewMessages.setAdapter(mAdapter);
btnSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendMessage();
}
});
}

@Override
public void onResponse(JSONObject response) {
if (response != null && response.length() > 0) {
try {
if(response.getInt("success")==1)
{
realm.beginTransaction();
Message message = realm.createObject(Message.class);
JSONObject m = response.getJSONObject("message");
message.setChatBotName(m.optString("chatBotName", ""));
message.setChatBotID(m.optInt("chatBotID"));
message.setMessage(m.optString("message", ""));

26 IES College of Engineering, Chittilappilly


Department of Computer Science & Engineering Report Project 2019-20

message.setEmotion(m.optString("emotions",null));
message.setSelf(false);
realm.commitTransaction();
appendMessage(message);
}
else
{
String error=response.getString("errorMessage");
Toast.makeText(getApplicationContext(), "Error: "+error,
Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "json parse error: " +
e.getMessage(), Toast.LENGTH_SHORT).show();
}
} else {
// errors
Toast.makeText(getApplicationContext(), "Retry Later ",
Toast.LENGTH_SHORT).show();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
NetworkResponse networkResponse = error.networkResponse;
Log.e(TAG, "Volley error: " + error.getMessage() + ", code: " +
networkResponse);
Toast.makeText(getApplicationContext(), "Volley error: " +
error.getMessage(), Toast.LENGTH_SHORT).show();

/*if (networkResponse != null)


{
27 IES College of Engineering, Chittilappilly
Department of Computer Science & Engineering Report Project 2019-20

// HTTP Status Code: 401 Unauthorized


Log.d("status", " " + networkResponse.statusCode);
if(networkResponse.statusCode==404)
Toast.makeText(context,"User Not
Found.",Toast.LENGTH_SHORT).show();
else
Toast.makeText(context,"Try
Later.",Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(context,"Try
Again.",Toast.LENGTH_SHORT).show();
}*/
/* if (error.getClass().toString().equals("class
com.android.volley.NoConnectionError"))
Toast.makeText(context,"Please connect to
internet.",Toast.LENGTH_SHORT).show();
else if (error.getClass().toString().equals("class
com.android.volley.AuthFailureError"))
Toast.makeText(context,"\"Request cannot be completed. Try again
later.",Toast.LENGTH_SHORT).show();
else if (error.getClass().toString().equals("class
com.android.volley.ServerError"))
Toast.makeText(context,"Request cannot be completed. Try again
later.",Toast.LENGTH_SHORT).show();
else if (error.getClass().toString().equals("class
com.android.volley.TimeoutError"))
Toast.makeText(context,"Request cannot be completed. Try again
later.",Toast.LENGTH_SHORT).show();
else {
// define other errors
Toast.makeText(context,"error",Toast.LENGTH_SHORT).show();
}

28 IES College of Engineering, Chittilappilly


Department of Computer Science & Engineering Report Project 2019-20

Log.d("check", "" + error.getClass().toString());*/


}
}
);
// disabling retry policy so that it won't make
// multiple http calls
int socketTimeout = 0;
RetryPolicy policy = new DefaultRetryPolicy(socketTimeout,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
jsonObjectRequest.setRetryPolicy(policy);
jsonObjectRequest.setTag(TAG);
queue.add(jsonObjectRequest);
}
public class MessagesListAdapter extends BaseAdapter {
private Context context;
private List<Message> messagesItems;
public MessagesListAdapter(Context context, List<Message> navDrawerItems) {
this.context = context;
this.messagesItems = navDrawerItems;
}
@Override
public int getCount() {
return messagesItems.size();
}
@Override
public Object getItem(int position) {
return messagesItems.get(position);
}
@Override
public long getItemId(int position) {

29 IES College of Engineering, Chittilappilly


Department of Computer Science & Engineering Report Project 2019-20

return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Message m = messagesItems.get(position);
LayoutInflater mInflater = (LayoutInflater) context
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);

if (messagesItems.get(position).isSelf()) {
convertView = mInflater.inflate(R.layout.list_item_message_right,
null);
} else {
convertView = mInflater.inflate(R.layout.list_item_message_left,
null);
}
TextView lblFrom = (TextView) convertView.findViewById(R.id.lblMsgFrom);
TextView txtMsg = (TextView) convertView.findViewById(R.id.txtMsg);
txtMsg.setText(m.getMessage());
lblFrom.setText(m.getChatBotName());
return convertView;
}
}
private void appendMessage(final Message m) {
runOnUiThread(new Runnable() {
@Override
public void run() {
messageList.add(m);
mAdapter.notifyDataSetChanged();
// Playing device's notification
playBeep();
}

30 IES College of Engineering, Chittilappilly


Department of Computer Science & Engineering Report Project 2019-20

});
}
private boolean networkIsAvailable(final Context context) {
final ConnectivityManager connectivityManager = ((ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE));
return connectivityManager.getActiveNetworkInfo() != null &&
connectivityManager.getActiveNetworkInfo().isConnected();
}

public void playBeep() {


try {
Uri notification = RingtoneManager
.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(getApplicationContext(),
notification);
r.play();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onStop () {
super.onStop();
if (queue != null) {
queue.cancelAll(TAG);
}
}
@Override
public void onDestroy() {
super.onDestroy();
realm.close();
}
31 IES College of Engineering, Chittilappilly
Department of Computer Science & Engineering Report Project 2019-20

@Override
protected void onResume() {
super.onResume();
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
}

32 IES College of Engineering, Chittilappilly

You might also like