|
|
Senior member
Total posts: 697
Joined: Aug 5, 2010
|
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?
|
|
|
|
|
Posted: Nov 22, 2012 |
[ # 1 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
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.
|
|
|
|
|
Posted: Nov 22, 2012 |
[ # 2 ]
|
|
Senior member
Total posts: 697
Joined: Aug 5, 2010
|
So basically, “request” == “input” and response == template-side-that ?
Can do.
|
|
|
|
|
Posted: Nov 22, 2012 |
[ # 3 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
That’s pretty much my guess, but I’m not 100% certain, so I feel I must defer to those more experienced.
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 4 ]
|
|
Administrator
Total posts: 2048
Joined: Jun 25, 2010
|
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”>.
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 5 ]
|
|
Senior member
Total posts: 697
Joined: Aug 5, 2010
|
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.
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 6 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
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.
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.
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 7 ]
|
|
Administrator
Total posts: 2048
Joined: Jun 25, 2010
|
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.
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 8 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
Jan, do you see now why I refer to Steve as an AIML god?
Thanks, Steve! I wasn’t aware of the “backwards” nature of the second part of the index. I’ll need to remember that bit.
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 9 ]
|
|
Senior member
Total posts: 697
Joined: Aug 5, 2010
|
Dave Morton - Nov 23, 2012: Jan, do you see now why I refer to Steve as an AIML god?
Thanks, Steve! I wasn’t aware of the “backwards” nature of the second part of the index. I’ll need to remember that bit.
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.
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 10 ]
|
|
Administrator
Total posts: 2048
Joined: Jun 25, 2010
|
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”/>?
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 11 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
Because index=“1” is “What did I say?”
Of course, if you wanted your chatbot to be a smart-@$$, you could use <input index=“1” /> anyway, just to torque off the user.
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 12 ]
|
|
Administrator
Total posts: 2048
Joined: Jun 25, 2010
|
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!
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 13 ]
|
|
Moderator
Total posts: 206
Joined: Jul 1, 2009
|
<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:
Human: One. Two. Three. Robot: Reply1. Reply2. Reply3.
or
Human: One. Robot: Reply1 Human: Two. Robot: Reply2 Human: Three. Robot: Reply3
<input/> and <that/> refer to the individual sentences, while <request/> and <response/> refer to multi-sentence inputs and response.
Human: One. Two. Three. Robot: Reply1. Reply2. Reply3.
At this point, <input/> = Three. <that/> = Reply3. <request/> = One. Two. Three. <response/> = Reply1. Reply2. Reply3.
but for
Human: One. Robot: Reply1 Human: Two. Robot: Reply2 Human: Three. Robot: Reply3.
<input/> = Three. <that/> = Reply3. <request/> = Three. <response/> = Reply3.
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 14 ]
|
|
Senior member
Total posts: 697
Joined: Aug 5, 2010
|
Ahh, so still a small difference. Bugger.
|
|
|
|
|
Posted: Nov 23, 2012 |
[ # 15 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
Ok, now it’s starting to make sense!
|
|
|
|