2

添加“!”后,我无法找到解决以下工作的方法 在它的中间

<category>
      <pattern>test</pattern>
      <template>testing stuff.</template>
  </category>
  <category>
        <pattern>gg</pattern>
        <that> testing stuff </that>
        <template>works</template>
  </category> 

上面的代码工作得很好,但是当你把它改成:

<category>
      <pattern>test</pattern>
      <template>testing! stuff.</template>
  </category>
  <category>
        <pattern>gg</pattern>
        <that> testing stuff </that>
        <template>works</template>
  </category> 

它只是停止工作。

那我如何让第二段代码工作呢?机器人所说的必须包含这个“!” 在它的中间

编辑:

我通过执行以下操作找到了解决方法:

<category>
      <pattern>test</pattern>
      <template>testing! stuff.</template>
  </category>
  <category>
        <pattern>gg</pattern>
        <that> stuff </that>
        <template>works</template>
  </category> 

它可以工作,因为在属性文件中它被配置为看到“!” 作为分线器,但似乎有点意外......有什么合适的方法来处理这个问题吗?

4

1 回答 1

0

这是 AIML<that>标签应该工作的方式。如果机器人的最后一个响应包含多个句子,则该标签仅匹配机器人的最后一个句子。句号和感叹号是句子终止符,所以之所以<that>STUFF</that>有效是因为您的机器人的最后响应是两个句子(测试!等等)检查匹配时删除标点符号,因此 'stuff' 匹配。

https://pandorabots.com/docs/aiml-reference/#that有很好的<that>解释

于 2017-10-26T10:32:36.527 回答