Skip to main content

Language overview

Colang is a high-level textual modeling language for conversational artificial intelligence. What we mean by that is the following:

  • high-level: a language with strong abstractions from the details of the implementation;
  • textual: uses standardized keywords accompanied by parameters or natural language terms and phrases;
  • modeling language: an artificial language that you can use to express information, knowledge or systems in a structure that is defined by a consistent set of rules;
  • conversational artificial intelligence: refers to technologies, like chatbots or voice assistants, which users can talk to.

You can use colang to describe how a conversational AI system should behave during the conversation with a user.

Models

A colang model is composed of multiple elements defined using specific definition blocks. A definition block is composed of a header, which is usually a line starting with define and a body which must be indented with respect to the header, usually two spaces. Comment lines can be added anywhere and they start with a # (hash sign).

For example:

# The definition block for X
define X
...

# The definition block for Y
define Y
...

A colang model can be split in any number of files with the .co extension and it can include other models:

include "some_other_model"

Comments

When writing a colang model, it's important to make sure that it can be easily understood by others. An easy way to increase the readability of your code is by using comments.

There are two types of comments: single-line and multi-line.

# This is a single line comment

"""
This is a multi-line comment.
It can have as many lines as needed.
"""

Language modules

The language is itself structured in multiple modules, each adding specific types of elements:

  1. co-nlu
  2. co-nlg
  3. co-flows
  4. co-context
  5. co-actions
  6. co-objects
  7. co-snippets