Hopefully you are familiar with the game of tennis and know something about the Wimbledon tournament, generally considered to be the most prestigious of the Grand Slam tournaments. Even if you are not, you certainly know the concept of a tournament winner and the tournament runner-up.
The WimbledonFinalsBot has only one purpose for its existence. When you ask it “Who was the winner of the women’s Wimbledon 1991?” as an example, it will give you the name of the women’s tennis player who won the tournament that year. Similarly, you can ask the bot about who was the runner up in a particular year. You can also ask the same question for the men’s players. To make it a little easier to create the chatbot, the bot will only provide answers about the tournaments which took place after 1980. We will be using the Wikipedia’s page about men’s winners and women’s winners for reference.
One thing you will notice, when comparing with the FAQ chatbot, is that the answer supplied by the bot has to be dynamic. This is where the concepts of entities comes into the picture.
Here is how entities are defined in API.AI’s documentation:
Entities represent concepts and serve as a powerful tool for extracting parameter values from natural language inputs.
The broad definition of entities is that they are concepts. For a programmer, a good way to think about entities is that they are instances of a class.
Consider the ubiquitous dropdown around the web that shows a list of country names. Here, the entity is “Country”. The actual values you see in that dropdown are the entity values.
A second analogy that programmers can relate to is the concept of the placeholder when you are printing strings. This is actually a very useful analogy, because when you are interacting with API.AI entities you will be using syntax which will look familiar if you are already comfortable using placeholders in your programming.
Want a copy of this agent’s ZIP file to import into your API.AI console? You don’t need the ZIP file to follow along with the guide.
In the next post, we will look at how to start building out the WimbledonFinalsBot.