Documentation

image
image
image
image
image
image

# Use supervised learning

Supervised learning allows you to teach a chatbot a sentence so that he can understand the user's intent. You then retrieve the entities like date, etc.

  1. Let's go to Build> Train in the left menu
  2. Let's add an intention
  3. In practice sentences, let's say several sentences in relation to the intention
  4. In What should the chatbot do?, choose the action of the chatbot when the intent has been triggered.

# Write the intention directly in the code

In the Chatbot conversational script, you can add an intention directly with practice phrases

@Intent('custom.intent', [
    'sentence 1',
    'sentence 2',
    'etc.'
])
naturalIntent() {
    > { :intent.response }
}

Do newbot deploy to deploy. Intentions will be synchronized with the code

# Simple reply from the chatbot

The "Simple Answer" skill allows you to write an answer directly via NewBot Cloud without going through the code.

If you want to customize the simple answer, add the following code in the conversational script:

@Intent('natural.intent')
naturalIntent() {
    > { :intent.response }
}

Warning, you no longer have the formats in the code

# Retrieve entities

On some occasions, you do not want to just display an answer. You want :

  1. Display a more advanced scenario (display a carousel, etc.)
  2. Retrieve entities in the sentence (a date, a number, a city, etc.)

For that, choose Customize in the section What should the chatbot do?

  1. Enter the name of the intent that will be used in your conversational script. For example, if we set buy, this will trigger the following code:
@Intent('buy')
buy() {
    > Buy items
}
  1. Let's put the schema of intent: recoverable entities in the sentence.

# Schema of the entities

  1. Enter the name of the entity. For example, we can put date
  2. Let's put the type of the entity. For example, let's say Date
  3. Finally, depending on the type, a value can be requested.
  4. Validate by clicking on Edit

In the code, we can recover the entity in this way:

@Intent('buy')
buy() {
    date = :intent.time.value
}

We can also know if the user has entered a date

@Intent('buy')
buy() {
    if (:intent.time.found) {
        > Thanks !
    }
}

Note that the context is automatically managed. If the user just changes the date, then this intention will be debated again with the new date

image