Open In App

AIML <that> Tag

AIML, which stands for Artificial Intelligence Markup Language, is like the language that chatbots and virtual assistants use to understand and respond to us. It’s the behind-the-scenes code that makes them talk to us in a way that feels natural.

Imagine you’re chatting with a friend. If they ask, “How’s the weather?” and you just met them, your answer might be different than if you’ve been talking about the weather for a while. The <that> tag in AIML is like the memory of our chatbot—it helps it remember what we were talking about.



Syntax:

<category>
<pattern>USER_INPUT_PATTERN</pattern>
<template>
<!-- Response template -->
</template>
<that>CONTEXT_PATTERN</that>
</category>

Attributes:



Example: Directory for ‘that.aiml’

C:\ab\bots\test\aiml\that.aiml




<?xml version="1.0" encoding="UTF-8"?>
<aiml version="1.0.1" encoding="UTF-8">
  
   <!-- Category 1: Initiating Weather Chat -->
   <category>
      <pattern>HOW ABOUT THE WEATHER</pattern>
      <template>Do you enjoy sunny days?</template>  
   </category>
     
   <!-- Category 2: Responding to a Positive Weather Preference -->
   <category>
      <pattern>YES</pattern>
      <that>Do you enjoy sunny days</that>
      <template>Great! Sunshine always brings positive vibes.</template>
   </category>
     
   <!-- Category 3: Responding to a Negative Weather Preference -->
   <category>
      <pattern>NO</pattern>
      <that>Do you enjoy sunny days</that>
      <template>That's alright. Rainy days have their own charm.</template>
   </category
     
</aiml>

Directory for ‘that.aiml.csv‘:

C:\ab\bots\test\aimlif\that.aiml.csv
UserResponse,Pattern,That,Template,FileName
YES,*,Do you enjoy sunny days,Great! Sunshine always brings positive vibes.,that.aiml
NO,*,Do you enjoy sunny days,That's alright. Rainy days have their own charm.,that.aiml

Output :

The `<that>` tag is like the memory of our chatbot. It helps our virtual companions remember what we said before, making our conversations feel natural and friendly. AIML, with its <that> tag magic, turns our interactions with chatbots into smart, enjoyable talks.


Article Tags :