AIML

2017-12-08

Understanding the concept behind 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).



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

Example

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

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

</template>

</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

<!DOCTYPE html>
<html>
<body>

<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>
<var>Variable</var>

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

<aiml version=”1.0">

<category><pattern>Hi</pattern>

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

</category>

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

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

</category>

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

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

</category>

<category><pattern>ok </pattern>

<template>PLEASE!!! </template>

</category>

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


Share: