📜  AIML-标签

📅  最后修改于: 2020-11-10 04:22:55             🧑  作者: Mango


标签在AIML中用于存储上下文,以便以后可以基于该上下文进行对话。通常,在“是/否”类型对话中使用标记。它有助于AIML搜索在主题上下文内编写的类别。

句法

使用标记定义主题


使用标签定义类别


   
      ...
        

例如,考虑以下对话。

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

在这里,机器人以“电影”为主题进行响应。

C> ab> bots> test> aiml内创建topic.aiml,并在C> ab> bots> test> aimlif目录内创建topic.aiml.csv。

topic.aiml



   
      LET DISCUSS MOVIES
        
   
   
   
      
          * 
         
      
      
      
          I LIKE WATCHING COMEDY! 
         
      
      
   

that.aiml.csv

0,LET DISCUSS MOVIES,*,*,Yes movies,topic.aiml
0,*,*,movies,Watching good movie refreshes our minds.,topic.aiml
0,I LIKE WATCHING COMEDY!,*,movies,I like comedy movies too.,topic.aiml

执行程序

打开命令提示符。转到C> ab>并键入以下命令-

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

验证结果

您将看到以下输出-

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