No results found
June 21, 2017Jeff Blankenburg
Today, we are incredibly excited to announce a new feature for Alexa developers to take advantage of: entity resolution. This enables you to define synonyms for the Alexa Service to resolve rather than having to figure this out in your code. For example, in your Alexa skill, rain may be synonymous with, downpour, shower, storm, and rainstorm. When the customer says downpour, the Alexa Service will let you know that they said “downpour” and it will also let you know that it’s a synonym for “rain”.
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. As an example, if you wanted to allow a user to ask about the weather, you might let them say:
"When is it going to rain?" "When is it going to shower?" "When is it going to rainstorm?" "When is it going to downpour?" "When is it going to storm?" "What is it going to be wet outside?"
In the old model, you would have to be able to catch all of those words as slot values, compare them to a group of values in your code, and determine which weather condition to return to the user. Take a look at the code block below. You can see that the slot value "shower" is stored as the value of the slot "WeatherType."
Example of a request without entity resolution showing that the user said “shower”
Now, with entity resolution, however, you can treat all of those statements equally, and return the word "rain" to your code in each instance. To do this, Alexa now includes a "resolutions" node that contains the additional information we are looking for. In the next code block, you can see that the IntentRequest still passes "shower" as the value, but the word "rain" appears as our resolution value.
Example of a request with entity resolution showing that “shower” is a synonym of “rain”.
To accomplish this, we need to add some information to the JSON in our interaction model. For each slot value, we have a "value" property that contains each individual string of text. We are adding two new properties to these objects in the form of "ID" and "synonyms". This allows us to define, in our voice interaction model, a list of synonyms that should resolve to our specific slot value, which is "rain." Take a look at the example below of the old JSON structure on the left, and the new structure on the right:
Example showing interaction model with entity resolution on the right
With this additional information available to you with each slot value, you can make more consistent, reliable decisions for your users.
Currently, you must use the Code Editor in the skill builder (beta) to define synonyms and IDs for slot values. You can continue to create slot values using the normal skill builder user interface, then switch into Code Editor to fill synonyms and id properties. For details, see Define Synonyms and IDs for Slot Type Values (Entity Resolution).
Example showing entity resolution defined in the skill builder’s code editor
We are very excited to see how you will use these new additions to the interaction model!
For more information about developing with the Alexa Skills Kit, you can also check out the following resources:
The Alexa Skills Kit (ASK) enables developers to build capabilities, called skills, for Alexa. ASK is a collection of self-service APIs, documentation, tools, and code samples that make it fast and easy for anyone to add skills to Alexa.
Developers have built more than 13,000 skills with ASK. Explore the stories behind some of these innovations, then start building your own skill. Once you publish your skill, apply to receive a free Echo Dot. This promotion is available in the US only. Check out our promotions in the UK, Germany, and India.