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

How far can/should <srai> go ?
 
 

For the purpose of building an interpreter I was wondering how far <srai> can/should go.

OK I see that you could use <srai> to link to another pattern at one level, but should/can that pattern’s template also contain an <srai> to somewhere else ?

And could this just go on forever ?

Thanks.

 

 
  [ # 1 ]

There should definitely be a limit to how deep SRAI nesting should go, because people actually write this:

<category>
  <
pattern>HI</pattern>
  <
template>
    <
srai>HI</srai>
  </
template>
</
category

and then wonder why their chatbot doesn’t work. :-\

Usually, you can’t go wrong with a recursion limit of 10. smile

 

 
  [ # 2 ]

The Pandorabots paid server goes to a <srai> depth of 256. I think the free one goes to about 20 or so.

 

 
  [ # 3 ]

Thanks guys. I’ll set a limit then.

 

 
  [ # 4 ]

Yes definitely set a limit or you will get infinite recursion errors, as Dave pointed out above.

As an aside, is AI Dreams down? I keep getting a “Page not found” error when trying to access the site.

 

 
  [ # 5 ]

In Microsoft SQL server the maximum nesting level for stored procedures is 32. Thus an MS SQL based interpreter will have a limit slightly under 32. From running test code, the max depth I have seen for ‘normal’ categories is about 10 to 12. Dave’s code above is obviously an exception smile However there is something similar in the standard AIML files where HI calls HELLO and HELLO could (via <random>) call HI again. This sorts itself out after a few recursions, but it should really be fixed.

In conclusion a ‘minimum’ limit of 20 should be OK. The ‘upper’ limit can be what you want, but if it’s too large then unintended recursion will cause your bot to wait a long time before answering, which is bad.

 

 
  [ # 6 ]

Thanks again and thanks Will smile

Steve, you should be able to get into Dreams on the forum link : http://aidreams.co.uk/forum/index.php?action=forum

There’s been some difficulty since they had to reset the main server, I guess some PHP settings need to be reset, they’re working on it.

Can you let me know if you get in on that link okay please. Cheers.

 

 
  [ # 7 ]
Steve Worswick - Oct 24, 2014:

The Pandorabots paid server goes to a <srai> depth of 256. I think the free one goes to about 20 or so.

Fortunately, the Pandorabots Playground (which is free) one also goes to 256. If it didn’t, my bot would barely function (I even hit that limit on some inputs).

 

 
  [ # 8 ]

How do you keep track of so many redirects ?

Doesn’t this level just slow the bot down ?

I was going to go with 10 - 20 levels deep.

btw, Steve Dreams is back now, they fixed the problem.

 

 
  [ # 9 ]

No offense intended here, but it seems to me that if you need an SRAI iteration/nesting depth of 256, then you’re probably introducing FAR too much complexity, most likely without enough of a benefit to justify it. Of course, that’s just my own opinion, but… wink

 

 
  [ # 10 ]
Dave Morton - Oct 25, 2014:

No offense intended here, but it seems to me that if you need an SRAI iteration/nesting depth of 256, then you’re probably introducing FAR too much complexity, most likely without enough of a benefit to justify it. Of course, that’s just my own opinion, but… wink

My bot isn’t intended to be a chatbot, it’s an arithmetic bot (which I made more for fun than to accomplish anything useful) which currently just answers arbitrary questions of the form a + b (where a and b are nonnegative integers). The algorithm predictably reaches maximum depths that are at least linear in the lengths of a and b. I’ve thought of no good way to reduce this except to use variables to replace the recursion with iteration, and that approach would make the code a fair bit more complex.

EDIT: I should mention that it only reaches depths in the hundreds when the inputs are huge. For more reasonable inputs, the depths it reaches are more reasonable.

Roger Davie - Oct 25, 2014:

How do you keep track of so many redirects ?

Doesn’t this level just slow the bot down ?

I was going to go with 10 - 20 levels deep.

btw, Steve Dreams is back now, they fixed the problem.

The algorithm uses a lot of recursion, but the way it works is fairly intuitive, so understanding the trace isn’t that hard.

 

 
  [ # 11 ]

Good point, and with this new information, I happily withdraw my earlier “objection”. smile

 

 
  [ # 12 ]

Interesting usage. I understand it was for fun, but surely there are better ways to do that smile

Have fun though !

 

 
  [ # 13 ]
Roger Davie - Oct 25, 2014:

Interesting usage. I understand it was for fun, but surely there are better ways to do that smile

Have fun though !

Must there be? I assume that if there were a simple way to do it, most of the top AIML bots would do it already. I don’t know of any AIML bots aside from mine that support arbitrary arithmetic (8pla’s might, but I’m not sure about that or whether his is even an AIML bot).

 

 
  [ # 14 ]

Well a language more suited to it was what I had in mind and then use that as a service…. I didn’t realise you were limited to AIML strictly…


Since Dave said 10 and Steve said 20 I went for 15 levels.

 

 
  [ # 15 ]
Roger Davie - Oct 25, 2014:

Well a language more suited to it was what I had in mind and then use that as a service…. I didn’t realise you were limited to AIML strictly…

Ah, right. Well, most languages implement something pretty close to arbitrary arithmetic already (not quite, but easy enough to extend). The fun of this project is the challenge of making a language bend in a way it’s clearly not designed to bend.

 

 1 2 > 
1 of 2
 
  login or register to react