python-3.x - ChatterBot 没有接受过 ubuntu 语料库的训练
问题描述
我按照这个例子用 Ubuntu 语料库训练我的聊天机器人
我的代码是下一个:
# import ChatBot
from chatterbot import ChatBot
# import Trainer
from chatterbot.trainers import UbuntuCorpusTrainer
# Declare a bot
bot = ChatBot('Zeus')
# Training
trainer3 = UbuntuCorpusTrainer(bot)
# Start by training our bot with the Ubuntu corpus data
trainer3.train()
# Get a response to an input statement
bot.get_response("Hello, how are you today?")
while True:
# Input from user
message = input('You: ')
# if message is not "Bye"
if message.strip() != 'Bye':
reply = bot.get_response(message)
print('Zeus:', reply)
# if message is "Bye"
if message.strip() == 'Bye':
print('Zeus: Bye')
break
输出显示该机器人未使用 ubuntu 语料库进行训练:
/usr/local/bin/python3.7 /home/user/Documents/python-workspace/zeus_bot/UbuntuCorpus.py
[nltk_data] Downloading package averaged_perceptron_tagger to
[nltk_data] /home/user/nltk_data...
[nltk_data] Package averaged_perceptron_tagger is already up-to-
[nltk_data] date!
[nltk_data] Downloading package stopwords to /home/user/nltk_data...
[nltk_data] Package stopwords is already up-to-date!
Training took 0.11888790130615234 seconds.
/usr/local/lib/python3.7/site-packages/chatterbot/corpus.py:38: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
return yaml.load(data_file)
You: Hi
Zeus: Hello, how are you today?
You: very well
Zeus: Hi
You: what news?
Zeus: Hello, how are you today?
You: i am fine
Zeus: Hi
You: Bye
Zeus: Bye
Process finished with exit code 0
它没有显示训练的加载过程。当我与机器人聊天时,我只得到 get 响应,没有别的。
解决方案
推荐阅读
- multithreading - 无法连接时停止频道
- java - 如何根据孩子的身高自动设置对话框高度?
- fragment - DQL 在 documentum 中查询类型片段
- r - RMarkdown 错误:包“yaml”的编译失败
- java - 像 JPanel 这样的轻量级组件可以在没有像 JFrame 这样的重量级组件的情况下显示吗?
- c# - HSTS 实施
- mysql - 如何使用案例语句优化选择查询?
- html - Bootstrap - 如何让卡片在搜索栏和视口底部之间垂直居中?
- python - Python h2o 集群在解析进度时冻结
- google-cloud-platform - 如何仅在一个或两个特定的 Google Cloud Compute Engine 实例上授予“编辑”角色?