QiChat - Introduction

Topic

A Topic is an object containing rules.

Its header contains at least the name of the topic.

Example

topic: ~introduction ()

u:(hello) hello human, pleased to meet you

Rule

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

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:

Robot output

Part of a User rule, User subrule, or a Proposal containing what the robot says and/or does when the rule is triggered.

Concept

A Concept is a list of words and/or phrases that refer to one idea. For example, a list of countries, a list of names, synonyms of a word.

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 global 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
val qiChatbot: QiChatbot = ...
val editablePhraseSet: EditablePhraseSet = qiChatbot.dynamicConcept("want")
val phrases: List<Phrase> = listOf(Phrase("I'd like"), Phrase("I want"), Phrase("I want a lot"))
editablePhraseSet.addPhrases(phrases)
QiChatbot qiChatbot = ...;
EditablePhraseSet editablePhraseSet = qiChatbot.dynamicConcept("want");
List<Phrase> phrases = new ArrayList<>();
phrases.add(new Phrase("I'd like"));
phrases.add(new Phrase("I want"));
phrases.add(new Phrase("I want a lot"));
editablePhraseSet.addPhrases(phrases);

Syntax

Enable / disable

Topics and rules must be enabled to be taken in account by the Dialog engine.

It is possible to enable and disable a part of them in order to create conversational contexts and/or reduce the number of rules managed in the memory.

Topic activation

Topic activation is managed using the TopicStatus object.

For further details, see: Topic & TopicStatus.

Rule activation

All the Rules of a disabled Topic are also disabled.

All the Rules of an enabled Topic are enabled, except if the rule:

Focus

Several Topics can be enabled 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 you to prevent this automatic selection.

Related functions and properties

Priority among Topics

When several topics are enabled, the rules are taken into consideration following this order:

Order All the rules located in the …
1 - Focus The topic having the Focus.
2 - All topics

All the topics, except those with the ^fallback property.

If several, they are randomly ordered.

3 - Fallback

The topics having the ^fallback property.

If several, they are randomly ordered.

../../../_images/priority_among_topics.png

Reusing human input

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: _.

Skin

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.