gunthercox / ChatterBot

ChatterBot is a machine learning, conversational dialog engine for creating chat bots
https://chatterbot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
14.03k stars 4.44k forks source link

Why do I type any statement and reply to me with only one letter #1914

Open 27182812 opened 4 years ago

27182812 commented 4 years ago

No matter what I type,the answer always a letter. And I tried many different corous,please help me! This is my code: from chatterbot import ChatBot from chatterbot.trainers import ChatterBotCorpusTrainer from chatterbot.trainers import ListTrainer chatbot = ChatBot("ChineseChatBot") trainer = ListTrainer(chatbot)

with open('./chinese_chatbot_corpus-master/clean_chat_corpus/qingyun.tsv', encoding='utf-8') as f:

data = f.read().replace('\t', '\n')

print(data[:100])

使用中文语料库训练它

trainer.train("chatterbot.corpus.english")

from chatterbot import ChatBot bot = ChatBot( 'my-chat', database_uri='sqlite:///db.sqlite3' ) print('Type something to begin...')

开始对话

while True: print(chatbot.get_response(input(">")))

This is my result: D:\Anaconda3\python.exe C:/Users/11491/Desktop/研究方法/code/chatbot.py [nltk_data] Error loading stopwords: <urlopen error [WinError 10054] [nltk_data] 远程主机强迫关闭了一个现有的连接。> [nltk_data] Error loading averaged_perceptron_tagger: <urlopen error [nltk_data] [WinError 10054] 远程主机强迫关闭了一个现有的连接。> List Trainer: [####################] 100% [nltk_data] Error loading stopwords: <urlopen error [WinError 10054] [nltk_data] 远程主机强迫关闭了一个现有的连接。> Type something to begin... [nltk_data] Error loading averaged_perceptron_tagger: <urlopen error

[nltk_data] [WinError 10054] 远程主机强迫关闭了一个现有的连接。> hello . how are you r why b

gitCommitWiL commented 4 years ago

Not sure if you've already figured it out, but it's because you used the wrong trainer. trainer = ListTrainer(chatbot) should instead be trainer = ChatterBotCorpusTrainer(chatbot)