Response order

View: New views
6 Messages — Rating Filter:   Alert me  

Response order

by Troy Vinson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In need of an AIML suggestion concerning ordering of a match or
pre-scanning a sentence.  Given these two patterns:

<category>
    <pattern>
        * FRIEND *
    </pattern>
    <template>
        <srai>    
            FRIEND RESPONSE
        </srai>    
    </template>
</category>

<category>        
    <pattern>      
        * A$$      
    </pattern>    
    <template>    
        <srai>    
            BADWORD RESPONSE
        </srai>    
    </template>    
</category>


And the input "my friend can kiss my a$$".  The desire is to have the
pattern match and send a response for BADWORD RESPONSE instead of FRIEND
RESPONSE.

Any help would be greatly appreciated.
_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/

Re: Response order

by drwallace :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Troy, one simple solution would be to change the * A$$ pattern to _
A$$, because the _ has higher matching priority in AIML.
(we all know that you can't have $ in patterns, but the example is
good because it shows a case where one keyword has priority over
another).

But generally speaking, there is a kind of "keyword priority problem"
in AIML.  The typical technique for detecting keywords in AIML is to
use 4 categories per keyword:

<pattern>_ KEY</pattern>
<template><srai>KEY</srai></template>

<pattern>_ KEY _</pattern>
<template><srai>KEY</srai></template>

<pattern>KEY _</pattern>
<template><srai>KEY</srai></template>

and finally

<pattern>KEY</pattern>
<template>The answer.</template>

The problem arises when you have two or more keys that have an
ordering, like your example of FRIEND and A$$.  You want to say that
the keyword A$$ "comes first".  But if a sentence contains both
keywords, AIML makes no assumptions over which will match first, if
the mathcing patterns either both contain a prefix _ or are both
atomic.  (This statement should be a little more complicated, because
as your example shows you can create a priority problem even if you
are using a * prefix to detect keywords).

Perhaps it should.

In this example, the patterns _ FRIEND _ and _ A$$ create a priority
problem.  Whichever one is picked as the first match, depends on the
hashing algorithm used in the root Nodemapper.

Some people have solved the keyword priority problem by applying a
pre-processor to the AIML input, which will look for any of the "bad
keywords" and, if found, replace the whole AIML input with a special
pattern like "BAD WORD".

Yours sincerely,

Dr. Rich Wallace




On 2/2/07, Troy Vinson <troy.vinson@...> wrote:

> In need of an AIML suggestion concerning ordering of a match or
> pre-scanning a sentence.  Given these two patterns:
>
> <category>
>    <pattern>
>        * FRIEND *
>    </pattern>
>    <template>
>        <srai>
>            FRIEND RESPONSE
>        </srai>
>    </template>
> </category>
>
> <category>
>    <pattern>
>        * A$$
>    </pattern>
>    <template>
>        <srai>
>            BADWORD RESPONSE
>        </srai>
>    </template>
> </category>
>
>
> And the input "my friend can kiss my a$$".  The desire is to have the
> pattern match and send a response for BADWORD RESPONSE instead of FRIEND
> RESPONSE.
>
> Any help would be greatly appreciated.
> _______________________________________________
> This is the alicebot-general mailing list
> Reply to alicebot-general@...
> Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
> Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
> Learn to read at http://www.literacy.org/
>
_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/

Parent Message unknown Re: Response order

by Troy Vinson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you Dr. Wallace,

The pre-processor idea is one we have been throwing around, but
considering we are using PandoraBots (at the moment), I am a little
hesitant at putting a proxy in between mainly because it skews the
logging of inputs.  Should not be a big problem, though.

BTW, the "$"s in the pattern were mainly for courtesy using our
real-life example.
 
Thanks for the help.

 
 

-----Original Message-----
From: alicebot-general-bounces@...
[mailto:alicebot-general-bounces@...] On Behalf Of Dr.
Rich Wallace
Sent: Friday, February 02, 2007 2:06 PM
To: Alicebot and AIML General Discussion
Subject: Re: [alicebot-general] Response order

Hi Troy, one simple solution would be to change the * A$$ pattern to _
A$$, because the _ has higher matching priority in AIML.
(we all know that you can't have $ in patterns, but the example is
good because it shows a case where one keyword has priority over
another).

But generally speaking, there is a kind of "keyword priority problem"
in AIML.  The typical technique for detecting keywords in AIML is to
use 4 categories per keyword:

