Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon Alexa: store user's words

Tags:

I'm new to writing Alexa skills and want to write a skill to store the speaker's words.
For example, if I say, 'Alexa, save {whatever i say}', it should save the words in some string.
Now from what I understand, the intent schema something should be like

{    intents:[        "intent" : "SaveIntent"    ] } 

and utterances like

SaveIntent save SaveIntent store 

In this case, how do I store '{whatever I say}'?

like image 883
Kuldeep Ghate Avatar asked May 16 '16 08:05

Kuldeep Ghate


People also ask

Where are Alexa skills stored?

All publicly available Alexa Skills can be found on Amazon's Alexa Skills website or in an Alexa mobile app.

What is invocation name in Alexa?

The invocation name is the most important few words you will write when designing your voice experience for Alexa or Google Assistant - it's what users will say to access your skill for the first time. Several factors have to be considered when designing your invocation name.

Can Alexa copy what you say?

Just say "Alexa, Simon says" followed by a phrase. Alexa will repeat what you say word-for-word. For example: "Alexa, Simon says, How many planets are in our solar system?"

What language is Alexa skills written?

You can author a web service in any language appropriate for web services. If you choose the Alexa-hosted skill option, you write your code in Node. js and Python.


2 Answers

To capture free-form speech input (rather than a defined list of possible values), you'll need to use the AMAZON.LITERAL slot type. The Amazon documentation for the Literal slot type describes a use case similar to yours, where a skill is created to take any phrase and post it to a Social Media site. This is done by creating a StatusUpdate intent:

{   "intents": [     {       "intent": "StatusUpdate",       "slots": [         {           "name": "UpdateText",           "type": "AMAZON.LITERAL"         }       ]     }   ] } 

Since it uses the AMAZON.LITERAL slot type, this intent will be able to capture any arbitrary phrase. However, to ensure that the speech engine will do a decent job of capturing real-world phrases, you need to provide a variety of example utterances that resemble the sorts of things you expect the user to say.

Given that in your described scenario, you're trying to capture very dynamic phrases, there's a couple things in the documentation you'll want to give extra consideration to:

If you are using the AMAZON.LITERAL type to collect free-form text with wide variations in the number of words that might be in the slot, note the following:

  • Covering this full range (minimum, maximum, and all in between) will require a very large set of samples. Try to provide several hundred samples or more to address all the variations in slot value words as noted above.
  • Keep the phrases within slots short enough that users can say the entire phrase without needing to pause.

Lengthy spoken input can lead to lower accuracy experiences, so avoid designing a spoken language interface that requires more than a few words for a slot value. A phrase that a user cannot speak without pausing is too long for a slot value.

That said, here's the example Sample Utterances from the documentation, again:

StatusUpdate post the update {arrived|UpdateText}

StatusUpdate post the update {dinner time|UpdateText}

StatusUpdate post the update {out at lunch|UpdateText}

...(more samples showing phrases with 4-10 words)

StatusUpdate post the update {going to stop by the grocery store this evening|UpdateText}

If you provide enough examples of different lengths to give an accurate picture of the range of expected user utterances, then your intent will be able to accurately capture dynamic phrases in real uses cases, which you can access in the UpdateText slot. Based on this, you should be able to implement an intent specific to your needs.

like image 137
Sam Hanley Avatar answered Sep 21 '22 21:09

Sam Hanley


Important: AMAZON.LITERAL is deprecated as of October 22, 2018. Older skills built with AMAZON.LITERAL do continue to work, but you must migrate away from AMAZON.LITERAL when you update those older skills, and for all new skills.

Instead of using AMAZON.LITERAL, you can use a custom slot to trick alexa into passing the free flow text into the backend.

You can use this configuration to do it:

{     "interactionModel": {         "languageModel": {             "invocationName": "siri",             "intents": [                 {                     "name": "SaveIntent",                     "slots": [                         {                             "name": "text",                             "type": "catchAll"                         }                     ],                     "samples": [                         "{text}"                     ]                 }             ],             "types": [                 {                     "name": "catchAll",                     "values": [                         {                             "name": {                                 "value": "allonymous isoelectrically salubrity apositia phantomize Sangraal externomedian phylloidal"                             }                         },                         {                             "name": {                                 "value": "imbreviate Bertie arithmetical undramatically braccianite eightling imagerially leadoff"                             }                         },                         {                             "name": {                                 "value": "mistakenness preinspire tourbillion caraguata chloremia unsupportedness squatarole licitation"                             }                         },                         {                             "name": {                                 "value": "Cimbric sigillarid deconsecrate acceptableness balsamine anostosis disjunctively chafflike"                             }                         },                         {                             "name": {                                 "value": "earsplitting mesoblastema outglow predeclare theriomorphism prereligious unarousing"                             }                         },                         {                             "name": {                                 "value": "ravinement pentameter proboscidate unexigent ringbone unnormal Entomophila perfectibilism"                             }                         },                         {                             "name": {                                 "value": "defyingly amoralist toadship psoatic boyology unpartizan merlin nonskid"                             }                         },                         {                             "name": {                                 "value": "broadax lifeboat progenitive betel ashkoko cleronomy unpresaging pneumonectomy"                             }                         },                         {                             "name": {                                 "value": "overharshness filtrability visual predonate colisepsis unoccurring turbanlike flyboy"                             }                         },                         {                             "name": {                                 "value": "kilp Callicarpa unforsaken undergarment maxim cosenator archmugwump fitted"                             }                         },                         {                             "name": {                                 "value": "ungutted pontificially Oudenodon fossiled chess Unitarian bicone justice"                             }                         },                         {                             "name": {                                 "value": "compartmentalize prenotice achromat suitability molt stethograph Ricciaceae ultrafidianism"                             }                         },                         {                             "name": {                                 "value": "slotter archae contrastimulant sopper Serranus remarry pterygial atactic"                             }                         },                         {                             "name": {                                 "value": "superstrata shucking Umbrian hepatophlebotomy undreaded introspect doxographer tractility"                             }                         },                         {                             "name": {                                 "value": "obstructionist undethroned unlockable Lincolniana haggaday vindicatively tithebook"                             }                         },                         {                             "name": {                                 "value": "unsole relatively Atrebates Paramecium vestryish stockfish subpreceptor"                             }                         },                         {                             "name": {                                 "value": "babied vagueness elabrate graphophonic kalidium oligocholia floccus strang"                             }                         },                         {                             "name": {                                 "value": "undersight monotriglyphic uneffete trachycarpous albeit pardonableness Wade"                             }                         },                         {                             "name": {                                 "value": "minacious peroratory filibeg Kabirpanthi cyphella cattalo chaffy savanilla"                             }                         },                         {                             "name": {                                 "value": "Polyborinae Shakerlike checkerwork pentadecylic shopgirl herbary disanagrammatize shoad"                             }                         }                     ]                 }             ]         }     } } 
like image 43
adam shamsudeen Avatar answered Sep 24 '22 21:09

adam shamsudeen