AIML Basic Tags - AIML

What is AIML Basic Tags?

In this section, we are going to discuss the primary tags of AIML.

  • <aiml> − It defines the beginning and end of a AIML document.
  • <category> − It defines the unit of knowledge in Alicebot's knowledge base.
  • <pattern> − It defines the pattern to match for and what a user may input to an Alicebot.
  • <template> − It defines the response of an Alicebot to user's input.

Subsequent AIML files are used here for reference.

<aiml> tag

This tag is used to mark the start and end of an AIML document. Similar to XML, this tag has version and encoding information. version attribute has the AIML version used by ALICE chatterbot Knowledge Base, KB. We have used 1.0.1 version here and this attribute is optional.

Other attribute is Encoding which provides character sets to use in the document. We have used UTF-8 here. Atleast one <category> tag is mandatory to have in the <aiml> tag. Multiple AIML files can be created where in each file has a single <aiml> tag. Each AIML file adds at least a single knowledge unit called category to ALICE chatterbot KB.

<category> tag

<category> tag is the fundamental knowledge unit of an ALICE Bot. Each category contains −

  • User input as a sentence which is either an assertion, exclamation and question etc. Input can contain wild card characters like * and as mentioned earlier.
  • Alicebot presents the response to the user input.
  • An Optional context.

A <category> tag compulsorily should have <pattern> and <template> tags where <pattern> depicts the user input and template depicts the bot's response.

Form above, if the user types Hello Alice, then bot responds back as Hello User.

<pattern> tag

<pattern> tag is the first tag inside <category> tag and it depicts a user’s input. It can contain wild card to match more than one sentence as user input. In the example above, <pattern> tag has HELLO ALICE.

Important feature of AIML is it is case-insensitive. Hello Alice, hello alice, HELLO ALICE etc., all inputs are valid and the bot will match them against HELLO ALICE.

From above, them template contains "Hello User" which represents a robot's response to user input.

<template> tag

<template> tag contains the bot's response to the user. Inside <category> tag, <template> tag is the second tag. This tag saves data as well, call another program and gives dependent answers or delegate to other categories.

From above, the template is “Hello User” and depicts the robot’s output to the user input.

AIML Related Practice Tests

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

AIML Topics