Chatterbot: AIML Integration

Created on 17 Mar 2016  路  10Comments  路  Source: gunthercox/ChatterBot

Hi everyone,

Great tool!
I was wondering if there was any consideration for adding in the ability to use AIML files?
I guess these can be converted to JSON files but that seems like a big work around.

Thanks!

enhancement

Most helpful comment

I appreciate everyone's discussion regarding the subject of AIML support in ChatterBot. There have been a number of other tickets that relate to this but I don't have any plans to build anything related to this functionality into ChatterBot related to this within the next year. My main focus is going to be on improving the quality and accuracy of the dialog that the chat bot can produce. I hope that It's alright but I'm going to close this ticket off.

All 10 comments

This is a great idea. I would be more than happy to add direct support for this. I will need to look into the AIML spec a bit fist as it looks like they support a few things like wildcard input which ChatterBot currently does not support. Also, this is really cool because it looks like there is a lot of data already available in this format: http://www.alicebot.org/aiml/aaa/.

Awesome!
I have been thinking about this issue with the wildcards and would be very interested in hearing about the approach you come up with. I feel like it may be similar to your ClosetMatchAdapter class but probably a lot more complicated. I was even thinking that each topic can get a class like TimeLogicAdapter with some NaiveBayesClassifier but that is probably overkill.

Also, a lot of the AIML files (https://github.com/drwallace/aiml-en-us-foundation-alice) have a notion of saved state. For example, you can tell the bot your name and then it saves that fact and can recall it later in the conversation. Is something like this supported in the current code?

BTW, I have been poking around a bit and found an open source AIML parser and bot: https://github.com/creatorrr/pyAIML
They have a pretty complex parser and string matcher in the files AimlParser.py and PatternMgr.py

Hi,
There is another project (https://github.com/cosimoiaia/pyAiml-2.0) is in very early stages , for AIML 2.0 it is a porting of program-AB (JAVA).

With pyAIML, I believe can be treated like any other logic adapter.

What you think ?

@davizucon Looks promising, definitely something to look in to.

@davizucon
Yes, it was pretty easy to use aiml as a logic adapter. I used the AIML interpreter here: https://github.com/creatorrr/pyAIML, which is AIML 1.0.1 standard. It was tricky to calculate the confidence level of the reply though, as it is not part of the AIML standard.

@gopiwh0 did you go any further with integration?

Basic integration without any development on the confidence. Had issues with the original library as it was for 2.7. Found a port to 3 that worked:
https://github.com/weddige/pyaiml3

from __future__ import unicode_literals
from chatterbot.logic import LogicAdapter
from chatterbot.conversation import Statement
import aiml

class AIMLEvaluation(LogicAdapter):
def __init__(self, **kwargs):
from nltk import NaiveBayesClassifier

    self.kernel = aiml.Kernel()
    self.kernel.learn("standard/std-65percent.aiml")


def process(self, statement):
    from chatterbot.conversation import Statement

    responseData = self.kernel.respond(statement.text.lower())
    response = Statement(responseData)

    response.confidence = 1
    return response

I've was reminded about AIML recently and I just wanted to record a brief though about a possible direction for supporting it in ChatterBot.

  1. It would be easy to add a field to mark Statements that contain AIML.
  2. A filter would have to be created to control when AIML responses are used.
  3. I'm not certain about how the AIML statements should be evaluated, but I'm fairly sure a custom logic adapter would be need for this so that the AIML responses could be processed into statement text.

Did anyone come up with a direct method for learning custom AIML files?

I appreciate everyone's discussion regarding the subject of AIML support in ChatterBot. There have been a number of other tickets that relate to this but I don't have any plans to build anything related to this functionality into ChatterBot related to this within the next year. My main focus is going to be on improving the quality and accuracy of the dialog that the chat bot can produce. I hope that It's alright but I'm going to close this ticket off.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gunthercox picture gunthercox  路  3Comments

cesarandreslopez picture cesarandreslopez  路  4Comments

filipceglik picture filipceglik  路  3Comments

juanpialbano picture juanpialbano  路  4Comments

decode007 picture decode007  路  4Comments