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

eg


Description

eg — an example group. When there a multiple examples for comparison, the e tag is impractical. You can use the eg tag and specify the required number of examples in a separate reference file. The reference file can be specified both in the platform’s GUI and manually.

A local tag. It is only triggered in a certain context upon a switch from a parent state.


Value type

  • multiline string

Parameters

  • fromState (string) — defines a state from which the transition is possible.
  • toState (string) — defines a state to which the transition is possible.
  • onlyThisState (boolean) — if true, the transition to a state can only be made from the state specified in the fromState flag, not from the child states. The default is false.

Learn more about context managing


Nested data

  • multiline data

How to use

  • Simple example of use:

Specify a group of examples in the examples.json file:

{
  "classes" : [
    {
      "id" : "",
      "path" : "/PlayGames/Games",
      "description" : "",
      "disabled" : false,
      "phrases" : [
        "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?"
      ]
    }
  ]
}

Script:

state: HaveAQuestion
            q: * ($yes|$agree|*play*) *
            eg: PlayGames.Games.CanYouPlay
            go!: /PlayGames/Games

        state: NoQuestions
            q: * ((don't want*|need*)|no time) to (play*) [cit*|number*|digit*|riddle*] *
            q: * ($no|$disagree|don't (start|start*|want|need*)) *
            go!: /PlayGames/Games/IDontWantToPlay

  • Example of using fromState, onlyThisState flags:

Specify a group of examples in the examples.json file:

{
  "classes" : [
    {
      "id" : "",
      "path" : "/SendFile/Files/CantSendFile",
      "description" : "",
      "disabled" : false,
      "phrases" : [
        "can't attach the file",
        "cannot send the photo",
        "can't send the file"
      ]
    }
  ]
}

Script:

state: Main
    q!: $regex</start>
    a: Hello. Please write your name and surname

    state: Name
        intent: /name
        a: Thanks! Please send your photo to receive the form.

    state: SendFile || modal=true
     event: sendFile
     a: Sending form

state: CantSend
    eg: /SendFile/Files/CantSendFile || fromState=/Main/SendFile , onlyThisState=true
    a: Please check the size of attached file and try again

In this script bot will switch states from SendFile to CantSend as soon as he receives a message from client Can't attach the file. The transition to CantSend is only possible from state /Main/SendFile as onlyThisState = true flag was set.