NL Studio Tutorial

Introduction

In Bot studio tutorial, we learned how to make keyword-based chatbot to order pizza. However, keyword-based chatbot is not so smart. In this tutorial we will learn how to enhance the chatbot using NL Studio.

Creating a NL Model with NL Studio

Login to Kata | platform

Login to Kata | Platform by entering your username and password.

nlst-1

Click Login to continue

Create Entity Label

After you entered to Kata Platform, click on the project you’ve created

nlst-2

Then, click on NLU on the side bar

nlst-3

Next, click Create Entity. Entity has similar definition with NL Model. It will help us to classify every input from users.

nlst-4

Now, create an entity called intent that with 4 labels: order, askOptions, confirm and cancel. Further explanation about entity is explained in NL Studio Guideline - English

nlst-5

Create Entity Type

In this entity type, we will create an entity with dictionary type (further explanation about entity dictionary type is explained in NL Studio Guideline - English). This entity will handle pizza type selection. Add new entity and fill in the data as follows

nlst-6

Then, continue filling the dictionary by adding other types

nlst-7

Create Entity Size

Entity size is used to handle pizzas size. In this entity, we will use Belongs to feature which binds an entity under another entity (further explanation about belongsTo usage is explained in NL Studio Guideline - English). We will put entity size under entity type.

nlst-8

In dictionary section, enter a keyword as a prediction for input from users

nlst-9

Create Entity Crust

Next, we will create an entity named crust to find out crust type on pizza. We’ll put it under entity type.

nlst-10

Enter the data as follows

nlst-11

Create Entity Qty

In pizza chatbot which we created earlier, user must enter pizza number to purchase using regex (regular expression.)

Entity qty will use dictionary by entering numbers or keywords related to the number of pizzas ordered. Add entity then fill in the form as follows

nlst-12

Then, fill in as below

nlst-13

After you’ve created entities, try to train data using your defined entities.

Training Your Model

To start training, enter Training menu under NLU

nlst-14

Enter a simple phrase like “want pizza” and press “enter” on your keyboard

nlst-15

Then, in this section you can start tagging and classifying text. Click on Add Trait, then select intent: order.

nlst-16

Click Train to submit your dataset.

nlst-17

Then, add a few more sentences to train more data. You can follow this

nlst-18

In our next example, we will do partial tagging by entering text and doing text selection on the word we want to tag. The process of selecting text can be done by blocking one or more words at a time using a cursor.

You can follow the example in this following picture. On the sentence “how much american all star”, select only on the word “American all star”

nlst-19

Then, select entity type to classify

nlst-20

You can also enter a phrase “I want American all star pizza, two and bbq hand tossed one” and tag it like this

nlst-21

You may see a number beside an entity. That number represents how accurate an entity identifies a phrase (highest is 1.0)

Try to tag more sentences.

nlst-22

Next, we will define parent entity using BelongsTo. Click on BelongsTo dropdown on small phrase, then select “Pepperoni”. Final result looks like this

nlst-23

Testing NLU in Prediction Console

Use Test NLU to test a dataset.

nlst-24

Enter a word such as “i want two aas” (read: aas means American All Star). You can see the prediction result as you can see in this image

nlst-25

Adjusting the Dataset

When performing NLU prediction in Test NLU, sometimes the prediction result is wrong, incomplete, or still has a low confidence score.

nlst-26

For example, the sentence above should be tagged as intent:order. However, prediction result has no prediction to order. To improve or fix a prediction, enter Log menu.

Enter Log Menu

Go to Log menu under NLU

nlst-27

On this page, you will see previous dataset when you have predicted on Test NLU.

Fix The Prediction

We will adjust the dataset. Click on pencil icon (which placed in left icon)

nlst-28

Then, select intent:order.

nlst-29

Click train to revise the prediction. Trained data will be seen as follow.

nlst-30

You will receive a notification after you click “Train”

Test NLU with data that has been fixed

We will try to predict another dataset and see if the result has been improved. Click Test NLU and enter a phrase “hi, do you sell aas”.

nlst-31

Congratulations, now you have learned how to train entity in NL Studio.

Contributing to the Documentation

Is something missing/incorrect? Please let us know by contacting support@kata.ai. If you know how to fix it straight away, don’t hesitate to create a pull request on this documentation’s GitHub repository.