Create a chatbot in python from scratch by using NLP nltk
Chatbot is a software or computer program which can conversation with user on chat and able to answer of user queries by using artificial intelligence algorithm.
Chatbot Source code - Step by Step
In this article you will learn that how you can build a simple chatbot using nltk in python. After execute this code in python console, you will give input that “my name is ayaz”. This will give answer according to our pair description.
from nltk.chat.util import Chat, reflections
pairs = [
r"my name is (.*)",
["Hello %1, How are you today ?",]
print("Hi, I am your chatbot.")
if __name__ == '__main__':