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: That Question
 
 

So I am fairly new to the <that> tag.  I have always known about it but never really dabbled with it.  So sorry, but this is a fairly easy [noob] question.

So I finally wrote some code for <that> tag when I realized something, do all the commands need their own individual AIML if they are all connected?

Here is an example….

<think><set name="lights"><star /></set></think>
 
<
category>
<
pattern>Turn on some lights</pattern>
<
template>Is it dark in here?
<
think><set name="it"><set name="topic">lights</set></set></think>
</
template>
</
category>

<
category>
<
pattern>*</pattern>
<
that>is it dark in here?</that>
<
template>Okaywhich light would you like to turn on?
<
think><set name="lights"><star /></set></think>
</
template>
</
category>

<
category>
<
pattern>*</pattern>
<
that>Okaywhich light would you like to turn on?</that>
<
template>Turning on the <star />
<
think><set name="lights"><star /></set></think>
</
template>
</
category>

<
category>
<
pattern>*</pattern>
<
that>Turning on the <star /></that>
<
template><template><silence msec="2000" /><EMail="SEND" To="[email protected]subject="#LampOn" Message="Hello Word"><silence msec="2000" /><ChatInput="send email"><silence msec="6000" />The lamp is now on</template>
<
think><set name="lights"><star /></set></think>
</
template>
</
category

This code basically turns on a lamp using an email trigger top IFTTT.com

Can I use this long code in only one AIML or do they all need to have its own individual AIML file?  Do any of you see anything wrong with this code?

 

 
  [ # 1 ]

Hi, Dominique.

I took the liberty of enclosing your AIML code with [code ] tags (minus the space, of course). Otherwise, the forum software does strange things to the code.

One problem that I see is that you’ve included punctuation with your <that> tags, and that’s a no-no. This:

<that>is it dark in here?</that

Will not work. It really should look like this:

<that>is it dark in here</that

at the very least, and ideally, should look like this:

<that>IS IT DARK IN HERE</that

Now most AIML interpreters will sort out the “normalization” bit, but NONE will handle that question mark, which will cause it to fail.

I haven’t truly looked at the code thoroughly yet (I’m in a conference ATM), but that kind of grabbed my attention, so I thought I’d point it out. I’ll revisit this in about an hour or so.

 

 
  [ # 2 ]

Nice, I should clarify that this AIML code is for Denise.

To be honest I did not even notice the ? until you pointed it out.  I will test without it.

 

 
  [ # 3 ]

Ok, I’m back. The conference call took less time than I had expected. cheese

Obviously, Denise uses custom AIML tags, hence the <email> and <silence> tags. I’ve never really gotten into using Denise, so I’m not familiar with the proper syntax for the tags, but given what I know about XML in general, I’d have to say that you might want to double check the capitalization of at least the <EMail> tag that I see in there, and possibly the <ChatInput> tag, as well. AIML is a sub-set of the XML language, and follows many of the same rules, and one of those rules that they share is that all tags are case sensitive, so <email>, <Email> and <EMail> are completely different tags.

Other than that, I don’t really see anything that “jumps out at me”. smile

 

 
  [ # 4 ]

[edit]
I take that back. I see more punctuation in your <that> tags, as well as a <star> tag that doesn’t belong.

Instead of using <star> inside the pattern-side <that>, you should just use the “*” (minus the quotes). I would also suggest changing this:

<that>Okaywhich light would you like to turn on?</that

and this:

<that>Turning on the <star /></that

to this:

<that>* WHICH LIGHT WOULD YOU LIKE TO TURN ON</that

and this:

<that>TURNING ON THE *</that


This will simplify the code a little, while adding a bit more flexibility in the process. Again, the normalization (converting it to all upper-case letters) isn’t all that important, but it does make the code easier to read in the long run.

The simplification and flexibility come into play when you have a dozen or more lights to control. There are ways to reduce the AIML code in such a way that you’d only need one control category to handle all of your lights. If you can provide me an example list of lights and/or appliances to control, I can provide you a simplified set of AIML categories to do just that.

 

 
  [ # 5 ]

That is interesting.  Usually it doesn’t matter when I use lowercase in my AIML.  I will try the * suggestion, thanks.

 

 
  login or register to react