Report For Chatbot Using NLTK Library Using Python Programming Python For Machine Learning (Int 522)
Report For Chatbot Using NLTK Library Using Python Programming Python For Machine Learning (Int 522)
PYTHON PROGRAMMING
AS A PROJECT WORK FOR COURSE
1|Page
TABLE OF CONTENTS :
S.NO CONTENTS PAGE NO’S
1 Abstract 3
2 Introduction: 3-4
2.1 What is chatbot?
2.2 Why we use chatbot?
2.3 Types of chatbots
3 Libraries: 4-7
NLTK
3.1 Install library
3.2 Chat
3.3 Reflection
3.4 Creating set of rules
3.5 Defining Function
4 Code : Github link 7
6 Conclusion 8-9
2|Page
BUILDING A CHATBOT USING NLTK LIBRARY IN PYTHON:
1. ABSTARCT :
What is a chatbot? How does it help to accelerate your business yield? How can
you build your own chatbot?
Chatbots are interactions between people and services, enhancing customer
experience. At the same time, they offer companies new opportunities to
improve the customers engagement process and operational efficiency by
reducing the typical cost of customer service.
To be successful, a chatbot solution should be able to effectively perform both
of these tasks. Human support plays a key role here: Regardless of the kind of
approach and the platform, human intervention is crucial in configuring,
training and optimizing the chatbot system.
It helps millions of people around the world get things done more easily every
day. Learn how Assistant works with content and services to help you find just
what you're looking for.
2. INTRODUCTION:
3|Page
behavior and offer relevant information. Using chatbots can help
automate interactions and offer instant accessibility across sales,
marketing, and customer service functions.
2.2 Why we use chatbots?
Cost and Time Effective - Humans cannot be active on-site 24/7 but
chatbots can and the replying power of chatbots is much fast than
humans.
Cheap Development cost - with the advancement in technology many
tools are developed that help easy development and integration of
chatbots with little investment.
Human Resource - Today Chatbots can also talk with text o speech
technology so it gives the feel as a human is talking on another side.
Business Branding - Businesses are changing with technology and
chatbot is one out of them. Chatbot also helps in advertising,
branding of organization product and services and give daily updates
to users.
2.3 Types of Chatbots?
There are mainly 2 types of chatbots.
4|Page
Most of the organization uses self-learning chatbot along with embedding
some rules like Hybrid version of both methods which makes chatbot
powerful to handle each situation during a conversation with a customer.
3. LIBRARIES IMPORTED :
3.1 NLTK:
NLTK is a standard python library with prebuilt functions and utilities
for the ease of use and implementation. It is one of the most used
libraries for natural language processing and computational
linguistics.
It used to deal with NLP applications and chatbot is one among them.
Now we will advance our Rule-based chatbots using the NLTK
library. Please install the NLTK library first before working using the
pip command.
NLTK Installation process:
Open a command prompt and type:
pip install nltk
First thing is to import the library and classes we need to use
import nltk
from nltk.chat.util import Chat, reflections
3.2 CHAT :
Chat is a class that contains complete logic for processing the text
data which the chatbot receives and find useful information out of it.
3.3 REFLECTIONS :
Another import we have done is reflections which is a dictionary
containing basic input and corresponding outputs. You can also create
5|Page
your own dictionary with more responses you want. if you print
reflections it will be something like this.
6|Page
3.5 DEFINING FUNCTION:
The function is very simple which first greet the user, and ask for any
help. And the conversation starts from here by calling a Chat class
and passing pairs and reflections to it.
def chat():
print("Hi! I am a chatbot created by Asha, How may I help you?")
chat = Chat(pairs, reflections)
chat.converse()
#initiate the conversation
if __name__ == "__main__":
chat()
I have created an amazing Rule-based chatbot just by using Python
and NLTK library. The nltk.chat works on various regex patterns
present in user Intent and corresponding to it, presents the output to a
user. Let’s run the application and chat with created chatbot.
4. GITHUB LINK :
https://github.com/AshaLakkoju/Chatbot.git
Here is the Link for the chatbot using nltk library using python
7|Page
5. SAMPLE OUTPUT OF THE PROGRAM:
Finally we can end conversation by telling – see you or bye to our Chatbot
6. CONCLUSION:
Chatbots are the top application of Natural Language processing and today it is simple
to create and integrate with various social medial handle and websites. Today most
Chatbots are created using tools like Dialogflow, RASA, etc. This is a quick
introduction to chatbots to present an understanding of how businesses are
transforming using Data science and artificial Intelligence.
Anyone can create their own Chatbot using simple Algorithms. They inhabit
platforms like – FB Messenger, Whatsapp, Skype, Slack, Line, Kik, Wechat and so
on.
8|Page
Today, the number of chatbots are keeps growing, and more and more brands are
starting to understand the main business benefits of chatbots.
The futuristic scope of chatbot technology: Now, as you are aware of what a chatbot
is and how important bot technology is for your business. You will certainly agree
that bots have drastically changed the way businesses interact with their customers.
Chatbot technologies will become a vital part of customer engagement strategy going
forward. Near to future bots will advance to enhance human capabilities and human
agents to be more innovative, in handling strategic activities.
In Future, we can see more number of chatbots using different libraries in certain
fields with respect to their usage.
9|Page