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

Problem regarding the rest & first tag, and Program AB
 
 

Hey there.
Just to make sure: is there a rest & first tag in Program AB? When I’ve tried it like

<aiml>
    <
category>
        <
pattern>TEST REST</pattern>
        <
template>
            <
rest>T E S T</rest>
        </
template>
    </
category>
</
aiml


it fails.
I’ve come up with a solution for both cases. It looks like:

<aiml><!-- RESTFIRST -->
    <
category>
        <
pattern>XREST * *</pattern>
        <
template><star index="2"/></template>
    </
category>
    <
category>
        <
pattern>XFIRST * *</pattern>
        <
template><star/></template>
    </
category>
</
aiml

Essentially, since the wildcard is non-greedy, every wildcard except the last will only catch one word. As a result, we simulate first and rest by either taking the first word or taking everything but the first word respectively.
Anyway, is there a problem with this method?
Thanks in advance as always.
Edit: I found that the following must be added!

<category>
    <
pattern>XREST *</pattern>
    <
template>nil</template>
</
category

Essentially, when something which can’t be rested is entered, such as “a”, it goes to “nil”, just like <rest> normally would!

 

 
  [ # 1 ]

Hi, Mush.

Your question about <rest> and <first> tags really doesn’t apply to Program AB, but to AIML 2.0. Either way, those are not tags that I recognise. I also cannot find reference to those tags in the AIML 2.0 Working Draft. So this has me wondering where you heard about such tags. smile

Still, your solution looks interesting, and if you have a use for such functionality, then I say go for it. cheese

[edit]
I’ve taken the liberty of editing the code in your post to make it more readable. I hope you don’t mind. smile
[/edit]

 

 
  [ # 2 ]

Hi, Dave.

I found the <rest> and <first> tags from http://docs.pandorabots.com/aiml/rest/ and http://docs.pandorabots.com/aiml/first/ which probably means Pandorabots made up those tags!

In case you’re interested, I’ve been trying a method to check the length of a string - “hello” returns “5”, for example. It does this by repetitive ‘rest’-ing of the string until the string becomes nil. Then, a counter which increments at each ‘rest’ outputs its value. Hope that helps.

By the way, thanks for improving the readability smile

 

 
  [ # 3 ]

I’m guessing then that those tags are proprietary to Pandorabots. Dr. Wallace may have more information on this, so hopefully he’ll find this thread and weigh in.

Actually this is something that interests me greatly. As the lead developer for Program O, any “new” AIML tags that I hear of pique my curiosity a great deal, even if they are meant only for another platform. Lately, the dev team for Program O have been working on supporting AIML 2.0 in Program O’s current architecture, as opposed to trying to develop a whole new version (that’s still in development, more or less… just on the back burner for now while I’m in school). I think I’ll add <first> and <rest> to the ToDo list. wink

 

 
  [ # 4 ]

That sounds good wink
Thanks for clearing that up.

 

 
  [ # 5 ]

<rest> and <first> are AIML 2.0 tags but seem unnecessary when a simple solution like the one in the first post is really quite simple to implement. They are not tags I would ever use.

 

 
  [ # 6 ]

I wonder why they don’t appear in the working draft I linked to. Is there a more current version, Steve?

 

 
  [ # 7 ]

There’s a few things here Dave.

http://docs.pandorabots.com/aiml/aiml/

These are the latest tags for 2.0 as far as I am aware.

 

 
  [ # 8 ]

Thanks for that, Steve. I expect it will prove useful.

 

 
  login or register to react