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

Debugging AIML?
 
 

As we create categories in our bot, increase the chances that some do not show the results we expected orhide another category .
It is often difficult to quickly see which was the pattern that coincided with the entry we introduced, because the staff is subject to several conditions or the response is random.
It is for this reason that there should be a way to debug your code.

In the library AIMLMultibot have incorporated a way to do this.
If you enter the command “@cmd verbose on” debug mode is activated and every user input will show what the pattern that coincided with that input.

<category>
  <
pattern>I like *</pattern>
  <
template>
    
I like too
  
</template>
</
category>

<
category>
  <
pattern>*0 cats *0</pattern>
  <
template>
    
I love cats
  
</template>
 </
category>

 <
category>
  <
pattern>* </pattern>
  <
template>
    
I don't understand you.
  </template>
</category> 
[10:43:12] Leo Ktaba: @cmd verbose on
verbose on
.
[10:43:23] Leo KtabaI like cats
[10
:43:23] BotI like too.
I LIKE * <THAT> * <TOPIC> *
[10:43:30] Leo KtabaI love cats
[10
:43:30] BotI love cats.
*
0 CATS *<THAT> * <TOPIC> *
[10:44:06] Leo Ktaba: and dogs?
[10:44:06] BotI don't understand you.
* <THAT> * <TOPIC> * 

