< set> 和< get> 标记用于处理AIML中的变量.变量可以是预定义变量或程序员创建的变量.
语法
< set> tag用于设置变量中的值.
variable-value
< get> tag用于从变量中获取值.
例如,请考虑以下对话.
Human: I am MaheshRobot: Hello Mahesh!Human: Good NightRobot: Good Night Mahesh! Thanks for the conversation!
示例
在 C > ab > bots > test > aiml 内创建setget.aiml 和在C > ab > bots > test > aimlif 目录创建setget.aiml.csv .
setget.aiml
I am * Hello! Good Night HiThanks for the conversation!
setget.aiml.csv
0,I am *,*,*, Hello,setget.aiml0,Good Night,*,*, Hi ! Thanks for the conversation!,setget.aiml
执行程序
打开命令提示符.转到 C> ab> 并输入以下命令 :
java -cp lib/Ab.jar Main bot = test action = chat trace = false
验证结果
您将看到以下输出 :
Human: I am MaheshRobot: Hello Mahesh!Human: Good NightRobot: Good Night Mahesh! Thanks for the conversation!