A dive into the language of chatbots : AIML

Oct 18, 2022by, Maheswari C S

Machine Learning

Have you ever filed a complaint on Google or maybe you have come across an interactive AI app? The term “Chatbot” is nothing new to the current milieu. Almost everyone who actively uses the internet knows what a chatbot is. Simply put, it is software that analyzes user-given conversations or texts and provides an appropriate response. They are programmed to respond in a manner similar to that of a human being. These digital assistants perform basic customer service operations and offer a variety of services, all through the medium of texting. But how does a chatbot work? What is its language? No, not the language in which the chatbot responds, but the language in which the chatbot understands.

That’s where AIML comes into the picture. AIML has a variety of applications, the most common of which is the chatbot.

What is AIML?

You might confuse it with Artificial Intelligence and Machine Learning. Although AIML works on the principles of AI and ML, the acronym actually stands for Artificial Intelligence Markup/Modeling Language. AIML is an XML dialect commonly used to create natural language software agents such as Chatbots. It establishes the chatbot’s personality and determines its conversational abilities using a set of rules. It is used in connection with a linguistic communication understanding processor, which examines and responds to text queries using these AIML rules. The more rules are added to AIML, the more intelligent a Chatbot becomes. This is essential in giving the chatbot a human-like touch.

AIML chatbots fall under the category of rule-based chatbots which typically work on the basis of pre-written keywords and use regular expressions or other types of string analysis. If the user types in a query without using a single keyword, the chatbot might fail to recognize it. However, with AIML some level of self-learning is involved as this language acts as the brain of the chatbot.

Before we move on to AIML Chatbots, let us take a look at AIML Tags.

What is an AIML Tag?

AIML is a tag-based language. The aim of this language is to facilitate easy dialogue modelling using the stimulus-response method. AIML describes a data object class known as AIML objects that models conversation patterns. They are basically language tags, and each tag serves as an identifier for creating code snippets and inserting commands to be understood by the chatbot. An AIML command is made up of a start tag (<command >), a closing tag (</command >), and a text (ListOfParameters). The basic structure of an AIML object/command/ tag is as follows:

<command> ListOfParameters </command>

The AIML vocabulary is made up of words, spaces and the special characters “*” and “_” called Wildcards which are used for replacing a string. AIML is an interpreted language in which software called an interpreter reads, interprets, and executes each statement. Under the different AIML object tags, ‘category’, ‘pattern’, and ‘template’ are the most significant (pattern and template come under the category tag). Let us take a brief look at them.

  • Category Tag: <category> defines the dialogue of the chatbot knowledge base or the chatbot KB. Each category in the chatbot KB represents a fundamental unit of knowledge and has three parts: a) user input in the form of a sentence (assertion, inquiry, exclamation, etc.) that also includes wildcard characters like * and _ b) the chatbot’s reaction to the user input and c) an optional context.
  • Pattern Tag : <pattern> specifies the user input. In each <category>, the first element to be set is the <pattern> tag. AIML pattern language employs only words, spaces, and wildcard symbols. Letters and numerals are permitted, but no additional characters can be used. AIML interpreter gives importance to categories containing patterns with the wildcard “_” over “*”. The pattern language is case-insensitive. In addition, single spaces would separate the words, and wildcards would replace parts of a sentence.
  • Template Tag: <template> specifies how the chatbot should react to the user’s input i.e. the output produced by the chatbot. It must be written after <pattern> within <category>. This tag binds the majority of the chatbot’s knowledge and allows it to save data, launch other apps, deliver conditional responses, and delegate to other categories. The template could consist of nothing more than text or variables. It includes general text formatting, conditional responses (if-then/else), and random responses. They can also redirect to different patterns using a component known as Symbolic Reduction in Artificial Intelligence (srai).For the AIML object/tag to be precise, it must adhere to the XML standards. Object names, for example, cannot begin with a number, are case-sensitive, and do not allow blank spaces. The text in the tag is written in capital letters in the KB. This factor aids in altering the user’s text in order to standardize the sentences.

How does AIML develop chatbots?

AIML-run chatbots are developed with the technological and theoretical infrastructure of Pattern Recognition. Pattern Recognition helps create computer systems modelled after human dialogues. It is built on a typical stimulus-response method where the stimulus is the input given by the user and the reaction is the output generated by the software. The AIML language is used to create the knowledge base or KB of the chatbot. The first ever chatbot using this method was developed by Richard Wallace and is called A.L.I.C.E. (Artificial Linguistic Internet Computer Entity). AIML when used together with Pattern Recognition makes it easy to implement since AIML, being an XML language, can easily create dialogues using tags. Computational systems assist developers in creating codes and distributing them to the Web. The fact that most of the chatbots are made with an open software license makes it easy for new chatbots to be made from old ones. Therefore, the source code, documentation, and examples of existing chatbots can be reused or customized for a new project. A.L.I.C.E is the best example of a free software project on which many other chatbots were created.

Chatbots can have a wide range of applications, some of which include customer service, social media platforms, and conversational AI. AIML-based chatbots are commonly used in domain-specific industries where they handle domain-related questions. A characteristic of AIML chatbots is that it will give out a default remark, something along the lines of “Sorry, I cannot understand your request.”, if the input pattern is not satisfactory. With detailed AIML rules, developers can create a chatbot that is sophisticated enough to handle a variety of requests.

Have projects in mind that include complex tech? We can be your best partner. Connect with us here.

Disclaimer: The opinions expressed in this article are those of the author(s) and do not necessarily reflect the positions of Dexlock.

  • Share Facebook
  • Share Twitter
  • Share Linkedin