Untitled
unknown
plain_text
3 years ago
3.5 kB
2
Indexable
import nltk from nltk.chat.util import Chat, reflections reflections = { "i am" : "you are", "i was" : "you were", "i" : "you", "i'm" : "you are", "i'd" : "you would", "i've" : "you have", "i'll" : "you will", "my" : "your", "you are" : "I am", "you were" : "I was", "you've" : "I have", "you'll" : "I will", "your" : "my", "yours" : "mine", "you" : "me", "me" : "you" } pairs = [ ['(hi|hello|hey|ahnyeong|hola)', ['Hey there!', 'Hi there!', 'Hey!']], ['(.*) your name?', ['My name is JAAKA, I am Transaction Chatbox AI']], ['(.*) do you do?', ['I am here to have a transaction with you in purchasing our product!']], ['(.*) created you?', ['I was created by a group of people namely Joseph Aloc, Angelo Echano, \n' 'Arriana Mae Malubay, Kris Rainelle Despaer and Andre Sanez. \n' 'Clearly my name came from their combined first name initials.']], ['(.*) want to order some t-shirts', ['How many t-shirts would you like to purchase?']], ['(.*) want buy (2|3|4|5) t-shirts', ['What sizes would you like it to be?']], ['(Small|Medium|Large)', ['Would you like it plain, designed or customized?']], ['Plain', ['What colors would you like your t-shirts are?']], ['(Black|White|Red|Blue)', ['How would you like to pay our transaction?']], ['Designed', ['Is the design you want for female, male or unisex?']], ['(Female|Male|Unisex)', ['How would you like to pay our transaction']], ['Customized', ['If you want a customized design t-shirt, Please go to our website\n' 'and contact us for your preferred design details. \n' 'How would you like to pay our transaction?']], ['(Cash|Credit Card|GCash)', ['Ok, total price of your purchased t-shirts will be given the moment you claim it. \n' 'How would you like to claim your purchased t-shirts?']], ['Delivery', ['Ok, as for Customers Home Delivery. \n' 'Please state your name, address and mobile number. \n' 'What is your name?']], ['(.*) name is ', ['What is your address?']], ['(.*) live in ', ['What is your mobile number?']], ['(.*) mobile number is', ['Would that be all for your order?']], ['Store WalkIn', ['Ok, for Direct WalkIn Customers. We are open at 8:00 a.m. to 5:00 p.m. \n' 'We will wait for your arrival to claim your items until our closing hours. \n' 'Would that be all for your order?']], ['Yes', ['Transaction Complete! \n' 'Data for customer purchase is successfully collected! \n' 'That would all for this transaction.']], ['(Thanks|Thank you)', ['Glad to be at your service Dear Customer.']], ['(Bye|Goodbye|Bye Bye)', ['Bye! Have a nice day! \n' 'Thank you again for purchasing our product. \n' 'Hope you would have a transaction with us again.']] ] def conversation(): print("Hi! I am Transaction Chatbox AI created by the JAAKA Group at your service.") print("I am here to take your order for our transaction, our Dear Customer!") conversation = Chat(pairs, reflections) conversation.converse() #initiate the conversation if _name_ == "_main_": conversation()
Editor is loading...