加入收藏 | 设为首页 | 会员中心 | 我要投稿 汽车网 (https://www.0577qiche.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 教程 > 正文

AIML <star>标记的用法

发布时间:2023-09-19 14:34:20 所属栏目:教程 来源:
导读:<star>标签用于匹配<pattern>标签中的通配符*字符。

语法

<star index = n/>
n表示<pattern>标签中用户输入中*的位置。

参考以下示例 -

<category>
<pattern> A * is a *. </pattern>
<templat
<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>
如果用户输入A mango is a fruit.。 那么机器人会回答:When a mango is not a fruit?

示例
在D:/software/ab/bots/test/aiml目录中创建一个文件:star.aiml,并在D:/software/ab/bots/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
执行程序
打开命令提示符。 转到D:/software/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?
 

(编辑:汽车网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章