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

response & request undocumented?
 
 

I just came across 2 elements that I can’t seem to find anything of in the documentation: Response & request. (it’s in BadAnswer.aiml). Here’s an example:

<category>
<
pattern>_</pattern
<
template>
<
think>
 <
set name="star"><star /></set>
 <
set name="response1"><response index "1" /></set>
 <
set name="response2"><response index "2" /></set>
 <
condition>
  <
li name="response2" value="OK, what should I have said">
  <
set name="badanswer-newresp"><request index "1" /></set>
  </
li>
 </
condition>
</
think

Any idea what they mean exactly?

 

 
  [ # 1 ]

According to http://www.alicebot.org/documentation/ptags.html those tags are Pandorabots extensions to AIML, and aren’t actually part of the “official” specification, so it may be better to get an exact description from Rich. I’m not 100% certain, but I ~THINK~ they have to do with multiple sentence inputs and outputs, like when a user types in, “Hello. My name is Dave.”

In this case, <request index=“1” > would be “Hello”, and <request index=“2” > would be “My name is Dave.”

I find the <RESPONSE> tag to be just a tiny bit more confusing, but I think it’s pretty much the same, save for it relating to multiple sentence replies from the bot. For example, given the input:

Hello. My name is Dave.

The chatbot may respond with:

Greetings! I’m pleased to meet you, Dave.

In this instance, <response index = “1” > would relate to “Greetings!”, while <response index = “2” > would be “I’m pleased to meet you, <get name=“name” >.”

But please bear in mind that though this is an educated guess, it’s still just a guess. cheese

 

 
  [ # 2 ]

So basically, “request” == “input” and response == template-side-that ?
Can do.

 

 
  [ # 3 ]

That’s pretty much my guess, but I’m not 100% certain, so I feel I must defer to those more experienced. smile

 

 
  [ # 4 ]

Very close Dave. A category such as this:

<category>
<
pattern>TEST</pattern>
<
template>
Response = <response index="1"/>
<
br/>
Request = <request index="1"/>
</
template>
</
category

Would give:

Human: hello. how are you?
Bot: Hi there! Everything is going extremely well. How are you?
Human: Test
Bot:
Response = Hi there ! Everything is going extremely well. How are you?
Request = hello. how are you?

request index=“2” would give the 2nd to last thing said rather than breaking the input down into sentences. Request and reponse still work (for now) but have mostly been superceded by <input index=“x”/> and “<that index=“x”>.

 

 
  [ # 5 ]

Request and reponse still work (for now) but have mostly been superceded by <input index=“x”/> and “<that index=“x”>.


I thought it had happened the other way round. I find request and response clearer then input and that.

 

 
  [ # 6 ]

Now I know that there are tags in there somewhere that can break multiple sentence inputs/responses into their constituent components, but apparently, I’ve forgotten what those tags are. downer

Or are the <INPUT> and {pattern-side} <THAT> tags multi-dimensional? (e.g. <input index=“1,1” >)

We have now entered an area where I need to learn some stuff, too. smile

 

 
  [ # 7 ]

Yes they are multidemensional but it is important to know that it works backwards.

If the bot had said, “sentence1. sentence2 “

The following would be automatically said:

<that index=“1,1”> = sentence2
<that index=“1,2”> = sentence1

You can do the same for <input index=“x,y”> as well if I remember correctly.

The first number indicates how many messages back you want to go (1 being the current message), the second number is how many sentences back in the message do you want.

 

 
  [ # 8 ]

Jan, do you see now why I refer to Steve as an AIML god? cheese

Thanks, Steve! I wasn’t aware of the “backwards” nature of the second part of the index. I’ll need to remember that bit. smile

 

 
  [ # 9 ]
Dave Morton - Nov 23, 2012:

Jan, do you see now why I refer to Steve as an AIML god? cheese

Thanks, Steve! I wasn’t aware of the “backwards” nature of the second part of the index. I’ll need to remember that bit. smile

Yep, both you guys are definitely handy to have around while working on aiml. I also wrongfully presumed that the second index was simply front to back, guess not.

 

 
  [ # 10 ]
Jan Bogaerts - Nov 23, 2012:

I also wrongfully presumed that the second index was simply front to back

If it’s any consolation, I once spent an hour trying to debug code before I realised that it worked backwards. It makes sense I suppose.

input index=“1” means the last message
input index=“2” means the 2nd to last message
input index=“3” means the 3rd to last message

So it follows that the second part of the index works backwards too.

It’s pretty handy because if someone say, “What did you just say?” or “What did I say?”, you can hard code that index=“1” or input index=“2” to get the answer without having to subtract the number of messages to try and work it out manually.

Pop quiz!

If someone said, “What did I say?” to the bot, why would we reference <input index=“2”/> instead of <input index=“1”/>?

 

 
  [ # 11 ]

Because index=“1” is “What did I say?” raspberry

Of course, if you wanted your chatbot to be a smart-@$$, you could use <input index=“1” /> anyway, just to torque off the user. cheese

 

 
  [ # 12 ]

Indeed!

Using <input index=“2”/>

Human: hello
Bot: Hi there
Human: What did I say?
Bot: You said “hello”


Using <input index=“1”/>

Human: hello
Bot: Hi there
Human: What did I say?
Bot: You said “What did I say?”
Human: GRRRRR!

 

 
  [ # 13 ]
<request/> and <response/> are somehwhat poorly documented in http://www.alicebot.org/Embrace.html

The need for these tags arises from multi-sentence inputs and responses.

An AIML bot will respond the same whether the input is:

HumanOneTwoThree.
RobotReply1.  Reply2Reply3.

or

HumanOne.
RobotReply1
Human
Two.
RobotReply2
Human
Three.
RobotReply3

<input/> and <that/> refer to the individual sentences, while <request/> and <response/> refer to multi-sentence inputs and response.

HumanOneTwoThree.
RobotReply1.  Reply2Reply3.

At this point
<
input/> = Three.
<
that/> = Reply3.
<
request/> = OneTwoThree.
<
response/> = Reply1.  Reply2Reply3.

but for

HumanOne.
RobotReply1
Human
Two.
RobotReply2
Human
Three.
RobotReply3.

<
input/> = Three.
<
that/> = Reply3.
<
request/> = Three.
<
response/> = Reply3
 

 
  [ # 14 ]

Ahh, so still a small difference. Bugger.

 

 
  [ # 15 ]

Ok, now it’s starting to make sense! smile

 

 
  login or register to react
‹‹ set name=star      html inside templates ››