<pattern>_ KEY</pattern>
<template><srai>KEY</srai></template>

<pattern>_ KEY _</pattern>
<template><srai>KEY</srai></template>

<pattern>KEY _</pattern>
<template><srai>KEY</srai></template>

and finally

<pattern>KEY</pattern>
<template>The answer.</template>

The problem arises when you have two or more keys that have an
ordering, like your example of FRIEND and A$$.  You want to say that
the keyword A$$ "comes first".  But if a sentence contains both
keywords, AIML makes no assumptions over which will match first, if
the mathcing patterns either both contain a prefix _ or are both
atomic.  (This statement should be a little more complicated, because
as your example shows you can create a priority problem even if you
are using a * prefix to detect keywords).

Perhaps it should.

In this example, the patterns _ FRIEND _ and _ A$$ create a priority
problem.  Whichever one is picked as the first match, depends on the
hashing algorithm used in the root Nodemapper.

Some people have solved the keyword priority problem by applying a
pre-processor to the AIML input, which will look for any of the "bad
keywords" and, if found, replace the whole AIML input with a special
pattern like "BAD WORD".

Yours sincerely,

Dr. Rich Wallace




On 2/2/07, Troy Vinson <troy.vinson@...> wrote:

> In need of an AIML suggestion concerning ordering of a match or
> pre-scanning a sentence.  Given these two patterns:
>
> <category>
>    <pattern>
>        * FRIEND *
>    </pattern>
>    <template>
>        <srai>
>            FRIEND RESPONSE
>        </srai>
>    </template>
> </category>
>
> <category>
>    <pattern>
>        * A$$
>    </pattern>
>    <template>
>        <srai>
>            BADWORD RESPONSE
>        </srai>
>    </template>
> </category>
>
>
> And the input "my friend can kiss my a$$".  The desire is to have the
> pattern match and send a response for BADWORD RESPONSE instead of
FRIEND
> RESPONSE.
>
> Any help would be greatly appreciated.
> _______________________________________________
> This is the alicebot-general mailing list
> Reply to alicebot-general@...
> Unsubscribe and change preferences at
http://list.alicebot.org/mailman/listinfo/alicebot-general
> Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
> Learn to read at http://www.literacy.org/
>
_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at
http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/
_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/

Parent Message unknown Re: Response order

by Square Bear :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Use _ instead of * for the A$$ category. The underscore overrules everything
else including an exact match. This should do it:

 <category>
     <pattern>
         _ A$$
     </pattern>
     <template>
         <srai>
             BADWORD RESPONSE
         </srai>
     </template>
 </category>

Regards
- Steve Worswick (Square Bear)
http://www.mitsuku.com


----- Original Message -----
From: <alicebot-general-request@...>
To: <alicebot-general@...>
Sent: Friday, February 02, 2007 8:00 PM
Subject: alicebot-general Digest, Vol 15, Issue 2


> Send alicebot-general mailing list submissions to
> alicebot-general@...
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://list.alicebot.org/mailman/listinfo/alicebot-general
> or, via email, send a message with subject or body 'help' to
> alicebot-general-request@...
>
> You can reach the person managing the list at
> alicebot-general-owner@...
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of alicebot-general digest..."
>
>
> Today's Topics:
>
>    1. Response order (Troy Vinson)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 2 Feb 2007 09:24:53 -0600
> From: "Troy Vinson" <troy.vinson@...>
> Subject: [alicebot-general] Response order
> To: <alicebot-general@...>
> Message-ID:
> <CE0EF2903833E649AB736134C73E3C64039B6932@...>
> Content-Type: text/plain; charset="us-ascii"
>
> In need of an AIML suggestion concerning ordering of a match or
> pre-scanning a sentence.  Given these two patterns:
>
> <category>
>     <pattern>
>         * FRIEND *
>     </pattern>
>     <template>
>         <srai>
>             FRIEND RESPONSE
>         </srai>
>     </template>
> </category>
>
> <category>
>     <pattern>
>         * A$$
>     </pattern>
>     <template>
>         <srai>
>             BADWORD RESPONSE
>         </srai>
>     </template>
> </category>
>
>
> And the input "my friend can kiss my a$$".  The desire is to have the
> pattern match and send a response for BADWORD RESPONSE instead of FRIEND
> RESPONSE.
>
> Any help would be greatly appreciated.
>
>
> ------------------------------
>
> _______________________________________________
> alicebot-general mailing list
> alicebot-general@...
> http://list.alicebot.org/mailman/listinfo/alicebot-general
>
>
> End of alicebot-general Digest, Vol 15, Issue 2
> ***********************************************
>

