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

interrupting a topic
 
 

I’m trying to handle topics interrupting others:

bot: hello Annie
me:  hello bot. Do you go to school?
bot:  Yes, I go to school at bot U
me: thats nice, what’s your major?
bot: I’m majoring in Artificial Intelligence
me: holy smokes! The room’s on fire!
bot: Are you a senior?  <—stuck in the ‘school’ topic

How do I get the bot to abandon the school topic when the user wants to ‘change subject’?

I’m really not getting the rules for changing the topic. This is as close as I’ve found in the docs to a description of the rules, and it’s pretty vague:

A topic is invoked in gambit mode or responder
mode. In gambit mode, it dishes out its gambits in order.
Each time a rule generates output, it is marked as
used up, so it will move onto another rule next time.
When it runs out of gambits, the topic exits. In responder
mode it will jump down to the responders area
and try to find a match to the input. It will keep trying
responders until it finds one that generates output or
tries them all unsuccessfully.

It neither describes how the next topic is chosen nor explains whether the responder mode exits - some clear explanation of the topic choice rule would be much appreciated 8cD

 

 

 
  [ # 1 ]

I am having the same confusion…

As the docs state… the topic ends when you run out of gambits. 

look at simplecontrol.top it seems to determine the order of the topics. 

Also there is a document “ChatScript System Functions Manual.”  It has a bunch of topic functions… ^next() looks interesting.

 

 
  [ # 2 ]

In the normal course of events, what happens is this…

You are in a topic (however you got there).  You provide new input. The system will try to find a rejoinder for that input (and we assume there isnt one). So the system will try to find a responder within that topic (we assume there isnt one). So the system will try to use keywords of the input matched against keywords of OTHER topics to see if they might be useful. If it finds a match, it will test the responders of that topic. I presume you have NO topic which is prepared to respond to your input that the room is on fire (much less the exclamation about holy smokes).  So the system can randomly decide to quibble (if it can find a match).  If it rolls against that, or cant find a quibble. then it would next try to find a topic with keywords that match that it might gambit from. That probably fails because you still have no topic to cover fire. So ALL IT CAN DO is continue talking in the current topic until that topic is exhausted. What did you want it to do?  Randomly pick some other topic?

The key thing is topics have keywords that allow the system to look into them when trying to match input. Do you have any topic that might match your inputs?

 

 
  [ # 3 ]

Secondarily there is the question of what to do with Holy Smokes!  First, it really should be treated as an interjection of surprise (which is not one currently in the LIVEDATA/interjections file but which I have added for the future.

Second, the Harry bot has a simple control script which is only expecting a single user input sentence and has no capacity to handle multiple sentences.  It’s a bunch more work to describe how to write a custom control script. In this case, I would probably have made the control script detect the interjection as first sentence and that %more was true (meaning there was more input) and had the control script simply ^fail(sentence) to move on to the next input since surprise is probably not useful to react to.

 

 
  [ # 4 ]

thanks - I think that clarifies a lot.  It’s a point that I couldn’t figure out from the basic users manual.

There’s a bunch of references to ‘active topic’ and ‘pending topics’, but no centralized place this algorithm is given exigesis.

Ok, ignoring the holy smokes, which I understand will complicate the issue - Imagine that there is indeed a topic for discussing the house being on fire. Here’s my understanding of how to fix my issue:

t: ~school [school study university]

?: (do * school?)  Yes, I go to school at bot U

?: (major)  I’m majoring in Artificial Intelligence

t: We had a great football team last year

t: ~fire [fire]

u: (* be *~2 on fire) Lets get out of here!

This does bring up another question - there’s a bunch of references to ‘pending topics’ in the documentation. I have the impression you can have n topics ‘pending’ and one active. But I can’t find a clear explanation of how this works?

On the subject of missing interjections - my bots are NPC’s in a game about the french resistance, they’re partial to saying Merde! and Sacre Bleau! (though they speak English)

 

 
  [ # 5 ]

I don’t think enough has been clarified or you wouldn’t write:
t: ~fire [fire]

First off, that gambit has no real meaning. It will not invoke a fire topic (you’d need to call ^gambit(~fire) or ^respond(~fire).
Second, you normally wouldn’t want to try to guess when to invoke it from a gambit since that is fixed. So instead you might add
u: (~fire) ^respond(~fire)
HOWEVER, there is no reason for this topic to be expecting fire. The whole point of authoring topics is that they are independent.  So if you have
topic: ~fire (fire conflagration flame burn)
then a sentence occuring during ~school which didn’t have a school keyword in it but did have a fire keyword, ought to go try out the ~fire topic for a responder. And if that fails, for a gambit.

On interjectsion, you can define your own in a topic file.
replace: merde ~emosurprise

 

 
  [ # 6 ]

Oops! Meant

topic: ~fire [fire]

u: (* be *~2 on fire) Lets get out of here!

 

 
  [ # 7 ]

ok. that would be reasonable, though the pattern does not need the leading *.

 

 
  [ # 8 ]

Appreciate the assistance.

I keep reading references to ‘pending topic’, as in this documentation for ^addtopic.  What does it mean to be ‘pending’?

^addtopic(topicname) – adds the named topic as a pending topic and clears the rejoinder
marker. Typically you don’t need to do this, because finding a reaction from a topic
which is not a system, disabled, or nostay topic will automatically add the topic to the
pending list. Never returns a fail code even if the topic name is bad.

 

 
  [ # 9 ]

When you end up in a topic, that is the active topic. if you leave there because some other topic takes control, your original topic is added to a pending topic list (think of it as a stack and the new topic like a function call). When your new topic exhausts its gambits, the system will return to the most recently stacked pending topic, resuming gambits from there. When you call addtopic, you explictly push a topiic at the front of that pending list. It does not make that the active topic (you are still in that), but when the active topic has no gambits left, you will go the pending topic.  You can, of course, make a topic the active topic by doing ^respond or ^gambit and having that work.

Documentation that addtopic clears the rejoinder marker is wrong and will be removed.

 

 
  [ # 10 ]

Thanks! That’s clear

 

 
  login or register to react