Git Product home page Git Product logo

pyaiml's Introduction

pyAIML

PyAIML -- The Python AIML Interpreter

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

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

pyaiml's Issues

License missing

Could you please include a license file?
This is a great package and I'm sure a lot more people would be using this if they can see the terms of license. Would love to see this under Apache 2.0 if possible.

Python3 issue

When I'm using this package in python3 it is thrown an error File "/usr/local/lib/python3.6/site-packages/aiml/__init__.py", line 4, in <module>

a bug

In line 268 of Kernel.py:

def _deleteSession(self, sessionID):
    """Delete the specified session."""
    if sessionID in self._sessions:
        _sessions.pop(sessionID)

It's supposed to be self._sessions.pop(sessionID)

Unicode support

Hello!

Thanks for this python module!
However, as I can understand, currently it does not support Unicode. Even test from Kernel.py fails.

You stopped support for this module, but I hope in some time you fix this issue. Or everybody will know, that all languages except English is not supported yet.

Maximum recursion depth exceed for "learn.aiml" examples

Hey @creatorrr , thanks for this great library!

I'm facing with a problem while trying to use these learn.aiml files with your library.
Mitsuku: http://www.square-bear.co.uk/aiml/learn.zip
ALICE: http://alicebot.wikidot.com/learn-aiml (WRONG/OUTDATED)

It's trapping in to an infinite loop, how can I solve that? This is the error.log from the beginning to KeyboardInterrupt.

stderr:

WARNING: maximum recursion depth exceeded (input='xlearnfact')WARNING: maximum recursion depth exceeded (input='XEDUCATE WHAT IS .........
........XSPLIT a language XSPLIT')WARNING: maximum recursion depth exceeded (input='xlearnfact')Traceback (most recent call last):
  File "main2.py", line 5, in <module>
    print kernel.respond("Learn the sun is hot")
  File "/usr/local/lib/python2.7/dist-packages/aiml/Kernel.py", line 329, in respond
    response = self._respond(s, sessionID)
  File "/usr/local/lib/python2.7/dist-packages/aiml/Kernel.py", line 394, in _respond
    response += self._processElement(elem, sessionID).strip()
  File "/usr/local/lib/python2.7/dist-packages/aiml/Kernel.py", line 425, in _processElement
    return handlerFunc(elem, sessionID)
  File "/usr/local/lib/python2.7/dist-packages/aiml/Kernel.py", line 928, in _processTemplate
    response += self._processElement(e, sessionID)
  File "/usr/local/lib/python2.7/dist-packages/aiml/Kernel.py", line 425, in _processElement
    return handlerFunc(elem, sessionID)
.
.
.
.
    return handlerFunc(elem, sessionID)
  File "/usr/local/lib/python2.7/dist-packages/aiml/Kernel.py", line 871, in _processStar
    response = self._brain.star("star", input, that, topic, index)
  File "/usr/local/lib/python2.7/dist-packages/aiml/PatternMgr.py", line 181, in star
    patMatch, template = self._match(input.split(), thatInput.split(), topicInput.split(), self._root)
  File "/usr/local/lib/python2.7/dist-packages/aiml/PatternMgr.py", line 325, in _match
    pattern, template = self._match(suf, thatWords, topicWords, root[self._STAR])
  File "/usr/local/lib/python2.7/dist-packages/aiml/PatternMgr.py", line 307, in _match
    pattern, template = self._match(suffix, thatWords, topicWords, root[first])
  File "/usr/local/lib/python2.7/dist-packages/aiml/PatternMgr.py", line 325, in _match
    pattern, template = self._match(suf, thatWords, topicWords, root[self._STAR])
  File "/usr/local/lib/python2.7/dist-packages/aiml/PatternMgr.py", line 320, in _match
    if root.has_key(self._STAR):
KeyboardInterrupt

With these usage attempts both of them has same problem:

import aiml

kernel = aiml.Kernel()
kernel.learn("learn.aiml")
print kernel.respond("Learn the sun is hot")
import aiml

kernel = aiml.Kernel()
sessionId = 12345
kernel.getSessionData(sessionId)
kernel.learn("learn.aiml")
print kernel.respond("Learn the sun is hot")

Tag that seems not supported.

The following example is not supported by pyAIML.

<category>
    <pattern>WHAT ABOUT MOVIES</pattern>
    <template>Do you like comedy movies</template>
</category>

<category>
    <pattern>YES</pattern>
    <that>Do you like comedy movies</that>
    <template>Nice, I like comedy movies too.</template>
</category>

<category>
    <pattern>NO</pattern>
    <that>Do you like comedy movies</that>
    <template>Ok! But I like comedy movies.</template>
</category>

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.