Dear Reader,
You can see the below python code reply different version of Hi, Hello message in chatbot using python.
Code:
You can see the below python code reply different version of Hi, Hello message in chatbot using python.
Code:
from nltk.chat.util import Chat, reflections
pairs = [
['(Hi|hello|halo|hallo|hii|hie)',['Hi Hello!']],
['Hi, I am (.*) here',['Hi Hello %1, How can I help you?']],
['Hi I am (.*) here',['Hi Hello %1, How can I help you?']],
['Hello, I am (.*) here',['Hi Hello %1, How can I help you?']],
['Hello I am (.*) here',['Hi Hello %1, How can I help you?']],
['I am (.*) here',['Hi Hello %1, How can I help you?']],
['(.*) here',['Hi Hello %1, How can I help you?']],
['I (.*)',['Hi Hello %1, How can I help you?']],
['I m (.*) here',['Hi Hello %1, How can I help you?']],
['I m (.*)',['Hi Hello %1, How can I help you?']],
['Hi I m (.*) here',['Hi Hello %1, How can I help you?']],
['Hi I m (.*)',['Hi Hello %1, How can I help you?']],
['I m (.*)',['Hi Hello %1, How can I help you?']],
['I m (.*) praveen',['Hi Hello %1, How can I help you?']],
['Hi I am (.*) here',['Hi Hello %1, How can I help you?']]
]
chat = Chat(pairs, reflections)
chat.converse()
Thanks and Regards
Praveen
0 comments:
Post a Comment