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

How does one topic call other topics?
 
 

In the Debugging Manual (v2.95) page 6,  talking about :trace ~SOMETOPIC,  it says “this enables tracing for this topic and all the topics it calls.”

I am totally drawing a blank on the idea of topics calling other topics.  The closest idea I see is popping topics off the topic stack.

Can someone amplify or give an example of a topic calling another topic? 
Thanks!

Wade

 

 
  [ # 1 ]

the basic functions are ^respond(~topicname) and ^gambit(~topicname)  to call in responder mode or gambit mode.
Using ^respond is more common.


eg.

topic: ~pets(...)

t: Do you have any pets?
  a: (~animals) ^respond(~pet_react)  —handles 1 liner response to all sorts of animals.


or from a control topic:  when one wants to gambit from a current topic:

^gambit($$currenttopic)

 

 
  [ # 2 ]

Then there’s quibble routing…. you want a quibble, you want to have different topics dedicated to specific types of sentences:

u: () ^respond(~xeliza_pre )
u: ([never not ] ) ^respond(~xeliza_not )
u: (or) ^respond(~xeliza_or )
u: (who) ^respond(~xeliza_who )
u: (what ) ^respond(~xeliza_what )
u: (when ) ^respond(~xeliza_when )
u: (where ) ^respond(~xeliza_where )
u: (why) ^respond(~xeliza_why )
u: (how much ) ^respond(~xeliza_howmuch )
u: (how many) ^respond(~xeliza_howmany)
u: (![much many] how) ^respond(~xeliza_how )
u: ([because cause ] ) ^respond(~xeliza_because )
u: (will ) ^respond(~xeliza_will )
u: (can ) ^respond(~xeliza_can )
u: (do ) ^respond(~xeliza_do )
u: () ^respond(~xeliza_misc )
u: ( < [do did can will could would might] you ) [No.] [Yes.][Maybe.]
u: () ^respond(~XINTENT_HONEST_RESPONSE )

 

 
  [ # 3 ]

and then my chatbots have tables of data (favorite, hate, do-you, etc)  and so a topic gets called to handle all table responses…

topic: ~XTable_responses system()
u: ()
if (%response == $$response){nofail(TOPIC respond(~XFAVE))}
if (%response == $$response){nofail(TOPIC respond(~XHATE))}
if (%response == $$response){nofail(TOPIC respond(~XCANYOU))}
if (%response == $$response){nofail(TOPIC respond(~XHOWOFTEN))}
if (%response == $$response){nofail(TOPIC respond(~XEXAMPLE))}

u: (%response=$$response ~XWEIGHT) nofail(TOPIC respond(~XWEIGHT))  # handle define loebner test
u: (%response=$$response ~XSPEED) nofail(TOPIC respond(~XSPEED))  # handle speed loebner test
u: (%response=$$response ~XTIME) nofail(TOPIC respond(~XTIME))  # handle time loebner test
u: (%response=$$response ~tool) nofail(TOPIC respond(~tools))  # handle tool loebner test

u: (%response=$$response ~xlifespan) nofail(TOPIC respond(~xlifespan)) 
u: (%response=$$response ~Xwords)  nofail(TOPIC respond(~xwords)) 
u: (%response=$$response) nofail(TOPIC respond(~Xcompare_test))  # handle comparison loebner test

 

 
  [ # 4 ]

A topic like XFAVE has all the ways of asking “what is your favorite” and maps them into appropriate queries into tables of favorites.  My typical favorites table looks like this

~sports ball sport “I love tennis.”

the 1st field is what topic to continue in (addtopic) after making this response.
the 2nd and 3rd fields are the primary things to react to. 

_ sport   would address a general question of “what is your favorite sport”

whereas one often gets a qualifier added to a question so I do qualifiers in the table. I don’t generally ever need 2 qualifiers, so I can handle favorite mountain in Japan as
~geography [ Japanese Japan] mountain “I love mount fuji.”
That is, the topic figures out where its Japanese mountain or mountain in japan or whatever the phrasing is, and eventually routes the right values to a query to find the answer and if it finds it, sets up the addtopic followup.

The 4th entry is the literal thing to say.

 

 
  [ # 5 ]

Thanks, Bruce.  Two follow up questions.

Is ^respond() limited to 1-liners,  or does it essentially make a copy of the entire new topic, indent it one level, relabel it a:, b:, c:,  (or wherever we continue) and then keep going?  For example, can the responding topic ITSELF have responders or can it, also, potentially call ^respond( ~GRANDCHILD_TOPIC), etc. ?

And,  what exactly IS a “quibble”, in general? It’s not a term I recognize.


Wade

 

 
  [ # 6 ]

Understand that every topic you write is being accessed via ^respond or ^gambit because the control topic is in fact calling your topics using those mechanisms.  There is no “relabeling of levels or anything going on.  A topic in programming terms is a subroutine.  You call a subroutine, it does its thing, it can call other subroutines, they do their things, eventually control returns back to the calling subroutine.  In the context of chatscript, if your topic calls another topics, then that call completes either you have generated output or not. If you have, then that’s what stops your CURRENT topic from continuing with new rules, just as though you had written the output directly instead of calling a topic. And if the topic you called merely built facts, did computations, but DIDNT generate any output, its like you didnt generate any output from the current topic so presumably it will move on to the next rule to try.

A “quibble” is a response made which does not accurately answer the user’s question or respond to his statement.  If the user says
“do you swim on tuesdays” and your bot DOESN"T know the answer for itself, it can use the “<do you” pattern in a rule like this:

u: ( < do you )  [Sometimes][Yes][No][Why do you ask][Why ask me? Why not ask someone else].

The system is taking a piece of the input, sans real meaning, and issuing some kind of pretend response.  The “honest” quibble would be to say “I don’t know.”  but that gets boring and doesn’t keep the converstation going.

 

 
  [ # 7 ]

So.. ~XTable_responses is a control topic called from a control topic. The topics it calls are intended to generate actual answers by table lookups so they are responder topics.  A responder topic is a style of topic that can answer questions but not engage in conversation (it has no gambits).  A conversational topic has gambits intended to simulate a conversational flow (and has responders or not).

 

 
  [ # 8 ]

quibble: To evade the truth or importance of an issue by raising trivial distinctions and objections.

In this case, we focus on some words in the input and generate a response, but we have NO CLUE really what the user wants to know. If the user does “do you always go to school on fridays” we respond “I don’t ALWAYS do anything.”

 

 
  [ # 9 ]

Again, thank you very much, Bruce!  It’s all becoming more clear day by day. 

I’m glad I asked, instead of assuming, since I had sort of parsed “quibble” to be “making finer distinctions”, but missed the “NO CLUE” part of what was going on.

smile

Wade

 

 
  login or register to react