在Python中创建简单的ChatBot时,如何修复“ xml.etree.ElementTree.ParseError:格式不正确(无效令牌):第1行,第0列”错误

时间:2019-05-26 03:49:59

标签: python tensorflow chatbot

我第一次创建简单的ChatBot,并停留在错误“ xml.etree.ElementTree.ParseError:格式不正确(无效令牌):第1行,第0列”

我已经解决了pip,tensorflow,获取url,ssl证书,没有模块名称chatterbot,没有模块名称chatterbot-corpus的问题

from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
import os

bot = ChatBot('Bot')
bot.set_trainer(ListTrainer)

for files in os.listdir('D:/aaprojects/Chat bot 2019\chatterbot-corpus-1.2.0\chatterbot-corpus-1.2.0\chatterbot_corpus\data\english/'):
        data = open ('D:/aaprojects/Chat bot 2019\chatterbot-corpus-1.2.0\chatterbot-corpus-1.2.0\chatterbot_corpus\data\english/' + files, 'r').readlines()
        bot.train(data)

while True:
        message = input('You:')
        if message.strip() != 'Bye':
                reply = bot.get_response(message)
                print('ChatBot:',reply)

        if message.strip()=='Bye':
                print('ChatBot:Bye')
                break

错误消息:

xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0" i believe when its gone my ChatBot wold run

0 个答案:

没有答案