What is the Entity and how to implement it to the Chatbot
Welcome to the Third lesson on how to Build Chatbots with IBM Watson assistant, we saw in the last lesson how to create an intent which is the intention of the user, interacting with the chatbot.
If you didn’t watch the previous tutorial you can see it in the link below.
In this lesson, we’ll look at the second important concept of a chatbot, which is the entity.
What is the entity?
Entities are knowledge repositories used by the bot to give customized and exact reactions or responses.
In other words, the Entity is a property that can be utilized by IBM Watson to answer the questions from the client/user.
At the point when the client talks or types their request, IBM Watson will search for the entity and the value of the given entity can be used within the request.
Watch this video to find out more about entities.
Working with entities
In our Hotel Reservation Chatbot, we have stores in New York, Pennsylvania, Texas, and Florida. So when a user asks, Where is your Florida Hotel? we shouldn’t ignore that little piece of data with the purpose that we might consider the area when formulating a response.
In this example, I have used famous cities in the USA, but you can use your own city such as Paris or California or Mumbai if you live in India.
just be comfortable to customize everything you have learned here so you can get more experience while you practice them on a real situation or a problem.
Now let’s see in action how to create locations entities:
Go to your skill section and with Entities tab selected, click on the Create entity button.
Choose @location as the name of the entity, it worth noting that this “@” symbol is automatically added for you by Watson assistant.
Leave Fuzzy Matching enabled so that we can still detect the city name even if the user misspells it.
Finally, click on the Create entity button to create an entity.
You’ll be asked to enter entity values and possible synonyms, Enter Texas then click Add Value to add this entity value to our entity.
As a rule, you don’t have to create a synonym for cities, But you might include some of them if the city has common nicknames or people refer to your store location by its street in the city.
Repeat the process for New York, Pennsylvania, and Florida, for New York, add Madison Avenue as a synonym.
The final results are shown in the image below, now open the Try it out panel.
Try Hours of operation of your Madison Avenue as shown in the image.
IBM Watson has to Detect the right City for this Avenue.
Working with pre-made system entities
As being humans, we know that “Street” or “Country” is a location and that “Tomorrow” refers to the next day or to the “Time”.
This is what system entities are all about. There is a @sys-location entity that will detect and recognize locations for our chatbot.
Now Let’s see this system entity in action.
Click on System entities in the Entities section of your skill and turn on @sys-location.
Now open the “Try it out” panel and type Hours for forida or Hours for new yrk (notice the typo here).
Watson Assistant can detect the misspelled word and recognize what you mean.
Import and Export entities via CSV files
The export process is essentially the import process in reverse, When you select one or more entities by checking off the checkmarks next to them, you will be able to export them to CSV.
And also you can import them by clicking the Import entities button next to the Add entity.
Click Here to download a CSV file with one new entity I have prepared for you, just make sure you have saved the file on your laptop first, and then click on the Import button as shown in the image below.
Finally, you should see an Import entities dialog, click on the Import button.
Now just click on Done.
You see that this entity has been added to our chatbot.
If you open the CSV file, you will see that each line has the entity name first, and next to it you see the values.
Finally, Delete That “@weekday” entity since just it was for demonstration purposes.
In the next lesson, we’ll make our chatbot do something useful by adding the Dialog component and make it claver and interactive with the user.