Chatbot 123
Chatbot 123
INT404 Project
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.
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.
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
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
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
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
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
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.