|
|
Senior member
Total posts: 149
Joined: Dec 17, 2015
|
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?
|
|
|
|
|
Posted: Feb 29, 2016 |
[ # 1 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
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.
|
|
|
|
|
Posted: Feb 29, 2016 |
[ # 2 ]
|
|
Senior member
Total posts: 149
Joined: Dec 17, 2015
|
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?
|
|
|
|
|
Posted: Mar 1, 2016 |
[ # 3 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
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).
|
|
|
|
|
Posted: Mar 1, 2016 |
[ # 4 ]
|
|
Senior member
Total posts: 200
Joined: Jan 12, 2016
|
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) ]
|
|
|
|
|
Posted: Apr 16, 2016 |
[ # 5 ]
|
|
Senior member
Total posts: 179
Joined: Feb 11, 2015
|
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.
|
|
|
|
|
Posted: Apr 16, 2016 |
[ # 6 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
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
|
|
|
|
|
Posted: Apr 17, 2016 |
[ # 7 ]
|
|
Senior member
Total posts: 179
Joined: Feb 11, 2015
|
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.
|
|
|
|
|
Posted: Apr 17, 2016 |
[ # 8 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
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
|
|
|
|
|
Posted: Apr 17, 2016 |
[ # 9 ]
|
|
Senior member
Total posts: 179
Joined: Feb 11, 2015
|
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.
|
|
|
|
|
Posted: Jun 2, 2016 |
[ # 10 ]
|
|
Dario D'Ambra
Member
Total posts: 12
Joined: Feb 28, 2016
|
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 _*1 * \] ) 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?
|
|
|
|
|
Posted: Jun 2, 2016 |
[ # 11 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
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
|
|
|
|
|
Posted: Jun 2, 2016 |
[ # 12 ]
|
|
Dario D'Ambra
Member
Total posts: 12
Joined: Feb 28, 2016
|
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
Thank you again!
|
|
|
|
|
Posted: Jun 2, 2016 |
[ # 13 ]
|
|
Dario D'Ambra
Member
Total posts: 12
Joined: Feb 28, 2016
|
Ok, I digged in the documentation and I found what I wanted, I rewrote the rule like this:
a: (< \[ * speed * \]) refine() b: (%more) Next(input) refine() c: (love) I love speed too!
Thank you Bruce your insight was fundamental!
|
|
|
|
|
Posted: Jun 3, 2016 |
[ # 14 ]
|
|
Moderator
Total posts: 2372
Joined: Jan 12, 2010
|
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!}
}
|
|
|
|
|
Posted: Jun 5, 2016 |
[ # 15 ]
|
|
Dario D'Ambra
Member
Total posts: 12
Joined: Feb 28, 2016
|
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?
|
|
|
|