Understanding the concept behind AIML

developerayo profile image Shodipo Ayomide ・2 min read

main image

What is AIML?

AIML or Artificial Intelligence Markup Language is an XML base language used for creating chatbots(AI), it is always saved with the extension (.aiml).

The tag always used in AIML used to specify a new function is the category tag which has two other tags running under it that i s the pattern tag and the template tag. Inside the template tage we cound also have other tags inbute “Depnds on the type of BOT you are building” eg set, br/, srai…etc

But note something just as in HTML or any other programming Language or Scripting Language Even Markup Languages have a closing tag, here in AIML there is really not much a difference, the closing tags are /category, /template, /srai>, /set…etc


<category><pattern>WHO IS ABRAHAM LINCOLN</pattern>

<template>was a great President of the United States, during the American Civil War.<br/>



When the user inputs this in on some very close to this, the bot will respond to the input

“WHO IS ABRAHAM LINCOLN” with the response “was a great President of the United States, during the American Civil War.”.

Now lets create a simple bot using AIML

<!DOCTYPE html>

<em>Emphasized text</em><br>
<strong>Strong text</strong><br>
<code>A piece of computer code</code><br>
<samp>Sample output from a computer program</samp><br>
<kbd>Keyboard input</kbd><br>


<?xml version=”1.0" encoding=”UTF-8"?>

<aiml version=”1.0">


<template>Hi, I’m Oscar I was developed by Shodipo Ayomide 2017, <br/>How may I be of help</template>


<category><pattern>What are you </pattern>

<template>I said, My name is Oscar and I was developed by Shodipo Ayomide ok! </template>


<category><pattern>Why are you rude </pattern>

<template>Oh sorry, Please forgive my manners do not report me PLEASE!!! </template>


<category><pattern>ok </pattern>

<template>PLEASE!!! </template>



Now lets explain Templates

A template specifies the response to a matched pattern.

I am Oscar by name

A template may use variables such as

You told me you are get name=”user-age” years old
which will fetch the users age if in db.

Thanks for reading! 🔥🚀

Posted on by:

developerayo profile

Shodipo Ayomide


Senior Developer Advocate at Fleek HQ 🥑 • Software Engineer • Media Developer Expert @cloudinary • Lead:@unstack_, @oscafrica, @react_summit, @naijahacks • Best-Friend @NikkitaFTW 🔥


Editor guide