Javadoc link

Artificial Intelligence Service based on ProgramAB and AliceBot


(ProgramAB WebGui interface)

AIML is known as Artificial Intellegence Markup Language.  It was created by Dr. Richard Wallace to power the ALICE bot.  AIML is a recursive language that allows breaking down natural language text input to match a repsonse that the chat bot can send.

Here is a simplistic AIML example: 

<?xml version="1.0" encoding="ISO-8859-1"?>
<aiml version="1.0.1" xmlns="http://alicebot.org/2001/AIML-1.0.1&quot;
      xmlns:html="http://www.w3.org/1999/xhtml&quot;
 
  <category>
    <pattern>HELLO WORLD</pattern>
    <template>Hello to you too!</template>
  </category>
 
  <category>
    <pattern>HELLO *</pattern>
    <template>Hello to you too <star index="1"/> !</template>
  </category>
 
</aiml>
 

References

Mastablasta

10 years 3 months ago

Some days ago I´ve started with ProgramD and AIML.

The installation was a little tricky (for a noob like me) but got it working after some hours. There are lot of aiml databases you can download (ALICE, Charlie etc.) so you can start pretty fast talking to your bot. In my opinion most of these aiml-files are too simple as AIML offers many more tags to use. After 2 days of reading and checking more than a 100 websites it´s still difficult to find good tutorials.

So far I ended up in using GaitoBot AIML Editor which seems to be a good helper to start with (it´s free). Here you can create and even test your files immediately. You  will be able to do simple files within a short time.

I have mentioned "too simple" before. My goal: a database for first names with the bot recognizing fake names e.g.:

Master: "My name is washing machine"

Bot: "Don´t fool me! Washing machine is not a name for a human"

So I started to use the condition tag and set name and value. For real names I get the correct response e.g. Mike, nice to meet you! or using the li tag for random answers.

Now I am stuck at the point where it comes to the fake names. I´ve created a condition tag for every real name, pointing to the correct answer, working fine. I was hoping to be able to make another condition tag for all inputs which does not match the prior condition tags (the real names). To say it more simple:

if input = real name then say hello name

if input = fake name then always say get lost

Thanks for any suggestions!

SOLVED! After 24 hours of brainstorming I got things moving! I´ll keep you up to date soon.


Update 10.08.2014 4:37PM BRT:

The condition-tag would need a whole database of existing names. I tried and it works. But no one wants to add thousands of names. Here is the future name-id plan:

 

Mastablasta

10 years 3 months ago

Today I tried AIML 2.0 with program AB (version 0.0.6.26). Very easy to install and to run. It already contains a bunch of aiml.files and you will see at the cmd where it takes the info from.

Here we can create databases and the prior goal is reached.

It also retrieves a lot of info from different websites (Wiki, WolframAlpha, Jeannie bot, Answers.com etc.), grabs audio/video from Youtube or shows a city on the map. It calculates, it translates (I could only get  english/spanish to work). Also all my AIML 1.0.1 files run normally with programAB, just load them into the AIML 2.0 bot. As I like swearing I have deleted the profanity.aiml and the inappropiate.aiml at the aiml-folder and aimlif-folder and added my own badwords.aiml.

Some examples:

Human: What is the weather in Berlin

Robot: It is currently clear.  57F

Human: convert 57f

Robot: 13.889 C

Human: 300+200/25

Robot: 308

Human: my dad is edgar

Robot: I will remember your father's name is edgar.
Isn't edgar usually a male name?

And this happened after the "my dad is edgar" input:

