Chatterbot is a very flexible and dynamic chatbot that you easily can create your own training data and structure.
The chatterbot corpus path can be found here, well documented.
Custom Corpus
Training a custom is possible with the following steps:
- Prepare your custom *.yml files in a similar syntax convention as the official corpus
- Manage the custom *.yml files in a hierarchical folders structure, where the top parent directory is adjacent to the app folder (also adjacent to manage.py and to the db.sqlite3 files).
- Add your custom *.yml files in the following manner (see in bold):
CHATTERBOT = {
'name': 'Heroku ChatterBot Example',
'logic_adapters' : [
"chatterbot.logic.BestMatch"
],
'trainer': 'chatterbot.trainers.ChatterBotCorpusTrainer',
'training_data': [
'chatterbot.corpus.english',
'chatterbot.corpus.hebrew',
'custom_corpus.subfolder1.my_ymls_are_here'
]
}
Then, just need to train the Bot:
% python manage.py migrate train
Note that ChatterBot enables by default an online-training scheme. This feature can be disabled by setting ‘read_only’: “True” in the above CHATTERBOT dictionary.
ChatterBot Reset
Resetting the Bot can be obtained by the following steps:
% heroku pg:reset DATABASE% heroku run python manage.py migrate
% heroku run python manage.py createsuperuser% heroku run python manage.py shell>>> from chatterbot import ChatBot
>>> from chatterbot.ext.django_chatterbot import settings
>>> chatbot = ChatBot(**settings.CHATTERBOT)
>>> chatbot.storage.drop()
>>> exit()% heroku run python manage.py train