One problem with debugging AIML on Pandorabots is that it only tells
you the top level match for your pattern. You might say “I love
apples” and get “Matched: I LOVE * / Too much recursion in AIML”.
Debugging the “Too much recursion” can be painstaking. What we’d
rather have is list of all matches in the <srai> chain, by tracing all
the steps. Pandorabots doesn’t have that feature yet, but in the
meantime I came up with a simple way to trace AIML matches using AIML.
It involves adding a little AIML to the categories you want to
trace.
First we need some helper categories to keep track of the “trace” predicate:
<category>
<pattern>GET TRACE</pattern>
<template><get name="trace"/></template>
</category>
<category>
<pattern>CLEAR TRACE</pattern>
<template>Trace cleared: <set name="trace">0</set> </template>
</category>
<category>
<pattern>TRACE *</pattern>
<template>
<think>
<set name="trace"><get name="trace"/>-<star/></set>
</think>
</template>
</category>
Then place <srai>TRACE something</srai> into the AIML categories you
want to trace.
Suppose you have the AIML
<category>
<pattern>I LOVE *</pattern>
<template><srai>I LIKE <star/></srai></template>
</category>
and
<category>
<pattern>I LIKE *</pattern>
<template><srai>I LOVE <star/></srai></template>
</category>
and no specific category for I LOVE APPLES.
You enter “I love apples” to the bot.
Then you get the dreaded “Too much Recursion in AIML” message.
To see what happened, you might change the above two categories to
<category>
<pattern>I LOVE *</pattern>
<template>
<srai>TRACE I LOVE <star/></srai>
<srai>I LIKE <star/></srai></template>
</category>
and
<category>
<pattern>I LIKE *</pattern>
<template>
<srai>TRACE I LIKE <star/></srai>
<srai>I LOVE <star/></srai></template>
</category>
Then test your input with: “Clear Trace. I love apples. Get trace.”
The bot will reply with something like
0-I LOVE APPLES-I LIKE APPLES-I LOVE APPLES-....