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

Chatbot 123

Uploaded by

ALNATRON GROUPS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
160 views

Chatbot 123

Uploaded by

ALNATRON GROUPS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

1

INT404 Project

(HealthCare ChatBot System)

Section: K18LC G-2

Team Members Details:


Vikash Choudhary 11808749 53
Sahil Patial 11808797 47
Manu Pratap 11808718 59

Github : https://github.com/vikash0404/Healthcare-chatbot

ABSTRACT
2

Normally Users are not aware about all the treatment or symptoms regarding the
particular disease. For small problem user have to go personally to the hospital for
check-up which is more time consuming. Also handling the telephonic calls for the
complaints is quite hectic. Such a problem can be solved by using medical Chat Bot
by giving proper guidance regarding healthy living .The medical chat-bots
functioning depends on Natural language processing that helps users to submit their
problem about the health. The User can ask any personal query related to health
care through the chat-Bot without physically available to the hospital. By Using
Google API for voice-text and text voice conversion. Query is sent to Chat Bot and
gets related answer and display answer on android app. The System’s major
concern behind developing this web based platform is analysing customer’s
sentiments.

INTRODUCTION
The main purpose of the scheme is to build the language gap between the user and
health providers by giving immediate replies to the Questions asked by the user.
Today’s people are more likely addicted to internet but they are not concern about
their personal health. They avoid to go in hospital for small problem which may
become a major disease in future. Establishing question answer forums is becoming
a simple way to answer those queries rather than browsing through the list of
potentially relevant document from the web. Many of the existing systems have
some limitation such as There is no instant response given to the patients they have
to wait for experts acknowledgement for a long time. Some of the processes may
charge amount to perform live chat or telephony communication with doctors
online .
This system allows computer to communication between human to computer by
using natural language processing (NLP). There are three analyses which
understand natural language i.e. identification of main linguistic relations is
completed to parse subject into object of the sentences. After that description of the
texts is done. The semantic interpretation uses knowledge of word meaning
Chat bot is an Entity which imitate human discussion in its particular accepted set-
up together with a text or vocal language with techniques such as Natural Language
3

Processing (NLP). The aim of this system is to replicate a person’s discussion. The
development of chat bot application can be done with making a user interface to
send input and receive response. It is a system that interact with user by keeping
the track of the state of interaction and recollecting the preceding commands to
give functionality. The medical chat-bots can be developed by using artificial
algorithms that scrutinize user's queries and recognize it and give reply to related
query. A big disease can start from small problems such as headache which feels
normal but it may beginning of big disease such as brain tumor .most of the disease
can be identified by common symptoms so the disease can be predicted if the
patient body is analyzed periodically[6].The system give response by use of an
efficient Graphical User Interface such that if actual person is chatting with the
user. chatterbot that can be used in various fields like education, healthcare, and
route assistance[8]The central part of the chat-bots includes MySQL. It is an
interactive system solve users query regarding medicine. so they can get correct
guidance for treatment through android app by using Google API.

LITERATURE REVIEW - The paper gives the information regarding products


which is useful for consumers to obtain what they want exactly. Question
Answering (QA) systems can be identified as information accessing systems which
try to answer to natural language queries by giving answers suitable answers
making a use of attribute available in natural language techniques .The system
takes a plain text as input and answering all type of questions output by qualified
user is the output . The purpose is to provide a generic solution to this problem. this
paper helps in recognizing the reality in texts and giving the past content for
developing a conversation which is used in middle-school CSCL scenarios. A smart
chat bot for customer care by using Software as a Service which analyze message of
each application server. It help the user to resolve the issue by providing a human
way interactions using LUIS and cognitive services which is implemented on AWS
public cloud .Admin feeds input to the machine so that machine can identify the
sentences and taking a decision itself as a response to a question. The database used
in the project is MySQL. The illustration and execution of SQL in the pattern
matching operation is required. The conversation can be done so that it can add
some knowledge to the database as it has not been modeled before. If in case the
input sentences in the database did not match then it will be remodeled. The
4

evaluation of sentence equivalence is completed with bigram that splits the input
sentence in to two parts. The data of chat bot are deposited in the database. The
database is appointed as information storage and predictor is used for storing the
function and perform pattern matching. This application can be developed by using
programming language of Pascal and Java. Paper uses artificial intelligence for
predict the diseases based on the symptoms and give the list of available treatments.
It can facilitate us to figure out the problem and to validate the solution.