_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/

Re: Response order

by drwallace :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The problem is that he has both a GOODWORD RESPONSE as well as a
BADWORD RESPONSE.  He wants both GOODWORD and BADWORD to have priority
over any other match, and moreover wants BADWORD to have priority over
GOODWORD.

If the input is MY FRIEND CAN KISS MY A$$ then he might not want to use
<pattern>* FRIEND</patten> if there is another category with
<pattern>MY *</pattern>

The "keyword priority problem" I described arises when both keywords
have patterns like
<pattern>_ ASS$</pattern> and
<pattern>_ FRIEND _</pattern>

If all of the bot's categories are keyword matches (e.g. no ALICE
Brain categories) then he can use

<pattern>_ ASS$</pattern> and <pattern>* FRIEND *</pattern>
no problem, but if there are other categories like <pattern>MY
*</pattern> in between, the second pattern will not match the input,
and the keyword won't be detected.

Maybe there is a workaround using <topic>?

Rich

On 2/3/07, Square Bear <steve@...> wrote:

> Use _ instead of * for the A$$ category. The underscore overrules everything
> else including an exact match. This should do it:
>
>  <category>
>     <pattern>
>         _ A$$
>     </pattern>
>     <template>
>         <srai>
>             BADWORD RESPONSE
>         </srai>
>     </template>
>  </category>
>
> Regards
> - Steve Worswick (Square Bear)
> http://www.mitsuku.com
>
>
> ----- Original Message -----
> From: <alicebot-general-request@...>
> To: <alicebot-general@...>
> Sent: Friday, February 02, 2007 8:00 PM
> Subject: alicebot-general Digest, Vol 15, Issue 2
>
>
> > Send alicebot-general mailing list submissions to
> > alicebot-general@...
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> > http://list.alicebot.org/mailman/listinfo/alicebot-general
> > or, via email, send a message with subject or body 'help' to
> > alicebot-general-request@...
> >
> > You can reach the person managing the list at
> > alicebot-general-owner@...
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of alicebot-general digest..."
> >
> >
> > Today's Topics:
> >
> >    1. Response order (Troy Vinson)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Fri, 2 Feb 2007 09:24:53 -0600
> > From: "Troy Vinson" <troy.vinson@...>
> > Subject: [alicebot-general] Response order
> > To: <alicebot-general@...>
> > Message-ID:
> > <CE0EF2903833E649AB736134C73E3C64039B6932@...>
> > Content-Type: text/plain; charset="us-ascii"
> >
> > In need of an AIML suggestion concerning ordering of a match or
> > pre-scanning a sentence.  Given these two patterns:
> >
> > <category>
> >     <pattern>
> >         * FRIEND *
> >     </pattern>
> >     <template>
> >         <srai>
> >             FRIEND RESPONSE
> >         </srai>
> >     </template>
> > </category>
> >
> > <category>
> >     <pattern>
> >         * A$$
> >     </pattern>
> >     <template>
> >         <srai>
> >             BADWORD RESPONSE
> >         </srai>
> >     </template>
> > </category>
> >
> >
> > And the input "my friend can kiss my a$$".  The desire is to have the
> > pattern match and send a response for BADWORD RESPONSE instead of FRIEND
> > RESPONSE.
> >
> > Any help would be greatly appreciated.
> >
> >
> > ------------------------------
> >
> > _______________________________________________
> > alicebot-general mailing list
> > alicebot-general@...
> > http://list.alicebot.org/mailman/listinfo/alicebot-general
> >
> >
> > End of alicebot-general Digest, Vol 15, Issue 2
> > ***********************************************
> >
>
> _______________________________________________
> This is the alicebot-general mailing list
> Reply to alicebot-general@...
> Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
> Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
> Learn to read at http://www.literacy.org/
>
_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/

Parent Message unknown Re: Response order

by Troy Vinson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

<topic> may just be the way to approach this in a conversational manner.
Unfortunately, the client has requested more of a "Magic 8-Ball" type
functionality here with relevant answers to user input.

