Open In App

AIML <that> Tag

Last Updated : 16 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

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:

  • <pattern>: This tag defines the pattern of user input that the rule or pattern will respond to. It’s what the user might say or ask.
  • <template>: This contains the possible responses that the chatbot can give. It could include variations or random responses for variety.
  • <that>: It specifies the context pattern under which the rule defined by <pattern> should be applied. It helps in managing the context of the conversation.

Example: Directory for ‘that.aiml’

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

XML




<?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 :

GFG_article

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.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads