我想将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'.
有人知道这里的问题吗?谢谢!