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

Need help creating a catch-all topic
 
 

I am having trouble getting this to work. I want to create a catch-all topic that accepts commands from the caller, that enables and disables topics. I want this topic to run any time and not interfere with the flow of other topics unless it disables them. Its operation should be invisible to the user.


This is what I have so far:

topic: ~MASTER_TOPIC noerase repeat priority ( \[ test1 \] \[ test2 \])
#! This topic is a catch all that always runs. It only accepts commands from the engine that enable and disable other topics in this script

#! enable CHILDHOOD topic
s: ( \[ test1 \] ) “CHILDHOOD topic enabled”

#! disable CHILDHOOD topic
s: (\[ test2 \]) “CHILDHOOD topic disabled”


It outputs the expected results, but interferes with the CHILDHOOD topic, if I am part way though it.


Also if I change the test1 line to:

s: ( \[ test1 \] ) ^enable(CHILDHOOD all) “CHILDHOOD topic enabled”

It no longer outputs “CHILDHOOD topic enabled”. It says, “I don’t know what to say.”


Any suggestions?

 

 

 

 
  [ # 1 ]

I’m not entirely clear on your goal.

The existing keywords of the topic make no sense…
( \[ test1 \] \[ test2 \])

test1 and test2 are fine.  The escaped brackets are implausible and two are repeats. If you are trying to only match on out-of-band gesture inputs, then maybe “[ test1 ]” and “[ test2 ]” make sense, but really I think that bracketing makes no sense in keywords.

If this is a catch-all topic, then presumably it requires NO keywords whatsoever and is called directly from the control script at some point. And what does “interfering with the topic if partway thru it” mean? Should it be able to disable the topic you are current in? Should it do it for FUTURE input but not the current input. Since you are running a “magic command”, one assumes if it is detected, it should be processed and stop all additional output.  Correctly getting it to output text would PROBABLY do that, but insurance is to run ^END(INPUT) at the end of matching it.

Syntax for enabling a topic is
^enable(topic ~childhood) 
vs ^enable(rule labelofrule)
and your syntax would make it fail, hence not process the rest of the rule.

 

 

 
  [ # 2 ]

Thanks for replying.

“If this is a catch-all topic, then presumably it requires NO keywords whatsoever and is called directly from the control script at some point.”

Thats what I thought, but it wasn’t responding to any input using empty brackets. I was calling it from simpletopic.top, so perhaps that was my problem? I will try calling from the simplecontrol.top and see how it goes. Another possibility is I am using Win7 64 and it is causing issues, so I will try changing the compatibility mode to Windows XP.

“And what does “interfering with the topic if partway thru it” mean? “

If I was in the CHILDHOOD topic and one of the [test1] or [test2] commands were matched in the MASTER_TOPIC, I would have to type in childhood, to re-enter the topic and only then would it continue in the topic where it left off.

“Should it be able to disable the topic you are current in? “

Yes, that would be ideal and enabling a topic would mark it as unseen, so it begins again.

“insurance is to run ^END(INPUT) at the end of matching it.

Syntax for enabling a topic is
^enable(topic ~childhood)
vs ^enable(rule labelofrule)
and your syntax would make it fail, hence not process the rest of the rule.”

Thanks, I will try those out.

 

 

 
  [ # 3 ]

I would expect you to call it from simplecontrol.top, which is the control structure.

If you want it to start a topic anew, you’d want do to ^reset(topic ~childhood) or whatever. If you want it to resume where it left off, you wouldn’t reset the topic.

Chatscript is “independent” of the OS except for the obvious you have to run the right copy.  So your problems will not be because of OS.

 

 
  [ # 4 ]

Bruce,
  I am still not having any luck with this. Can you tell me where in simplecontrol.top, I should put this code?


topic: ~master_topic noerase repeat priority ()

#! enable CHILDHOOD topic
s: (\[ test 1 \]) ^END(INPUT) ^reset(topic ~childhood) “CHILDHOOD topic enabled”

#! disable CHILDHOOD topic
s: (\[ test 2 \]) ^END(INPUT) ^disable(topic ~childhood) “CHILDHOOD topic disabled”

 

 
  [ # 5 ]

a couple of points— the “topic” can be anywhere… it is freestanding. What you are asking is presumably where to put a call to the topic.  Also, since the topic has no keywords, “priority” contributes nothing to its definition.

Where to put this call:

if (%response == 0) { nofail(TOPIC ^respond(~master_topic)) }

depends on your priority for when it should be called—- before rejoinders? before current topic? before other topics.


Either immediately after:  nofail(TOPIC ^rejoinder())

or after: if (%response == 0) { nofail(TOPIC ^respond($$currenttopic)) } 
would make sense

 

 
  [ # 6 ]

Thanks Bruce.

 

 
  [ # 7 ]

I just tried it and no luck on ChatScript Version 2.0.

I placed it after this:

nofail(TOPIC ^rejoinder()) # try for rejoinders. might generate an answer directly from what we are looking for.

if (%response == 0) { nofail(TOPIC ^respond(~master_topic)) } #<——


I put the master topic at the bottom of simplecontrol.top

topic: ~master_topic noerase repeat ()

#! enable CHILDHOOD topic
s: (\[ test 1 \]) ^END(INPUT) ^reset(topic ~childhood) “CHILDHOOD topic enabled”

#! disable CHILDHOOD topic
s: (\[ test 2 \]) ^END(INPUT) ^disable(topic ~childhood) “CHILDHOOD topic disabled”


I used the :build 1 command on it and it built without errors.

When I ran it and use the command [test 1], it asks if I have been here before.

 

 
  [ # 8 ]

Well, the original question was how to activate this topic, not whether the topic was correctly coded. A responder like:
s: (\[ test 1 \]) ^END(INPUT) ^reset(topic ~childhood) “CHILDHOOD topic enabled”


1: doesn’t need quote around the childhood topic disabled
2: ends the responder immediately upon ^end(input), which should be placed AFTER all the other stuff in the responder.

 

 
  [ # 9 ]

It worked! Thanks for your help Bruce.


Here is the code for anyone that is interested:

topic: ~master_topic noerase repeat()

#! enable CHILDHOOD topic
s: (\[test 1 \]) CHILDHOOD topic enabled ^reset(topic ~childhood) ^END(INPUT)

#! disable CHILDHOOD topic
s: (\[test 2 \]) CHILDHOOD topic disabled ^disable(topic ~childhood) ^END(INPUT)

 

 
  [ # 10 ]

Sorry to bother you again Bruce, but on testing I ran into another issue.

What I want to be able to do is

1) enable and reset a topic back to its intitial state.

2) disable the topic.

3) I want to be able to switch back and forth between 1 and 2.


The problem I have run into is the reset system function, does not let me re-enter the topic after it has been disabled. Just using enable on its own works, but it continues in the topic where I last left off, which is not the behavior I want.

This is the code I have. Can you see what I am doing wrong?

topic: ~master_topic noerase repeat()

#! enable CHILDHOOD topic
s: (\[test:1 \]) CHILDHOOD topic enabled ^enable(topic ~childhood) ^reset(topic ~childhood) ^END(INPUT)

#! disable CHILDHOOD topic
s: (\[test:2 \]) CHILDHOOD topic disabled ^disable(topic ~childhood) ^END(INPUT)

 

 
  [ # 11 ]

I got it working. I added “noerase repeat” to the childhood topic:

topic: ~CHILDHOOD noerase repeat (child childhood kid little memory young younger history )

 

 
  login or register to react
‹‹ Talking Angela      ChatScript status ››