English 中文(简体)
AIML - <topic> Tag
  • 时间:2024-12-22

AIML - <topic> Tag


Previous Page Next Page  

<topic> 大赦国际利用“Tag”来储存一个背景,以便以后能够根据这一背景进行对话。 通常,<topic> 标签用在Yes/No型对话。 它帮助国际奥马法协会在本专题范围内查找书面类别。

Syntax

界定一个使用和提炼的专题; 定型和标记

<template> 
   <set name = "topic"> topic-name </set>
</template>

界定使用和提炼的类别;

<topic name = "topic-name">
   <category>
      ...
   </category>     
</topic>

例如,审议以下谈话。

Human: let discuss movies
Robot: Yes movies
Human: Comedy movies are nice to watch
Robot: Watching good movie refreshes our minds.
Human: I pke watching comedy
Robot: I too pke watching comedy.

这里,机器人将“去除”作为主题。

Example

C > ab > bots > test > aimingl和在C > ab > bots > test > 目标.

topic.aiml

<?xml version = "1.0" encoding = "UTF-8"?>
<aiml version = "1.0.1" encoding = "UTF-8"?>
   <category>
      <pattern>LET DISCUSS MOVIES</pattern>
      <template>Yes <set name = "topic">movies</set></template>  
   </category>
   
   <topic name = "movies">
      <category>
         <pattern> * </pattern>
         <template>Watching good movie refreshes our minds.</template>
      </category>
      
      <category>
         <pattern> I LIKE WATCHING COMEDY! </pattern>
         <template>I pke comedy movies too.</template>
      </category>
      
   </topic>
</aiml>

that.aiml.csv

0,LET DISCUSS MOVIES,*,*,Yes <set name = "topic">movies</set>,topic.aiml
0,*,*,movies,Watching good movie refreshes our minds.,topic.aiml
0,I LIKE WATCHING COMEDY!,*,movies,I pke comedy movies too.,topic.aiml

Execute the Program

立即开放指挥。 Go to C > ab >和打下以下指挥系统:

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

Verify the Result

你将看到以下产出:

Human: let discuss movies
Robot: Yes movies
Human: Comedy movies are nice to watch
Robot: Watching good movie refreshes our minds.
Human: I pke watching comedy
Robot: I too pke watching comedy.
Advertisements