亚马逊 Alexa:存储用户的话 [英] Amazon Alexa: store user's words

查看:30
本文介绍了亚马逊 Alexa:存储用户的话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编写 Alexa 技能的新手,想编写一项技能来存储演讲者的话.
例如,如果我说,Alexa,保存 {whatever i say}",它应该将单词保存在某个字符串中.
现在据我所知,意图模式应该是这样的

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"
   ]
}

和类似的话语

SaveIntent save
SaveIntent store

在这种情况下,我如何存储{whatever I say}"?

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

推荐答案

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

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"
        }
      ]
    }
  ]
}

由于它使用 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:

如果您使用 AMAZON.LITERAL 类型来收集自由格式的文本插槽中可能包含的单词数量差异很大,请注意以下事项:

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:

  • 涵盖整个范围(最小值、最大值以及介于两者之间)将需要非常大的样本集.尝试提供数百样本或更多以解决槽值字中的所有变化,如上面提到.
  • 保持槽内的短语足够短,以便用户可以无需停顿即可说出整个短语.

冗长的口语输入会导致体验的准确性降低,因此请避免设计一个需要不止几个的口语界面槽值的词.用户不能没有的短语暂停对于槽值来说太长了.

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 发布更新 {arrived|UpdateText}

StatusUpdate post the update {arrived|UpdateText}

StatusUpdate 发布更新 {dinner time|UpdateText}

StatusUpdate post the update {dinner time|UpdateText}

StatusUpdate 发布更新{午餐时|UpdateText}

StatusUpdate post the update {out at lunch|UpdateText}

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

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

StatusUpdate 发布更新{今晚要去杂货店|UpdateText}

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

如果您提供足够多的不同长度的示例来准确描述预期的用户话语范围,那么您的意图将能够准确捕获实际用例中的动态短语,您可以在 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.

这篇关于亚马逊 Alexa:存储用户的话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