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

Hey guys…. I would like to restate my earlier AIML question…

How do I get these 3 statements and responses?
1 Hi => Hello
2 Hi can we talk => yes, let’s talk
3 Can we talk about you => I would prefer to talk about you

These rules:

<category>HI ^</pattern><template>Hello</template></category>
<category>^ CAN WE TALK ^</pattern><template>Yes, let’s talk</template></category>

gives
1 Hi => Hello
2 Hi can we talk => Hello


<category>HI ^</pattern><template>Hello</template></category>
<category># CAN WE TALK #</pattern><template>Yes, let’s talk</template></category>

1 Hi => Hello
2 Hi can we talk => yes, let’s talk

If I add a rule…

<category># CAN WE TALK ABOUT YOU #</pattern>
<template>I would prefer we talk about you.</template></category>

1 Hi => Hello
2 Hi can we talk => yes, let’s talk
3 can we talk about you? => yes, let’s talk

I can’t find a way to get third response.

 

 
  [ # 1 ]

Obviously I am aware of the trivial answer of doing 3 exact matches… but I want to get more general matches that are afforded by the wildcards… like….

just wanted to ask, can we talk => yes we can talk
just curious, can we talk about you? =>  I would prefer to talk about you

 

 
  [ # 2 ]

It seems like the wildcards are conflated with precedence.  It might make more sense if the precedence was an integer attribute of the pattern tag.

 

 
  [ # 3 ]

You can use a reduction pattern to remove unnecessary/extraneous parts of the user’s input:

<category>
<
pattern>JUST WANTED TO ASK *</pattern>
<
template><sr/></template>
</
category

Just wanted to ask can we talk? => CAN WE TALK
Just wanted to ask can we talk about you? => CAN WE TALK ABOUT YOU

<category>
<
pattern>JUST CURIOUS *</pattern>
<
template><sr/></template>
</
category

Just curious can we talk? => CAN WE TALK
Just curious can we talk about you? => CAN WE TALK ABOUT YOU

Any time an input begins with “JUST WANTED TO ASK” or “JUST CURIOUS” the input will be stripped of the prefix.

Now you can add categories to handle the reduced forms:

<category>
<
pattern>CAN WE TALK</pattern>
<
template>Yeswe can talk.</template>
</
category>

<
category>
<
pattern>CAN WE TALK ABOUT YOU</pattern>
<
template>I would prefer to talk about you.</template>
</
category

Adding reductions like this will increase your bot’s overall comprehension.

Regarding wildcard precedence, you should avoid using high-priority wildcards (# or _) at the beginning of your patterns, because you run the risk over overriding exact matches:

<category>
<
pattern>WHAT IS MY NAME</pattern>
<
template>Your name is Andrew.</template>
</
category>

<
category>
<
pattern># NAME</pattern>
<template>My name is Alice</template>
</
category

The first category here will never be matched, because the # takes precedence over the exact match. You can see how this might cause the bot to give an improper response.

For this reason, it’s best practice to work from front to back when designing reductions.

 

 

 

 
  login or register to react
‹‹ Order of operations      AIML 2 - input tag ››