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
 
 
  [ # 16 ]

I guess you mean ^getrule and ^match together.
But I dont understant how to use getrule. Can it retrieve a set of rule patterns from a specified topic to loop with ^match?
Does getrule return a factset of patterns?
The documentation for getrule in the Manual is not very clear. Its seem to work by getting a single rule by specifiying its label. so my call would be getrule(pattern ~topic.~label) which means I would have to walk my topics and rules individually and manually. I’m asking for there is any way to get them all in one go. Or some function that will return all s: rule patterns of a topic?

Also, what does “If a rule label is involved, optional third argument if given means
only find enabled rules with that label” from the documentation mean? If we HAVE to specify a tag I know we can specify duplicates in a topic but reuse will only go the first one.

 

 
  [ # 17 ]

A label is a topic name . top level index . rejoinder index
so ~mytopic.0.0 is 1st rule
    ~mytopic.1.0 is 2nd rule
etc. You can loop thru a topic creating these tags and call
^getrule(pattern tag)
which will fail when you run off the list of rules
^getrule(type tag) will tell you the type, and you only care about ? s u rules

$$tag = ^join($topic . $$index . 0 )
$$pattern = ^getrule(pattern $$tag)
if (^match($$pattern)) { this rule would fire }

 

 
  [ # 18 ]

Ah thanks bruce. That really helps. I was not aware of the format of tags.

 

 
  [ # 19 ]

The almost complete start of the system functions manual has:

Rule Tags

Some functions out or take “rule tags”. All rules have an internal label consisting of ~topic.toplevelindex.rejoinderindex. E.g.
~introductions.0.5
stands for the 0th rule in the ~introductions topic, rejoinder # 5.

 

 < 1 2
2 of 2
 
  login or register to react