Giter Site home page Giter Site logo

pyaiml's Introduction

PyAIML -- The Python AIML Interpreter

PyAIML 中文支持

中文支持维护(current maintainer): andelf (andelf AT gmail.com)

NOTE:

  • 目前可以支持中文规则
  • 规则库目测翻译量巨大
  • 规则中请使用半角标点
  • 暂时对 CJK 中的 JK 无支持
  • 修正了 match() 函数的一个严重 BUG, 会导致 * 错误匹配
  • 可以完美保存会话进度

Python 3 Support?

via #8 py3Aiml_Chinese

Changelog:

  • 2013/03/09
    • 初步中文支持完成
  • 2013/03/10
    • 修复 match() BUG
    • 添加 example1 example2 两个例子
  • 2013/03/12
    • 为 Kernel() 添加 session 参数
    • 添加 example3
  • 2013/03/14
    • 添加 dumps(), loads() 保存 PatterMgr()

以下为原 README

author: Cort Stratton ([email protected]) web: http://pyaiml.sourceforge.net/

PyAIML is an interpreter for AIML (the Artificial Intelligence Markup Language), implemented entirely in standard Python. It strives for simple, austere, 100% compliance with the AIML 1.0.1 standard, no less and no more.

This is currently pre-alpha software. Use at your own risk!

For information on what's new in this version, see the CHANGES.txt file.

For information on the state of development, including the current level of AIML 1.0.1 compliance, see the SUPPORTED_TAGS.txt file.

Quick & dirty example (assuming you've downloaded the "standard" AIML set):

import aiml

# The Kernel object is the public interface to
# the AIML interpreter.
k = aiml.Kernel()

# Use the 'learn' method to load the contents
# of an AIML file into the Kernel.
k.learn("std-startup.xml")

# Use the 'respond' method to compute the response
# to a user's input string.  respond() returns
# the interpreter's response, which in this case
# we ignore.
k.respond("load aiml b")

# Loop forever, reading user input from the command
# line and printing responses.
while True: print k.respond(raw_input("> "))

pyaiml's People

Contributors

andelf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyaiml's Issues

一个可能比较幼稚的问题

我是一个初学者,老师要我研究自然语言处理。
我想从AIML出发,我看您的中文分词方面,就是用空格将中文隔开,变成了英语单词的形式。对此我有两个疑问。
一是我不懂这一做法有什么用,就是AIML的机制不就是模式匹配吗,通过标签里的内容查找匹配,然后在中读出。这种模式根本不会因为是否有中文分词而出问题呀,我上网看的有些人写的简易的AIML对话机器人,也没有加中文分词,同样也是通过模式匹配可以进行简单的中文对话。我就想知道这个splitChinese()模块到底有什么用,还有怎么用。
二是网上很多中文分词方法都是基于字典或者统计的方法,远比这种直接加空格的方式复杂得多,我想知道这种方法可行性好不好。
也许我问的问题可能很好笑,但它们的确让我很困惑,希望能得到您的解答。谢谢

基础的问题

请问aiml只能在linux下安装吗,windows下可以吗,自己在windows下试着安装,装不上。(我是小白,问题有些简单,还望不要嫌弃,做毕业设计要学这个,但是不会弄,还请多多指教)

小白的疑问

现在我直接用你的包(aiml),但是在你的例子中还是无法识别中文。

import simple
Loading cn-startup.xml... done (0.00 seconds)
Loading cn-test.aiml... done (0.00 seconds)
你好
我怎么称呼你?
你 好
很高兴见到你, ����.
王毛毛
你多大了?
34
34 岁, 我比你年轻好多好多.
再见
你最喜欢什么颜色?
红色
��ɫ, 我也喜欢, 不过我更喜欢透明色.

Aimlparser does not pass the value of BOT_NAME

In aimlparser.py, while parser process the tag, it only cascade the string "BOT_NAME" to self._current ... So, the aiml agent will not respond the user for the inputs embedded agent's name. for example, assume the agent is named as Chancy, users' utterance is "Chancy你好" and one pattern is 你好, the agent will not respond the user because the aimlparser only replace the bot tag with BOT_NAME instead of bot name assignment like in the kernel.py

kernel.bootstrap(learnFiles="std-startup.xml", commands="你好")

kernel.bootstrap方法不支持中文

Loading std-startup.xml... done (0.03 seconds)
WARNING: No match found for input: 你好

Kernel bootstrap completed in 0.03 seconds
Saving brain to bot_brain.brn... done (0.00 seconds)

简单处理:

if isinstance(commands, (list,)):
        for command in commands:
                command = command.decode(self._textEncoding)
                cmds = Utils.sentences(command)
                for cmd in cmds:
                    print self._respond(cmd, self._globalSessionID)
 else:
            commands = commands.decode(self._textEncoding)
            cmds = Utils.sentences(commands)
            for cmd in cmds:
                print self._respond(cmd, self._globalSessionID)

example2里的例子和README里不一样

~/oss/PyAIML/example2$ python simple.py
Loading cn-startup.xml... done (0.02 seconds)
Loading cn-test.aiml... done (0.00 seconds)

你好
你现在在什么地方?
厦门
真希望我也在厦门, 陪你.
北京
我暂时不会说别的了.
真的吗?
我暂时不会说别的了.
太好了
我暂时不会说别的了.
谢谢
我暂时不会说别的了.
你好
我暂时不会说别的了.
exit
我暂时不会说别的了.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.