STATE=my dad is edgar:THAT=X is your wife:TOPIC=berlin
input: my dad is edgar, that: Xis your wife, topic: berlin, chatSessio
n: org.alicebot.ab.Chat@a70ad76, srCnt: 0
Matched: MY DAD * <THAT> * <TOPIC> * reductions2.aiml
0. <srai>MY FATHER is edgar</srai> from MY DAD * <THAT> * <TOPIC> * topic=berlin
)
Matched: MY <SET>FAMILIARNAME</SET> IS <SET>NAME</SET> <THAT> * <TOPIC> * famili
ar.aiml
1. <srai>FAMILIARPREDICATE FATHER</srai> from MY <SET>FAMILIARNAME</SET> IS <SET
>NAME</SET> <THAT> * <TOPIC> * topic=berlin)
Matched: FAMILIARPREDICATE <SET>FAMILIARNAME</SET> <THAT> * <TOPIC> * familiar.a
iml
Set predicate familiarpredicate to father in MY <SET>FAMILIARNAME</SET> IS <SET>
NAME</SET> <THAT> * <TOPIC> *
Set predicate contactname to edgar in MY <SET>FAMILIARNAME</SET> IS <SET>NAME</S
ET> <THAT> * <TOPIC> *
2. <srai>REMEMBERFAMILIARNAME</srai> from MY <SET>FAMILIARNAME</SET> IS <SET>NAM
E</SET> <THAT> * <TOPIC> * topic=berlin)
Matched: REMEMBERFAMILIARNAME <THAT> * <TOPIC> * familiar.aiml
Set predicate familiarpredicate to father in REMEMBERFAMILIARNAME <THAT> * <TOPI
C> *
3. <srai>GENDERCOMMENT</srai> from REMEMBERFAMILIARNAME <THAT> * <TOPIC> * topic
=berlin)
Matched: GENDERCOMMENT <THAT> * <TOPIC> * familiar.aiml
4. <srai>GENDERNAME edgar</srai> from GENDERCOMMENT <THAT> * <TOPIC> * topic=ber
lin)
Matched: GENDERNAME <SET>NAME</SET> <THAT> * <TOPIC> * sraix.aiml
Set var gendername to M in GENDERCOMMENT <THAT> * <TOPIC> *
Set var genderpred to F in GENDERCOMMENT <THAT> * <TOPIC> *
Set predicate father to edgar in REMEMBERFAMILIARNAME <THAT> * <TOPIC> *
Learn Pattern = WHO IS edgar
Learn Pattern = WHO IS EDGAR
Learn That = *
Learn Template = edgar is your father.
Learn Pattern = edgar
Learn Pattern = EDGAR
Learn That = *
Learn Template = Your father.
writeCertainIFCaegories learnf.aiml size= 0


He learns fast and easy. Nice to play with. I will do lots of reading this week and always keep you up to date.

Mastablasta

10 years 3 months ago

As program AB is a typical aiml interpreter and features like "google blablabla", play "highway to hell" or "map Los Angeles" are not performed, I have tested the CallMom app on my S3 with Android. Default setting is Mitsuku but you can change to other bots incl. Alice 2.0. Looks like to be the same Alice running as on program AB. Just did it for a test as I usually use my cellphone only to recharge its battery.

Compared to aiml 1.0 or 1.0.1 (both files still run on aiml 2.0!) the included aiml.files and databases are really big. Together with the features mentioned in my previous post it appears like a "small intelligence". 

Adding new aiml.files got much more easy as there is no need to change the bot.config for every singe file. Just drop the new file into the aiml-folder you are using. That´s it.

Editing the sample files is possible as it was on previous aiml-versions. But there are a lot more tags available now, link: https://docs.google.com/document/d/1wNT25hJRyupcG51aO89UcQEiG-HkXRXusukADpFnDs4/pub

The GaitoBot Editor is also working fine for aiml 2.0.

You can change the properties (thanks to kwatters!) and re-name the bot (properties.txt) and set your personal info at the predicates.txt as well. Whenever I start the program he knows I am the botmaster and he knows my name.

I´m trying to figure out how the learnf-tag works as he learns in the current session but after restart these learned things are gone and the learnf.aiml is empty. It is supposed to write these new info right into that file. Could be that the learnf is not configured correct. This is the next step for me.

If we could get this to work with MRL and InMoov......holy shi*! You will have a realy smart machine ;-)

.....Human: weather in rio....Robot: It is currently sunny, 81 Fahrenheit

 

Mastablasta

10 years 3 months ago

Lack of programming expierence and english language forces me to ask some questions.

I found this info from Richard Wallace:

Program AB will output the <oob> tags but by itself, AB doesn’t do anything with them.  Shortly we’ll be releasing an app that links AB.jar as a library.  This app post-processes the AB outputs and takes device actions based on OOB tags.

AB does have <sraix> to connect to web services though.  It also has the <system> tag to call another program.

Do I understand this correct that ProgramAB will be able to e.g. start a web browser or launch another program? I found that AB.jar but I´m still confused.


learnf.aiml is still empty, doesn´t save anything but shows "write"..... I´m still fighting.


Translate to almost any language works. Just type translate german car and you get Auto or translate french i like you my friend = J'ai comme toi mon ami.

 

Using programAB and the ALICE aiml files 2.0 makes a bot learn easy:

Human: my table is red

Robot: OK, now you can ask me "What is my table?"

Human: ice is cold

Robot: Now you can ask me: "What is cold"? and "What does ice be"?

Before you end a session with your bot you need to use wq (write and quit) and hit enter. Now you go to the aimlif folder and you will see a new aiml.file called null.aiml, Open it with notepad and you will see all the things you told the bot before. Rename the file to e.g. null1.aiml and start the bot again. Add new info to him, use wq + enter and look at the aimlif-folder again, the next null.aiml is ready! I suggest to rename every null.aiml folder after each session. E.g. you teach him things about your house name it house.aiml.

