A chatbot (otherwise called a talkbot, chatterbot, Bot, IM bot, intuitive operator, or Artificial Conversational Entity) is a PC program or a man-made consciousness which leads a discussion by means of sound-related or literary techniques. Such projects are regularly intended to convincingly reenact how a human would act as a conversational accomplice, in this manner breezing through the Turing assessment. Chatbots are ordinarily utilized in discourse frameworks for different pragmatic purposes including client assistance or data securing. Some chatterbots utilize advanced common language preparing frameworks, however, numerous less difficult frameworks check for watchwords inside the information, at that point pull an answer with the most coordinating catchphrases, or the most comparative wording design, from a database.
Chatbots are not very new, one of the foremost of this kind is ELIZA, which was created in the early 1960s and is worth exploring. In order to successfully build a conversational engine, it should take care of the following things:
Today we will learn to create a simple chat assistant or chatbot using Python’s NLTK library.
NLTK has a module, nltk.chat, which simplifies building these engines by providing a generic framework.
In this video, I am using 2 imports from nltk.chat.util:
Chat: This is a class that has all the logic that is used by the chatbot.
Reflections: This is a dictionary that contains a set of input values and its corresponding output values. It is an optional dictionary that you can use. You can also create your own dictionary in the same format as below and use it in your code. If you check nltk.chat.util, you will see its values as below:
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"
}
You can also create your own reflections dictionary in the same format as above and use it in your code. Here is an example for this:
my_dummy_reflections= {
"go" : "gone",
"hello" : "hey there"
}
and use it as :
chat = Chat(pairs, my_dummy_reflections)
Using the above concept from python’s NLTK library lets build a simple chatbot without using any of the Machine Learning or Deep Learning Algorithms. So obviously our chatbot will be a decent one but not an intelligent one.
👉 Source Code & Link :https://drive.google.com/drive/folders/1uZzmS3ae14KWWlowlr0uymfr61h1lC2s
🔔 Subscribe: https://www.youtube.com/channel/UCNs6a3HlrbYw7dSUEXk9W3A
#python