PROPOSED SYSTEM - Some chat bots are compact medical reference books
which are useful not only for patients, doctors etc. but also for those who want to
learn something about health. The user feels that they are incorporated in the
process of their health. Patients who feel included, who are interacting through chat
bots with the healthcare system, will stay with the system, and that is important for
them and the healthcare provider. The old chat bot are client communications
systems and their best effort is a question and answer page on a website. Bot can
facilitate to get the common health related question and prediction of disease
without a human interference.
This system helps users to submit their complaints and queries regarding the health.
Customer satisfactions the major concern for developing this system. . The actual
welfare of the chat bot is the facilitate the people by giving proper guidance
regarding the good and healthy living. For the reason that many of the people do
not have fundamental awareness of physical condition. Some people live for years
with debilitating but they do not pay attention to symptoms simply because they
think they don’t require a doctor. The working of the system is as follows.
A. User Login to System : User registers on Chat bot application. Then ask queries
regarding to the health care and medical details.

B. Ask some Questions : You can ask some questions regarding some healthcare.
And its related to voice- text and text-voice conversation. Using Google API for
inter conversion of text-voice and vice versa.
5

C. Age based Medicine dosage details : You c an ask medical dosage related
queries to this app in voice and system gets output for medicine API and display all
data. Get your age from registration data and provide data related to your data like
age, area, gender and so on. Give me age Then predict disease using SVM
Algorithm.

D. Get Medicine Details on medicine name : You can ask about medicine related
details on the basis of medicine names.

E. Disease Prediction : Depending on the disease symptoms SVM algorithm can


predict the disease.
F. Online API : Use Google API for text and text conversion. The Chat bot API
sends query to chat bot and get related answer and refer this answer analysis on that
and display answer on android app. Get medicine related data like medicine name,
medicine expiry details and so on from medicine API.

PROPOSED METHOD –
A. Support Vector Machine Algorithm(SVM): SVM is a powerful classifier that
is able to distinguish two classes. SVM classifies the test image in to the
class with highest distance up to the neighboring point in the training. SVM
training algorithm built a model that predict whether the test image fall into
this class or another. SVM necessitate a vast training data to decide an
decision boundary and computing cost is very high although we are using
single pose (frontal) detection. The SVM is a learning algorithm for
classification which attempt to discover the finest distinguishing hyper plane
which minimize the error for unseen patterns.
6

Distinguishing hyper plane to minimize the error


The data which cannot be distinguished the input is mapped to high-dimensional
attribute space where they can be separated by a hyper plane. This projection is well
performed by means of kernels.
If training set of samples and the equivalent resultant values {-1, 1}. So SVM
intend to get the best separating hyper plane specified by the equation Wt +b that
make use of the distance between the two classes as shown in above figure.
B. NLP(Natural language Processing)- The enlargement of NLP function is quite
tough because computers usually need humans to "speak" with them in certain
programming language. Human language is not accurate as it include on a lot of
composite variables. NLP permits users to ask a query. The machine understand the
important elements from users speech, that may relate to particular features in a
data set, and gives an answer. The use of NLP is to recognize the meaning of the
text. The stored information contains the text files, like patients' medical records,
symptom related to particular disease on the basis of which we can predict the
disease also some medicine related information. Porter stemming algorithm (or
'Porter stemmer') It is a procedure for discarding the ordinary words which is
related to the exact form of words with also having flexional endings in English.
Following are the steps of this algorithm:- o Gets rid of plurals and -ed or -ing
7

suffixes o Turns terminal y to i when there is another vowel in the stem o Maps
double suffixes to single ones: ization, -ational, etc. o Deals with suffixes, -full,
-ness etc. o Takes off -ant, -ence, etc.
Removes a final –e
C. Word Order Similarity among Sentences - The word order similarity of two
sentences is important, because different word order can significantly change the
meaning of a sentence.
For example: Dogs can swim, but chicken cannot. We can change the word order so
the sentence looks like: Chicken can swim, but dogs cannot. As a result, the
meaning of both sentences is completely different. We must therefore form word
order vectors for both sentences, namely r1 and r2 . For the first sentence, this is
achieved by doing the following for each word w in the joint word set:
1. If the first sentence contains w, we fill the entry in r1 with the corresponding
index of w in the first sentence.
2. If the first sentence does not contain w, we find the word from the first sentence,
which is most similar to w. This word is denoted as ~w. If the similarity is greater
than the preset threshold, we fill the first sentence’s vector entry with the
corresponding index of ~w in the first sentence. If the similarity is not greater than
the threshold, we fill the vector’s entry with 0.

CODE (PYTHON)

1. RUN.PY
from flask import Flask, render_template, request
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
import os

from chatterbot import ChatBot


8

from chatterbot.trainers import ListTrainer

