A DSL is a "Domain Specific Language", which is usually designed to model problems in a specific domain. Bubblescript is a DSL that has been developed to model interactive conversations (chatbots).
The dialog manager is responsible for managing dialog state and select the best matching response. In Bubblescript, all state is kept in variables. Given this state and the users utterance the dialog manager will try to find the best (first) dialog that matches the intent of the user.
Guards are logical expressions associated to dialogs using
when. During dialog resolution, the guard expression is evaluated
and only when it returns
true, the dialog is considered.
Anything the user says. For example, if a user types “Do you have them in red?”, the entire sentence is the utterance.
An intent is the user’s intention. For example, if a user types “Do you have these shoes in red?”, the user’s intent is to retrieve a list of the shoes previously displayed (context) in red.
dialog is the main building block of conversations. It groups
together and optionally names interactions with the user (statements).
Dialogs can be invoked either direclty via
invoke followed by a
dialog name, or indirectly when the dialog
trigger: matches in a
task is a set of commands that will be executed when the task is
perform or triggered by an
task remove_emojis do message = strip_emoji(message) message = strip_markdown(message) end
Note you cannot perform conversational actions (
show, ...) in tasks
Blocks are interactions grouped together: everything between
and are passed in as an argument to that prepended statement:
random do say "hello" say "hi" say "hey" end
In this example, the
random statement opens a block that will
randomly execute one of the lines in its block.
Statements in Bubblescript are actions that do something but don't return anything.
An expression is a combination of variables, operations and values that returns a result value.
greeting = "Hello " + name + ", " + random(["how are you?", "what's up?", "how you doing?"])
askcan be used as both statement and expression.