A chatbot is a computer program that's designed to simulate human conversation. Users communicate with these tools using a chat interface or via voice, just like they would converse with another person. Chatbots interpret the words given to them by a person and provide a pre-set answer.
Artificial intelligence, which brings into play machine learning and Natural language Processing (NLP) for building bot or chatbot, is specifically designed to unravel the smooth interaction between humans and computers.
- Increases operational efficiency.
- Automating customer request fulfillment.
- Handling basic queries, which in turn free employees to work for complex & higher value inquiries.
- Offers Multi-language support.
- Saves time & effort by automating customer support.
- Improves the response rate as well as customer engagement.
- Personalization of communication
- ChatterBot is a Python library that makes it easy to generate automated responses to a user’s input. ChatterBot uses a selection of machine learning algorithms to produce different types of responses.
- This is a corpus of dialog data that is included in the chatterbot module.
ChatterBot includes tools that help simplify the process of training a chat bot instance. ChatterBot’s training process involves loading example dialog into the chat bot’s database. This either creates or builds upon the graph data structure that represents the sets of known statements and responses. When a chat bot trainer is provided with a data set, it creates the necessary entries in the chat bot’s knowledge graph so that the statement inputs and responses are correctly represented.
from chatterbot.trainers import ChatterBotCorpusTrainer
-
trainer.train('chatterbot.corpus.english')
-
trainer.train('chatterbot.corpus.english')
For more info on the data, refer to the official repo of the ChatterbotCorpus package.
This piece of code is pretty straight forward. It uses a while loop to get responses untill we get a 'Bye' from the user.
name=input("Enter Your Name: ") print("Hi "+name+", how can I help you?") while True: request=input(name+':') if request=='Bye' or request =='bye': print('Pranav: Bye') break else: response=bot.get_response(request) print('Pranav:',response)
- Drop a ★ on the Github Repository.
- Download Python IDE (recommended Anaconda IDE)
Install Anaconda for Windows
Install Anaconda for MacOS
Install Anaconda for Linux - Clone the Repo by going to your local Git Client and pushing this command:
git clone https://github.com/Pranav016/Python-Chatbot.git
- Go to the AnacondaPrompt and use this command to install the packages. Open Jupyter Notebook to work-on/ use the chatbot:
pip install -r requirements.txt
or
Open the project in your Jupyter Notebook. Run these commands in it.
!pip install chatterbot !pip install chatterbot_corpus
bot = ChatBot(
'Pranav',
logic_adapters=[
'chatterbot.logic.BestMatch',
'chatterbot.logic.TimeLogicAdapter'],
)