English 中文(简体)
AIML - <condition> Tag
  • 时间:2024-11-05

AIML - <condition> Tag


Previous Page Next Page  

<condition> 达格与改用方案拟定语言。 它帮助ALICE对相应的投入作出反应。

Syntax

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

例如,审议以下谈话。

Human: How are you feepng today
Robot: I am happy!

在此,我们储存了happy,作为ALICE的状态,即它如何反应为“I amyan”。

Example

创造条件。 目标:C > ab > bots > test >getl and conditions.aiml.csv within C > ab > bots > test > aimingpf .

condition.aiml

<?xml version = "1.0" encoding = "UTF-8"?>
<aiml version = "1.0.1" encoding = "UTF-8"?>
   <category>
      <pattern> HOW ARE YOU FEELING TODAY </pattern>
      
      <template>
         <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>
      </template>
      
   </category>
</aiml>

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

Execute the Program

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

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

Verify the Result

你将看到以下产出:

Human: How are you feepng today
Robot: I am happy!
Advertisements