Creating Chat Bot using Chatterbot (Python)

What is a Chatbot?

A chatbot (also known as a talkbot, chatterbot, Bot, IM bot, interactive agent, or Artificial Conversational Entity) is a computer program or an artificial intelligence which conducts a conversation via auditory or textual methods. Such programs are often designed to convincingly simulate how a human would behave as a conversational partner, thereby passing the Turing test. Chatbots are typically used in dialog systems for various practical purposes including customer service or information acquisition. Some chatterbots use sophisticated natural language processing systems, but many simpler systems scan for keywords within the input, then pull a reply with the most matching keywords, or the most similar wording pattern, from a database.
Source Wiki


What is ChatterBot?

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 makes it easy for developers to create chat bots and automate conversations with users.



What is ChatterBot Language Training Corpus?

These modules are used to quickly train ChatterBot to respond to various inputs in different languages. Although much of ChatterBot is designed to be language independent, it is still useful to have these training sets available to prime a fresh database and make the variety of responses that a bot can yield much more diverse.
Github Repo

Chat Bot using Chatterbot

By using the library you can skip the part of understanding the details of  NLP (Natural Language Processing) and directly go to creating a fully functional Chat Bot.


Coding

SetUp

virtualenv -p python3 venv --no-site-packages
source venv/bin/activate
pip3 list
pip3 install -r requirements.txt
Using Python 3.5+

Training

python3 train.py

Notes

  • You can train this on custom data as well, just pass the folder location in ChatBot.train(datafolder="./custom", train_corpus=True) in train.py
  • Since we are using trainer='chatterbot.trainers.ChatterBotCorpusTrainer' check ChatBot.py, you need to pass your custom data in the given format. Check custom/credit.yml for info

Running

python3 run.py

Notes

  • You can turn of logging if you want by commenting logging.basicConfig(level=logging.INFO) in ChatBot.py
  • Threshold is set in ChatBot.py at 'threshold': 0.65,, you can change it.
  • In case of response is not found the bot will reply 'default_response': 'I am sorry, but I do not understand.' set in ChatBot.py
  • Can create a help response as well in ChatBot.py
    'input_text': 'Help me!',
    'output_text': 'mail your quey here: singhsidhukuldeep@gmail.com'
  • The reply is chosen randomly if multiple responsies available: response_selection_method=get_random_response, in ChatBot.py



Github Repo for this code: https://github.com/singhsidhukuldeep/ChatBot-using-Chatterbot

Github: https://github.com/singhsidhukuldeep

Comments

  1. I always like and search such topics and everything connected to them.Excellent and very cool idea and the subject at the top of magnificence and I am happy to comment on this topic through which we address the idea of positive reaction.
    Chatbot Company in Dubai
    Chatbot Companies in Dubai
    Chatbot Development
    AI Chatbot Development
    Chatbot Companies in UAE
    Chatbot Company in Chennai
    Chatbot Company in Mumbai
    Chatbot Company in Delhi
    Chatbot Development Companies

    ReplyDelete
  2. business chatbot I would like to say that this blog really convinced me to do it! Thanks, very good post.

    ReplyDelete
  3. qualifying prospects Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info.

    ReplyDelete

Post a Comment

Popular Posts