Navigate back to the homepage

Understanding the concept behind AIML

Shodipo Ayomide
December 8th, 2017 · 1 min read

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

Example

1<category><pattern>WHO IS ABRAHAM LINCOLN</pattern>
2
3<template>was a great President of the United States, during the American Civil War.<br/>
4
5</template>
6
7</category>

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

1<!DOCTYPE html>
2<html>
3<body>
4
5<em>Emphasized text</em><br>
6<strong>Strong text</strong><br>
7<code>A piece of computer code</code><br>
8<samp>Sample output from a computer program</samp><br>
9<kbd>Keyboard input</kbd><br>
10<var>Variable</var>
11
12</body>
13</html>
1<?xml version=”1.0" encoding=”UTF-8"?>
2
3<aiml version=”1.0">
4
5<category><pattern>Hi</pattern>
6
7<template>Hi, I’m Oscar I was developed by Shodipo Ayomide 2017, <br/>How may I be of help</template>
8
9</category>
10
11<category><pattern>What are you </pattern>
12
13<template>I said, My name is Oscar and I was developed by Shodipo Ayomide ok! </template>
14
15</category>
16
17<category><pattern>Why are you rude </pattern>
18
19<template>Oh sorry, Please forgive my manners do not report me PLEASE!!! </template>
20
21</category>
22
23<category><pattern>ok </pattern>
24
25<template>PLEASE!!! </template>
26
27</category>
28
29</aiml>

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! 🔥🚀

Join the Newsletter

More articles from Shodipo Ayomide

unStack Workshop on React.js to Kick Off Soon in Lagos

Free unStack Workshop on React.js Coming Up in Lagos on March 20-21 2020, learn about the tracks, agenda, and speakers at the free unStack Workshop to be held in Lagos on March 20-21 2020.

March 15th, 2020 · 1 min read

Getting started with Raspberry Pi 3

Raspberry Pi 3 is a small computer the size of an ATM card which was built by the Raspberry Pi foundation and has the ability to connect with external devices and networks via wireless LAN and Bluetooth connectivity.

May 7th, 2019 · 3 min read
© 2017–2020 Shodipo Ayomide
Link to $https://twitter.com/developerayo_Link to $https://github.com/developerayoLink to $https://instagram.com/developerayoLink to $https://www.linkedin.com/in/shodipo-ayomideLink to $https://dev.to/developerayo