创建Q&A Alexa应用程序的最佳实践是什么?

时间:2018-11-16 22:50:06

标签: node.js aws-lambda alexa alexa-skills-kit alexa-skill

我想制作一个简单的Alexa问答应用程序,类似于Alexa的自定义问答蓝图应用程序。我不想使用蓝图,因为我需要其他功能。创建Alexa应用的最佳实践是什么?我应该为每个问题创建单独的意图还是应该以某种方式使用话语?

2 个答案:

答案 0 :(得分:2)

最好的方法取决于问题是什么以及如何提出。

1。如果问题的结构简单
考虑以下示例:

what is a black hole
define supernova
tell me about milkyway
what is a dwarf star

然后可以按如下所示对其进行配置:

what is a {space}
define {space}
tell me about {space}

和插槽{space} -> black hole, supernova, milkyway, dwarf star从广告位值中,您可以了解问题所在并进行回答。由于Alexa还将使用非配置值填充插槽,因此您可以根据此句子结构容纳更多问题。

2。如果问题结构不太复杂

what is the temperature of sun
temperature to boil water
number of eyes of a spider 
what is the weight of an elephant

然后可以按如下所示对其进行配置:

what is the {unit} of {item}
{unit} to boil {item}
{unit} of eyes of a {item}
what is the {unit} of an {item}

在这里

{unit} -> temperature, number, weight, height etc.
{item} -> sun, moon, water, spider etc

通过插槽的正确验证,您将能够为用户提供正确的答案。

此外,如果用户部分提出问题,您将能够提供建议

例如:

user: what is the temperature 
[slots filled: "unit"="temperature","item":""]

现在,您知道用户询问了温度,但是item丢失了,因此您以类似这样的建议进行回复

"Sorry I didn't understand. Do you want to know the temperature of the sun?"

3。如果问题的结构完全不同

How to deal with an annoying neighbor
What are the types of man made debris in space
Recommend few good Nickelback songs
Can I jump out of a running train

如果您的问题是这样的,并且结构完全随机,那么您可以专注于问题的某些关键字或外壳并将其分组。即使您无法对它们进行分组,也要找出必填字段或必填词

IntentA: How to deal with an annoying {person}
IntentB: What are the types of man made {item} in {place}
IntentC: Recommend few good {person} songs
IntentD: Can I {action} out of a running {vehicle}

在此处使用广告位的优点是,即使用户提出了部分问题并触发了相关的意图,您也可以识别出该问题并通过回答/建议或错误消息进行回复。

例如:

user: what are the types of man made mangoes in space 
[IntentB will be triggered]

如果您没有配置强制插槽,则后端将专注于触发的意图,并以正确的答案(在空间中人为碎片)做出响应,在这种情况下,这对用户没有任何意义。

现在,正确使用插槽并进行验证,您会发现后端收到debris而不是"mangoes"这是无效的。因此,您可以使用

之类的建议或错误消息进行回复
"Sorry, I don't know that. Do you want to know about the man made debris found in space"

分组问题将帮助您稍后轻松添加其他类似问题。如果很难分组,可以对每个问题使用一个意图。但是,如果要避免上述情况,请记住使用插槽验证它。

在命名问题意图时使用前缀。这可能有助于您根据后端设计将后端代码中的处理程序分组。这不是强制性的,只是一个建议。

摘要:

  1. 将结构相似的问题分组。
  2. 正确使用插槽并进行验证。
  3. 尽可能使用预定义的插槽。
  4. 不仅仅依赖于意图,因为可以将意图映射为最接近的匹配。但是问题可能完全不同,或者没有任何意义。因此,请正确使用插槽并进行验证。
  5. 如果可能,请提出部分问题的建议。
  6. 进行彻底的测试,并确保它不会破坏您的交互模型。

答案 1 :(得分:0)

您应检查Alexa对话框界面,该对话框允许您进行Q / A或QUIZZ。

https://developer.amazon.com/fr/docs/custom-skills/dialog-interface-reference.html