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

Saving labels
 
 

Is there any way to use variables with reuse()?

I’m currently using reuse($rule) and saving labels like $rule = LABEL but thats a bit annoying. I tried creating a single letter outputmacro r $rule = %rule but nothing is saved in the variable.
Does %rule save the topic as well so it can be called from other topics?

 

 
  [ # 1 ]

^reuse DOES evaluate its argument, so it should work fine with a $var argument.
%rule generates a complete tag, including topic name.

Since you are sloppy in writing your text here, I cannot say whether you are doing it correctly in your code.
outputmacro r $rule = %rule   is not legal syntax

outputmacro: ^r() $rule = %rule   is legal.

And a reference in text to it would be
u: () this is my ^r()  output

 

 
  [ # 2 ]

I didnt notice I had a leading space before the parens so it prolly wasnt defined. Thanks.

Btw, Bruce, is there a quick way/system command to test if a pattern matches a string?

 

 
  [ # 3 ]

What does it mean that a pattern matches a string. Give an example of what you seek?

 

 
  [ # 4 ]

is there sysfunc like

:match (~psychology_adjectives * role_romantic)  “I’m depressed about my wife”

Wait there is testpattern right? I think I recall that supports custom concepts and variables as well?

 

 
  [ # 5 ]

There are two things:

:testpattern (pattern data ) sample input

^match(pattern data)——operating on current input.

 

 
  [ # 6 ]

Thanks.
^respond currently matches a sentences with a topic pattern and executes the rule. Can I just match it so I can go do something else when I know there is a match?

 

 
  [ # 7 ]

can I use the second FAIL argument? I THINK so.
So to make use of that I suppose I could loop through topics returned by ^gambittopics. Is there any function that returns the names of all topics? even ones with just responders remaining?

 

 
  [ # 8 ]

if you want the names of all topics, do a query(direct_v ? member ?) and then prove each answer has the topic flag bit

 

 
  [ # 9 ]

Sorry not sure I understand that.

query(direct_v ? member ?) would return a HUGE svo factlist of all concepts right?

What do you mean by prove each “answer”? Would I be checking the subject or the object? Since the name is defined in the subject, I assume I would check the object.

I also cant find any info on the topic flag bit. Is it defined in ~sys? How is it specified? ~topic?

 

 
  [ # 10 ]

OK. not practical, I agree.  Why did you want a list of all topics instead of just ones your sentence has keywords of?

 

 
  [ # 11 ]

As for ^substitute, you can use the optional 5th argument to tell it to indicate failure.  Although I will probably directly support ~email_url in the engine in the next release.

 

 
  [ # 12 ]

I just want a topic listing because ^respond looks in specific topics for matching rules to the current sentence. I suppose I could manually specify each topic name but I just wanted to know if there was another way to find rules in ALL topics to match with input without executing the rue.

Btw, I doubt your last post about ^substitute was meant for THIS thread.

 

 
  [ # 13 ]

Also I suppose I could create a table of my topics and loop through that with if (^respond($topic FAIL) == FAILRULE_BIT) {Found matching rule in $topic}

Would that work for what I want?
Also say I found a matching rule using ^respond($topic fail) is there any way to save the rule so I can go output something else say in a t: ($undef) gambit with rejoinders and then respond with the saved rule in a matching rejoinder in the gambit?

 

 
  [ # 14 ]

I suppose that would involve another statement in the control script like
u: RULEMATCH ($rulematch==true) Output sentence
    a:(pattern1) Output then set $rulematch = false then execute previous matched rule
    a:(patern1)  Output then set $rulematch = false then execute previous matched rule
that is activated by $rulematch = true then reuse(RULEMATCH) in the harry u:() if a matching rule is found but not sure how to save the previous matching rule to respond with it in u:($rulematch==true) rejoinders since using %rule in the u() in the control script would when, ^respond($topic FAIL) matches a rule, would only match u:()

 

 
  [ # 15 ]

^respond currently matches a sentences with a topic pattern and executes the rule. Can I just match it so I can go do something else when I know there is a match?

technically you can. You can write a script that retrieves the pattern components of the rules of a topic, tries them, and notes if they match, and saves the topic tag so it could be executed later.

 

 1 2 > 
1 of 2
 
  login or register to react