模式中如何有多个通配符 [英] How can I have more than one Wildcard in a pattern

查看:141
本文介绍了模式中如何有多个通配符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Pandoabots中使用AIML中的XML在AI聊天机器人上工作,我陷入困境,如何在不破坏模式的情况下拥有多个通配符。

I am working on a AI chat bot in Pandoabots using XML in AIML and I am getting stuck on how you would have more than one wildcard in a pattern without it breaking.

在这里,我试图在Cardiff之前存储一个值,例如 where,在Cardiff之后存储一个值,我希望该程序接受诸如 please,之类的任何关键字?和机器人。
但是,当我这样做时,会显示默认值我对此没有答案。但是,并非所有问题的末尾都会有 please或?。

Here I am trying to store a value like "where" before Cardiff and after Cardiff I want the program to pick up on any keywords like "please","?" and "bot". However when I do this is displays the default value which is "I have no answer for that. However not all the questions will have "please" or "?" at the end.

 <category>
     <pattern>* Cardiff *</pattern>
     <template><think><set name = "place"><star/></set><set name = "others"><star/></set></think>
         <condition name = "place">
             <li name ="Where">In wales</li>
         </condition>
     </template> 
 </category>

我一直在研究如何解决这个问题,但我没有找到解决方案。

I have been doing research on how to tackle this problem and I have not found a solution to it.

推荐答案

*通配符表示至少1个字,因此如果有人说,则不会被触发, 加的夫在哪里,因为加的夫后面没有1个或多个单词。您需要用#通配符替换它,以表示ze ro或更多字词,因此加的夫在哪里和加的夫在哪里将激活该类别。您不需要知道第二个通配符的值。

The * wildcard indicates at least 1 word and so won't be triggered if someone says, "Where is Cardiff", as there isn't 1 or more words after Cardiff. You need to replace this with the # wildcard which indicates zero or more words, so "Where is Cardiff" and "Where is Cardiff please" will activate the category. You don't need to know the value of the second wildcard.

此外,您需要更改条件以检查 where is,而不仅仅是 where

Also, you need to change your condition to check for "where is" rather than just "where"

 <category>
     <pattern>* Cardiff #</pattern>
     <template>
         <think><set name="place"><star/></set></think>
         <condition name="place">
             <li name ="Where is">In wales</li>
         </condition>
     </template> 
 </category>

这篇关于模式中如何有多个通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