filenumber=int(os.listdir('saved_conversations')[-1])
filenumber=filenumber+1
file= open('saved_conversations/'+str(filenumber),"w+")
file.write('bot : Hi There! I am a medical chatbot. You can begin conversation by typing in a
message and pressing enter.\n')
file.close()

app = Flask(__name__)

english_bot = ChatBot('Bot',
storage_adapter='chatterbot.storage.SQLStorageAdapter',
logic_adapters=[
{
'import_path': 'chatterbot.logic.BestMatch'
},

],
trainer='chatterbot.trainers.ListTrainer')
english_bot.set_trainer(ListTrainer)

@app.route("/")
def home():
return render_template("index.html")

@app.route("/get")
def get_bot_response():
userText = request.args.get('msg')
response = str(english_bot.get_response(userText))

appendfile=os.listdir('saved_conversations')[-1]
appendfile= open('saved_conversations/'+str(filenumber),"a")
appendfile.write('user : '+userText+'\n')
appendfile.write('bot : '+response+'\n')
appendfile.close()

return response

if __name__ == "__main__":
app.run()
9

2. TRAIN.PY

from chatterbot import ChatBot


from chatterbot.trainers import ListTrainer
import os

try:
os.remove("db.sqlite3")
print("Old database removed. Training new database")
except:
print('No database found. Creating new database.')

english_bot = ChatBot('Bot')
english_bot.set_trainer(ListTrainer)
for file in os.listdir('data'):
print('Training using '+file)
convData = open('data/' + file).readlines()
english_bot.train(convData)
print("Training completed for "+file)

Local Setup:
1. Open command prompt and locate folder. run 'pip install -r requirements.txt'
2. Run train.py
3. Run run.py
4. Demo will be live at http://localhost:5000/
10

RESULTS
11

This work performed analysis on datasets of different sizes and domains to


demonstrate that the proposed framework works on data of all sizes and domains.
We are using three dataset for different symptoms and getting the possible output in
the form of text and prescriptions of medicines and if its really serious then the
facility of booking an appointed with a doctor in the nearby hospital is also
available.
12

Training Record in Percentage

CONCLUSION -

By reviewing the literature we come to know that this system giving the accurate
result. As we are using large dataset which will ensures the better performance
compared as earlier. Thus we build up a system which is useful for medical institute
or hospitals to help the users to freely ask medical dosage related queries by text.
System gets output for medicine API and display out all medicine names. We are
using NLP because we want to a computer to communicate with users in their
terms. So by using SVM algorithm and disease symptoms system can predict
disease. User can get related answer displayed r on android app. and refer this
answer for analysis.

REFERENCES –
[1] Agnese Augello, Giovanni Pilato, Alberto Machi' ICAR Istituto di Calcolo e
Reti ad Alte Prestazioni CNR - Consiglio Nazionale delle Ricerche Viale delle
Scienze , 978-0-76954859-3/12 $26.00 © 2012 IEEE . "An Approach to Enhance
13

Chatbot Semantic Power and Maintainability: Experiences within the FRASI


Project".
[2] Emanuela Haller, Traian Rebedea Faculty of Automatic Control and Computers
university Politehnica of Bucharest, 978-0-7695-4980-4/13 $26.00 © 2013 IEEE.
"Designing a Chat-bot that Simulates a Historical Figure".

[3] Bayu Setiaji, Ferry Wahyu Wibowo , Department of Informatics Engineering


STMIK AMIKOM Yogyakarta, Yogyakarta, Indonesia, 2166-0670/16 $31.00 ©
2016 IEEE "Chatbot Using A Knowledge in Database-Human-to-Machine
Conversation Modeling".

[4] Chatbot Using A Knowledge in Database,"Bayu Setiaji,Ferry Wahyu


Wibowo",2016 7th International Conference on Intelligent Systems, Modelling and
Simulation.2016 IEEEE.
[5] "Novel Approach for Medical Assistance Using Trained Chatbot",Divya
Madhu, Neeraj Jain C, International Conference on Inventive Communication and
Computational Technologies.

Team Efforts:
VIKASH CHOUDHARY (53)  Run.py: The program takes the input from the
user and responds the suitable solutions to the
user with the help of real time Healthcare
Chatbot.
 sqlite3: Storing the data in the database so that
it will be helpful in the development of
Healthcare Chatbot by learning from the past
inputs taken.

SAHIL PATIAL (47)  Train.py: It trains the chatbot with the help of
previous inputs taken from the different users
and helps itself to develop in the terms of
accuracy, efficiency, optimistic solution and a
friendly UI.
 Template: The overall design of the program
14

MANU PRATAP (59)  Data: Adding the different lists of diseases and
symptoms and their medication in the program
which helps the user by suggesting appropriate
medication.
 Organizing and debugging: Organizing the
code together and testing for any bugs and
correcting them.

You might also like