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

code pattern - subtree and come back to main tree
 
 

We are trying to create small dialog trees with CS. We are struggling on a specific case: we want the conversation to follow different subtrees, but to come back at next step once finished.

A simple example:

Some simple text. Question?
  
Answer 1 : bla bla bla
  Answer 2 
: bla bla bla
*Some text that should trigger one the user is out of Answer 1 or Answer 2 sub trees.* 

It can be nested at different sublevels:

Some simple text. Question?
 
Answer 1 : bla bla
 Answer 2 
: bla bla. Question?
  
Answer 2.1 : bla bla
  Answer 2.2 
: bla bla
  
*Some common text for Answer 2.1 and Answer 2.2 sub trees.*   
*
Some commun text once out of Answer 1 and Answer 2 sub trees.* 

A sample conversation I’d like to have:

bot: Some simple text. Question?
user: Answer 2
bot
: bla bla. Question?
user: Answer 2.1
bot
: Some common text for Answer 2.1 and Answer 2.2 sub trees. Some commun text once out of Answer 1 and Answer 2 sub trees. 

This kind of code pattern works, using rule labels and goto via ^reuse:

u: (test3) 
 
Some simple text. Question?
 
a: (Answer 1)
  
bla bla. ^reuse(A3_1)
 
a: (Answer 2)
  
bla bla. Question?
  
b: (Answer 2.1)
   
bla bla ^reuse(A3_2)
  
b: (Answer 2.2)
   
bla bla ^reuse(A3_2)

u: A3_1 ($dont)
 
Some commun text once out of Answer 1 and Answer 2 sub trees.

u: A3_2 ($dont)
 
Some common text for Answer 2.1 and Answer 2.2 sub trees.
 ^
reuse(A3_1) 

But I don’t like it - too complex.

What could be a better pattern?

 

 

 
  [ # 1 ]

You should be able to craft some post processing code that checked whether there is a rejoinder set and if not then based on the rule label that generated the output construct a label for the common text. That could repeat up rule hierarchy dynamically constructing labels as you go.

 

 
  [ # 2 ]

Thanks Andy.
In fact, the whole code is dynamically generated from another source. Thus it is not a real issue to produce all the labels and the gotos. But I would prefer to have a simpler/cleaner code, even if nobody is ever meant to maintain or edit it directly.

 

 
  login or register to react