Chatbot with ChatterBot

How It Works

ChatterBot is a machine-learning based conversational dialog engine which is able to generate responses based on collections of known conversations.

maid-chatbot-messenger
class maidchan.chatbot.ChatBotDriver(storage_adapter)[source]

Maid-chan is trained with the provided Indonesian corpus, English corpus, and an additional corpus which is stored at maidcorpus of this project (some of them are Japanese words). Each time a user enters a statement, Chatterbot stores the text and its response for the next learning process.

ChatterBot is language independent, which means that Maid-chan could support 3 different languages quite easily.

ChatBotDriver.get_response_from_chatbot(query, language)[source]
ChatBotDriver.get_response(query)[source]

The initial idea was to check whether user’s language is in the supported list. However, it seems the accuracy of langdetect is quite low, so it only checks whether the input is a valid language or not (e.g.: emoticon).

Storage Adapter

By default, ChatterBot uses chatterbot.storage.JsonFileStorageAdapter as its database adapter. However, after receiving messages from number of users, ChatterBot becomes slow (more than 5 seconds per query). Therefore, it is recommended to use MongoDB adapter (chatterbot.storage.MongoDatabaseAdapter) for production.

See http://chatterbot.readthedocs.io/en/stable/storage/index.html for full references.

Maid-chan Corpus

Maid-chan corpus consists of 3 files:

  • conversations.corpus.json
  • greetings.corpus.json
  • trivia.corpus.json

You could append any other training materials as long as the file has the format of corpus.json.