question

erikroloff avatar image
erikroloff asked

What is the best way to do handle a wide array of possible user phrases?

I am working on a skill where one of the intents is to send a message. I would like to have as many options as possible (speech to text would be ideal if it was possible). The intent would be:

Tell {NAME} {MESSAGE}.

To make the widest possible array of message options I was thinking about doing multiple variations of the intent with something like:

Tell {NAME} {MESSAGE_SLOT_1} {MESSAGE_SLOT_2} {MESSAGE_SLOT_3} {MESSAGE_SLOT_4}

Each slot would would then be optional and I could fill each slot with a lot of common words.

Otherwise, the main option I am seeing is just:

Tell {NAME} {MESSAGE}

with the MESSAGE slot populated with a list of common phrases or sentences.

Does anyone have any advice on how to handle something like this?

alexa skills kitskillintentshow-totext-to-speech
10 |5000

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

jjaquinta avatar image
jjaquinta answered

Alexa is not a general voice dictation machine. It was not designed to do what you want. You can fake it into doing what you want by forcing a "generic slot". This will perform poorly. For a detailed explanation of why, and how to do it if you want to try it anyway, search "generic slot" on the forum.

10 |5000

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

James L Guinn avatar image
James L Guinn answered

A lot of people, including me, have been asking about handling generic responses.

Here's my attempt to explore slot capabilities: (YouTube demo)

My approach was to make a skill to handle input of up to ten words to be echoed (spoken) back. The code is simplistic and lacks proper help or quit intents, but has some debugging features that could be expanded if anyone finds this to be a useful starting point for your own exploration.

To invoke the skill say "Alexa, launch test voice input" or you can simply say "Alexa test voice input."

This was inspired by my desire to make an immersive adventure game--ambitious, considering I'm just now getting past "Hello World."

Though testing in the demo video was pretty smooth, experimenting with something like this can quickly awaken you to some of the limitations of Alexa's ability and voice recognition technology, in general. After all, how often can you dictate a text message over your iPhone or Android without some embarrassing error?

I'm not a big expert on git or github so for now here's a dropbox link to my zip archive which hopefully has everything you need. Please let me know if there's anything wrong or missing.

Hope this helps!

3 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.

The sequel: Test Alexa Voice Input The Sequel

I'm sorry--this never gets old. I just find it funny (and sometimes annoying) when Alexa tries to respond to a video playing Alexa commands.

On that note, it would be good to have a voice command to mute and unmute. Unmute is the trick, of course, as this would require Alexa to listen for the unmute command and ignore all others. This would be a different functionality than actually pressing the mute button.

0 Likes 0 ·

Thank you for the detailed answer and dropbox link. Do you have a sample word list that you were working from for the custom slots? In your TEST_LITERAL.txt file I only see one line, "test". Am I missing something?

I have lists of common words that I will put in there for testing, but I just wanted to make sure I understand what you were doing.

0 Likes 0 ·

Apologies for the late response. My use of the custom slot was to bypass what I perceived as a limitation on using a true LITERAL type. I'm not an expert Alexa developer, so there may be a better way to represent the slots. I did no experimentation with the values of the custom slots. They were simply there as placeholder.

0 Likes 0 ·