Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

alexa skill user input for spelling out letters

I'd like Alexa to be able to accept a variable-length list of English letters to my custom skill. It will allow users to search based on a string.

There's two steps to this:

  1. Getting good representation for individual letters that Alexa can understand
  2. Enumerating sample utterances with variable number of letters

For the first, one way would be to define a custom slot that has as its enumerated values of the English alphabet:

SLOT_LETTER

ay
bee
see
dee
ee
eff
gee
... etc

but that feels hacky. Does Amazon support any way to do this or is there a cleverer way?

I'd really rather not use NATO phonetic ("alpha bravo charlie" for "A-B-C") because it's a terrible user experience and very few people actually know them.

For the second issue (sample utterances), for AMAZON.LITERAL I want to define something like:

SpellIntent find me things starting with {first second|SLOT_LETTER}   
SpellIntent find me things starting with {first second third|SLOT_LETTER}
SpellIntent find me things starting with {first second third fourth|SLOT_LETTER}

But I don't think Amazon will let you define a variable length LITERAL using a custom slot (since they are different "types")?

like image 558
lollercoaster Avatar asked Jan 05 '23 09:01

lollercoaster


1 Answers

It isn't very well documented, but you can use "a.", "b.", "c." etc to represent the letter, as opposed to the sound. Create a custom slot and use these as the values. That should do you for the slot.

For the intent, create an intent with, say, five slots, all with the same slot type. Create five utterances against the intent, with one, two, three, four and five slots filled. When the user spells something, the intent will be invoked. Any slots the user did not specify will be null.

Having two slots in one intent not separated by a word often does not perform well. But try it and see. With a restricted vocabulary like this, it could do OK.

Lastly, if it has trouble distinguishing, say, "b." and "v.", you might try adding NATO call codes to your list. Alpha, Bravo, Charlie, etc. Then, in your processing, just take the first character of whatever value comes in for the slot.

You might enable the "Star Lanes" skill and experiment with the "Set Call Sign to X Y Z" intent. I do the above in that skill and it works fairly well.

like image 100
Joseph Jaquinta Avatar answered Jan 13 '23 09:01

Joseph Jaquinta