Amazon Alexa: Entity Resolution And Its Usefulness

Saptadip Sarkar
Techno Tales
Published in
4 min readMay 8, 2018

Humans are a unique species. We all are different from one another. So it’s normal that most of the time we express similar emotions and feelings in a different way. As a result, when it comes to natural language processing by using technology, sometimes it becomes quite hard and cumbersome to tackle.

Amazon Alexa is a smart device which uses voice interaction model to communicate with users. The basic working principle of Alexa is that the user speaks anyone of the predefined phrases(called “Utterances”) and Alexa in turn triggers specific actions(called “Intents”). In most of the practical cases, the “Utterance” phrase consist of one or more variable (called “Slots”) that are passed to the “Intent”. For simplicity of understanding, you can think of “Slots” as arguments that are passed to a function, which in this case is the “Intent”. Now due to human nature, different slot values can have same interpretation. Below example will help to get a more clear picture.

Let’s say your Alexa skill gives recommendation to the users based on their mood.

Alexa: How are you feeling today?

User: I am feeling {user_feeling} today

In the above example, “user_feeling” is the “Slot” variable. Now to convey “happiness”, different users can use different adjectives like:

User1 Utterance: I am feeling INTOXICATED today.

User2 Utterance: I am feeling DELIGHTED today.

User3 Utterance: I am feeling ECSTATIC today.

User4 Utterance: I am feeling JOYOUS today.

So all the four adjectives — Intoxicated, Delighted, Ecstatic & Joyous, represents that the user is feeling “happy” today. However to interpret this meaning in the back-end AWS lambda function, it requires a lot of coding, as the developer has to write the logic to match the synonym(in this case “happy”) that user said to the “Slot” value.

This is where “Entity Resolution” comes to rescue. In simple words, “Entity Resolution” enables to add synonyms to the slot values and validate that a user actually said one of them. The Alexa service then handle resolving the synonyms to the slot values. In Amazon’s own word:

Entity resolution improves the way Alexa matches possible slot values in a user’s utterance with the slots defined in your interaction model.

So when a user says any one of the above mentioned four phrases, using “Entity Resolution” feature Alexa understand that the actual value of the slot is “happy”. It then passes the value to the back-end lambda function. The back-end lambda code then properly handles the “Slot” value through “Intent” implementation and finally provide necessary recommendation to the user.

Let’s take another example.

Your Alexa skill is based on Crypto currencies which tells the latest price of any crypto currency to the user.

Alexa: Which currency price you want to know?

User: Tell me the price of bitcoin.

The back-end AWS lambda code handles the logic that uses only the currency code, which is normally a three letter code, like BTC for Bitcoin. It would be unnatural and undesirable to force the user to say the three letter code while using the skill so that Alexa could map the currency name as synonym to the three letter code. But using “Entity Resolution” feature in the Alexa, user can say the currency name which is much more user speech friendly and natural. Then the back-end AWS lambda function would use the three-letter code to make the necessary API call to get the latest price.

A good way to think about “Entity Resolution” is the same way that we think about creating sample utterances. Utterances are synonyms for our intents, so that no matter how our user indicates their intentions, we can map that back to our intent and perform the appropriate action. “Entity Resolution” allows us to create synonyms for our slot values, so that we can receive consistent data in our code, but still allow a user to speak in the way that makes sense for them.

In my next article, I will explain how to use “Entity Resolution” in the code while building an Alexa skill. If you like this article, please don’t forget to leave a comment below. You can also follow my publication Techno Tales to read more interesting technology related articles in future.

--

--

Saptadip Sarkar
Techno Tales

Technology enthusiast. Always learning how to make new things with the latest tech.