Skip to content
Marius Ursache edited this page Aug 8, 2015 · 19 revisions

IntroductionTriggersRepliesConversationsTopicsPlugins and FunctionsKnowledgeUnder the Hood


Replies

We have seen examples of replies in some of the above examples. Replies appear exactly as they are written–grammar, mistakes and all.

Basic replies

+ Hello *
- Hi, good to see you!

If you write more replies, the system will choose a random one, deliver it to the user and then discard it, so it is never used again. If the user asks the same question again, he will be delivered one of the remaining answers and that answer is discarded, too, and the process repeats until there are no more answers. So it is a good idea to have a few replies for every trigger. This will also keep your dialogue less robotic and more natural.

+ Hello *
- Hi, good to see you!
- Hey, welcome back!
- Hello to you too!

If we don’t want an answer to be discarded from a set of replies, we can add {keep} in front of it. This is especially useful in conversations, or to make sure the user gets a reply anytime.

+ Hello *
- {keep} Hi, good to see you!
- Hey, welcome back!
- Hello to you too!

Longer replies can be split on more lines manually, in the SuperScript editor reply text area (or by using \n in SuperScript):

+ Hello *
- Hi, good to see you!
- How are you today?

You can use alternates in replies, same as in inputs:

- Hi, (good|great) to see you!

will reply with Hi, good to see you! or Hi, great to see you!. This allows you to be more diverse in replies, without writing separate replies.

Capturing data back

Sometimes you want to return the result of what was said back to the user in the reply. This is easily done by using the <cap> tag in replies.

+ my name is *2
- Nice to meet you, <cap>!

In the above example, the input My name is John Doe will trigger a reply Nice to meet you, John Doe!

If you have more than one thing you want to capture, just add a number to the <cap>:

+ *1 is taller than *2
- Are you sure that <cap1> is taller than <cap2>?
  • Generic wildcards and optionals are not captured.
  • Variable length, precise length, min-max wildcards, alternates, wordnet keywords and parts of speech are captured.

Redirecting `{@reply}``

Sometimes you want to reuse the same reply/set of replies in more than one gambit. Instead of duplicating, you can define this set of replies in a new gambit, then redirect to it (we use double underscore to delimit it rather to avoid confusing it with regular gambits, it’s not a technical requirement):

+ hello my friend
- {@__greeting__} How are you today?
+ __greeting__
- Hi there!
- Hello to you too!
- Howdy!

will match Hello my friend! and reply with one of these three replies:

  • Hi there! How are you today?
  • Hello to you too! How are you today?
  • Howdy! How are you today?

Unlike regular replies, these are truly random (not a random sequence), meaning you can get the same reply even three times in a row. When using a redirect, it should be a NxM random combination, providing each N has a redirect to M.


Continue to Conversations

Clone this wiki locally