用户可以通过语音设置 Slots 和 Slots 同义词吗

Can user set Slots and Slots synonyms by voice

我创造了一个有意图、话语和槽位的技能 我想知道用户是否可以通过语音设置插槽或插槽同义词。

我的设置: 意图:OutletIntent 话语:你能打开{IOT}吗 插槽:{IOT}:插座

例如:

User :Can you turn on the outlet please Alexa : Outlet turned on

User: Can you add synonym of outlet Alexa: tell me the synonym User: Power Alexa: Done

User: Can you turn on the Power please Alexa: Power turned on

然后

插槽 -> {IOT}:插座 => 同义词:电源

希望清楚,如果不清楚,请告诉我哈哈, 提前致谢

是的,你可以!

您需要创建如下所示的意图:

意图:AskForSynonymChange
话语:你可以添加 {ExistingSlotValue} 的同义词吗?

意图:TakeSynonymValue
话语:设置为{NewSynonymValue}

ExistingSlotValue is a custom slot of which values you can already define based on all the IOT slots values you have.

NewSynonymValue is of type AMAZON.SearchQuery

在此之后,您需要根据您在处理函数中获得的上述响应更新交互模型。

你可以利用 'Alexa Skill Management API' (SMAPI).
更多相关信息:https://developer.amazon.com/docs/smapi/interaction-model-operations.html

您可以获得当前的交互模型: https://developer.amazon.com/docs/smapi/interaction-model-operations.html#get-interaction-model

然后通过将 {NewSynonymValue} 添加到 {ExistingSlotValue} 的同义词的修改来更新此交互模型:https://developer.amazon.com/docs/smapi/interaction-model-operations.html#update-interaction-model

之后,您需要发布您的技能,是的,再次使用 SMAPI:
https://developer.amazon.com/docs/smapi/skill-certification-operations.html#request

让我知道这是否适合你。

作为用户之一,您不能更改技能的交互模型。
作为开发人员,您始终可以通过开发人员门户或通过 Alexa 技能管理 API 添加新的同义词。但是,对于您在交互模型中所做的每一项更改,都需要重新构建您的技能。

只能在development skills中更改交互模型(通过门户或SMAPI),一旦您的技能发布,您将永远无法添加同义词。如果你想添加,那么它是一个交互模型更改,你必须在发布新技能版本(技术上 new/updated 交互模型)之前获得认证。


When you create a custom slot type, a key concept to understand is that this is training data for Alexa’s NLP (natural language processing). The values you provide are NOT a strict enum or array that limit what the user can say. This has two implications

1) words and phrases not in your slot values will be passed to you,

2) your code needs to perform any validation you require if what’s said is unknown

因此您可以期望 Alexa return 示例中未定义的槽值。您的 IOT 插槽也将 return 其他值。只需给出 IOT 的各种示例插槽值即可。每当您的技能后端收到槽值时,只需对其进行验证并继续。

如果只想响应用户添加的同义词,可以在用户添加时保存新的槽值。 例如:

User: Can you add synonym of outlet
Alexa: tell me the synonym 
User: Power

现在,当您收到此插槽值作为电源时,将其保存在数据库中用户为插座添加的同义词列表中。即,{IOT} 插槽。

Alexa: Done

现在当用户说:

User: Can you turn on the Power please 

由于 Alexa 传递了其他未定义的插槽值,您应该将 IOT 插槽值设为 power。现在在您的后端检查值 power 是否已添加为 outlet 的同义词并相应地做出响应。

对于已发布的技能,交互模型的任何更改都需要在新版本再次上线之前进行认证。