AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

wild cards allowed in <condition> tags in AIML?
 
 

I tried the following:

<li><name>goal-component</name><value>* goal*</value

The purpose was that this conditional should be true and executed for a series of possible use-inputs: “goal”, “the goal”, “my goals”.

But it didn’t work.  Just wondering whether AIML supported wildcards in conditions:

 

 

 
  [ # 1 ]

You do not have a space between goal and the final * but this will only pick up whole words and will not match “my goals”.

It also seems a strange syntax you are using. I would use:

<condition name=“goal-component”>
<li value=”* goal *”>...</li>
</condition>

Also * goal * will never match any of your suggestions, as the * needs to be at least one word.

 

 
  [ # 2 ]

Is there a way to match just the letter?

I actually moved to XML since AIML 2.0 allows it rather than embedding values.

I want to accommoddate for spelling or plural/singular

Is * the only wild card, or does ^ work in conditions?  because sometimes the response will be “my goal” or just “goal”....thanks!

 

 
  [ # 3 ]

You can’t match just letters. Wildcards in AIML 2.0 match zero or more words.

Don’t know about ^ as I don’t work with AIML 2.0 that much but the easiest way would be to try it?

 

 
  [ # 4 ]

I went ahead and tried it—it seems like it doesn’t work in conditionals :(

 

 
  [ # 5 ]

Can you please let us know exactly which platform you’re using (e.g. Pandorabots, Program AB, etc.), as well as provide some example code that you tried? This will help us to better advise you.

 

 
  [ # 6 ]

I am on Pandorabots.

I would like the name itself to have a wildcard.

check *</pattern>
<template>
  <condition name = ‘check-<star>’>
  <li value = ‘1’>
  <li value = ‘2>
  </condition>
</template>

It doesn’t seem to work based on examples and cannot get it to work but not sure if I am doing something wrong.

 

 
  [ # 7 ]

The code you just posted is not valid AIML. Apart from the obvious syntax errors, you cannot check for <star> within a condition name.

You can either do something like:

<set name="input"><star/></set

and then use condition to check the value of “input”

or write categories for each possibility of the star you want to check. Like this:

<pattern>CHECK VARIABLE</pattern
 

 
  [ # 8 ]

Also, on Pandorabots the dash might be converted to “dash” or whatever is in the substitution file so you cannot search on punctuation but must use the substituted term (if you were trying to use dashes in the input).

So try:
<category>
CHECK DASH *</pattern>
<template>
<set name=“input”><star></set>
<condition name = “input”>
  <li value = “1”>Matched 1</li>
  <li value = “2”>Matched 2</li>
</condition>
</template>
</category>

 

 
  login or register to react