Aiml-star-tag

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

AIML-<star>タグ

*<star>* タグは、<pattern>タグ内のワイルドカード***文字に一致させるために使用されます。

構文

<star index = "n"/>
*n* は、<pattern>タグのユーザー入力内の*の位置を示します。

次の例を考慮してください-

<category>
   <pattern> A *is a* . </pattern>

   <template>
      When a <star index = "1"/> is not a <star index = "2"/>?
   </template>

</category>

ユーザーが「マンゴーは果物です」と入力した場合。ボットは「マンゴーが果物ではないとき」と応答します。

*C> ab>ボット>テスト> aiml* 内にstar.aimlを作成し、 *C> ab>ボット> test> aimlif* ディレクトリ内にstar.aiml.csvを作成します。

star.aiml

<?xml version = "1.0" encoding = "UTF-8"?>
<aiml version = "1.0.1" encoding = "UTF-8"?>

   <category>
      <pattern>I LIKE *</pattern>
      <template>
         I too like <star/>.
      </template>
   </category>

   <category>
      <pattern>A *IS A* </pattern>
      <template>
         How <star index = "1"/> can not be a <star index = "2"/>?
      </template>
   </category>

</aiml>

star.aiml.csv

0,I LIKE *,*,*,I too like <star/>.,star.aiml
0,A *IS A* ,*,*,How <star index = "1"/> can not be a <star index = "2"/>?,star.aiml

プログラムを実行する

コマンドプロンプトを開きます。 C> ab> に移動し、次のコマンドを入力します-

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

結果を確認する

次の出力が表示されます-

Human: I like mango
Robot: I too like mango.
Human: A mango is a fruit
Robot: How mango can not be a fruit?

<star index = "1"/>は、多くの場合<star/>として使用されます