English 中文(简体)
AIML - <set>, <get> Tags
  • 时间:2024-11-05

AIML - <set>, <get> Tags


Previous Page Next Page  

<set>;get> 标签被用于与《反洗钱法》中的变量合作。 变量可以是预先界定的变量,也可以是方案制定者生成的变量。

Syntax

tag、set和gt;tag被用于在变数中设定价值。

<set name = "variable-name"> variable-value </set>

tag、植被和特;tag被用于从变数中获得价值。

<get name = "variable-name"></get>

例如,审议以下谈话。

Human: I am Mahesh
Robot: Hello Mahesh!
Human: Good Night
Robot: Good Night Mahesh! Thanks for the conversation!

Example

C > ab > bots > test >getl和 setget.aiml.csv within C > ab > bots > test > aimingpf .

setget.aiml

<?xml version = "1.0" encoding = "UTF-8"?>
<aiml version = "1.0.1" encoding = "UTF-8"?>
   <category>
      <pattern>I am *</pattern>
      <template>
         Hello <set name = "username"> <star/>! </set>
      </template>  
   </category>  
   
   <category>
      <pattern>Good Night</pattern>
      <template>
         Hi <get name = "username"/> Thanks for the conversation!
      </template>  
   </category>  
   
</aiml>

setget.aiml.csv

0,I am *,*,*, Hello <set name = "username"> <star/>! </set>,setget.aiml
0,Good Night,*,*, Hi <get name = "username"/> Thanks for the conversation!,setget.aiml

Execute the Program

立即开放指挥。 Go to C > ab >和打下以下指挥系统:

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

Verify the Result

你将看到以下产出:

Human: I am Mahesh
Robot: Hello Mahesh!
Human: Good Night
Robot: Good Night Mahesh! Thanks for the conversation!
Advertisements