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.
Login to Kata | Platform by entering your username and password.
Click Login to continue
After you entered to Kata Platform, click on the project you’ve created
Then, click on NLU on the side bar
Next, click Create Entity. Entity has similar definition with NL Model. It will help us to classify every input from users.
Now, create an entity called
intent that with 4 labels:
cancel. Further explanation about entity is explained in NL Studio Docs
In this entity
type, we will create an entity with dictionary type (further explanation about entity dictionary type is explained in NL Studio Docs). This entity will handle pizza type selection. Add new entity and fill in the data as follows
Then, continue filling the dictionary by adding other types
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 Docs). We will put entity
size under entity
In dictionary section, enter a keyword as a prediction for input from users
Next, we will create an entity named
crust to find out crust type on pizza. We’ll put it under entity
Enter the data as follows
In pizza chatbot which we created earlier, user must enter pizza number to purchase using regex (regular expression.)
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
Then, fill in as below
After you’ve created entities, try to train data using your defined entities.
To start training, enter Training menu under NLU
Enter a simple phrase like “want pizza” and press “enter” on your keyboard
Then, in this section you can start tagging and classifying text. Click on Add Trait, then select
Click Train to submit your dataset.
Then, add a few more sentences to train more data. You can follow this
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”
Then, select entity
type to classify
You can also enter a phrase “I want American all star pizza, two and bbq hand tossed one” and tag it like this
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.
Next, we will define parent entity using
BelongsTo. Click on
BelongsTo dropdown on
small phrase, then select “Pepperoni”. Final result looks like this
Use Test NLU to test a dataset.
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
When performing NLU prediction in Test NLU, sometimes the prediction result is wrong, incomplete, or still has a low confidence score.
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.
Go to Log menu under NLU
On this page, you will see previous dataset when you have predicted on Test NLU.
We will adjust the dataset. Click on pencil icon (which placed in left icon)
Click train to revise the prediction. Trained data will be seen as follow.
You will receive a notification after you click “Train”
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”.
Congratulations, now you have learned how to train entity in NL Studio.