This documentation supports the 20.02 version of Live Chat. To view an earlier version, select the version from the Product version menu.

AIML structure


Artificial Intelligence Markup Language (AIML) consists of a series of elements, similar to XML and HTML elements. Every AIML file must contain the <aiml> element to indicate the beginning and end of the AIML document. The AIML file also contains the following standard elements:

  • <category>: The element that indicates the beginning of the unit of knowledge. Each category section contains a question and a response.
  • <pattern>: The element that contains a question that a user might ask. Pattern matching and wildcard symbols are used to formulate the pattern entry.
  • <template>: The element that contains the answer to the question specified in the pattern element. This element can also contain a link to a URL or website.

The AIML language consists of words, spaces, and wildcard symbols (_ and *). Words can contain letters and numbers only; special characters are not permitted. Words are separated by a single space, and wildcard characters function like words.

In addition to the standard elements, you can enhance the functionality of your responses with the following common elements:

  • <srai>: Used with the <template> element, the <srai> element points to a pattern (question) that contains the template (answer) to be used. Use of this element allows one answer to be coded and referenced by multiple questions. For an example, see Specifying answers in the <template> element of AIML.
  • <random>: Used with the <template> element, the <random> element indicates that the template answer is randomly used. For example, your AIML file might include a question with several answers. When you specify the answers as random, one of the answers appears randomly when the user asks the question. The user can get a different answer every time. The random element must contain a <li> element.
  • <li>: Used with the <random> element, <li> element enables you to list out several responses to a question that are presented to the user randomly. This element is similar to the HTML <li> element. For an example, see Specifying-answers-in-the-template-element-of-AIML

Use the following topics to configure your AIML responses:

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*