I did some tests without renaming the null.aiml. In some cases he kept the old info for 3 new sessions but after a 4th session the null.aiml only contains the trained info of session 4, training of session 1-3 was gone.In other cases the trained info was already gone after the 2nd session.

Another way for the bot to learn or you to teach the bot is using the "Category Browser - Pattern Suggestor".

You should have a file named 1000.txt at the data folder. Rename this file to sample.random.txt (this is a sample file with only 1000 inputs). Run programAB and type ab and you are at the pattern suggestor.

Now you are able to make new aiml categories without using an aiml-editor or the notepad. It sure depends what the sample.random.txt file contains. Take a closer look and you will see that all these inputs are simple questions or phrases. Time to add as many as possible!

To be able to follow the progress of using ab I did a new and empty bot with the typical folders named aiml, aimlif, config, sets, maps. Start programAB, type ab, go thru some categories, add whatever you want (for testing) and type wq. Now check your aiml and aimlif folder. :-))))

Here is a nice tuto: https://docs.google.com/document/d/1WJ3HsFR6k3Z8XdNVS9EownhIxoiUe7DbNZwNr7yVYc8/pub

Mastablasta

10 years 3 months ago

He doesn´t take some inputs. The name of my bot is Elias. If I type e.g. Elias is my boy he doesn´t take it as a learned input. In cases like this you just type learn Elias is my boy.

Mastablasta

10 years 1 month ago

Since today programAB is fully integrated in my script. Awesome!

Now I need to fill him up with words. For this I did a small GUI (first time I did a Java GUI).

All I need is words/phrases for the "ear.startListening" and of course a def. I use 2 outputs, one for a single def and the 2nd output for multi-def.

Maybe Ma.Vo. could integrate something similar the the gesturecreator.

I added a HtmlFilter service that can strip html from the program ab reponses.  (it can also add html but that's not the default use case)

Here's an example of using it from python 
 

alice = Runtime.createAndStart("alice", "ProgramAB")
alice.startSession()
htmlfilter =  Runtime.createAndStart("htmlfilter", "HtmlFilter") 
# create a Speech service
mouth = Runtime.createAndStart("mouth", "Speech")
alice.addTextListener(htmlfilter)
htmlfilter.addTextListener(mouth)
 
 
 

 

Thanks MaVo. One days work though and updated, looks a bit better now.

If someone wants the GUI, please tell me. Really a fast help for using programAB.

Let me know your bots name and I change the GUI for that name.

BillC

9 years 9 months ago

In reply to by Mastablasta

Can you send me a copy of this so I can use it? My robot name is Robbie

Thanks

Bill C

moz4r

8 years 5 months ago

Hi is it possible to change the "write AIML method" to support UTF8 encoding ?

I found a workaround, not clean but seem ok  :

import io
import glob, os
oridir=os.getcwd().replace("\\", "/")
dir=oridir+"/ProgramAB/bots/rachel/aiml"
os.chdir(dir)
for file in glob.glob("*.aiml"):
    with io.open(dir+'/'+file,'r',encoding='iso-8859-1') as f:
        text = f.read()

    with io.open(dir+'/'+file,'wb') as f:
            f.write(text.encode('utf8'))
            print file+' converted'
os.chdir(oridir)

pinchis123

8 years 4 months ago

Hello 
excuse me want to make imoov Talk or can have a conversation with someone
but when we run a code error appears programAB and python , 
not if we can help or assist with the code thanks

We've love to help, what's happening?  Can you reproduce the issue and send a "no worky"  so we can see the log file.

I suspect it's just an issue with the script

It seems like you're using version 1.0.119  ... that's a very old build.  I would recommend using build 1412  (available from the link in the shoutbox.)

That being said, the "Speech" service used google's speech API and that no longer works.  I recommend using "AcapelaSpeech"

Try changing your script to say the following:

mouth = Runtime.createAndStart("mouth", "AcapelaSpeech")

 

Hope that helps! 

 

pinchis123

8 years 3 months ago

one question if I use this code as
I do to make you connect to arduino to inmoov
can move your mouth every time you answer 
another question as I can change the good language 
if I want to speak Spanish is a link or an instruction
 I hope I can help thanks

pinchis123

8 years 3 months ago

one question if I use this code as
I do to make you connect to arduino to inmoov
can move your mouth every time you answer 
another question as I can change the good language 
if I want to speak Spanish is a link or an instruction
 I hope I can help thanks

pinchis123

8 years 3 months ago

The probe code Disculpen coming on this page ,
so I was wondering if you can change the language for example
 in Spanish hope your help thank you very much