2016-03-08 24 views
2

添加'!'後,我無法找到解決以下問題的方法。在它<that>標記不能用標點符號嗎?

<category> 
     <pattern>test</pattern> 
     <template>testing stuff.</template> 
    </category> 
    <category> 
     <pattern>gg</pattern> 
     <that> testing stuff </that> 
     <template>works</template> 
    </category> 

中頻上面的代碼工作得很好,但是當你將其更改爲:

<category> 
     <pattern>test</pattern> 
     <template>testing! stuff.</template> 
    </category> 
    <category> 
     <pattern>gg</pattern> 
     <that> testing stuff </that> 
     <template>works</template> 
    </category> 

它只是停止工作。

我該如何獲得第二塊代碼?機器人說什麼必須包括這個'!'在它的中間

編輯:

我發現了一個辦法解決它通過執行以下操作:「!」

<category> 
     <pattern>test</pattern> 
     <template>testing! stuff.</template> 
    </category> 
    <category> 
     <pattern>gg</pattern> 
     <that> stuff </that> 
     <template>works</template> 
    </category> 

它的工作原理,因爲在屬性文件中它的配置看作爲一個分線器,但似乎有點意外...有沒有適當的方法來處理這個問題?

+1

嗨了很好的解釋!對不起,請在這裏發表評論,但沒有找到任何其他方式。根據你的問題,你已經有標籤工作。那麼,您可以在這裏回答我的問題嗎? http://stackoverflow.com/questions/38646903/pyaiml-does-not-respond-on-that-tag。謝謝。 – sparrow

回答

0

這是AIML <that>標籤應該工作的方式。如果機器人的最後一個響應由多個句子組成,則標籤只與機器人的最後一個句子匹配。句號和驚歎號是句子結束符,所以<that>STUFF</that>的工作原因是因爲你的機器人的最後回覆是兩句話(測試!東西。)。檢查比賽時刪除標點符號,因此'stuff'匹配。

還有就是<that>http://docs.pandorabots.com/aiml/that/