3

I want to ask for a flight number. Flight numbers are composed of a short code like EZY, AFR, DLH or CCA and a 3 to 5 digit flight number. Because I have these limited set of codes combined with a large set of potential numbers, I don't know how to define my slot type.

I thought about splitting it up in a custom slot type CODE and the integrated AMAZON.NUMBERS type. That way I run into problems in my model, because both of them are required to fulfil my intent and I would have to ask twice for the slots.

The option to just type out all the numbers seems like very bad practice. How would I concatenate slot types?

Thank you in advance.

Ipsider
  • 553
  • 1
  • 7
  • 20

2 Answers2

4

You can and should use a single Custom SlotType.

Alexa Custom SlotTypes:

A custom slot type defines a list of representative values for the slot. Custom slot types are used for lists of items that are not covered by Amazon's built-in set of types.
...
Slot values are sent to your skill in written format. For example, both "fire h. d. 7" and "fire h. d. seven" would be sent to your skill as "Fire HD7". For better recognition, acronyms and other phrases involving spoken letters should either be all caps ("HD") or separated by periods and a space ("h. d. ").

Know that the values you define in Custom SlotTypes do not limit the recognition of the user's input to fill the slot. So you don't need to write every possible combination of letter-number flight codes. Just give it a good amount of samples and Alexa will learn the pattern and recognize the language based on but not limited to those sample values.

Here are some suggestions for how to write the values in the SlotType so that Alexa will output the format you desire: Custom SlotType Values

Jay A. Little
  • 3,239
  • 2
  • 11
  • 32
  • I was not sure how many training objects the model needs in order to work reliable. Thanks for the clarification! – Ipsider Aug 08 '18 at 07:57
4

Create a custom FLIGHT_NUMBER slot and give a wide variety of sample values.

When you create a custom slot type, a key concept to understand is that this is training data for Alexa’s NLP (natural language processing). The values you provide are NOT a strict enum or array that limit what the user can say. This has two implications

1) words and phrases not in your slot values will be passed to you,

2) your code needs to perform any validation you require if what’s said is unknown.

Abbreviations and numbers in Slot values

When you are dealing with abbreviations like EZY or AFR or DLH and followed by numbers you have to give sample slot values like this. (try to give more variations)

e. z. y. two four seven nine three four
a. f. r. one two three four one two 
d. l. h. two three eight zero eight zero

And always validate your slot values in your backend.

When testing it in Test Simulator use utterances like

flight number a. f. r. one two three four one two

You will get the value of slot as AFR238080. A sample request generated by Alexa would be like:

"intent": {
            "name": "FlightNumberIntent",
            "confirmationStatus": "NONE",
            "slots": {
                "flightNumber": {
                    "name": "flightNumber",
                    "value": "AFR238080",

...
johndoe
  • 4,387
  • 2
  • 25
  • 40