alexa技能个数_如何改善Alexa技能的对话流程

alexa技能个数

by Garrett Vargas

通过Garrett Vargas

如何改善Alexa技能的对话流程 (How to improve the conversation flow of your Alexa skill)

Natural conversations are fluid. That’s one of the joys of face to face human conversation, you never know how the dialog will evolve. But sometimes, there is a natural flow to the conversation. Ask someone where they want to eat, and you expect to hear a restaurant or type of food, not a response about a favorite movie.

自然的对话是流畅的。 这是面对面的人类对话的乐趣之一,您永远不知道对话将如何发展。 但是有时候,对话自然而然。 询问某人要吃饭的地方,您希望听到一家餐馆或某种食物,而不是对喜欢的电影的回应。

One of the frustrations people have with voice assistants is that they sometimes do a poor job understanding what they’re saying. Amazon has a tool to help third party developers provide better recognition. Dialog Management lets you prompt for values to fulfill a request with increased accuracy.

人们对语音助手的不满之一是,他们有时在理解他们所说的内容方面做得很差。 亚马逊有一个工具可以帮助第三方开发人员提供更好的认可度。 对话框管理可让您提示输入值,以提高准确性。

For example, if you are creating a skill that searches for a car rental, Alexa can prompt the customer for a city and dates of travel after they say “find a car.” Alexa’s built-in functionality improves the accuracy of speech recognition in this case as it listens for specific values.

例如,如果您要创建搜索汽车租赁的技能,则Alexa会在客户说“找到汽车”后提示客户输入城市和出行日期。 在这种情况下,Alexa的内置功能可以侦听特定值,从而提高了语音识别的准确性。

The problem is that the customer has to speak the appropriate words to trigger a Dialog-controlled intent. Amazon recently announced intent chaining as a solution to this problem.

问题在于,客户必须说出适当的单词才能触发Dialog控制的意图。 亚马逊最近宣布使用意向链接作为此问题的解决方案。

In this blog I’m going to show you how I use this functionality with a skill that lets the user perform a car search. First, let’s review how Dialog Management works within Alexa. Let’s look at a CarSearchIntent that gathers the input needed to kick off a car search.

在本博客中,我将向您展示如何使用这项功能,使用户能够进行汽车搜索。 首先,让我们回顾一下对话框管理在Alexa中的工作方式。 让我们看一下CarSearchIntent,它收集启动汽车搜索所需的输入。

As you can see, we have several variations on how a customer can find a car, including slots for Location, PickUpDate, and DropOffDate. We want to make sure the customer provides all three of these slots before we start processing the request. We use Dialog Management to let Alexa handle prompting the customer to provide these.

如您所见,我们在客户找到汽车的方式上有多种变体,包括位置,提货日期和投递日期的插槽。 我们希望在开始处理请求之前确保客户提供所有这三个广告位。 我们使用对话框管理来让Alexa处理提示客户提供这些信息。

When in Dialog mode, Alexa has a higher chance of accuracy because it is trying to fill slots for this intent. But to get into this mode, the customer has to trigger this intent by saying “Find a car” or a similar phrase. Ideally, we’d drop the customer into this mode as soon as they launched the skill.

在对话模式下,Alexa的准确率更高,因为它正试图为此目的填补空缺。 但是要进入此模式,客户必须通过说“找到汽车”或类似的短语来触发此意图。 理想情况下,我们会在客户启动该技能后立即将其置于此模式。

Enter Intent Chaining! We can add a Dialog Delegate directive to our response that puts the customer into the dialog flow of CarSearchIntent.

输入意图链接! 我们可以在响应中添加一个Dialog Delegate指令,使客户进入CarSearchIntent的对话框流程。

canHandle(handlerInput) {  const request = handlerInput.requestEnvelope.request;  return handlerInput.requestEnvelope.session.new ||    (request.type === 'LaunchRequest');},handle: function(handlerInput) {  return handlerInput.responseBuilder    .addDelegateDirective({      name: 'CarSearchIntent',      confirmationStatus: 'NONE',      slots: {}    })    .speak("Welcome to car search.")    .getResponse();}

The dialog directive allows us to pre-fill some of the slots (for example, we could default the location to the last used search location). What’s interesting to note is that we only specify “Welcome to car search” as the response for this handler. We don’t specify a reprompt. Alexa appends the dialog prompt for CarSearchIntent to our response and uses that as the reprompt. So in this case what the user will hear is “Welcome to car search. Where would you like to pick up the car?” If they don’t answer, they will hear a reprompt of “Where would you like to pick up the car?”

dialog指令允许我们预填充一些插槽(例如,我们可以将位置默认为最后使用的搜索位置)。 有趣的是,我们仅将“ Welcome to car search”指定为此处理程序的响应。 我们没有指定提示。 Alexa将CarSearchIntent的对话框提示附加到我们的响应中,并将其用作提示。 因此,在这种情况下,用户将听到的是“欢迎进行汽车搜索。 您想在哪里上车?” 如果他们不回答,他们会听到“您想在哪里上车的提示”。

You also have the ability to direct the customer to fill out a specific slot when dropping them into a dialog. Let’s say that we want to guide the user to first specify the pick up date for their car. We can do that using an Elicit Slot directive, as shown in the following code.

当将客户放入对话框时,您还可以指导客户填写特定的广告位。 假设我们要引导用户首先指定他们的汽车的提取日期。 我们可以使用Elicit Slot指令执行此操作,如以下代码所示。

canHandle(handlerInput) {  const request = handlerInput.requestEnvelope.request;  return handlerInput.requestEnvelope.session.new ||    (request.type === 'LaunchRequest');},handle: function(handlerInput) {  return handlerInput.responseBuilder    .addElicitSlotDirective('PickUpDate', {      name: 'CarSearchIntent',      confirmationStatus: 'NONE',      slots: {}    })    .speak("Welcome to car search. When would you like to pick up your car?")    .reprompt("When would you like to pick up your car?")    .getResponse();}

In this case, we need to spell out the entire speech and reprompt that the customer will hear. We need to do this since we are controlling how we drop the customer into the dialog management flow.

在这种情况下,我们需要说出整个演讲内容并提示客户。 我们需要这样做,因为我们正在控制如何将客户放入对话框管理流程。

Chaining intents lets you manage the conversation flow in a more natural way. Use it to make your skill more usable for your customers!

链接意图使您可以更自然地管理对话流程。 使用它可以使您的技能对客户更有用!

翻译自: https://www.freecodecamp.org/news/how-to-improve-the-conversation-flow-of-your-alexa-skill-1b6c6556f9a3/

alexa技能个数

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值