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

AIML Pattern Matching
 
 

I am having a problem in identifying the “_” wildcard matching in the ALICE pattern matching algorithm.
I did read the document at http://www.alicebot.org/documentation/matching.html but I am still having some confusions.
I will be grateful if someone can give me a clear explanation about “_” and “*” wildcard matching.
Thank you very much.

 

 
  [ # 1 ]

There is a similar discussion at the ALICE AI forums, http://forum.alicebot.org/viewtopic.php?f=4&t=24, that should clarify things.

Basically, the “_”  wildcard has priority and takes precedence over everything, even exact matches, while the “*” wildcard has the lowest priority, so everything else takes precedence over it. It’s explained in much more detail, including examples, at the posted link.

 

 
  [ # 2 ]

Thanks for the reply.But I still got some problems regarding the matchings.My bad :(
Say I have the following patterns:

tell me about *
_ yourself

So if a user asks Tell me about you self and according to the algorithm, it searches for the “_” first. And if it match the _yourself how can we assure that it gets the correct answer. I mean my actual question is what is actually represented by wildcard “_”???

*Does it represent only one word??
* Number of words??

The pattern “tell me about*” can be a better match because it matches with three words and * but in the pattern yourself it has only the word yourself??

Sorry, I have all sorts of these confusions.Hope suggestions and answers form you all to clarify my doubts.
Thank you very much.smile

 

 
  [ # 3 ]

_ YOURSELF will overrule ANY message that ends with the word “yourself”, even if there is a direct match. The underscore wildcard should be used sparingly.

 

 
  [ # 4 ]

One thing to remember, too, is that there’s no rule for placement of either wildcard. So the following:

_ yourself

* yourself

-or-

yourself _

yourself *

only matters in what the specific wildcard does, not where it’s placed. In other words, the underscore isn’t required to go before any matched words. You can just as easily use the asterisk. In fact, in the vast majority of cases, the asterisk is the recommended wildcard to use.

In the ALICE Annotated AIML (AAA) set, the pattern “_ yourself” exists, with a template of “<star> myself”. That particular category changes “tell me about yourself” to “tell me about myself” in EVERY case, even when there’s a direct match of “tell me about yourself” existing. This has caused me a few problems with Morti, so I removed the “_ yourself” category completely, and added some categories, while modifying others, to achieve the same effect.

Which brings me to the <person> and <person2> tags. These are the preferred methods for changing “context perspective” in responses. These tags work as follows:

The <person> tag swaps words between first person and second person:

I—> you
me—> you
myself—> yourself
mine—> yours

you—> me
yours—> mine
yourself—> myself

There are likely other transformations, but they are script dependent. In fact, all of these are script dependent, to be honest. smile

The <person2> tag, on the other hand, is for making the following changes:

I—> “him or her”, or “they”, depending on the script
me—> “him or her”, or “they”, depending on the script

(reverse transformations are problematical, at best. The functions I’ve studied that accomplish this follow very loose rules, and therefore provide poor results, most times)

I don’t know if you’ve seen it yet, but alicebot.org has a Tag Reference Page that may prove useful to you. smile

 

 
  [ # 5 ]

Hi,
I have a problem with pattern matching.

Say the user input is “What are the degree courses available at the university?”

then the knowledgebse contains the following category

<category>
<
pattern>* DEGREE COURSES AVAILABLE *</pattern>
<
templateCourses are available in both computing and business.</template>
</
category


So from the pattern matching process the _ or atomic match does not exist. Therefore the “*” match should be done.

How does this happens for the above category??

According to the description of the pattern matching process by Dr Wallace in the given link http://www.alicebot.org/documentation/matching.html

“Does the Nodemapper contain the key “*”? If so, search the subgraph rooted at the child node linked by “*”. Try all remaining suffixes of the input following “X” to see if one matches. If no match was found, go back up the graph to the parent of this node, and put “X” back on the head of the input.”


Therefore in this scenario the X==“What” , and when matching with the words following X, the “are” part of the input can not be matched.What really happens at this stage??

Can someone help me with understanding this process??What is the pattern matching process related to this scenario??
A reply will be highly appreciated.

Thanks a lot. smile

 

 
  [ # 6 ]

Whenever you are trying to answer a question like, “Why doesn’t this category match my input?” you need to know three things:

1. The input
2. The desired matching category
3. All the other categories in your AIML

It’s hard to know “why doesn’t this category match?” without knowing what other categories are there.

I suspect what may have happened in your case is that there was another category in your set with a pattern like WHAT * or WHAT ARE *.  In that case the input matched the first word WHAT, matching continued down that path and found a successful match, so no patterns beginning with * were ever tried.

Umesha Gunasinghe - Jan 4, 2011:

Hi,
I have a problem with pattern matching.

Say the user input is “What are the degree courses available at the university?”

then the knowledgebse contains the following category

<category>
<
pattern>* DEGREE COURSES AVAILABLE *</pattern>
<
templateCourses are available in both computing and business.</template>
</
category


So from the pattern matching process the _ or atomic match does not exist. Therefore the “*” match should be done.

How does this happens for the above category??

According to the description of the pattern matching process by Dr Wallace in the given link http://www.alicebot.org/documentation/matching.html

“Does the Nodemapper contain the key “*”? If so, search the subgraph rooted at the child node linked by “*”. Try all remaining suffixes of the input following “X” to see if one matches. If no match was found, go back up the graph to the parent of this node, and put “X” back on the head of the input.”


Therefore in this scenario the X==“What” , and when matching with the words following X, the “are” part of the input can not be matched.What really happens at this stage??

Can someone help me with understanding this process??What is the pattern matching process related to this scenario??
A reply will be highly appreciated.

Thanks a lot. smile

 

 
  [ # 7 ]

Would
_ DEGREE COURSES AVAILABLE *

work better?

 

 
  [ # 8 ]

Patterns hidden by other patterns have been called “shadowed”.  There are few tools that can find shadowed categories and tell you which pattern covered them.  You can find more info in the following posts http://www.mail-archive.com/[email protected]/msg08618.html or http://aiml.1580448.n4.nabble.com/RE-Re-Fwd-Fwd-AIML-conflict-solving-td1580698.html.

 

 
  login or register to react
‹‹ New Alicebot AIML Forum      AIML <srai> tag ››