PyAIML未加载启动 [英] PyAIML not loading startup

查看:166
本文介绍了PyAIML未加载启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Python上实现 PyAIML 的项目,并编写了以下代码来为我的项目创建大脑:

I am beginning a project on Python that implements PyAIML and I wrote the following code to create a brain for my project:

import aiml

k=aiml.Kernel()
k.learn("std-startup.xml")
k.respond("LOAD AIML B")
k.saveBrain("jarvis.brn")

当我跑步时程序出现此错误:警告:找不到匹配的输入内容:LOAD AIML B

When I run the program I get this error: WARNING: No match found for input: LOAD AIML B

我了解我需要下载 AIML 集开始开发。所以我做到了,但是我被困在那里。

I understand that I needed to download an AIML set to begin development. So I did, but I'm stuck there.

请帮助。我是一个菜鸟程序员,所以不要为这个愚蠢的错误对我粗鲁。

Please help. I'm a noob programmer so don't be rough on me for this dumb mistake.

预先感谢!

推荐答案

如果您传递的文件不存在, .learn()方法不会引发错误,我猜您正在尝试从 std-startup.xml 中学习模式,而无需将此文件放在目录中。

The .learn() method will not throw an error if the file you pass it does not exist, and I'm guessing that you are trying to learn patterns from "std-startup.xml" without having this file in your directory.

确保文件 std-startup.xml 在运行脚本的目录中。您的工作目录中还应该有一个名为 standard 的目录,其中包含标准的aiml文件集。基本上,您的目录应如下所示:

Make sure the file std-startup.xml is in the directory you are running your script from. You should also have a directory called standard in your working directory that contains the standard set of aiml files. Basically your directory should look like this:

 mydir/my_script.py
 mydir/std-startup.xml
 mydir/standard/a-bunch-of-std-aiml-files.aiml

这些文件可以在 pyaiml源伪造站点。转到该文件夹​​并下载tarball或zip文件之一。

These files can be found in the "Other Files/Standard AIML Set/" folder on the pyaiml source forge site. Go to that folder and download the one of the tarballs or the zip.

这篇关于PyAIML未加载启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