ChatterBot: AttributeError: 'ChatBot' object has no attribute 'set_trainer'

Hi, Just after installing ChatterBot ( version is 1.0.0a3.) , I tried to execute the following code snippet from quick start guide:

from chatterbot import ChatBot
chatbot = ChatBot("Ron Obvious")
from chatterbot.trainers import ListTrainer

conversation = [
    "Hello",
    "Hi there!",
    "How are you doing?",
    "I'm doing great.",
    "That is good to hear",
    "Thank you.",
    "You're welcome."
]

chatbot.set_trainer(ListTrainer)
chatbot.train(conversation)

It failed to execute with the error, " AttributeError: ‘ChatBot’ object has no attribute ‘set_trainer’ ". I couldn’t find any other post related to this attribute either. I skimmed through the code of chatterbot.py and found ChatBot indeed has neither ‘set_trainer’ nor ‘train’ function. Am I missing something here? I would really appreciate if anybody could help me here. Thanks,

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 18 (5 by maintainers)

Most upvoted comments

Hi @Chingcham, make sure you are viewing the latest version of the documentation for 1.0.0a3. The default (stable) will be for version 0.8.

https://chatterbot.readthedocs.io/en/latest/quickstart.html#training-your-chatbot

from chatterbot.trainers import ListTrainer

conversation = [
    "Hello",
    "Hi there!",
    "How are you doing?",
    "I'm doing great.",
    "That is good to hear",
    "Thank you.",
    "You're welcome."
]

trainer = ListTrainer(chatbot)

trainer.train(conversation)