Artificial Intelligence Markup Language (AIML) is a programming language which is an Extensible Markup Language (XML) specification used by chatbot, verbot, pandorabot, superbot, and other talking robot.
It was developed by Dr. Richard Wallace and followed by other likeminded programmers (AIML free software community). An A.L.I.C.E. (“Artificial Linguistic Internet Computer Entity”) AIML tag set was released under GNU General Public License (GPL).
There are different AIML interpreter on the Net like AIMLbot (Program #) (.NET/C#), CHAT4D edit and run (delphi) (french), ChatterBean (Java), Program D (Java, J2EE), Program O (PHP/MySQL), Program Q (C++, Qt), Program R (Ruby), Program W (Java), RebeccaAIML (C++, Java, .NET/C#, Python, Eclipse AIML editor plugin), and others. Most of AIML interpreters are open source programs.
The Loebner Prize for artificial intelligence ( AI ) at http://www.loebner.net/Prizef/loebner-prize.html is designed to implement the Turing Test which will prove the most human-like computer that “think” using the AIML.
The 2008 winner is Fred Roberts and Artificial Solutions of www.elbot.com
Now, I’ll teach you how to make your own AIML file ready to be put inside the “brain” of your robot using the “simple” Windows Notepad. This is a basic AIML coding instructable. You do not need any AIML editor or AIML file creator or even AIML parser chatbot editor. We will simply used Notepad. That’s it, you see it right, Windows Notepad!
Even if you do not want to make an AIML file, you can still use the basic AIML coding tutorial which you can find in this instructable. You can save it as XML for integrating into a Javascript-based or Flash-based website with AIML interpreter.
There are other application programs that extended the capability of Windows Notepad such as NoteTab, Crimson Editor, VIM, Boxer Software Text Editor, Rogsoft Notepad+, ProNotepad, Notepad++, Notepad 2, Metapad, NoteXpad 2.0, etc.
But in this instructable I simply used the Window XP notepad. Beware, Notepad programming can either make or break you.
This seemingly innocent application can do things that are really astounding and to some will find them shocking and alarming as shown by the following: format your computer’s HDD, lock a folder, make a digital diary, create a cycle message, shut down your computer, “hack” the administrator account, toggle caps lock button, continually pop out your computer’s CD drive, hit Enter or Backspace simultaneously, automatic keyboard typing, open Notepad continually, change text header and footer, print tree root (directory or location of file), access CMD, write virus programs, play sound, flood files, create hidden text file, make a matrix falling text effect, program chat codes (VBS), make your computer talk, make your own autorun for your CD and DVD, open and close CD-ROM, increase Internet speed, add your photo in computer properties, test your anti-virus software (active or non-active), add shutdown option in right click, make a timer, etc.
You see Notepad is not just a simple text editor as many thought it to be. You can make different types of files (not just only TXT) by means of Notepad with the following extension names: HTM, HTML, XHTML, XML, WML, CSS, JS, BAT, VBS, EXE, PHP, etc. It is so amazing, isn’t it?
Step 1: Open Notepad.
1. Start -> All Programs -> Accessories ->Notepad.
2. Start -> Run -> In the Open textbox type ”Notepad” (without quotation).
Step 2: Type the XML Specification Tag.
Since AIML is an XML specification, like HTML and XHTML, it always includes less than (<) and greater than (>) signs which are also called angle brackets. Between these two signs is an element that indicates the type of command which an AIML interpreter will follow. Collectively, this is called an AIML tag which has two kinds: an opening or start tag and a closing or end tag. The end tag contained always a forward slash (/) at the beginning of an element. Thus, typing AIML codes is like typing HTML codes (start tags, contained text and end tags).
But all your AIML file must start with tag that specifies it as an appropriate or valid extended XML subset (or dialect):
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
Or you can also use the following:
<?xml version=”1.0″ encoding=”UTF-8″?>
This will serve as the prolog to a typical AIML file. The UTF-8 in the encoding will be used in saving the file instead of ANSI, UNICODE, etc.
Step 3: Type the Parent AIML Tags.
The XML specification tag is followed by parent tags:
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<aiml>
</aiml>
Some of the AIML interpreters need the version to recognize it as a valid AIML file so you can also write the version of the AIML in the parent start tag.
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<aiml version=”1.0″>
Step 4: Type the Category Tags.
The parent tag which indicates that it is an AIML file is followed by the category tag. It must be put inside the two parent tags. The basic unit of an AIML is called category which is commonly divided into two sets of tags: pattern and template.
The pattern is the user’s expected or assumed question (the matching part) while the template is the chatbot’s prepared or programmed answer (the returning part).
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<aiml>
<category>
<pattern>WHAT IS INSTRUCTABLES.COM?</pattern>
<template>It is the world’s biggest show and tell.</template>
</category>
</aiml>
When the user asked, what is instructables.com? (an input), the AIML bot will answer: It is the world’s biggest show and tell (an output). As you can see, it is so easy. If you asked a chatbot, it will simply look for a pattern of each category and if it finds a match (ignoring the case of the contained text in the pattern) it will immediately respond based on the template of that category and thus simulating a normal conversation.
Step 5: Use Wildcards in the Pattern.
However, the matching process will match only one input what is instructables.com? and not another form of that question that may be asked by the user such as what is www.instructables.com? (with www), what is instructables? (without .com), what is intructables? (misspelled), what is instructable? (misspelled), etc. There are two basic methods to solve this problem: 1. By using wildcards in the pattern and 2. By using SRAI tag in the template.
Using wildcards is very useful in DOS commands and in searching files or data in the computer. It is also useful in AIML coding. In AIML, wildcard characters can be either an asterisk * or an underscore _.
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<aiml>
<category>
<pattern>WHAT IS INSTRUCTABLES *</pattern>
<template>Instructables.com is the world’s biggest show and tell.</template>
</category>
</aiml>
The wildcards will match infinite number of words (and, of course, input questions) like what is instructables.com? what is instructables on the Internet? what is instructables’ uniqueness to other do-it-yourself website? etc. All these questions will be answered by AIML according to the template of that matched category: Instructables.com is the world’s biggest show and tell.
Step 6: Type SRAI Tag and RANDOM Tag in the Template.
The element srai is very useful in the situation when the programmer wants to redirect different sets of questions that are similar in meaning to one answer in the above category.
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<aiml>
<category>
<pattern>WHAT IS INSTRUCTABLES *</pattern>
<template>Instructables.com is the world’s biggest show and tell.</template>
</category>
<category>
<pattern>WHAT IS THE FAMOUS DO-IT-YOURSELF WEBSITE?</pattern>
<template><srai>what is instructables <star/></srai></template>
</category>
</aiml>
When a user asked the question what is the famous do-it-yourself website? the template will be redirected to the above pattern what is instructables *? (the wildcard * must be replaced with <star/> tag in srai tags) which means that the two questions (or more if you will add another srai tags) are synonymous (rephrased questions) and thus the AIML bot has only one answer: Instructables.com is the world’s biggest show and tell. By means of srai tag, one matched pattern in a category can be redirected to other pattern of another category.
If you used srai tag for a bot to respond with one answer to many questions, there is a tag that you can use to respond with different answer to a single question which has been asked many times by a user. It is the random tag.
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<aiml>
<category>
<pattern>WHAT IS INSTRUCTABLES *</pattern>
<template>
<random>
<li>Instructables.com is the world’s biggest show and tell.</li>
<li>Instructables.com is the famous do-it-yourself website on the Internet.</li>
<li>Instructables.com is the haven of inventors, innovators, hackers, tech geek, etc. on the Internet.</li>
</random>
</template>
</category>
<category>
<pattern>WHAT IS THE FAMOUS DO-IT-YOURSELF WEBSITE?</pattern>
<template><srai>what is instructables <star/></srai></template>
</category>
</aiml>
The user’s question with the form what is instructables * will be answered randomly with the following list (or list item as shown by the <li>&</li> tags): Instructables.com is the world’s biggest show and tell.
Instructables.com is the famous do-it-yourself website on the Internet.
Instructables.com is the haven of inventors, innovators, hackers, tech geek, etc. on the Internet.
The answer will be given by an AIML bot one at a time as the same pattern of question is being repeated by the user.
Step 7: Formally Convert Your Text File to AIML File.
Notepad will always saved your file with the extension name txt unless you change it by naming your file with extension name of aiml.
Here’s how you can do it. Select File in the menu by clicking it and the submenu will appear. Choose Save As and go to the folder of a bot brain in which you want to save your file by clicking the downward button of Save in. Name your file with the extension name AIML in the textbox of File name. Example: Instructables.aiml
In the drop-down menu of Save as Type choose All Files. Change the encoding to UTF-8. Then, save it by clicking the save button. That’s it. You have already created an AIML file via Notepad!
Step 8: Conclusion
There are still many AIML tags that can be used in making and editing an AIML file. Don’t forget to use AIML variables which are really fascinating.
This article has been published from the source link without modifications to the text. Only the headline has been changed.