NAOqi Audio - Overview | API | QiChat | Tutorials
Table of Content | Introduction | Syntax | Overview | Cheat Sheet
A Topic is a script box (or file) containing Rule.
Its header contains at least the name and the language of the topic.
Example
topic: ~introduction ()
language: enu
u:(hello) hello human, pleased to meet you
To create your first Topic, see: Creating Dialog boxes.
A Rule associates a Human input (what the human says) with a relevant Robot output (what the robot answers).
Delimiters, Special characters and Rule functions and properties allows you to create powerful rules, managing in one line lots of different cases.
There are three type of rules: User rule, User subrule and Proposal.
Human input is Part of a User rule or a User subrule delimited by parentheses and containing the message to be recognized by the robot.
When the Human input matches, i.e. the message is recognized, the Rule is triggered.
When a Rule is triggered:
Part of a User rule, User subrule, or a Proposal containing what the robot says and/or does when the rule is triggered.
They can be used both in Human input or Robot output.
There are two types of Concepts:
Type | Scope | At run time ... | May contain ... |
---|---|---|---|
Static | global | cannot be modified | Choice: [ ], Optional part: { }, concepts (static and dynamic), functions (^rand, ^first), Variable: $ and Conditions: == > <> <. |
Dynamic | local to a Topic | must be modified | a list of words or phrases between a single Choice: [ ]. |
Examples
concept:(want) ^rand {"i'd * like" "i want {"a lot"}"}
dynamic:want
python:
setConcept("want","enu", ["i'd like" "i want" "i want a lot"]
Syntax
Topics and rules must be activated to be taken in account by the Dialog engine.
It is possible to activate and deactivate a part of them in order to create conversational contexts and/or reduce the number of rules managed in the memory.
In Choregraphe, a Topic is activated or deactivated when the Dialog topic box is loaded and unloaded.
By script, you can also use:
All the Rules of a deactivated Topic are also deactivated.
All the Rules of an activated Topic are activated, except if the rule:
Several Topics can be activated simultaneously, but only one Topic at a time has the Focus.
The Focus is given to the Topic containing the last triggered rule, except if it has the ^noStay property.
If similar rules are duplicated in several topics, then the topic with the focus has the priority, otherwise the choice is random.
In some cases, Dialog engine can decide by itself to give the Focus to a topic and say his first proposal. ^noPick function allows to prevent this automatic selection.
Related functions and properties
Rules placed after the recover section has a lower priority level.
Syntax
recover:
Usage
Rules placed after the recover section has a lower priority level.
Example
topic: ~topic1()
language: frf
u:(alien) I am not an alien, I am a humanoid robot
recover:
u:(hello) hello human
Execution
> hello alien
I am not an alien, I am a humanoid robot
The rules are taken into consideration following this order:
Order | All the rules located in the ... |
---|---|
1 - Focus | Main section of the topic having the Focus. |
2 - All topics | Main section of all the other activated topics, ^fallback excepted - randomly ordered. |
3 - Recover | Recover sections of all activated Topics. |
4 - Fallback | Main section of the activated topics having the ^fallback property. |
It is possible to store a part of the human input in order to reuse it in the robot answer.
For further details, see: Input storing: _.
ALDialog uses ALMemory to store and retrieve data.
Any stored data can be seen as a variable or as an event.
A Skin is a meta rule, defining transformations to be applied on already defined Robot outputs.
A Skin can be placed in any Topic and is triggered when a Robot output matches.
For further details, see: Transformation rules.