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!
例
内部にthink.aimlを作成します C > ab > bots > test > aiml とthink.aiml.csv内部 C > ab > bots > test > aimlif ディレクトリ。
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!