This site is no longer updated.Go to new Conversational Cloud docs

Using the classifier Deprecated


Please note that the use of the classifier by examples has been deprecated since version 1.10.0. Learn more about migrating projects to CAILA.

Set classifier parameters in the chatbot.yaml configuration file before you start.

The following tags are used in the script when the classifier is used:


Using a single example

The e and e! tags are used for single examples: one tag for one reply. For example, in the script:

theme: /Bank
    state: Credit
        e!: Give me a credit.
        a: To get a credit, you only need to...

    state: CatchAll
        q!: *
        a: Sorry, I don’t understand you.

Specify the phrase to which user requests are to be compared in the e! tag. If user requests are similar to the sample reply, the bot will recognize them as belonging to the same class, and the same behavior will be used for them.

For example, phrases like “get credit”, “how to get a credit”, “take credit”, “give me a credit” will be allocated to the Credit state. The “I want to get a credit card” phrase will be allocated to the CatchAll state.


Using example groups

For a large number of examples, using the e and e! tags is impractical. In this case you can use the eg and eg! tags and specify examples in a separate reference file. The reference file can be specified both in the platform’s GUI and manually. This article covers filling in the reference file manually.

Learn more about using the classifier from the platform interface

Working with an example group includes several stages:


Creating a reference file of examples

Create the examples.json file in the /src/dictionaries folder. The reference file is created in the .json format and includes an array of objects, each of them describing a single example class.

Specify parameters in the reference file. The following tags can be defined in each object:

  • id— an optional field. Set the id of the class to be used in the eg and eg! tags in the scripts. If no example is specified, id defaults to the class path (with a period).
  • path — path to the state where the classifier is accessed to process a specific class.
  • description— an optional field. Free-form text description of the class.
  • disabled — the true or false boolean value is specified. The example class is disabled in the classifier.
  • phrases — a string array. All the examples for the class are specified here.

Example of a class:

{
  "classes" : [
    {
      "id" : "common",                          // class id
      "path" : "/PlayGames/Games",              // path to the state from which the classifier is accessed
      "description" : "",                       // class description
      "disabled" : false,                       // disables the class
      "phrases" : [                             // array of examples
        "let’s play some games"
      ]
    },
    {
      "id" : "",
      "path" : "/PlayGames/Games/CanYouPlay",
      "description" : "",
      "disabled" : false,
      "phrases" : [
        "can you play a game?",
        "do you know any games?",
        "do you know how to play?"
      ]
    }
  ]
}

Now that you have your reference of examples, specify the path to it in the chatbot.yaml configuration file:

exampleGroups:
  -  src/dictionaries/examples.json

Accessing the example reference file from the script

Accessing the group of examples if the class id is specified:


state: Order
    eg!: common                                       // specify the class id
     a: Let’s play!

Accessing the group of examples if the class id is not specified:

state: CanYouPlay
            q!: * [what] * (can you play/do you play) *
            q!: * {games  * (know/can play)} *
            eg!: PlayGames.Games.CanYouPlay            // class id is not specified, specifying the path to the state after the '.' symbol:
            q: * how* [games] * || fromState = "/Education/What can you do", onlyThisState = true
            script:
                $temp.canYouPlay = true;
            go!: ../../Games