AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Python 3.x Implementation of AIML 2.0

I just published my implementation of AIML 2.0 Spec in Python 3 on GitHub at

Its not fully complete, but has all tags except learn, learnf and eval, and seems to work really well with the rosie aiml set.

Still a few things to implement, but I’ve always wanted to write one myself, and really get to know how AIML and Chat bot works, so here it is.



  [ # 1 ]

Well its been awhile since I first posted this, but today v11 of Program-Y has been pushed to GitHub.

Program-Y is as close to the AIML 2.0 Spec in Python 3.x that I can get. It includes every single tag I have managed to find referenced in various AIML 2 and Pandora sites. This includes

Full support for triples ( or RDF ) as addtriple, deletetriple, select, uniq and tuple
Full list processing with First and Rest
Full OOB support

However it doesn’t stop there, Program-Y is massively extensible with the ability to add new Pattern and Template nodes at will, dynamic Sets, Maps and Variables, plug and play service extensions and a whole range of additional features.

Its been fun getting this far, and incredibly frustrating at the lack of proper AIML 2 specification, but thats probably half the fun working out how half of these tags work


  [ # 2 ]

i have python 3.6..i have tried everything and tried to run any piece of code from your work but it just doesn’t run..i think the reason is aiml..and i have searched everywhere and i am not able to find aiml2.0 anywhere..everywhere i go i just see name of aiml2.0 but nothing solid that works…plsssss help.. i have tried literally everything


  [ # 3 ]

Hi there

Plenty of people using it with 3.6 including myself so we will need to get some information to help diagnose

Let’s start with what operating system you are uszing

Next have you followed the instructions from the wiki including installing all the dependencies in requirements.txt

If so, what bot are you running bot, alice2, Rosie or professor

Finally what error messages are you getting


  [ # 4 ]

Hi There,

What does “Remove references to ..\program-y\bots\y-bot\aiml in files section of aiml” mean in the Program-y wiki?.. Does it mean that i have to remove that particular line in the config.yaml or something else… I’ve tried removing that and the other reference lines as specified in the Wiki, and i get this ” FileNotFoundError: [Errno 2] No such file or directory: ‘.\config\denormal.txt’” when i run console.cmd.. Can someone help me out with this?

Image Attachments

  [ # 5 ]

The reason for this, is that the tutorial uses the template bot set up found in Template-Y, but for the tutorial the instructions are intended to help reduce the amount of information and data which is loaded.

Where an instruction states to remove something from a section, it means only remove the reference stated and leave the other others, so for examples

Remove references to ..\program-y\bots\y-bot\aiml in files section of aiml

Change this section in the config from

        files: |

        files: |

This will mean you start with a completely empty bot with no grammar and then the tutorial will help you build it up

I’ve added more instructions to the wiki page


  [ # 6 ]

Thanks alot…I’ve got the bot running and i’ve added a few questions.Will there be any chance of integrating this bot into my own web page?


  [ # 7 ]

Y-Bot already ships with a webchat client, take in a look in the make Y-Bot repo and you’ll see a script called y-bot-webchat.cmd which runs a Flask based web client.

You then have a couple of options, either extend the web chat client html and js to your own needs, or use the REST API running Y-Bot as a RESTful service and use Ajax to call the server from your web client



  [ # 8 ]

Thanks alot..It’s working just as i wanted!!


  [ # 9 ]

I tried changing the host address of the webchat in the config.aiml file in y-bot. But after running the y-bot-webchat.cmd, the bot seems to be running on the same host address..Why is that? Could i change the host address?


  [ # 10 ]

What address are you trying to change it to, you only have a few options, which is then how the server accepts requests, so its basically

1) The physicall IP address of the machine it its running

The 1 and 2 mean that the server only accepts connections from the same machine it is running on, while 3 means it accepts connections from any server

If you are trying to set it to an ip that it does not know, or is not valid, it will fail



  [ # 11 ]

I was wanting to host that bot on my webpage, so that people could use it. Could you help me out with that?.I am sorry that i keep asking silly questions…


  [ # 12 ]

You have 2 options for this

1) Run Program-Y on the same server that is hosting your webpage, you will then only need to specify the ip address of that server

2) Run Program-Y on a different server, but host the HTML page on the server hosting your webpage. If its this option, you need to set the ip address to the ip address of the server hosting your webpage, but you will also need to modify the ajax code on the webchat client to call the ip address of the Program-Y server

which option are you trying to use ?


  [ # 13 ]

The first one


  [ # 14 ]

OK, so is it installed and running, can you bring up the webchat web page


  [ # 15 ]

Yes. But the bot never replies back to me. I just stays on the welcome note. It was working perfectly when i started ybot-webchat.cmd. It replied back to me through the localhost:5000


 1 2 3 > 
1 of 3
  login or register to react