728x90 AdSpace

Latest News
Tuesday, May 26, 2020

Hi Hello Greetings - Chatbot - Python

Dear Reader,

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
  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment

Item Reviewed: Hi Hello Greetings - Chatbot - Python Rating: 5 Reviewed By: Praveen Kumar Rajendran