Main concepts of the AIML language are:


Following are the important tags which are commonly used in AIML documents.

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

Following are some of the other widely used aiml tags. We'll be discussing each tag in details in coming chapters.

  • <star> : Used to match wild card * character(s) in the <pattern> Tag.
  • <srai> : Multipurpose tag, used to call/match the other categories.
  • <random> : Used <random> to get random responses.
  • <li> : Used to represent multiple responses.
  • <set> : Used to set value in an AIML variable.
  • <get> : Used to get value stored in an AIML variable.
  • <that> : Used in AIML to respond based on the context.
  • <topic> : Used in AIML to store a context so that later conversation can be done based on that context.
  • <think> : Used in AIML to store a variable without notifying the user.
  • <condition> : Similar to switch statements in programming language. It helps ALICE to respond to matching input.

AIML Vocabulary

AIML vocabulary uses words, space and two special characters * and _ as wild cards. AIML interpreter gives preference to pattern having _ than pattern having *. AIML tags are XML compliant and patterns are case-insensitive.


<aiml version = "1.0.1" encoding = "UTF-8"?>
      <pattern> HELLO ALICE </pattern>      
         Hello User!

Following are the important points to be considered −

  • <aiml> tag signifies start of the AIML document.
  • <category> tag defines the knowledge unit.
  • <pattern> tag defines the pattern user is going to type.
  • <template> tag defines the response to the user if user types Hello Alice.

Result :

User: Hello Alice
Bot: Hello User
  • developer_guide/aiml_fundamentals/start.txt
  • Last modified: 2016/11/07 13:02
  • by borja