AIML - Tag <that>

<that> Tag é usada em AIML para responder com base no contexto.

Sintaxe

<that> template </that>

Por exemplo, considere a seguinte conversa.

Human: Hi Alice! What about movies?
Robot: Do you like comedy movies?
Human: No
Robot: Ok! But I like comedy movies.

Exemplo

Crie that.aiml dentro C > ab > bots > test > aiml e that.aiml.csv dentro C > ab > bots > test > aimlif diretórios.

that.aiml

<?xml version = "1.0" encoding = "UTF-8"?>
<aiml version = "1.0.1" encoding = "UTF-8"?>
   <category>
      <pattern>WHAT ABOUT MOVIES</pattern>
      <template>Do you like comedy movies</template>  
   </category>
   
   <category>
      <pattern>YES</pattern>
      <that>Do you like comedy movies</that>
      <template>Nice, I like comedy movies too.</template>
   </category>
   
   <category>
      <pattern>NO</pattern>
      <that>Do you like comedy movies</that>
      <template>Ok! But I like comedy movies.</template>
   </category> 
   
</aiml>

that.aiml.csv

0,WHAT ABOUT MOVIES,*,*,Do you like comedy movies,that.aiml
0,YES,Do you like comedy movies,*,Nice! I like comedy movies too.,that.aiml
0,NO,Do you like comedy movies,*,Ok! But I like comedy movies.,that.aiml

Execute o programa

Abra o prompt de comando. Vamos paraC > ab > e digite o seguinte comando -

java -cp lib/Ab.jar Main bot = test action = chat trace = false

Verifique o resultado

Você verá a seguinte saída -

Human: What about movies?
Robot: Do you like comedy movies?
Human: No
Robot: Ok! But I like comedy movies.