I think, in the long run, we will build a pre-processor to handle the
client-defined BADWORD input with separate logging we can integrate into
the overall results later.

Thanks.
 
 

-----Original Message-----
From: alicebot-general-bounces@...
[mailto:alicebot-general-bounces@...] On Behalf Of Dr.
Rich Wallace
Sent: Saturday, February 03, 2007 10:48 AM
To: Alicebot and AIML General Discussion
Subject: Re: [alicebot-general] Response order

The problem is that he has both a GOODWORD RESPONSE as well as a
BADWORD RESPONSE.  He wants both GOODWORD and BADWORD to have priority
over any other match, and moreover wants BADWORD to have priority over
GOODWORD.

If the input is MY FRIEND CAN KISS MY A$$ then he might not want to use
<pattern>* FRIEND</patten> if there is another category with
<pattern>MY *</pattern>

The "keyword priority problem" I described arises when both keywords
have patterns like
<pattern>_ ASS$</pattern> and
<pattern>_ FRIEND _</pattern>

If all of the bot's categories are keyword matches (e.g. no ALICE
Brain categories) then he can use

<pattern>_ ASS$</pattern> and <pattern>* FRIEND *</pattern>
no problem, but if there are other categories like <pattern>MY
*</pattern> in between, the second pattern will not match the input,
and the keyword won't be detected.

Maybe there is a workaround using <topic>?

Rich

On 2/3/07, Square Bear <steve@...> wrote:
> Use _ instead of * for the A$$ category. The underscore overrules
everything

> else including an exact match. This should do it:
>
>  <category>
>     <pattern>
>         _ A$$
>     </pattern>
>     <template>
>         <srai>
>             BADWORD RESPONSE
>         </srai>
>     </template>
>  </category>
>
> Regards
> - Steve Worswick (Square Bear)
> http://www.mitsuku.com
>
>
> ----- Original Message -----
> From: <alicebot-general-request@...>
> To: <alicebot-general@...>
> Sent: Friday, February 02, 2007 8:00 PM
> Subject: alicebot-general Digest, Vol 15, Issue 2
>
>
> > Send alicebot-general mailing list submissions to
> > alicebot-general@...
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> > http://list.alicebot.org/mailman/listinfo/alicebot-general
> > or, via email, send a message with subject or body 'help' to
> > alicebot-general-request@...
> >
> > You can reach the person managing the list at
> > alicebot-general-owner@...
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of alicebot-general digest..."
> >
> >
> > Today's Topics:
> >
> >    1. Response order (Troy Vinson)
> >
> >
> >
----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Fri, 2 Feb 2007 09:24:53 -0600
> > From: "Troy Vinson" <troy.vinson@...>
> > Subject: [alicebot-general] Response order
> > To: <alicebot-general@...>
> > Message-ID:
> >
<CE0EF2903833E649AB736134C73E3C64039B6932@...>

> > Content-Type: text/plain; charset="us-ascii"
> >
> > In need of an AIML suggestion concerning ordering of a match or
> > pre-scanning a sentence.  Given these two patterns:
> >
> > <category>
> >     <pattern>
> >         * FRIEND *
> >     </pattern>
> >     <template>
> >         <srai>
> >             FRIEND RESPONSE
> >         </srai>
> >     </template>
> > </category>
> >
> > <category>
> >     <pattern>
> >         * A$$
> >     </pattern>
> >     <template>
> >         <srai>
> >             BADWORD RESPONSE
> >         </srai>
> >     </template>
> > </category>
> >
> >
> > And the input "my friend can kiss my a$$".  The desire is to have
the
> > pattern match and send a response for BADWORD RESPONSE instead of
FRIEND

> > RESPONSE.
> >
> > Any help would be greatly appreciated.
> >
> >
> > ------------------------------
> >
> > _______________________________________________
> > alicebot-general mailing list
> > alicebot-general@...
> > http://list.alicebot.org/mailman/listinfo/alicebot-general
> >
> >
> > End of alicebot-general Digest, Vol 15, Issue 2
> > ***********************************************
> >
>
> _______________________________________________
> This is the alicebot-general mailing list
> Reply to alicebot-general@...
> Unsubscribe and change preferences at
http://list.alicebot.org/mailman/listinfo/alicebot-general
> Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
> Learn to read at http://www.literacy.org/
>
_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at
http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/
_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/