carmelo-cyber / Carmelo_GitHub

All code for any situation
0 stars 0 forks source link

Chat 1 #5

Open carmelo-cyber opened 1 year ago

carmelo-cyber commented 1 year ago

Import necessary libraries

from nltk.chat.util import Chat, reflections

Define a list of responses for the chat bot

responses = [ (r'hi|hello|hey', ["Hello! How can I help you today?", "Hi there! What can I do for you?", "Hi! What can I assist you with?"]), (r'I need help with (.*)', ["Sure, I'll do my best to help you with that. What do you need help with?", "No problem, I'm here to assist. What can I help you with?", "Of course, I'm here to help. What do you need assistance with?"]), (r'Thank you', ["You're welcome!", "No problem, happy to help!", "It was my pleasure to assist you. Let me know if you need anything else."]), (r'bye', ["Goodbye! I hope I was able to help you.", "Bye! Let me know if you have any other questions.", "Goodbye. Have a great day!"]) ]

Initialize the chatbot

chatbot = Chat(responses, reflections)

Start the chat loop

chatbot.converse()