Learn

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.

Why do we need consistency, you ask? Let’s say we are using the IMDB API to pull a list of movies based on genre. The API only accepts the genre of “action”, but your skill must work when the user asks for a synonym, like “battle”, “combat”, or “war”.

Remember that the resolved value is accessed with :

this.event.request.intent.slots.YOUR_SLOT_NAME.resolutions.resolutionsPerAuthority[0].values[0].value.name;

In the case of our movie skill, YOUR_SLOT_NAME would be genre, so you can access the resolved value with:

this.event.request.intent.slots.genre.resolutions.resolutionsPerAuthority[0].values[0].value.name;

Instructions

1.

On line 17 of main.js, we need to access the resolved value for the slot genre, and save it to the constant variable, genreResolvedTo.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?