< condition> 标记类似于编程语言中的switch语句.它有助于ALICE响应匹配的输入.
<condition name = "variable-name" value = "variable-value"/>
例如,请考虑以下对话.
Human: How are you feeling today Robot: I am happy!
这里我们存储了 happy 作为ALICE的状态,这就是"我很开心!"的回应方式.
在C > ab > bots > test > aiml中创建condition.aiml 和在C > ab > bots > test > aimlif中创建condition.aiml.csv .
0,HOW ARE YOU FEELING TODAY,*,*,
<think>
<set name = "state"> happy</set>
</think>
<condition name = "state" value = "happy">I am happy!</condition>
<condition name = "state" value = "sad">I am sad!</condition>,condition.aiml
打开命令提示符.转到 C> ab> 并输入以下命令 :
java -cp lib/Ab.jar Main bot = test action = chat trace = false
您将看到以下输出 :
Human: How are you feeling today Robot: I am happy!