AI Zone Admin Forum Add your forum
Merge the responses of two patterns

I have the following two patterns:

u: AGE (<< [~voustu ~quel]  âge {~avoirpronom} >>) 42 ans
u: ADRESSE (<< {~voustu ~quel} {~habiter}  ~adresse >>)  [gif sur yvette][j’habite sur gif sur yvette]

now I want to combine the two to have this response

u: (<< âge ~habiter ~adresse >>) J’ai 42 ans et j’habite gif sur yvette

it does not work and returns in the first or second pattern according to the word order in the sentence constituting the third pattern.

Thanks in advance


  [ # 1 ]

You want the most specific pattern first.
CS (generally*) starts at the top and works down the topic until it finds a rule whose pattern matches. It will stop when one generates output. So put the harder to match patterns first and the least specific, catch-all patterns at the end.

*It is possible to tweak that via topic keywords and enabling/disabling of rules, but that probably is not relevant here.


  [ # 2 ]

Thank you, it works. I am very curious to know how to enable/disable rules via topic as you suggest even if it is not relevant in my case.



  [ # 3 ]

The normal processing of CS is that gambits are automatically disabled after use, i.e. your bot will only ask a question once, and responders are kept as active, but if the same response was issued recently then CS will move on to the next rule instead of repeating it.

That processing can be influence by topic control flags, see the documentation (Advanced manual) on keep/erase, repeat/norepeat and system.

But you can also do this via script. The ^keep() function will not disable the current rule, and ^repeat() will allow the output from the current rule to be repeated.

The other more sophisticated way is to use ^enable() and ^disable() to change the active status of some other rule. These are not commonly used, but I have used them to re-enable an entire topic after all of its rules have been exhausted - think of a person who repeats the same old stories and just keeps cycling through them!


  login or register to react