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

Universal tag
 
 

I was wondering if there is a way to specify a particular pattern with a particular type of tag that means that no matter which <topic name=”“></topic> sub-topic a conversation is in the AIML engine would look throughout the whole of the AIML file for the set pattern, rather than just within the bounds of the sub-topic?

Not sure if this makes any sense to anyone but me. My AIML bot is used by students learning Chinese for scenario based conversations in Chinese. The structure of the AIML files/conversations is such that the bot will ask a specific question and through the use of the <set name=“topic”>.....</set> tags will automatically move the conversation into a specific sub-topic. Once in the sub-topic, a range of patterns to be matched are available that relate to that sub-topic. Some <template></template> responses will throw the conversation back out to the general part of the AIML file (again using <set name=“topic”></set>), while others will keep the pattern matching within the sub-topic until a point in the conversation is reached where it needs to move on to a new sub-topic or it can return to the general part of the AIML file.

An example would be, after entering our restaurant, a student/customer is greeted by our waitress bot. When the student/customer replies with the equivalent of ‘hello’, they are welcomed and then asked if they want to have a meal. At this point, the AIML throws to a sub-category called ‘enterdialogue’. If the student/customer says ‘yes’ they want to eat, the bot waitress will then ask ‘how many people’ and automatically throw the AIML over to the next sub-category (<set name=“topic”>howmany topik</set>). A range of possible responses from the student/client is possible within this sub-topic (i.e. ‘only one’, ‘two of us’, etc.). Depending on the answer given by the student/client, the bot waitress will then say ‘good, please follow me’, begin waling towards a pre-set table, and the AIML with then throw to another sub-topic (which starts off the conversation about ordering particular dishes).

This structure works well, except for the fact that there are some questions that could come up at any time in the conversation and that are not necessarily directly related to the particular sub-topic for that part of the conversation. At the moment unless this type of question/pattern is entered into every sub-topic, the AIML will not find the question/pattern within the sub-topic and will give the default response of ‘I don’t understand. Could you repeat that please?’ (which is entered in every sub-topic).

Is it possible to tag some questions so that no matter what sub-topic the conversation is in, the AIML engine will look outside the sub-topic (i.e throughout the whole file or all of the associated files) for a match if it can’t find one within the sub-topic?

Sorry to be so convoluted with my question.

 

 
  [ # 1 ]

Why not code it without any topic? If it doesn’t have a topic, it should find it ok.

 

 
  [ # 2 ]

One easy way to think about this is that when a category has no <that> or no <topic> associated with it, these values ae set to * implicitly.

In other words:

<category>
<
pattern>HELLO</pattern>
<
template>Hi there!</template>
</
category

 

is really the same as

<topic name="*">
<
category>
<
pattern>HELLO</pattern>
<
that>*</that>
<
template>Hi there!</template>
</
category>
</
topic

And the associated pattern path in the Graphmaster is

HELLO, <that>, *, <topic>, *

 

 
  [ # 3 ]

Thank you Steve and Richard for your replies.

I suspect that some of my problem stems from my half-baked understanding of how the various aspects of AIML work. I am working on that grin

My need for topics (as I perceive it) arises from the fact that we have modified our AIML engine so that commands can be embedded in the AIML code/dialogues that trigger certain actions in our bots. For example, when an interlocutor orders a dish in our restaurant, a command is sent from the AIML code at that point in the dialog to the bot engine which makes the bot ‘say’ another command in Second Life which triggers an invisible object to ‘rez’ the dish on the table. At the moment we have four different tables where this ordering of food can occur, so I need four different ‘topics’ to differentiate the chain of commands that trigger the ‘rezzing’ of the dishes on each table (otherwise the same command would rez the dish on all four tables). The four different topics are labelled ‘Aorderfood1’, ‘Aorderfood2’, ‘Aorderfood3’, etc. Each is a repetition of the other except that the command said by the bot in Second Life is said on a different ‘channel’ for each table. Once the conversation reaches the point where the person ordering the food has finished saying their order (they are asked ‘is there anything else you want’ after each dish that they order) they can end that part of the conversation by saying ‘No, nothing else’. At this point the topic is changed to a ‘nil’ topic, in other words back to the general not topic specific part of the AIML file.  This may be very bad programming / structuring on my part, but for the moment I can’t think of any other way to structure this kind of thing.

In each of my ‘topics’ I also have a ‘default’ response where the person interacting with the bot says something that is not covered in that topic. I do this using a wildcard ‘*’ plus a response that says “I am sorry I don’t understand. Could you please repeat.” This gives the person speaking to the bot another chance of saying what it was they tried to say the first time within the scope of the topic. I have also built in an ‘escape phrase’ for each topic where if the conversation goes into a circular mode, the person speaking to the bot can type “I don’t understand” and change the ‘topic’ setting back to ‘nil’ topic, or in other words back to the general non-topic section of the AIML file. The problem is that I have to make everyone aware of the fact that they can escape a non-productive loop by using that phrase.

So, I feel that I am locked into having to have a structure that includes a number of ‘topics’, but would still like to be able to tag certain questions so that they sit outside specific topics but would be accessible even when a conversation had moved into the narrow bounds of a specific topic, while not leaving that topic until the key phrases I mentioned above are said. Thinking about this now, what I am wanting may be impossible.

Anyhow, any further advice or ideas would be greatly appreciated.

Cheers,

Scott

 

 
  [ # 4 ]

Why not change the topic to something like “general” instead of nil, then you could do:

<topic name="general">
<
category>
<
pattern>HELLO</pattern>
<
that>*</that>
<
template>Hi there!</template>
</
category>
</
topic

 

 

 
  login or register to react