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

Rule will ignore noerase() and/or repeat() if it contains a analyze call
 
 

Hi,

I’m new to the forums and new to using ChatScript.

I believe that I’ve found a bug in that a rule seems to ignore the noerase() and repeat() commands if that rule contains a analyze call.

A simple example is :

topic: ~TalkFood (~food ~eat )

u: (~eat much _*)^noerase()  ^repeat()  ^analyze (_0yes you eat a lot

#u: (~eat much _*)^noerase()  ^repeat()  ^analyze (_0) yes you eat a lot 

The active rule will only get fired once and then it will never be called again.  At first I thought the analze call must be failing after the first time, but I’ve ran the program under a debugger and the analyzecode method is only being called the first time and then is never called again.

If you uncomment the second rule then that also can be called once. Lastly just to confirm that it seems to be either the noerase or repeat call that isn’t working, if you add noerase and repeat to the topic then the rules can be called repeatedly.

Also is there anyway to check if a string variable contains another string. I don’t mean equal but if the variable was a sentence then I want to check if it contains a word or two. The only way I can see at the moment is to use the analyze method and then call respond on a topic that tries to match the search string and sets another variable if it finds it. It works but it seems that a simple string contain function would be better at least for simple searches. I’ve started to look how to add another function call to the source code but I’m only just starting to find my way around it. Is there anything more required for the scripts to be able to call it, than adding the details of the new method to systemFunctionSet ?

 

 

 
  [ # 1 ]

Yes, there was a bug.  When you call “noerase” it adds the rule to a list of rules to protect.
The call to Analyze treated the data like a new sentence and reset that list to empty so when the rule actually completed, it was no longer protected. 
New version release soon will fix that bug.

you can request a ^substitute on a string and see if substitution succeeds or fails, eg

if (^substitute(character $tmp “want this substring” “” true) { substring was found }

 

 

 
  [ # 2 ]

Adding a new function to the table (and its code) is all that is required to add a new function. Though I’d recommend that if you have a new function you might pass it by me first to tell you if it’s thought of everything, if it is redundant, or to include in the engine so you dont have to keep patching it back in on new releases from me.

 

 
  [ # 3 ]

Thanks Bruce.

Once I know the code base a bit more if I have any new functions then I will certainly pass them to you.

At the moment though I’m still learning how it fits together. The main function I was thinking of at the moment was the string contains one but it looks like substitute will work. I also realized that I had forgot about the match function. So I don’t actually have to use another topic to respond after calling analyze, I can just then use match to search from the original rule.

 

 
  login or register to react