question

Liam avatar image
Liam asked

Match slot type values

Hello.

Is it possible to match slot type values together in the Alexa Developer Console? I have 2 custom intents and 2 custom slot types:

  • GetCountryByCode (Intent)
    • Code (Slot)
  • GetCodeByCountry (Intent)
    • Country (Slot)

The Code slot features European country codes (i.e. CZ). The Country slot features European countries (i.e. Czech Republic).

Is there a way of matching both slot type values together so when I utter "What code is used to represent {Country}" or "What country is identified by {Code}", Alexa finds a match and returns a response? For example:

  • Utterance: "What country is identified by PL?"
  • Response: "PL represents Poland."

Thanks in advance for your help.

Liam

alexa skills kitintentsslotsutterances
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Gaetano@Amazon avatar image
Gaetano@Amazon answered

Dear customer,

can you please share the skill-ID? I would need to have a look to your interaction model.

Thanks,
Gaetano

4 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Liam avatar image Liam commented ·

amzn1.ask.skill.4faca780-3cd7-49cf-a24c-2de91d33cb9a

0 Likes 0 ·
Gaetano@Amazon avatar image Gaetano@Amazon ♦ Liam commented ·

Hi Liam,

I have checked your interaction model. You will still have to handle the matching within your backend. I'd suggest using a simple dictionary (key/value) as data structure.

So whenever an intent is reached, for example, you can either match "PL" with "Poland" or the other way around.

Kind regards,
Gaetano

1 Like 1 ·
Liam avatar image Liam Gaetano@Amazon ♦ commented ·

Hi, Gaetano.

Thank you for checking my interaction model and providing some advice.

In AWS Lambda and in my skill function, I created a JSON file called 'europlate.json'. I have pasted it below for your information.

[
  {
    "Code": "GB",
    "Country": "United Kingdom"
  },
  {
    "Code": "S",
    "Country": "Sweeden"
  },
  {
    "Code": "E",
    "Country": "Spain"
  },
  {
    "Code": "SLO",
    "Country": "Slovenia"
  },
  {
    "Code": "SK",
    "Country": "Slovakia"
  },
  {
    "Code": "RO",
    "Country": "Romania"
  },
  {
    "Code": "P",
    "Country": "Portugal"
  },
  {
    "Code": "PL",
    "Country": "Poland"
  },
  {
    "Code": "NL",
    "Country": "Netherlands"
  },
  {
    "Code": "M",
    "Country": "Malta"
  },
  {
    "Code": "L",
    "Country": "Luxembourg"
  },
  {
    "Code": "LT",
    "Country": "Lithuania"
  },
  {
    "Code": "LV",
    "Country": "Latvia"
  },
  {
    "Code": "I",
    "Country": "Italy"
  },
  {
    "Code": "IRL",
    "Country": "Ireland"
  },
  {
    "Code": "H",
    "Country": "Hungary"
  },
  {
    "Code": "GR",
    "Country": "Greece"
  },
  {
    "Code": "GBZ",
    "Country": "Gibraltar"
  },
  {
    "Code": "D",
    "Country": "Germany"
  },
  {
    "Code": "F",
    "Country": "France"
  }
]

So within my index.js file, I am trying to retrieve the JSON data. So I am doing this using the following code:

const json = require('./europlate.json');
const obj = JSON.parse(json);

Is it at this point I should be using a simple dictionary (key/value) as data structure?

Thanks.

Liam

0 Likes 0 ·
Show more comments