AttributeError:“ Chatbot”对象没有属性“ train”

时间:2019-08-18 16:48:52

标签: python api twitter chatbot chatterbot

我想将Twitter API与我的chatterbot连接起来,以下是我的代码:

from chatterbot import ChatBot
from settings import TWITTER

chatbot = ChatBot(
      "TwitterBot",
      logic_adapters=[
          "chatterbot.logic.BestMatch"
      ],
      input_adapter="chatterbot.input.TerminalAdapter",
      output_adapter="chatterbot.output.TerminalAdapter",
      database="./twitter-database.db",
      twitter_consumer_key=TWITTER["CUSTOMER_KEY"],
      twitter_consumer_secret=TWITTER["CUSTOMER_SECRET"],
      twitter_access_token_key=TWITTER["ACCESS_TOKEN"],
      twitter_access_token_secret=TWITTER["ACCESS_TOKEN_SECRET"],
      trainer="chatterbot.trainers.TwitterTrainer",
      random_seed_word="random"
  )

chatbot.train()

下面是错误消息:

chatbot.train()
AttributeError: 'ChatBot' object has no attribute 'train'. 

有人知道这里的问题吗?谢谢!

0 个答案:

没有答案