Christ Chatbot
Christ Chatbot
PROJECT REPORT
Submitted By
ATYX ANTONY
Reg. No. CCASSCS008
for the award of the Degree of
Bachelor of Science (B.Sc.)
in Computer Science
(University of Calicut)
March 2021
DEPARTMENT OF COMPUTER SCIENCE
IRINJALAKUDA
CERTIFICATE
First and foremost we like to thank Lord almighty for his providence
and for being the guiding light throughout the project. We wish to express
my sincere gratitude to our beloved Department head for giving me all the
facilities for our project. We take this opportunity to express my gratitude
to the class teacher Ms. SINI THOMAS and head of the department Ms.
VIJI VISWANATHAN who has been supported us throughout the course of
this project. We are thankful for her aspiring guidance and valuable advice
during the project work. We express my sincere thanks to my project guide
Ms. NISHA RAVEENDRAN for supporting and guiding throughout the
project.We would take this opportunity to specially thank all other faculty
members for their constant and continuous motivation. Finally we would like
to thank my family and friends for giving valuable advice and moral support
throughout our project.
Declaration
We here by declare that this project work ”CHRIST CHATBOT” sub-
mitted by Christ College (Autonomous)Irinjalakuda,affliated to Calicut Uni-
versity in partial fullfillment of the requirement for the award of the Bache-
lor of Computer Science, is a record of original work done by us,under the
guidance of Ms.NISHA RAVEENDRAN, Department of Computer Science.
Place:Irinjalakuda
Date:
1
ABSTRACT
2 System Analysis 2
2.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1.1 Existing System . . . . . . . . . . . . . . . . . . . . . . . 2
2.1.2 Proposed System . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Problem definition . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.3 FEASIBILITY STUDY . . . . . . . . . . . . . . . . . . . . . . . 3
2.3.1 Technical Feasibility . . . . . . . . . . . . . . . . . . . . . 3
2.3.2 Economical Feasibility . . . . . . . . . . . . . . . . . . . . 3
2.3.3 Operational Feasibility . . . . . . . . . . . . . . . . . . . . 3
2.4 Module Description . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.4.1 Admin Section . . . . . . . . . . . . . . . . . . . . . . . . 4
2.4.2 User Section . . . . . . . . . . . . . . . . . . . . . . . . . 4
4 Design Document 10
4.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.2 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.3 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.4 Data Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Appendix 19
C ER DIAGRAM 24
D ADMIN INTERFACES 25
D.1 LOGIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
D.2 ADMIN PAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
D.3 VIEW QUERIES . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
D.4 ADD QUERIES . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
D.5 DELETE QUERIES . . . . . . . . . . . . . . . . . . . . . . . . . 29
D.6 UNKNOWN QUESTIONS . . . . . . . . . . . . . . . . . . . . . 30
D.7 LOG TABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
E USER INTERFACES 32
E.1 DUMMY WEBSITE . . . . . . . . . . . . . . . . . . . . . . . . . 32
E.2 CHATBOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
E.3 EMAIL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
F CODE 35
Christ College(Autonomous) christ chatbot
Chapter 1
1 Introduction
Chatbot is nothing but a software that will perform automatic tasks.The main
aim of this chatbot was immediate response reaction and consistent connectiv-
ity.Chatbot is a computer application which may speak to human beings natu-
rally, the way we interact with one another.It can replace a person for several
tasks of answering queries. Chatbots make use of machine learning to succeed
in AI helping them to know the user query and supply an appropriate response.
The main features of the upgraded chatbot are – Automated customer support
for similar queries,Save human resources for qualitative tasks,Accelerate opera-
tions.
1.1 Overview
The objective of the christ chatbot is to design an simple and adaptable chatbot
for the website which helps users access the website, register and retrieve useful
information regarding the same.It provides a rapid clearing of each and every
queries related to christ college and in which users can know about every aspect
about the christ college .The project includes many functions such as clearing
queries, and to perform different functions.
Chapter 2
2 System Analysis
2.1 Purpose
After analyzing the requirements of the task to be performed , the next step is to
analyse the problem and understand its content. The first activity in the phase
is studying the existing system and other is to understand the requirements and
domain of the new system. Both the activities are equally important , but the
first activity serves as a basis of giving the functional specifications and then
successful design of the proposed system. Understanding the properties and
requirements of the new system is more difficult and requires creative think-
ing understand of existing of running system. The improper understanding of
present system can lead diversion from solution.
User
User is the one who ask queries related to the Christ College.
Chapter 3
3 Software Requirement Specification
3.1 Purpose
The purpose of this document is to give a detailed description of the require-
ments for the CHRIST CHATBOT. It illustrate the purpose and complete de-
scription for the development of the system. It explain system constraints,
interface and interactions with other external applications. This document is
primarily intended to be proposed to a college for conducting Techfest and a
reference for the upcoming students of the college.
3.2 Scope
This is a chatbot system developed to help the visiters of the College website
to get the services more easily.This chatbot has php at the front end and mysql
at the back end,will record product related activities in a secured manner.The
concept of this chatbot system is that the Office Staffs to make their job easy.
Keyboard: Standard
Mouse: Standard
Database : MySql
2.User or Student
Admin
The Admin can add and view the questions into chatbot.Admin can update and
delete questions inserted into chatbot.The admin can also analyse the data and
store the FAQs.
User
User can ask any queries about the college and the chatbot is capable of clearing
all doubts of users. User can also view the results of each event in their chat
window.
security
safety
usability
Performance
Performance requirements concern the speed of operation of a system. Types
of performance requirements :
Response requirements (how quickly the system reacts to a user input).
Safety
Safety requirements are not required which exclude unsafe situation from
the possible solution of the system.
Usability
Usability is the ease with which a user can learn to operate, prepare inputs
for, and interpret outputs of system or components. Usability requirements
include :
information error messages.
MySQL
MySQL, pronounced either ”My S-Q-L” or ”My Squel, ” is an open source
relational database management system. It is based on the structure query
language (SQL), which is used for adding, removing and modifying information
in the database. Standard SQL commands, such as ADD, DROP, INSERT,and
UPDATE can be used with MySQL.
What distinguishes PHP from something like client - side Javascript is that
the code is executed on the server, generating HTML which is then sent to the
client. The client would receive the results of running that script, but would not
know what the underlying code was. You can even configure your web server
to process all your HTML files with PHP, and then there’s really no way that
users can tell what you have up your sleeve. The best things in using PHP are
that it is extremely simple for a newcomer, but offers many advanced features
for a professional programmer.
Chapter 4
4 Design Document
4.1 Purpose
This system enables the users to interact more friendly with the College. The
Admin can view upload and update their permitted data.The project enables
the users to ask their doubts and Queries to the chatbot and able to get the
result instantly.if the answer is found to be invalid, admin collects the email
address of the user and notify the admin about the incorrect answer. Purpose
of this document is to give the detailed description of the architecture and sys-
tem design for the software.The system design document shows the software will
be structured to satisfy the requirement identified in the software requirement
specification.It is a translation of requirements into a description of the software
structure,software component,interfaces and data necessary for the implemen-
tation phase.In a complete software design document,each requirements must
be traceable to one or more design entities.
4.2 Scope
CHRIST CHATBOT is a web application which helps in automating the work
of the office staff. It also helps the students to clear their queries very effectively.
4.3 Overview
The purpose of this document is to help the reader to visualize the solution to
the project presented.This document verifies how the design meet the require-
ment stimulated in the SRS document through design viewpoints.The design
viewpoints will cover all design elements presented before. This document will
provide a direct approach to the development of this project hence reducing
feature creep and ponitedly determine the quality of the design.
Primary Key- The field that is unique for all the record occurrence.
Normalization
Normalization is the process of organizing the data in the database.
The normal form is used to reduce redundancy from the database table.
Tables
Chatbot feeds
Name DataType Constraints Description
id int(11) Primarykey ID of query
queries varchar(100) Notnull Query requested by the user
replies varchar(250) Notnul Answer to the user
Unknown
Name DataType Constraints Description
email int(11) primarykey email from the user
query int(9) Notnull query entered by userl
status int(9) Notnull status of the query
LOG TABLE
Name DataType Constraints Description
user query int(9) Primarykey query entered by user
count varchar(200) Notnull count the user query
Chapter 5
5 Development of the System
A chatbot is a software program for stimulating intelligent conversations with
human using artificial intelligence. It allows a form of interaction between a
human and a machine through messages. The dynamic intelligence of chatbots
will allow them to converse with users as in the way we converse and commu-
nicate in real life situations. Chatbots are being built to handle user requests,
provide relevant information and to look for to seek information. To implement
these modules different input screens,controls,events are used.Controls used in
the forms are textbox, option button,buttons etc. Admin is the one who adds
the questions and corresponding answers in the chatbot. User is the one who
ask queries related to the college.
Chapter 6
6 System Testing
Testing is the penultimate step of software development. An elaborate testing
of data is prepared and the system is using the test data. While doing testing,
errors are noted and correction is made. The users are trained to operate the
developed system. Both hardware and software securities are made to run the
developed system successfully. System testing is aimed at ensuring the system
works accurately before the live operation commences. Testing is vital to the
system. System testing makes a logical assumption that if all parts of the system
are correct, the goal will be successfully achieved. The proposal Tracking system
is subjected to a variety of tests, unit testing, integration testing and system
testing. A series of testing are performed for the proposed system before the
system is ready for user acceptance testing. Nothing is complete without testing
as is vital success of the system. Normally, testing of any Large Systems will be
in two parts, The functional verification and validation against the Requirement
Specification and performance evaluation against the indicated requirements.
Testing activity is involved right from the beginning of the project. At the very
first stage of testing, the goals and objectives are set. This simplifies the limits
or borders of testing process. Before testing, the tester should plan what kind
of data he is giving for test. Give data inputs as functional, boundary, stress,
performance, usability values etc. The characteristics of a good test are tests
are likely to catch bugs no redundancy.
White box testing is a testing technique, that examines the program structure
and derives test data from the program logic/code. In white box testing, the
UI is bypassed. Inputs and outputs of ratings are tested directly at the code
level and the results are compared against specifications. It Reveals errors in
”hidden” code.
Black Box Testing
Black - box testing is a method of software testing that examines the function-
ality of an application based on the specifications. Black box testing typically
involves running through every possible input to verify that it results in the
right outputs using the software as an end - user would.
Unit Testing
The module includes four main components to undergo unit testing. It checks
the syntax error, logic error and validity of the program correctness. This test
will be performed by the developers.
Integration Testing
After all components pass the unit testing, they get to be tested whether they
work correctly when they are running concurrently and communicating to each
other. Integration tests exercise an entire subsystem and ensure that a set of
components play nicely together.
Internal Data Testing
We will test the validity of the data before it enters the database to avoid any
problems that may face us in the database. We will test the encryption of the
personal information of all the users along with the user names and passwords
to ensure maximum security of the users privacy.
Chapter 7
7 System Implementation and Maintenance
7.1 Implementation
System implementation is a conversion of a new system into an operating one
which involves creating compatible files ,training clients , and installing hard-
ware. User training is crucial for minimizing resistance to change and giving
chance to prove its worth. Training aids user friendly manuals and healthy
screens provide the user with a good start. Software maintenance follows con-
version to the extent that changes are necessary to maintain satisfactory opera-
tions relative to changes in the users environment. Maintenance often includes
minor enhancements or corrections to the problem that surface late in the sys-
tem operations. In the implementation phase, the team builds the components
either from scratch or by composition. Given the architecture document from
the design phase and the requirement document from the analysis phase, the
team should build the exactly what has been requested, through there is still
room for innovation and flexibility. For example, a component may be narrowly
designed for this particular system , or the component may be made more gen-
eral to satisfy reuse guideline. The architecture document should give guidance.
Sometimes, this guidance is found in the requirement document. The implemen-
tation phase deals with issues of quality ,performance , baselines, libraries, and
debugging. The end deliverable is the product itself. During the implementa-
tion phase, the system is build according to the specifications from the previous
phases. This includes writing code, performing code reviews, performing test,
selecting components for configuration and integration. The implementation
includes the following things.
Careful planning
7.2 Maintenance
This phase occurs as a result of deploying the whole system at the end users
organization. They will perform the beta testing at the end users and inform to
the developers about any needed modification to the application. The customer
records all the problems that are encountered during the beta testing and reports
these to the developer at regular intervals.
Chapter 8
8 Conclusion and Future Scope
8.1 Conclusion
There are two types of users that interact with the system Admin and Stu-
dent.Each of these two types has different uses of the system .Admin can manage
all the features of chatbot dynamically by login on admin panel. If the answer
is found to be invalid, admin collects the email address of the user and notify
the admin about the incorrect answer.The user can ask any queries about the
college and the chatbot is capable of clearing all doubts of users. User can also
view the results of each event in their chat window.
Appendix
A Data Flow Diagram
Data flow is the one of the best way of documenting the entire functionality
of the system.For the system ,which will have data flows in and have some
processing inside and then some data flow out from the system can be docu-
mented or represented effectively by means of data flow out from the system
can be documented or represented effectively by means of data flow diagrams.
The data flow diagram are a diagrammatic representation of the system,which
has input,process and output.Once any system is represented using a data flow
diagram we can identify the following things easily:
Various entities interacting with the system are identified
A data flow is a route, which enable packets of data to travel from one point
to another.Data may flow,with arrowhead pointing in the direction of the flow
B.2 Level 1
C ER DIAGRAM
D ADMIN INTERFACES
D.1 LOGIN
E USER INTERFACES
E.1 DUMMY WEBSITE
E.2 CHATBOT
E.3 EMAIL
F CODE
admin index.php
[breaklines=true]
<!DOCTYPE html>
<html lang="zxx" class="no-js">
<head>
<!-- Mobile Specific Meta -->
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Favicon-->
<link rel="shortcut icon" href="img/fav.png">
<!-- Author Meta -->
<meta name="author" content="CodePixar">
<!-- Meta Description -->
<meta name="description" content="">
<!-- Meta Keyword -->
<meta name="keywords" content="">
<!-- meta character set -->
<meta charset="UTF-8">
<!-- Site Title -->
<title>ChatBot Admin</title>
<!--
CSS
============================================= -->
<link rel="stylesheet" href="css/linearicons.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/themify-icons.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/owl.carousel.css">
<link rel="stylesheet" href="css/nice-select.css">
<link rel="stylesheet" href="css/nouislider.min.css">
<link rel="stylesheet" href="css/ion.rangeSlider.css" />
<link rel="stylesheet" href="css/ion.rangeSlider.skinFlat.css" />
<link rel="stylesheet" href="css/magnific-popup.css">
<link rel="stylesheet" href="css/main.css">
<style>
.christ{
background:url(’assets/images/christ.jpg’);
background-repeat: no-repeat;
background-size:100
}
</style>
</head>
<body>
<div class="banner-content">
</div>
</div>
<div class="col-lg-7">
<div class="banner-img">
<!-- <img class="img-fluid" src="assets\images\christ.jpg" alt="christ"> -->
</div>
</div>
</div>
<!-- single-slide -->
<div class="row single-slide">
<div class="col-lg-5">
<div class="banner-content">
</div>
</div>
<div class="col-lg-7">
<div class="banner-img">
<!-- <img class="img-fluid" src="assets\images\christ.jpg" alt=""> -->
</div>
</div>
</div>
<!-- </div> -->
</div>
</div>
</div>
</section>
<!-- End banner Area -->
<script src="js/vendor/jquery-2.2.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/
umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/
4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4"
crossorigin="anonymous"></script>
<script src="js/vendor/bootstrap.min.js"></script>
<script src="js/jquery.ajaxchimp.min.js"></script>
<script src="js/jquery.nice-select.min.js"></script>
<script src="js/jquery.sticky.js"></script>
<script src="js/nouislider.min.js"></script>
<script src="js/countdown.js"></script>
<script src="js/jquery.magnific-popup.min.js"></script>
<script src="js/owl.carousel.min.js"></script>
<!--gmaps Js-->
<script src="https://maps.googleapis.com/maps/api/js?key=
AIzaSyCjCGmQ0Uq4exrzdcL6rvxywDDOvfAu6eE"></script>
<script src="js/gmaps.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>
admin login.php
<!--
Author: WebThemez
Author URL: http://webthemez.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content=
"free-educational-responsive-web-template-webEdu">
<meta name="author" content="webThemez.com">
<title>Subject Aptitude Test</title>
<link rel="favicon" href="assets/images/favicon.png">
<link rel="stylesheet" media="screen" href="http://fonts.googleapis.com/css?
family=Open+Sans:300,400,700">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<!-- Custom styles for our template -->
<link rel="stylesheet" href="assets/css/bootstrap-theme.css" media="screen">
<link rel="stylesheet" href="assets/css/style.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5
elements and media queries -->
<!--[if lt IE 9]>
<script src="assets/js/html5shiv.js"></script>
<script src="assets/js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Fixed navbar -->
<div class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<!-- Button for smallest screens -->
<button type="button" class="navbar-toggle"
data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span><span class="icon-bar">
</span><span class="icon-bar"></span></button>
<a class="navbar-brand" href="index.html">
<!--<img src="assets/images/logo.png"
alt="Techro HTML5 template"></a>-->
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav pull-right mainNav">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="admin_login.php">Login</a></li>
<!-- <li><a href="price.html">Price</a></li>
<li><a href="videos.html">Videos</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Pages <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="sidebar-right.html">Right Sidebar</a></li>
<li><a href="#">Dummy Link1</a></li>
<li><a href="#">Dummy Link2</a></li>
<li><a href="#">Dummy Link3</a></li>
</ul>
</li>
<li><a href="contact.html">Contact</a></li>-->
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- /.navbar -->
name="submit"><p><br/></p>
<a href="register.php"><input type="button" class="btn btn-two"
value="REGISTER"
name="submit"></a><p><br/></p>
</form>
</div>
<!--<div class="col-md-4">
<div class="row">
<div class="col-md-6">
<h3 class="section-title">Office Address</h3>
<div class="contact-info">
<h5>Address</h5>
<p>5th Street, Carl View - United States</p>
<h5>Email</h5>
<p>[email protected]</p>
<h5>Phone</h5>
<p>+09 123 1234 123</p>
</div>
</div>
</div>
</div>-->
</div>
</div>
<!-- /container -->
<footer id="footer">
<!-- <div class="container">
<div class="row">
<div class="footerbottom">
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Course Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li><a href="#">
List of Technology
</a>
</li>
<li><a href="#">
List of Business
</a>
</li>
<li><a href="#">
List of Photography
</a>
</li>
<li><a href="#">
List of Language
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Products Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li> <a href="#">
Individual Plans </a>
</li>
<li><a href="#">
Business Plans
</a>
</li>
<li><a href="#">
Free Trial
</a>
</li>
<li><a href="#">
Academic
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Browse by Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li><a href="#">
All Courses
</a>
</li>
<li> <a href="#">
All Instructors
</a>
</li>
<li><a href="#">
All Members
</a>
</li>
<li>
<a href="#">
All Groups
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4></h4>
<p></p>
<div class="contact-info">
<i class="fa fa-map-marker"></i> <br>
<i class="fa fa-phone"></i>+00 123 156 711 <br>
<i class="fa fa-envelope-o"></i>
</div>
</div><!-- end widget -->
</div>
</div>
</div>
<div class="social text-center">
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-dribbble"></i></a>
<a href="#"><i class="fa fa-flickr"></i></a>
<a href="#"><i class="fa fa-github"></i></a>
</div>
<div class="clear"></div>
<!--CLEAR FLOATS-->
</div>
<div class="footer2">
<div class="container">
<div class="row">
</div>
<!-- /row of panels -->
</div>
</div>
</footer>
<!-- JavaScript libs are placed at the end of the document so the
pages load faster -->
<script src="assets/js/modernizr-latest.js"></script>
<script type=’text/javascript’ src=’assets/js/jquery.min.js’>
</script>
<script type=’text/javascript’ src=’assets/js/fancybox/
jquery.fancybox.pack.js’></script>
<script type=’text/javascript’ src=’assets/js/jquery.mobile.
customized.min.js’></script>
<script type=’text/javascript’ src=’assets/js/
jquery.easing.1.3.js’></script>
<script type=’text/javascript’ src=’assets/js/
camera.min.js’></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/custom.js"></script>
<script>
jQuery(function(){
jQuery(’#camera_wrap_4’).camera({
transPeriod: 500,
time: 3000,
height: ’600’,
loader: ’false’,
pagination: true,
thumbnails: false,
hover: false,
playPause: false,
navigation: false,
opacityOnGrid: false,
imagePath: ’assets/images/’
});
});
</script>
</body>
</html>
adminlogin.css
**{
margin: 0;
padding: 0;
}
body
{
background-image:url("52.jpg");
height:100vh;
background-position: center;
background-size: cover;
}
.fullSection{
position: absolute;
top: 32%;
left: 37%;
}
.legend{
text-align: center;
}
.fieldSet{
border: 2px ridge black;
}
.formTable{
padding: 25px;
}
.footer{
top: 100%;
left: 50%;
position: absolute;
}
adminlogin.html
<!DOCTYPE html>
<!--
To change this license header, choose License Headers
in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen"
href="addachievment.css" >
</head>
<title>Trip Planner</title>
<body>
<header>
<div class="header">
<h1>ADMIN LOGIN</h1>
</div>
</header>
<div class="fullSection">
<form action="index.html" method="get">
<fieldset class="fieldSet"><span class="legend"><legend>
</legend></span>
<div class="formTable">
<table cellspacing="5">
<tr>
<td>USER ID </td>
<td><input type ="text" name="id" value="admin" required></input>
</td>
</tr>
<tr>
<td>PASSWORD</td>
<td><input type ="password" name="password" value="admin"
required></input>
</td>
</tr>
<TR>
<TD><BUTTON TYPE="LOGIN" NAME="LOGIN">LOGIN
</BUTTON></TD>
<TD><BUTTON TYPE="RESET" NAME="CANCEL">CANCEL
</BUTTON></TD></TR>
</table>
</div>
</fieldset>
</form>
</div>
</body>
</html>
admin loginpage.php
<!--
Author: WebThemez
Author URL: http://webthemez.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<meta name="description" content="free-educational-
responsive-web-template-webEdu">
<meta name="author" content="webThemez.com">
<title>Subject Aptitude Test</title>
<link rel="favicon" href="assets/images/favicon.png">
<link rel="stylesheet" media="screen" href="http://
fonts.googleapis.com/css?family=Open+Sans:300,400,700">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<!-- Custom styles for our template -->
<link rel="stylesheet" href="assets/css/bootstrap-theme.css"
media="screen">
<link rel="stylesheet" href="assets/css/style.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements
and media queries -->
<!--[if lt IE 9]>
<script src="assets/js/html5shiv.js"></script>
<script src="assets/js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Fixed navbar -->
<div class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<!-- Button for smallest screens -->
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target=".navbar-collapse">
<span class="icon-bar"></span><span class="icon-bar"></span>
<span class="icon-bar"></span></button>
<a class="navbar-brand" href="index.html">
<!--<img src="assets/images/logo.png" alt="Techro HTML5 template"></a>-->
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav pull-right mainNav">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="admin_loginpage.php">Login</a></li>
<!-- <li><a href="price.html">Price</a></li>
<li><a href="videos.html">Videos</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Pages <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="sidebar-right.html">Right Sidebar</a></li>
<li><a href="#">Dummy Link1</a></li>
<li><a href="#">Dummy Link2</a></li>
<li><a href="#">Dummy Link3</a></li>
</ul>
</li>
<li><a href="contact.html">Contact</a></li>-->
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- /.navbar -->
<p></p>
</div>
</header>
</form>
</div>
<!--<div class="col-md-4">
<div class="row">
<div class="col-md-6">
<h3 class="section-title"></h3>
<div class="contact-info">
<h5>Address</h5>
<p></p>
<h5></h5>
<p></p>
<h5></h5>
<p></p>
</div>
</div>
</div>
</div>-->
</div>
</div>
<!-- /container -->
<footer id="footer">
<!-- <div class="container">
<div class="row">
<div class="footerbottom">
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Course Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li><a href="#">
List of Technology
</a>
</li>
<li><a href="#">
List of Business
</a>
</li>
<li><a href="#">
List of Photography
</a>
</li>
<li><a href="#">
List of Language
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Products Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li> <a href="#">
Individual Plans </a>
</li>
<li><a href="#">
Business Plans
</a>
</li>
<li><a href="#">
Free Trial
</a>
</li>
<li><a href="#">
Academic
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Browse by Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li><a href="#">
All Courses
</a>
</li>
<li> <a href="#">
All Instructors
</a>
</li>
<li><a href="#">
All Members
</a>
</li>
<li>
<a href="#">
All Groups
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>Contact</h4>
<p>Board of Technical Education</p>
<div class="contact-info">
<i class="fa fa-map-marker"></i> Thiruvananthapuram<br>
<i class="fa fa-phone"></i>+00 123 156 711 <br>
<i class="fa fa-envelope-o"></i> [email protected]
</div>
</div><!-- end widget -->
</div>
</div>
</div>
<div class="social text-center">
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-dribbble"></i></a>
<a href="#"><i class="fa fa-flickr"></i></a>
<a href="#"><i class="fa fa-github"></i></a>
</div>
<div class="clear"></div>
<!--CLEAR FLOATS-->
</div>
<div class="footer2">
<div class="container">
<div class="row">
</div>
<!-- /row of panels -->
</div>
</div>
</footer>
jQuery(’#camera_wrap_4’).camera({
transPeriod: 500,
time: 3000,
height: ’600’,
loader: ’false’,
pagination: true,
thumbnails: false,
hover: false,
playPause: false,
navigation: false,
opacityOnGrid: false,
imagePath: ’assets/images/’
});
});
</script>
</body>
</html>
admin loginprocess.php
<html>
<body>
<?php
session_start();
$objConnect = mysqli_connect("localhost","root","") or
die("connection error".mysqli_error());
$objDB = mysqli_select_db($objConnect,"mydatabase") or
die("error in selection".mysqli_error());
$myusername=$_POST["myusername"];
$mypassword=$_POST["mypassword"];
<?php
echo "password accepted";
$_SESSION[’login’]=true;
}else {
?>
<script>
alert("Invalid admin username and password");
window.location.replace(’admin_loginpage.php’);
</script>
<?php
}
?>
</body>
</html>
listqueries.php
<html>
<head>
<meta charset="utf-8">
<title>View Records</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="form">
<p><a href="admin_index.php">Home</a>
| <a href="admin_logout.php">Logout</a></p>
<h2>View Records</h2>
<table width="100%" border=1 style="border-collapse:collapse;">
<thead>
<tr>
<th><strong>Queries</strong></th>
<th><strong>Replies</strong></th>
</tr>
</thead>
<tbody>
<?php
$objConnect = mysqli_connect("localhost","root","") or
die("connection error".mysqli_error());
$objDB = mysqli_select_db($objConnect,"mydatabase") or
die("error in selection".mysqli_error());
$count=1;
session_start();
//$objConnect = mysqli_connect("localhost","root","","satdb") or
die("connection error".mysqli_error());
//$objDB = mysql_select_db("satdb") or
die("error in selection".mysql_error());
$n="approved";
$sql="select * from chatbot";
$result=mysqli_query($objConnect,$sql) or
die(’error in selection’.mysqli_error($objConnect));
while($line=mysqli_fetch_array($result))
{
?>
<tr>
<td align="center"><?php echo $line[’queries’] ?></td>
<td align="center"><?php echo $line[’replies’] ?></td>
</tr>
</div>
</body>
</html>
listadd1.php
<!DOCTYPE html>
<html lang="zxx" class="no-js">
<head>
<!-- Mobile Specific Meta -->
<meta name="viewport" content="width=device-width,
initial-scale=1, shrink-to-fit=no">
<!-- Favicon-->
<link rel="shortcut icon" href="img/fav.png">
<!-- Author Meta -->
<meta name="author" content="CodePixar">
<!-- Meta Description -->
<!--
CSS
============================================= -->
<link rel="stylesheet" href="css/linearicons.css">
<link rel="stylesheet" href="css/owl.carousel.css">
<link rel="stylesheet" href="css/themify-icons.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/nice-select.css">
<link rel="stylesheet" href="css/nouislider.min.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<script src="js/vendor/jquery-2.2.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/
1.11.0/umd/popper.min.js"
integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+
GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4"
crossorigin="anonymous"></script>
<script src="js/vendor/bootstrap.min.js"></script>
<script src="js/jquery.ajaxchimp.min.js"></script>
<script src="js/jquery.nice-select.min.js"></script>
<script src="js/jquery.sticky.js"></script>
<script src="js/nouislider.min.js"></script>
<script src="js/jquery.magnific-popup.min.js"></script>
<script src="js/owl.carousel.min.js"></script>
<!--gmaps Js-->
<script src="https://maps.googleapis.com/maps/api/js?
key=AIzaSyCjCGmQ0Uq4exrzdcL6rvxywDDOvfAu6eE"></script>
<script src="js/gmaps.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>
listdelete.php
<html>
<head>
<meta charset="utf-8">
<title>View Records</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="form">
<p><a href="admin_index.php">Home</a>
| <a href="admin_logout.php">Logout</a></p>
<h2>View Records</h2>
<table width="100%" border="1" style="border-collapse:collapse;">
<thead>
<tr>
<th><strong>Queries</strong></th>
<th><strong>Replies</strong></th>
</tr>
</thead>
<tbody>
<?php
$objConnect = mysqli_connect("localhost","root","") or
die("connection error".mysqli_error());
$objDB = mysqli_select_db($objConnect,"mydatabase") or
die("error in selection".mysqli_error());
$count=1;
session_start();
//$objConnect = mysqli_connect("localhost","root","","satdb") or
die("connection error".mysqli_error());
//$objDB = mysql_select_db("satdb") or die("error in selection".mysql_error());
$n="approved";
$sql="select * from chatbot";
$result=mysqli_query($objConnect,$sql) or
die(’error in selection’.mysqli_error($objConnect));
while($line=mysqli_fetch_array($result))
{
?>
<tr>
<td align="center"><?php echo $line[’queries’] ?></td>
<td align="center"><?php echo $line[’replies’] ?></td>
<td align="center">
<a href="listdelete_action.php?id=<?php echo $line["id"]; ?>">Delete</a>
</td>
</tr>
</div>
</body>
</html>
listunknown.php
<html>
<head>
<meta charset="utf-8">
<title>View Records</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="form">
<p><a href="admin_index.php">Home</a>
| <a href="admin_logout.php">Logout</a></p>
<h2>View Records</h2>
<table width="100%" border=1 style="border-collapse:collapse;">
<thead>
<tr>
<th><strong>Queries</strong></th>
<th><strong>User Email</strong></th>
<th><strong>Add Response</strong></th>
</tr>
</thead>
<?php
$objConnect = mysqli_connect("localhost","root","") or
die("connection error".mysqli_error());
$objDB = mysqli_select_db($objConnect,"mydatabase") or
die("error in selection".mysqli_error());
$count=1;
session_start();
//$objConnect = mysqli_connect("localhost","root","","satdb") or
die("connection error".mysqli_error());
//$objDB = mysql_select_db("satdb") or die("error in selection".mysql_error());
$n="w";
$sql="select * from unknown where status=’$n’";
$result=mysqli_query($objConnect,$sql) or
die(’error in selection’.mysqli_error($objConnect));
while($line=mysqli_fetch_array($result))
{
$a=$line[’data’];
$b=$line[’email’];
?>
<tr>
<td align="center"><?php echo $line[’data’] ?></td>
<td align="center"><?php echo $line[’email’] ?></td>
</tr>
<?php $count++;
}
?>
</table>
</div>
</body>
</html>
listdelete action.php
<?php
$objConnect = mysqli_connect("localhost","root","") or
die("connection error".mysqli_error());
$objDB = mysqli_select_db($objConnect,"mydatabase") or
die("error in selection".mysqli_error());
$id=$_GET[’id’];
#Query here...
$sql="delete from chatbot where id=’$id’";
$result=mysqli_query($objConnect,$sql) or
die(’error in selection’.mysqli_error($objConnect));
if($result)
{
?>
<script language="javascript">
alert(’query deleted successfully’);
window.location.replace(’admin_index.php’);
</script>
<?php
} else {
?>
<script language="javascript">
alert(’query deletion failed’);
window.location.replace(’admin_index.php’);
</script>
<?php
}
?>
listadd unknownaction.php
<?php
require_once(’class.pop3.php’);
require_once(’class.phpmailer.php’);
require_once(’class.smtp.php’);
$objConnect = mysqli_connect("localhost","root","") or
die("connection error".mysqli_error());
$objDB = mysqli_select_db($objConnect,"mydatabase") or
die("error in selection".mysqli_error());
$query=$_GET[’query’];
$reply=$_GET[’reply’];
$email=$_GET[’email’];
#Query here...
$sql="insert into chatbot (queries,replies)values(’$query’,’$reply’)";
$result=mysqli_query($objConnect,$sql) or
die(’error in selection’.mysqli_error($objConnect));
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "<h3>Message has been sent</h3>";
}
if($result)
{
?>
<script language="javascript">
alert(’query inserted’);
window.location.replace(’admin_index.php’);
</script>
<?php
} else {
?>
<script language="javascript">
alert(’query not inserted’);
window.location.replace(’admin_index.php’);
</script>
<?php
}
?>
listcount.php
<html>
<head>
<meta charset="utf-8">
<title>View Records</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="form">
<p><a href="admin_index.php">Home</a>
| <a href="admin_logout.php">Logout</a></p>
<h2>View Records</h2>
<?php
$objConnect = mysqli_connect("localhost","root","") or die("connection
error".mysqli_error());
$objDB = mysqli_select_db($objConnect,"mydatabase") or die("error
in selection".mysqli_error());
$count=1;
session_start();
//error_reporting(0);
//$objConnect = mysqli_connect("localhost","root","","satdb") or die("connection
error".mysqli_error());
//$objDB = mysql_select_db("satdb") or die("error in selection".mysql_error());
$n="w";
$sql="select * from history";
$result=mysqli_query($objConnect,$sql) or die(’error in selection’.
mysqli_error($objConnect));
while($line=mysqli_fetch_array($result))
{
$a=$line[’a’];
//echo "a is".$a;
$sql1="select * from history where a=’$a’";
$count=0;
$result1=mysqli_query($objConnect,$sql1) or die(’error in selection’.
mysqli_error($objConnect));
while($line1=mysqli_fetch_array($result1))
{
// echo "hello".$sql1;
$count++;
?>
<?php
}
?>
<table width="100%" border=1 style="border-collapse:collapse;">
<thead>
<tr>
<th><strong>Query</strong></th>
<th><strong>Count</strong></th>
</tr>
</thead>
<?php
$sql2="select distinct(a),c from history order by c desc";
$result2=mysqli_query($objConnect,$sql2) or die(’error in selection’.
mysqli_error($objConnect));
while($line2=mysqli_fetch_array($result2,MYSQLI_ASSOC))
{
//echo "insiede";
?>
<tr>
<td align="center"><?php echo $line2[’a’] ?></td>
<td align="center"><?php echo $line2[’c’] ?></td>
</tr>
<?php
}
?>
</table>
</div>
</body>
</html>
y
dummy index.php
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<div class="navbar-nav">
<a class="nav-item nav-link active" href="#" style="color: white;">Home
<span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="#" style="color: white;">Course</a>
<a class="nav-item nav-link" href="#" style="color: white;"></a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink"
data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false" style="color: white;">
Department
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item links" href="#">Computer Science</a>
<a class="dropdown-item" href="#">Chemistry</a>
<a class="dropdown-item" href="#">Geology</a>
</div>
</li>
</ul> </div>
</div>
</nav>
<div class="col-12 col-md-12 col-sm-12">
<div class="row">
<div class="col-md-12">
<img src="./assets/images/christ.jpg" alt=""style="width:100%;">
</div>
<div class="wrapper">
<ul class="no-pad">
<li class="facebook">
<img src="http://christcollegeijk.edu.in/images/right-icon2.png" class="img-responsive">
<div class="slider">
</div>
</li>
<li class="facebook">
<img src="http://christcollegeijk.edu.in/images/right-icon1.png" class="img-responsive">
<div class="slider">
</div>
</li>
<li class="facebook">
<a href="bot.php">
<i>
<img src="assets/images/chatbot_logo.png" width=60px height=50px>
</i>
<div class="slider">
</div>
</a>
</li>
</ul>
</div>
</div>
</div>
bot.php
</div>
<div class="msg-header">
<p>Hello there, how can I help you?</p>
</div>
</div>
</div>
<div class="typing-field">
<div class="input-data">
<input id="data" type="text" placeholder="Type something here..." required>
<button id="send-btn">Send</button>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$("#send-btn").on("click", function(){
$value = $("#data").val();
$msg = ’<div class="user-inbox inbox"><div class="msg-header"><p>
’+ $value +’</p></div></div>’;
$(".form").append($msg);
$("#data").val(’’);
// start ajax code
$.ajax({
url: ’new.php’,
type: ’POST’,
data: ’text=’+$value,
success: function(result){
$replay = ’<div class="bot-inbox inbox"><div class="icon"><i class="fas fa-user">
</i></div><div class="msg-header"><p>’+ result +’</p></div></div>’;
$(".form").append($replay);
// when chat goes down the scroll bar automatically comes to the bottom
$(".form").scrollTop($(".form")[0].scrollHeight);
let msg = $replay;
let speech = new SpeechSynthesisUtterance();
speech.lang = "en-US";
speech.text = msg;
speech.volume = 1;
speech.rate = 1;
speech.pitch = 1;
window.speechSynthesis.speak(speech);
}
});
});
});
/* JS comes here */
function textToAudio() {
var aa= document.getElementById("data").value;
}
</script>
</body>
</html>
bot.py
def BuildLast(pattern) :
last = [-1]*128
for i in range (0,len(pattern)):
last[ord(pattern[i])] = i
return last
j = m - 1
hit = 0
temphit = 0
check = 0
while True :
if(pattern[j] == text[i]):
if (j==0) :
hit = temphit + 1
check = check + 1
return hit/check
else :
check = check + 1
temphit = temphit + 1
i = i -1
j = j - 1
else :
if(temphit >= hit ):
hit = temphit
temphit = 0
lo = last[ord(text[i])]
i = i + m - min(j,1+lo)
j = m-1
if (i > n-1) :
break
return -1
def KMPSearch(pat, txt):
M = len(pat)
N = len(txt)
# create lps[] that will hold the longest prefix suffix
# values for pattern
lps = [0]*M
j = 0 # index for pat[]
# Preprocess the pattern (calculate lps[] array)
computeLPSArray(pat, M, lps)
i = 0 # index for txt[]
while i < N:
if pat[j] == txt[i]:
i += 1
j += 1
if j == M:
print ("Found pattern at index " + str(i-j))
j = lps[j-1]
# mismatch after j matches
elif i < N and pat[j] != txt[i]:
# Do not match lps[0..lps[j-1]] characters,
# they will match anyway
if j != 0:
j = lps[j-1]
else:
i += 1
def computeLPSArray(pat, M, lps):
len = 0 # length of the previous longest prefix suffix
lps[0] # lps[0] is always 0
i = 1
# the loop calculates lps[i] for i = 1 to M-1
while i < M:
if pat[i]== pat[len]:
len += 1
lps[i] = len
i += 1
else:
# This is tricky. Consider the example.
# AAACAAAA and i = 7. The idea is similar
# to search step.
if len != 0:
len = lps[len-1]
chathome.css
.links a:hover{
}.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.front-text{
font-size: 80px;
font-weight: 700;
font-family: monospace;
color: white;
}html{
margin: 0%;
}body{
margin: 0%;
}#socl-icons2 ul li.facebook {
background: #5e63ca;
}#socl-icons2 .wrapper img {
margin: 0px auto;
padding: 13px;
}#socl-icons2 .wrapper img {
margin: 0px auto;
padding: 13px;
}#socl-icons2 .slider {
position: absolute;
top: 0;
right: 50px;
width: 0px;
height: 50px;
line-height: 50px;
background: #eebb5c;
text-align: center;
border-radius: 20px 0 0 20px;
transition: all 0.2s ease;
}p {
margin: 0 0 10px;
}ol, ul {
margin-top: 0;
margin-bottom: 10px;
}div {
display: block;
}#socl-icons2 .slider {
position: absolute;
top: 0;
right: 50px;
width: 0px;
height: 50px;
line-height: 50px;
background: #eebb5c;
text-align: center;
border-radius: 20px 0 0 20px;
transition: all 0.2s ease;
}#socl-icons2 ul li {
width: 50px;
height: 50px;
background: #e59500;
margin: 10px 0;
border-radius: 0px;
position: relative;
cursor: pointer;
box-shadow: 0 0 10px rgb(0 0 0 / 30%);
color: #fff;
}.img-responsive {
display: block;
max-width: 100%;
height: auto;
}.no-pad {
padding: 0;
}.front-icons{
position: absolute;
}@media(min-width:500px){
.home-align{
margin-left: 45%;
}
}@media(max-width:500px){
.home-align{
margin-left: 45%;
}
}
message.php
<!-- Created By CodingNepal -->
<?php
// connecting to database
$conn = mysqli_connect("localhost", "root", "", "mydatabase") or die("Database Error");
// if user query matched to database query we’ll show the reply otherwise it go to else stat
if(mysqli_num_rows($run_query) > 0){
//fetching replay from the database according to the user query
$fetch_data = mysqli_fetch_assoc($run_query);
//storing replay to a varible which we’ll send to ajax
$replay = $fetch_data[’replies’];
echo $replay;
}else{
}
?>
new.php
// if user query matched to database query we’ll show the reply otherwise it go to else stat
if(mysqli_num_rows($run_query) > 0){
//fetching replay from the database according to the user query
$fetch_data = mysqli_fetch_assoc($run_query);
//storing replay to a varible which we’ll send to ajax
$replay = $fetch_data[’replies’];
echo $replay;
}else{
echo "Sorry, I am not able to understand you, You may give your email address so that
I will let you know ";
echo
"<form action=’filldata.php’ method=’get’>
<input type=’text’ name=’email’>
<input type=’hidden’ name=’data’ value=$x>
</input>
<input type=’submit’/>
</form>";
?>
\begin{itemize}
\item TextToSpeech
\end{itemize}
TextToSpech.php
<?php
namespace duncan3dc\Speaker;
use duncan3dc\Speaker\Exceptions\RuntimeException;
use duncan3dc\Speaker\Providers\ProviderInterface;
/**
* Convert a string of a text to spoken word audio.
*/
class TextToSpeech implements TextToSpeechInterface
{
/**
* @var string $text The text to convert.
*/
private $text;
/**
* @var ProviderInterface $provider The provider instance to handle text conversion.
*/
private $provider;
/**
* @var string $data The audio data.
*/
private $data;
/**
* Create a new instance.
*
* @param string $text The text to convert
* @param ProviderInterface $provider
*/
public function __construct(string $text, ProviderInterface $provider)
{
$this->text = $text;
$this->provider = $provider;
}
/**
* Get the audio for this text.
*
* @return string The audio data
*/
public function getAudioData(): string
{
if ($this->data === null) {
$this->data = $this->provider->textToSpeech($this->text);
}
return $this->data;
}
/**
* Generate the filename to be used for this text.
*
* @return string
*/
public function generateFilename(): string
{
$options = $this->provider->getOptions();
$options["text"] = $this->text;
$data = serialize($options);
/**
* Create an audio file on the filesystem.
*
* @param string $filename The filename to write to
*
* @return $this
*/
public function save(string $filename): TextToSpeechInterface
{
$result = file_put_contents($filename, $this->getAudioData());
return $this;
}
/**
if (!is_file($filename)) {
$this->save($filename);
}
return $filename;
}
}
TextToSpechInterface.php
<?php
namespace duncan3dc\Speaker;
use duncan3dc\Speaker\Providers\ProviderInterface;
/**
* Convert a string of a text to spoken word audio.
*/
interface TextToSpeechInterface
{
/**
* Get the audio for this text.
*
* @return string The audio data
*/
public function getAudioData(): string;
/**
/**
* Create an audio file on the filesystem.
*
* @param string $filename The filename to write to
*
* @return $this
*/
public function save(string $filename): TextToSpeechInterface;
/**
* Store the audio file on the filesystem.
*
* @param string $path The path to the directory to store the file in
*
* @return string The full path and filename
*/
public function getFile(string $path = null): string;
}