|
|
Senior member
Total posts: 328
Joined: Jul 11, 2009
|
I’ve been reading this page here about substitutions, but some of it seems a little odd.
http://blog.pandorabots.com/substitutions-and-sentence-splitting/
If you look at this substitutions.xml :
http://alicebot.wikidot.com/aiml:pt-br:cybernet:cybora:substitutions-xml
You can see what person and person2 contain. All well and good.
The trouble is, according to the blog they are the wrong way around - unless I am confusing something.
Take :
Input: Give the password to me.
Output: User has asked me to give the password to him or her.
<category> <pattern>GIVE THE * TO *</pattern> <template>User has asked me to give the <star/> to <person2><star index="2"/></person2></template> </category>
him or her - is not in person2 but it is in person
Similarly…
Input: You are waiting for me.
Output: I am waiting for you.
<category> <pattern>YOU ARE *</pattern> <template>I am <person><star/></person></template> </category>
you is not in person but in person2
Could someone advise which one is right ?
Thanks !
|
|
|
|
|
Posted: Oct 26, 2014 |
[ # 1 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
According to the original AIML 1.0 Specification:
The <person> tag converts first person to third person and vice-versa, whereas the <person2> tag converts first person to second, and second person to first. Thus, the blog does, indeed, have it wrong. Personally, I don’t much care for the use of the labels “person” and “person2”, but I don’t have a more fitting set of labels to use.
|
|
|
|
|
Posted: Oct 26, 2014 |
[ # 2 ]
|
|
Senior member
Total posts: 328
Joined: Jul 11, 2009
|
OK thanks Dave, I thought I was going nuts
|
|
|
|
|
Posted: Oct 26, 2014 |
[ # 3 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
Happy to help, Rog. Let me know if I can help with your interpreter project.
|
|
|
|
|
Posted: Oct 26, 2014 |
[ # 4 ]
|
|
Senior member
Total posts: 328
Joined: Jul 11, 2009
|
You just have and thanks to your previous replies in the past I am on track. Many thanks
|
|
|
|
|
Posted: Oct 27, 2014 |
[ # 5 ]
|
|
Senior member
Total posts: 328
Joined: Jul 11, 2009
|
It looks like they changed things in AIML 2.0
I spoke to Pandorabots on Facebook, dropping this in for future reference :
https://www.facebook.com/permalink.php?story_fbid=10204220543786244&id=47719737069
|
|
|
|
|
Posted: Oct 27, 2014 |
[ # 6 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
Aha! Well, that’s gonna mess a few things up. I guess it makes better sense at this point to go with a substitutions file, rather than internal parsing for those 2 tags. Thanks for the final clarification, Roger.
|
|
|
|
|
Posted: Oct 27, 2014 |
[ # 7 ]
|
|
Senior member
Total posts: 328
Joined: Jul 11, 2009
|
Do you interpret (no pun ) that the same way as I do then - that they have swapped them around ?
I agree, surely this makes AIML 2.0 partly incompatible with AIML 1.0 ?
Another thing, take these lines from substitutions.xml :
<substitute find=" with me " replace=" with you "/> <substitute find=" to me " replace=" to you "/> <substitute find=" me " replace=" you "/>
Couldn’t the last line do the same job as the two above ?
Coding these substitutions as per example in the three lines above is a bit of a headache.
Say one triggers the first line ‘with me’ and then swaps it to ‘with you’.
That’s fine, but then later in the xml comes :
<substitute find=" you " replace=" me "/>
So you are back to square one again.
Maybe I’m looking at it too linearly - it does need to check what has been changed so it doesn’t over write itself. This can be done easier if those first three rules were simply…
<substitute find=" me " replace=" you "/>
Then you could take note that ‘you’ is a replacement. With all three rules it gets unnecessarily complex to my mind.
|
|
|
|
|
Posted: Oct 27, 2014 |
[ # 8 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
Yeah, that can be a hassle. What I did was to do a 2 step replacement; first replacing ” you ” and ” me ” with placeholders (” m~e ” and ” y~ou “, respectively, for example), then making a second pass, replacing the placeholders with the proper word. It’s an extra step, but it solved the double replacement issue for me. A simple str_replace() (if done in PHP) to strip out the tilde is all the second pass needs to do, if done right.
|
|
|
|
|
Posted: Oct 27, 2014 |
[ # 9 ]
|
|
Senior member
Total posts: 328
Joined: Jul 11, 2009
|
Thanks for the tip Dave, that will help I think. I still don’t see the need for the extra rules though. Maybe I will have to go off at a fork, but I did want to keep to the AIML 1.0 specs if possible.
Off to the dentist in a bit, so that’s sure to take my mind off things !
|
|
|
|
|
Posted: Oct 27, 2014 |
[ # 10 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
You know, the easiest way to deal with the discrepancy would be to provide 2 substitutions files, one for AIML 1.0 and one for 2.0, the only difference being that the <person> and <person2> tags (but not the content of each) are switched. Then, in the help file (you will be providing a help file, won’t you? ;) ), provide a short explanation for the two files. The 2.0 specification mentions that the mechanism for implementation is up to the interpreter (your job), but the actual substitutions are up to the botmaster.
|
|
|
|
|
Posted: Oct 27, 2014 |
[ # 11 ]
|
|
Senior member
Total posts: 328
Joined: Jul 11, 2009
|
I’m with you Dave. Yes up to the botmaster means I will have to leave in that flexibility.
If I ever release it I would provide documentation yes. Already I document my code heavily.
This is one of those fun to do projects that I had on my back burner for a long time and for the most part it is fun. My own personal goal is to extend AIML 1.0 with some of my own tags, like the <add> <multiply> and other string functions or anything I can think of - this ultimately leads to the end result of my own slightly different chat bot.
It’s the long way around but whilst I do it I am learning what AIML does, so I am killing two birds with one stone. And I wanted a nice project to get my teeth into.
|
|
|
|
|
Posted: Oct 27, 2014 |
[ # 12 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
Well, I don’t want to take away from your own project, but if you ever had the inkling, I know of a great, similar project that I’m sure that the dev team would be tickled to get some help with. If you’re interested, I could talk to the team leader.
|
|
|
|
|
Posted: Oct 27, 2014 |
[ # 13 ]
|
|
Senior member
Total posts: 328
Joined: Jul 11, 2009
|
I’ll bear that in mind Dave, thanks
You might want to check out that link I gave to Facebook again. Pandorabots is telling me that AIML 1.0 spec is actually the one that is wrong.
There’s a lot of other things in that AIML 1.0 spec that are wrong too - like saying some tags are deprecated when they are still in use.
|
|
|
|
|
Posted: Oct 27, 2014 |
[ # 14 ]
|
|
Administrator
Total posts: 2048
Joined: Jun 25, 2010
|
While “person” is extremely useful, I don’t know of anyone who uses the “person2” tag.
*EDITED to put tag names in.
|
|
|
|
|
Posted: Oct 28, 2014 |
[ # 15 ]
|
|
Senior member
Total posts: 328
Joined: Jul 11, 2009
|
Well I coded both tags to the AIML 2.0 specification as described in that blog. It seemed the best thing to do in the end.
|
|
|
|