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

Default oob (out-of-band) handler
 
 

Hi,

I read everything the documentation said about oob and I think I understood the basic concept.

As far as I understand oob works like this:

- data in “[]” at the begin of the output and input is left unchanged by the chatscript engine
- Because of this it can be used to communicate with cs in cases where cs is embedded
- There is no provided way of parsing oob, everything I want to do with oob data has to be done by myself

The only thing I am not quite sure about is the way standalone cs handles oob data.

The “ChatScript JSON.pdf” says:

Standalone ChatScript contains a built-in handler for OOB

Standalone ChatScript doesn´t display oob messages, where embedded chatscript does.
Is there anything else the handler does? Or just hiding oob?

 

 
  [ # 1 ]

CS communication using OOB is not tied to being embedded.  Merely its how it communicates with an application. The browser is also an application and the std webpage CS uses the standard OOB conventions.  The application is expected to strip off OOB before displaying to user (making whatever use of OOB data is agreed with script).

Stand alone CS therefore does not display (by default) OOB messages. It merely handles the standard ones of LOOPBACK, CALLBACK, and ALARM.  One can use :show OOB   to turn on seeing them before they get stripped.

 

 
  [ # 2 ]

Hi Bruce,

thank you for your response.

Bruce Wilcox - Feb 29, 2016:

Stand alone CS therefore does not display (by default) OOB messages. It merely handles the standard ones of LOOPBACK, CALLBACK, and ALARM.

The handling of LOOPBACK, CALLBACK, and ALARM is part of the controlscript, and not of standalone cs, or did I get something wrong?

Ok, than I would like to explain the reason I am asking a little further:

I would like to use oob for calling functions in the program cs is embedded in.
I could easily write my own protocol for it where the first argument is the function name followed by the arguments etc. (just an example) .But I would like cs to check my oob messages somehow to generate errors during the build process. Otherwise spell errors would cause errors in my software which only occur at runtime in special situations and are hard to test if I have many function calls.

So I would like to know if I can extend the default oob handler to do that for me somehow .
It would be great if I could for e.g. include a header file with all my function declarations from another library and extend cs so that I can check the following things during the build process of my chatbot:

- Does the function exist?
- Does the number of parameters match?
- Do the types of the parameters match?

Do you think this is possible?

 

 

 
  [ # 3 ]

The handling of ANY OOB message sent out by CS is done by the application. The stand alone engine IS an application, so it handles the default standard ones. Likewise the webpage I make available IS an application so it too handles it.  Other than knowing OOB exists and leaving it alone, CS :build command knows nothing about its content because it is always custom. So at present, there is no way for CS :build command to do validity checking. 

HOWEVER, you could write a script that acts as an extra step, that reads all the rules of your program and does validity checking for you as an extra behavior you could invoke.  Such a script would read a rule, burst its output into tokens, walk the list of tokens and if it does not start with [, ignore it. Otherwise examine the next token to match against a list of functions, and count how many tokens til the ]  to count arguments and match that against a data entry. So you could say “test functions” or whatever, and it would execute that.  As for whether the “types” of parameters match, that is problematic because normally CS only has text as its datatype. You’d have to write additional code to discriminate other data types (though probably that can be done).

 

 
  [ # 4 ]

Tobias,

Another thing you could do is use privatetable and privatesrc to define your own CS functions to generate the oob stream. The CS compiler does validate those names and the number of parameters, but you would have to do the type validation/conversion yourself at run-time. There are quite a few functions in textUtilities and examples in functionExecute to assist.

e.g.

u: ()
  [ ^oobFunction(parm1 parm2) ]

 

 

 
  [ # 5 ]

Hi Bruce I read the manual, the part about oob,
but I don’t quite get it,

I’m using CS in server mode on windows, there is main application that communicates with CS via TCP connection. I would like CS to send and recive name of functions to/from that application

could you please post an example of a oob in input and output???

I have tried these…

TOPIC: ~OOBTEST [aa bb cc]
u: LABELAA ([CODEEE] aa) [ UNCODED ] botmsg has uncod before it

u: LABELBB [CODEEE] (bb) [ UNCODED ] botmsg has uncod before it


Thanks Advanced.

 

 
  [ # 6 ]

Here is a sample input pattern to catch oob data.
u: (< \[  * speed _*1 * \])  The speed is _0
u: (< \[  * rate _*1 * \])  The rate is _0
You need * in front of your data when you can have multiple forms of data and you need
* \] after your data to insure you don’t match words from user input.

On output you need to do one of these
u: ()  \[ oob data \]  Here is user message
u: () ^”[oob data] Here is user message

 

 
  [ # 7 ]

Hi Bruce, thanks for your support
Now I understand, I tested it and it worked fine, except for one thing…

u: ()  \[ UNCODED_simplecontrol \] Here is the Bot answer

if I used the above output obb, and the resulted output was…

[ UNCODED simplecontrol ] Here is the Bot answer

I know CS treats underscores “_” as spaces, does CS do it even inside an obb part?? So, can obb contain underscores?? I have not found nothing in manual about how to escape underscores.

Thanks for your support again.

 

 
  [ # 8 ]

It’s a good point that oob data should not be adjusted like normal output. Next version of CS will not do so. Meanwhile, either dont use underscores in your oob data or change the $cs_response value not to do underscore substitution

 

 
  [ # 9 ]

Thanks for your Support Bruce
Yes, now I avoid using underscores inside oobs
Hope you don’t mind me pointing out these little details, I guess is a way to contribute CS,
thanks for giving us such a great tool,
by the way, thanks for the “spanish spell checking” rules that you added,
hope you could just improve the é-e, í-í, í-i, ó-ó, issues so I can completly use vowels with tildes,
now I’m replacing all the tildevowels with notilde vowels in my spanish DICT, and making the rules without tildes because of those issues.

Thanks for your support Bruce.

 

 
  [ # 10 ]

Hello everyone,
I’m using oob communication, though I am having an issue in the pattern recognition. I want to detect when the bot receives some oob communication together with normal text so I wrote this:

u: ( love  <  \[ speed _**  \] The speed I love is _0 

But if I type “[speed 1] love” the input is not recognized. Is this the intended behaviour? Or am I missing something?

 

 

 
  [ # 11 ]

You are not using OOB communication in your example.  OOB is a separate sentence at the beginning starting with [ and ending with ].  CS auto splits it off as a sentence. Hence
[speed 1]  love
becomes

[speed 1]
love
as 2 sentences

 

 
  [ # 12 ]

Hi Bruce thank you for your answer,

I’m sorry, I’m still new to chatscript and I didn’t catch up still with all the documentation. What I need to do is to check if an OOB message is sent together with normal text. And according to both text and OOB provide different answers.
There is a way to do this? Can I avoid the split or check both OOB and the second sentence together?

If how to do so is mentioned in the documentation, please just point me to the right document wink

Thank you again!

 

 
  [ # 13 ]

Ok, I digged in the documentation and I found what I wanted, I rewrote the rule like this:

a: (< \[ speed \]refine()
  
b: (%moreNext(inputrefine()
   
c: (love)  I love speed too

Thank you Bruce your insight was fundamental!

 

 

 
  [ # 14 ]

except that a: should probably be u: and the others moved up in alphabet. OR you could do

u: (< \[ * speed * \] )
  if (%more)
  {
^next(input)
if (pattern love) { I love speed too!}
  }

 

 
  [ # 15 ]

Sorry for the delayed reply, thanks also for the alternative. In this last case is it still possible to have rejoinders? Or after the

if (pattern love) { I love speed too!}

I cannot add them anymore?

 

 1 2 > 
1 of 2
 
  login or register to react