Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#import the library
from nltk.chat.util import Chat, reflections
import requests
#URL='http://apps.who.int/gho/athena/api/GHO?format=json'
def get_latest_blood( ):
response = requests.get(URL+'/')
return response
"""List which hold responses"""
name_resp = [
['my name is (.*)',['hi %1']],
[('hi|hello') ,['hey there' , 'hello there', 'greetings!']],
['why were you made(.*)' , ['I am a chatbot designed for managing operations of a blood bank']],
['how many blood groups are there(.*)',['8 blood groups']],
['which are the blood groups(.*)',['A+ , A- , B+ , B- , O+ , O- , AB+ ,AB-']]
#,['(.*)database(.*)', [''.join( str(get_latest_blood( ))),]]
]
dummy_myresponse = {
'how are you' : 'I am fine,thank you'
}
"""Function for conversing with user"""
def chatter():
print("Hi, I'm a Blood Bank Chatbot and I want to help and chat with you ! \n Type quit to leave ") #default message at the start
chat=Chat(name_resp,dummy_myresponse)
chat.converse()
chatter()