(AIML)- 10. AIML 標籤

(AIML)- 10. AIML <think>標籤

(AIML)- 10. AIML <think>標籤

   

<think>標籤在AIML中用於存儲變量而不通知用戶。

 

語法

使用<think>標記存儲值-

<think>
<set name = “variable-name”> variable-value </set>
</think>

 

例如,請考慮以下對話。

Human: My name is Mahesh
Robot: Hello!
Human: Byeee
Robot: Hi Mahesh Thanks for the conversation!

 

示例

在D:/software/ab/bots/test/aiml目錄中創建一個文件:think.aiml,

並在D:/software/ab/bots/test/aimlif目錄中創建一個文件:think.aiml.csv。

 

文件:think.aiml

<?xml version = “1.0” encoding = “UTF-8”?>
<aiml version = “1.0.1” encoding = “UTF-8”?>
<category>
<pattern>My name is *</pattern>
<template>
Hello!<think><set name = “username”> <star/></set></think>
</template>
</category>

<category>
<pattern>Byeee</pattern>
<template>
Hi <get name = “username”/> Thanks for the conversation!
</template>
</category>

</aiml>

 

文件:think.aiml.csv –

0,My name is *,*,*, Hello! <think><set name = “username”> <star/></set></think>,think.aiml
0,Byeee,*,*, Hi <get name = “username”/> Thanks for the conversation!,think.aiml

 

執行程序

 

:目錄命令。進入目錄:D:/ software / ab並鍵入以下命令-

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

 

執行上面的示例代碼,得到以下結果-

Human: My name is Mahesh
Robot: Hello!
Human: Byeee
Robot: Hi Mahesh Thanks for the conversation!

 

 

免責聲明:

1.本影像檔案皆從網上搜集轉載,不承擔任何技術及版權問題。

2.如有下載連結僅供寬頻測試研究用途,請下載後在24小時內刪除,請勿用於商業。

3.若侵犯了您的合法權益,請來信通知我們,我們會及時刪除,給您帶來的不便,深表歉意。



發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *