2016-03-08 57 views
2

添加'!'后,我无法找到解决以下问题的方法。在它<that>标记不能用标点符号吗?

<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> 

它的工作原理,因为在属性文件中它的配置看作为一个分线器,但似乎有点意外...有没有适当的方法来处理这个问题?

+1

嗨了很好的解释!对不起,请在这里发表评论,但没有找到任何其他方式。根据你的问题,你已经有标签工作。那么,您可以在这里回答我的问题吗? http://stackoverflow.com/questions/38646903/pyaiml-does-not-respond-on-that-tag。谢谢。 – sparrow

回答

0

这是AIML <that>标签应该工作的方式。如果机器人的最后一个响应由多个句子组成,则标签只与机器人的最后一个句子匹配。句号和惊叹号是句子结束符,所以<that>STUFF</that>的工作原因是因为你的机器人的最后回复是两句话(测试!东西。)。检查比赛时删除标点符号,因此'stuff'匹配。

还有就是<that>http://docs.pandorabots.com/aiml/that/