Aiml-think-tag

提供:Dev Guides
移動先:案内検索

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!

*C> ab>ボット>テスト> aiml* 内にthink.aimlを作成し、 *C> ab>ボット>テスト> 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

プログラムを実行する

コマンドプロンプトを開きます。 C> 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!