带有Python的AIML文件 [英] AIML files with Python

查看:297
本文介绍了带有Python的AIML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想使用python创建一个聊天机器人,我是,我尝试了这段代码


这是代码和问题的屏幕截图:



...但是我总是收到此警告,但我不知道原因:
警告:找不到匹配的输入:LOAD AIML B

解决方案

您需要拥有 botdata\standard ,与您在Python脚本中运行的路径相同。


我建议您使用



So I wanted to create a chatbot using python and i am , I tried this code

this is a screenshot of the code and the problem:

...But I'm always having this Warning and I Don't Know Why : WARNING: No match found for input: LOAD AIML B

解决方案

You need to have botdata\standard in the same path as you run in your Python script.

I suggest you use python-aiml as it's most updated. The old PyAIML was last updated around 10 years ago, link to Github. Steps below assuming you're a Windows user and have Anaconda environments enabled.

  1. Install pip install python-aiml
  2. Copy files from C:\Users\your-username\Anaconda3\envs\env-name\Lib\site-packages\aiml\botdata\standard and create a standard folder in your Python script's root and paste all those files.

The code you need:

import aiml
k = aiml.Kernel()
k.learn("startup.xml")
k.respond("LOAD AIML B")
while True:
    k.respond(input("Enter your message: "))

  1. Otherwise just cd to that aiml package location and keep your python script there. The screenshot below on how I loaded in my terminal and working proof.

这篇关于带有Python的AIML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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