This is a simple example, but demonstrates the value that may be of debugging code for the programmer AIML robot.

 

 
  [ # 1 ]

Seeing a lot of AIML discussions popping up in “AI thoughts” lately. Don’t these belong more under “AIML & other standards”? I guess it’s not so important, just in a tidy mood. smile

I do find these discussions interesting, not being personally familiar with AIML myself. Definitely learning a lot.

 

 
  [ # 2 ]

How difficult would it be to implement a “backtrace”,
showing the succession of recursive rules that were matched?

 

 
  [ # 3 ]

Good idea.

 

 
  [ # 4 ]

On the AIML language design the system responds with the first pattern that matches user input in the tree structure AIML.

Thus there are two possible options to debug:

1) Debugging of the selected category.
This case shows the pattern chosen, and a possible improvement would be to show patterns that can be recursively calling the tag <srai>

<category>
  <
patternHello</pattern>
  <
templateHow do you do?</template>
</
category>

<
category>
  <
pattern>Hi</pattern>
  <
template><srai>Hello</srai> </template>
</
category
Hi
How 
do you do?

Hi <that> * <topic> *
Hello <that> * <topic> * 


2) Description of all patterns that match the user input.
Show the pattern selected and continue the search tree to see if some pattern but could also be a valid pattern for that input. (The pattern * will usually show).

<category>
  <
pattern>* cat</pattern>
  <
templateI love cats</template>
</
category>

<
category>
  <
pattern>What is a  *</pattern>
  <
templateI don’t know </template>
</
category>

<
category>
  <
pattern> *</pattern>
  <
templateUnknow  </template>
</
category
What is a cat?
I don’t know

What is a 
* <that> * <topic> *   -> Selected pattern 
cat <that> * <topic> * -> 1º alternative
* <that> * <topic> * ->2º alternative 

What would be the option you mention?

 

 
  [ # 5 ]

Isn’t this what Dr Wallace has already done in standard AIML?
http://www.chatbots.org/ai_zone/viewthread/49/

 

 
  [ # 6 ]

Yes, but that requires editing your AIML.

 

 
  [ # 7 ]

The option proposed by Dr Wallace is good only when the motor program AIML does not support debugging of code. Normally we are talking about a bot is about 30K or more categories. You have to put the code on each of the categories. Putting debug code in the same code as well as being ugly AIML visually and in writing it can possibly go wrong, there is a problem, these categories are available to any user.

Prefer a debugging made ​​by the program or library it will be more efficient and transparent to the programmer of the bot.

 

 
  [ # 8 ]

True. To be honest, I don’t really see any problem with debugging, as you just follow each category back until you get to the cause of the problem.

 

 
  [ # 9 ]

The debugging routines in Program O trace the output chain from initial input to final output without having to deal with extra code in either the AIML files, or anywhere else. Frankly, Leo (and with all due respect), the overwhelming majority of the suggestions you’ve made so far should more accurately be handled by an AIML interpreter, rather than by an extension of the AIML specification. But that’s just my opinion, so take it as you will. smile

 

 
  [ # 10 ]

@CR:

I agree with you that these need to be in a different portion of the forum, but my attempts at splitting or moving them into the correct section have been fruitless. I’ll have a chat with Erwin, and see what can be done.

 

 
  [ # 11 ]

There is only the wildcard suggestion and the regex that I would say was worth pursuing. Your other suggestions can be handled quite adequately by AIML as it stands.

 

 
  [ # 12 ]

Of course, the debugging code should be managed by the AIML interpreter. Of the remaining improvements are lolo some guesses, but others do not think so, since they themselves should be integrated into the AIML specification or should create a new specification. For example, the set of words that simplifies the number of categories, more so when there are several sets in the same category as the total number of categories to program would be a permutation of the number of elements in both sets. Another word would be necessary to exclude a wildcard to avoid false positives.

I find it very curious that Chatscript glory in what I’m trying to be integrated into a new AIML language specification.

http://www.chatbots.org/ai_zone/viewreply/4483/

Dave Morton - Mar 24, 2011:

Hi, Oliver, and welcome to chatbots.org. smile

The biggest reason I’m doing the translation from AIML to ChatScript is because ChatScript has the potential to be much more flexible and efficient than AIML is. With AIML, any wildcard in your pattern has to match at least one word in order for the pattern to fire. So the pattern “I love you *” won’t match “I love you”. This means that with AIML, you need more categories to accomplish the same desired responses.

Also, ChatScript has a special type of wildcard, called a concept, that adds a whole new dimension to matching. Let’s say you want to create some responses in AIML that covers certain hobbies. You need, then, to either create a category for each hobby you want to deal with, or create a category that would accept inputs that may not describe a hobby:

<category>
<
pattern>I like *</pattern>
<
template><star /> sounds like a good hobby.</template>
</
category

The same response in ChatScript would look like the following:

concept: ~hobbies (reading “stamp collecting” woodcraft “chasing girls”)
s: (I like _~hobbies) _0 sounds like a good hobby.

As you can see, not only is the rule more flexible and efficient, it’s also easier to read. There are other reasons for my migrating to ChatScript, but this is the biggest reason. Bruce Wilcox has a post in these forums that describes in greater detail the other advantages of ChatScript. I recommend it highly. smile

Just as there are different specifications for a language with extensions to its functionality here can also pass the same. Soon players will be new versions of existing or to collect these improvements and new bots correctly interpret improved.

 

 
  [ # 13 ]

Please don’t get me wrong, Leo. I’m not trying to dissuade you from your goals, even a little bit. I was just pointing out a few things that you may (or may not) need to be aware of. smile

Perhaps we should all consider the potential involved in creating a new, expanded specification, based on AIML. It could be called any number of things, but I think that AAIML (Advanced Artificial Intelligence Markup Language) may be best suited. For this extended specification, direct use of RegEx within the patterns (including <that> patterns), use of “optional word” (e.g. *{wealth happiness power}) wildcards, zero-length, exact-length, and range-length wildcards all could be implemented, along with pre-defined, reusable match concepts (e.g. *(^hockey) where ^hockey is a pre-defined list of words, all related to hockey, such as ‘puck’, ‘hat trick’, ‘penalty box’, etc. I’m trying NOT to “swipe” Bruce Wilcox’s “concept” idea here, but it’s a natural for this sort of thing). Further enhancements and extensions could (and should) be included, as well.

I agree with Dr. Wallace that it’s VERY hard to be both a good programmer, and a good creative writer at the same time, which is why Morti didn’t do as well in the recent Chatterbox Challenge (I’m good at programming, but my creative writing skills lack), so changing the current AIML specification isn’t as attractive to me as creating an extended specification would be, but either way, your ideas are good ones.

 

 
  [ # 14 ]

Let me show you the possibilities to debug AIML: (in AAIML of course cheese)

(It is an absurd example only with educational claims)

<category>
  <
pattern>beware</pattern>
  <
template>
     and 
be careful with it
  
</template>
</
category>

<
category>
  <
pattern>an animal</pattern>
  <
template>
    
of course <srai>beware</srai>.
  </
template>
</
category>

<
category>
  <
pattern>A dog is an animal </pattern>
  <
template>
    
A dog, <srai>an animal</srai>
  </
template>
</
category>

<
category>
  <
pattern>*0 an *0</pattern>
  <
template>
    
A dog, <srai>an animal</srai>
  </
template>
</
category>

<
category>
  <
pattern>*0 dog *0</pattern>
  <
template>
    
A dog, <srai>an animal</srai>
  </
template>
</
category>

<
category>
  <
pattern>*0 a dog *0</pattern>
  <
template>
    
A dog, <srai>an animal</srai>
  </
template>
</
category>

<
category>
  <
pattern>*0 a *0 dog *0</pattern>
  <
template>
    
A dog, <srai>an animal</srai>
  </
template>
</
category>

<
category>
  <
pattern>*</pattern>
  <
template>
    
I don't know.
  </template>
</category> 

1) Recursively debugging

[22:23:43] Leo Ktaba: @cmd verbose on
OK
verbose on

[22
:24:01] Leo Ktabaa dog is an animal
[22
:24:01] BotA dogof course and be careful with it..
A DOG IS AN ANIMAL <THAT> * <TOPIC> *
AN ANIMAL <THAT> * <TOPIC> *
BEWARE <THAT> * <TOPIC> * 

2) Debugging in all matches

[22:24:23] Leo Ktaba: @cmd allMatch on
OK
allMatch on

[22
:24:31] Leo Ktabaa dog is an animal
[22
:24:31] Bot
A DOG IS AN ANIMAL <THAT> * <TOPIC> *
*
0 A DOG *<THAT> * <TOPIC> *
*
0 A *0 DOG *<THAT> * <TOPIC> *
*
0 DOG *<THAT> * <TOPIC> *
*
0 AN *<THAT> * <TOPIC> *
* <
THAT> * <TOPIC> * 
 

 
  login or register to react