2017-10-08 37 views
1

我試圖讓我的機器人根據答案提出問題並回復。這個問題是隨機的,以「你好嗎?」結尾。在AIML中使用<that>並加* *

<aiml version = "1.0.1" encoding = "UTF-8"> 
    <category> 
     <pattern>HI</pattern> 
     <template> 
      <random> 
       <li>Hi! How are you?</li> 
       <li>Hello there. How are you?</li> 
       <li>Greeings. And how are you?</li> 
      </random> 
     </template> 
    </category> 

    <category> 
     <pattern>GOOD</pattern> 
     <that>* how are you?</that> 
     <template>Happy to hear that.</template> 
    </category> 


    <category> 
     <pattern>*</pattern> 
     <template>Can you rephrase that?</template> 
    </category> 

</aiml> 

如果我回復'好',機器人將不會理解並回復'您能改述嗎?'。

+0

你使用這個AIML文件與python代碼來傳遞輸入? –

回答

1

嘗試從that標記中刪除問號。在AIML版本1中,所有模式和'that'標籤只能使用星號(*)下劃線(_)或大寫字母。大寫字母更符合實際需求。