-
Notifications
You must be signed in to change notification settings - Fork 16
Documentation
This is a placeholder for documentation until a full version will be available.
SuperScript is a dialog system and bot engine for creating human-like chat bots. The SuperScript Editor allows editing dialogue rules without handling huge amounts of hand-written scripts, which can be troublesome for complex bots.
- Topics: the main entry point into your application. All your conversations start within a topic depending on what exactly was said the first topic could vary. SuperScript will continue to search topics until it finds a matching gambit, then replies. A topic includes one or more gambits, and each gambit includes at least one reply.
- Gambits: a set of rules that tells the bot how to reply to a specific user action. In SuperScript, the gambit includes two parts: the input (the basis of the trigger that we match on) and one or more replies that the bot offers, either randomly or under specific conditions.
- Reply: a specific reply given by the bot under certain conditions, and is part of a gambit. A reply can also have a series of gambits attached to them thus creating a thread of conversation.
You can access all the gambits from the top navigation, but if you have a lot of them it might be better to get to them from the corresponding topic.
A basic trigger will match the text in user input and offer a reply.
...
...
...
...
...
...
Alternates are used when you have a range of words that could fit into the rule, but one is required.
my (truck|car|van) is red
The above will allow any of these replies:
My truck is red.
My car is red.
My van is red.
Alternates capture the used term (for usage in replies), and can also be used in replies.
Optionals can be used to add an extra optional word in triggers:
my [big] red balloon [is awesome]
The above will allow all of these options below:
my red balloon
my big red balloon
my red balloon is awesome
my big red balloon is awesome
Optionals are not captured, and do not work in replies.
...
A trigger that generates a reply to Hello bot!
will also generate a reply to Hey bot!
, Hi bot!
, Cheers bot!
. This is because many words are normalized (for example hello, hey, hi, hola, cheers, etc to ~emohello see Normalizer for the full list of words that are normalized (and other changes to text in general).
...
...
...
...
...
...
...
By using alternates in replies, you don't need multiple replies, in case you just want to alter/randomize a few words:
Sounds (cool|nice|good|fine) for me!
For conversation to really flow you need to have more then one exchange. We use a % command to recall the previous thing said and continue to build off of that.
+ *
- What is your favorite color?
+ *1
% What is your favorite color?
- <cap> is mine too.
So let's walk though this example. Some input comes into the system and the open wildcard matches and replies with What is your favorite color?
When the next input comes into the system, it tries to match it with all the possible patterns, and at the same time looks for any previous responses, i.e.. statements starting with a %
. In this case, their is a previous response, i.e.. % What is your favorite color?
line.
It check the user history for try and match the previous response, and if it matches, That particular gambit is selected. In this case it is *1
meaning one word. The bot then replies with <cap> is mine too
. replacing that one word with <cap>
.
Note that, in the current version, the line with previous reply match i.e.. the %
command will come after, and not before, the matching gambit with +
command
...
...
...
...
...
...
Once you've created a topic, you can create a new gambit from inside it.
Gambits are prioritized in order they are listed in the topic. Any user input will try to match the trigger rules in the first gambit. If they match, it will give a reply from the first gambit. If they do not match, it will go to the second gambit to look for rules and so on.
For example, if you create the universal * trigger in the first gambit, it will be used always, and the rest of the gambits will be ignored.
The solution is to sort the gambits in the topic, by using the Sort topic button in the top right corner. This will automatically sort the topics, so the most greedy trigger gets placed last. You can also manually sort them by dragging to reorder.
...
...
...
...
...