question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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,

Issue Analytics

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

github_iconTop GitHub Comments

14reactions
gunthercoxcommented, Jan 12, 2019

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)
0reactions
pathapatisivayyacommented, Nov 8, 2019

HI,

I am facing an issue regarding set_trainer in chatterbot please check the bellow code if their is any error please let me know

from flask import Flask, render_template from chatterbot import ChatBot from chatterbot.trainers import ListTrainer

app = Flask(name)

english_bot = ChatBot(“Chatterbot”, storage_adapter=“chatterbot.storage.SQLStorageAdapter”)

english_bot.set_trainer(ListTrainer) english_bot.train(“./data”)

@app.route(“/”) def home(): return render_template(“index.html”)

@app.route(“/get”) def get_bot_response(): userText = request.args.get(‘msg’) return str(english_bot.get_response(userText))

if name == “main”: app.run()

from flask import Flask, render_template, request

from chatterbot import ChatBot

from chatterbot.trainers import ChatterBotCorpusTrainer

app = Flask(name)

english_bot = ChatBot(“Chatterbot”, storage_adapter=“chatterbot.storage.SQLStorageAdapter”)

english_bot.set_trainer(ChatterBotCorpusTrainer)

english_bot.train(“./data”)

@app.route(“/”)

def home():

return render_template(“index.html”)

@app.route(“/get”)

def get_bot_response():

userText = request.args.get(‘msg’)

return str(english_bot.get_response(userText))

if name == “main”:

app.run()

Thank you in Advance

hi bro

i am also same issue facing but fix this error

please following solve error steps: Flask==0.12.3 chatterbot==0.8.4 SQLAlchemy==1.1.11

install same version packages

issue is solved …

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'ChatBot' object has no attribute 'set_trainer'
I had this problem until I rearranged placing of the set_trainer statement, as in my code here: from chatterbot import ChatBot from ...
Read more >
chatterbot/Lobby - Gitter
I am getting this error AttributeError: 'ChatBot' object has no attribute 'find'. Code: from chatterbot import ChatBot chatbot = ChatBot("Ron Obvious")
Read more >
AttributeError: 'ChatBot' object has no attribute 'set_trainer' - GUJ
coding: utf-8 * from chatterbot.trainers import ListTrainer from chatterbot import ChatBot import os bot = ChatBot('BORIS') bot ...
Read more >
AttributeError: 'ChatBot' object has no attribute 'set_trainer' | by Neha ...
can any one help me in resolving this issue. “AttributeError: 'ChatBot' object has no attribute 'set_trainer'” is published by Neha Firdous.
Read more >
Trying To Run Chatbot On Discord But Get Attributeerror - ADocLib
It failed to execute with the error AttributeError: 'ChatBot' object has no attribute 'settrainer'.I couldn't find any other post related to this.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found