亚马逊Alexa:存储用户的话

Kul*_*ate 20 amazon alexa-skill alexa-skills-kit

我是新手写Alexa的技能,想写一个技巧来存储说话者的话.
例如,如果我说'Alexa,保存{无论我说什么}',它应该保存一些字符串中的单词.
根据我的理解,意图模式应该是这样的

{
   intents:[
       "intent" : "SaveIntent"
   ]
}
Run Code Online (Sandbox Code Playgroud)

和话语一样

SaveIntent save
SaveIntent store
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我如何存储'{无论我说什么}'?

Sam*_*ley 15

要捕获自由格式语音输入(而不是可能值的已定义列表),您需要使用AMAZON.LITERAL插槽类型.Literal插槽类型Amazon文档描述了与您类似的用例,其中创建了一种技能来获取任何短语并将其发布到社交媒体网站.这是通过创建StatusUpdate意图来完成的:

{
  "intents": [
    {
      "intent": "StatusUpdate",
      "slots": [
        {
          "name": "UpdateText",
          "type": "AMAZON.LITERAL"
        }
      ]
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

由于它使用了AMAZON.LITERAL插槽类型,因此该意图将能够捕获任意短语.但是,为了确保语音引擎能够很好地捕获真实世界的短语,您需要提供各种示例语句,这些语句类似于您希望用户说出的各种事物.

鉴于在您描述的场景中,您尝试捕获非常动态的短语,文档中有一些内容需要您额外考虑:

如果您使用AMAZON.LITERAL类型来收集插槽中可能包含的字数变化较大的自由格式文本,请注意以下事项:

  • 涵盖这个全范围(最小值,最大值和介于两者之间)将需要非常大的样本集.如上所述,尝试提供数百个或更多样本以解决时隙值字的所有变化.
  • 保持插槽中的短语足够短,用户可以说出整个短语而无需暂停.

冗长的口头输入可能导致较低的准确度体验,因此避免设计需要多于几个字的口语值的口语界面.用户在没有暂停的情况下不能说话的短语对于时隙值来说太长.

也就是说,这是文档中的示例Sample Utterances:

StatusUpdate发布更新{到达| UpdateText}

StatusUpdate发布更新{晚餐时间| UpdateText}

StatusUpdate发布更新{out at lunch | UpdateText}

...(更多样本显示4-10个单词的短语)

StatusUpdate发布更新{今晚将由杂货店停止| UpdateText}

如果您提供足够的不同长度示例来准确描述预期用户话语的范围,那么您的意图将能够准确捕获真实用例中的动态短语,您可以在UpdateText插槽中访问这些短语.基于此,您应该能够实现特定于您需求的意图.


ada*_*een 5

重要提示:自2018年10月22日起,将不赞成使用AMAZON.LITERAL。使用AMAZON.LITERAL构建的较早技能仍然可以继续工作,但是当您更新这些较早的技能以及所有新技能时,必须从AMAZON.LITERAL迁移。

代替使用AMAZON.LITERAL,您可以使用自定义插槽来诱使alexa将自由文本传递到后端。

您可以使用此配置来执行此操作:

{
    "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"
                            }
                        }
                    ]
                }
            ]
        }
    }
}
Run Code Online (Sandbox Code Playgroud)


Ale*_*use 0

更新:这个答案不正确。评论中提到,Amazon.Literal插槽类型应该允许这样做。


Alexa 目前不支持访问用户的原始语音输入。将来可能有可能,或者您可以查看其他一些语音到文本 API,例如Google 的.

目前使用 Alexa 实现此目的的唯一方法是拥有一组用户可以说它将保存的单词列表。

为此,您可以按照 Amazon 使用自定义槽类型的示例之一进行操作。然后将用户可能说的所有单词放入该类别中。

  • 这个答案是不正确的 - 您可以实现“AMAZON.Literal”插槽类型,这将允许捕获自由格式的输入。但是,您必须为其提供各种示例输入,以训练它了解预期的一般输入类型。 (2认同)