AIML - tag <think>
<think> Tag jest używany w AIML do przechowywania zmiennej bez powiadamiania użytkownika.
Składnia
Zapisz wartość za pomocą tagu <think>
<think> 
   <set name = "variable-name"> variable-value </set>
</think>Weźmy na przykład pod uwagę następującą rozmowę.
Human: My name is Mahesh
Robot: Hello!
Human: Byeee
Robot: Hi Mahesh Thanks for the conversation!Przykład
Stwórz think.aiml inside C > ab > bots > test > aiml i think.aiml.csv w środku C > ab > bots > test > aimlif katalogi.
think.aiml
<?xml version = "1.0" encoding = "UTF-8"?>
<aiml version = "1.0.1" encoding = "UTF-8"?>
   <category>
      <pattern>My name is *</pattern>
      <template>
         Hello!<think><set name = "username"> <star/></set></think>
      </template>  
   </category>  
   
   <category>
      <pattern>Byeee</pattern>
      <template>
         Hi <get name = "username"/> Thanks for the conversation!
      </template>  
   </category>  
   
</aiml>think.aiml.csv
0,My name is *,*,*, Hello! <think><set name = "username"> <star/></set></think>,think.aiml
0,Byeee,*,*, Hi <get name = "username"/> Thanks for the conversation!,think.aimlWykonaj program
Otwórz wiersz polecenia. Iść doC > ab > i wpisz następujące polecenie -
java -cp lib/Ab.jar Main bot = test action = chat trace = falseSprawdź wynik
Zobaczysz następujący wynik -
Human: My name is Mahesh
Robot: Hello!
Human: Byeee
Robot: Hi Mahesh Thanks for the conversation!