Unless you teach your bot new tricks its going to remain dum.
Hello everyone. In this tutorial we are going to teach our bot some new tricks
As i browsed the web i only found two way to train your chatbot:
- Using Listrainer class
- Using chatterbot corpus
from chatterbot import ChatBot from chatterbot.trainers import ListTrainer
chatbot = ChatBot('Training Example') trainer = ListTrainer(chatbot) trainer.train([ "Hi there!", "Hello", ]) trainer.train([ "Greetings!", "Hello", ])
Its that simple
According to the documentation:
Chatterbot corpus is a corpus of dialog data that is included in the chatterbot module.
Corpus data is user contributed, but it is also not difficult to create one if you are familiar with the language. This is because each corpus is just a sample of various input statements and their responses for the bot to train itself with.
pip install chatterbot-corpus
In most cases chatterbot-corpus is not installed by default so you have to install it.
Forgive me i am thinking of the corpus callosum right now. I must be mad right?
from chatterbot import ChatBot from chatterbot.trainers import ChatterBotCorpusTrainer ''' This is an example showing how to create an export file from an existing chat bot that can then be used to train other bots. ''' chatbot = ChatBot('Export Example Bot') # First, lets train our bot with some data trainer = ChatterBotCorpusTrainer(chatbot) trainer.train('chatterbot.corpus.english')
All this stuff can be done from a separate file as long as you specify the correct bot name.
After some experimentation i discovered that the corpus is not that smart, you can get easily detected by someone who knows how you chat. We could use ListTrainer right?
You cant anticipate every conversation, it would take you days if not months or years to include every possible use case. So what should do we do? Curse fbchat and chatterbot authors?........Nope
What if we make chatbot take notes silently as we chart. We do the chitty chat chat and chatbot simply learns from the boss. One day when we are confident enough.......We unleash the beast
Until next time. See you next tutorial