【发布时间】:2015-02-15 04:01:51
【问题描述】:
我想设置 grokitbot 通过终端与用户进行本地聊天。
Grokitbot 被连接到使用 twisted 直接与 irc 服务器对话。
查看源代码,似乎 Grokitbot.py 完成了所有 irc 的工作,而 AIMLBot.py 完成了所有实际工作,所以我放弃了以前的文件。 This is AIMLBot.py
还有一个名为 AIMLBayes.py 的脚本可以处理所有的贝叶斯问题。
在我的第一个问题中,我运行的代码没有作为名称发送的字符串。因此无法创建训练文件。
所以,改写我原来的问题:
from AIMLBot import AIMLBot
bot = AIMLBot("Joe")
while True:
line = raw_input()
print bot.on_MSG_IN("netanel", line)
这是脚本中的日志:
Loading data/aiml/startup.xml... done (0.11 seconds)
Loading data/aiml\example.aiml... done (0.01 seconds)
Loading data/aiml\goodbye.aiml... done (0.00 seconds)
Loading data/aiml\hello.aiml... done (0.01 seconds)
Loading data/aiml\main.aiml... done (0.01 seconds)
Loading data/aiml\thanks.aiml... done (0.00 seconds)
Loading data/aiml\tools.aiml... done (0.01 seconds)
Loading data/aiml\unknown.aiml... done (0.00 seconds)
Interpreter Version Info: PyAIML 0.8.6
Kernel bootstrap completed in 0.18 seconds
[Alert] Failed to load bayesian brain - Joe.bay, creating it now
hello
Loading data/aiml/training/netanel.aiml... done (0.00 seconds)
Sorry, I don't understand. What do you mean?
hello
[Handler] TRAINING
Failed to learn
OK, I grok that
此代码在 Windows 上失败。但是同样的代码可以在运行 Debian 的 Linux 机器上运行。
【问题讨论】:
-
顺便说一句,我尝试在 AIML 文件夹中插入一个 std-hello.aiml 文件,它成功启动它,并且可以使用 AIML 文件中指定的命令进行响应。但是,机器人仍然不会学习新的短语。该模块带有一个 hello.aiml,但是当我加载默认的 AIML 文件时我没有得到任何响应。