阿里云AI语音技能开发训练营第二天

目录

一、配置语音交互模型

二、配置单轮对话语料

三、配置实体和追问

1.实体是什么?

2. 创建”城市”实体(自定义实体)

3.创建”时间”实体(公共实体)

4.将参数和实体进行关联

5. 参数追问配置

6.配置多轮对话语料

四、后端功能开发

五、效果测试

任务:在第一课的基础上,创建部署云开发平台预发布环境后实现语音对话的服务意图,并在上线测试中截图对话界面。

[En]

Assignment: on the basis of the first lesson, create a service intention to realize the voice conversation after the pre-release environment of the cloud development platform is deployed, and take screenshots of the dialogue interface in the online test.

相信大家对天猫精灵技能应用的基本理念、开发方式和部署流程都有一个简单的了解。今天我们来了解一下天猫精灵的创建和配置,让我们的智能应用拥有真正的服务能力。在本课中,我们将实现天气查询功能,学习如何让技能与用户进行单轮或多轮对话,让技能更有趣。

[En]

I believe that you have a simple understanding of the basic concept, development method and deployment process of Tmall elf’s skill application. Today we learn about the creation and configuration of Tmall’s wizard, so that our intelligent applications have real service capabilities. In this lesson, we will implement the weather query function to learn how to make skills have single-round or multiple-round conversations with users to make skills more interesting.

一、 配置语音交互模型

点击 创建意图按钮进入创建意图页面,并且设置默认意图。

意图是用户使用语音技能的目的,语音技能应该至少有一个意图(用户至少有一个功能,或多个)才能说呼叫词进入默认意图,所以具有呼叫词的技能需要有默认意图。

[En]

Intention is the purpose for users to use voice skills, and voice skills should have at least one intention (at least one function for users, or multiple) only to say that calling words enter the default intention, so skills with calling words need to have a default intention.

意图是用户交互对话的目的。您可以创建新的意向或参考平台提供的公共意向。当您创建意图时,您需要清楚该意图提供了什么功能。例如,在天气助手技能中,我们创建了一个旨在提供天气的查询函数。

[En]

Intention is the purpose of the user’s interactive dialogue. * you can create new intentions or refer to public intentions provided by the platform. * when you create an intention, you need to be clear about what kind of functionality the intention provides. For example, in the Weather Assistant skill, we create a query function that is intended to provide weather.

阿里云AI语音技能开发训练营第二天

阿里云AI语音技能开发训练营第二天

二、 配置单轮对话语料

语料库:指用户为了达到目的而向说话人发出的语音指令。

[En]

Corpus: refers to the voice instructions spoken to the speaker by the user in order to achieve the purpose.

一轮对话语料库的意思是:当用户说出这句话时,可以确认用户想要使用该意图的功能。

[En]

The meaning of the one-round dialogue corpus is: when the user says this sentence, it can be confirmed that the user wants to use the function of this intention.

语料库泛化:用户不可能只根据一句话说话,所以相似的表达也应该配置到语料库中,这就是语料库泛化。不同的人有不同的表达方式,所以在实际开发过程中应该尽可能多地涵盖表达方式。否则,一些用户的表达与我们的意图不符。

[En]

Generalization of corpus: it is impossible for users to speak according to only one sentence, so similar expressions should also be configured into corpus, which is called corpus generalization. Different people have different ways of expression, so the expression patterns should be covered as much as possible in the actual development process. Otherwise, some users’ expressions don’t match our intentions.

例如:”贵阳今天天气怎么样”,”贵阳今天天气如何”,”查一下贵阳今天天气”,”贵阳天气怎么样”、”今天天气怎么样”……。

在天气查询意向中,可以配置几个相似的语料库:

[En]

In the weather query intention, you can configure several similar corpus:

阿里云AI语音技能开发训练营第二天

保存预期后的创作意图。提交并保存。

[En]

Save the creation intention after anticipation. Submit and save.

阿里云AI语音技能开发训练营第二天

三、 配置实体和追问

1. 实体是什么?

在配置意向语料库时,天气查询意向涉及两个参数:城市和时间(例如,今天杭州的天气怎么样)。我们不需要在语料库中穷尽城市和时间,我们可以创建实体来为这两个参数提供一系列值。

[En]

When we configure the intention corpus, the weather query intention involves two parameters: city and time (for example, “what’s the weather like in Hangzhou today”). We do not need to exhaust the city and time in the corpus, we can create entities to provide a range of values for these two parameters.

实体: 是自然语言处理领域中的重要概念,是一个规范的自然语言短语集合,通常定义为应用所在领域的关键词、术语。如常见的时间、地点、POI、人名、数量等,都可以作为实体来处理。

实体创建有两种方式:

自定义实体(开发人员创建实体并填写实体值):城市实体可以使用自定义实体

[En]

Custom entities (developers create entities and fill in entity values): city entities can use * Custom entities *

引用公共实体(可以直接引用平台提供的实体值填写的实体):Time实体使用公共实体

[En]

Reference to public entities (entities with filled entity values provided by the platform can be referenced directly): the “time” entity uses * public entities *

2. 创建”城市”实体(自定义实体)

第一步是填写实体的中文名称和身份。

[En]

The first step is to fill in the Chinese name and identity of the entity.

阿里云AI语音技能开发训练营第二天

阿里云AI语音技能开发训练营第二天

第二步是添加物理价值:例如,北京、杭州、上贵阳等城市的名称。

[En]

The second step is to add physical values: for example, the names of Beijing, Hangzhou, Shangguiyang and other cities.

新增时,可以同时输入多个实体值,以空格分隔,按Enter键保存。

[En]

When adding, you can enter multiple entity values at the same time, separated by spaces, and click enter to save.

阿里云AI语音技能开发训练营第二天

Tips:通过模板。调整我们的语料库(更具有通用性)

阿里云AI语音技能开发训练营第二天

3.创建”时间”实体(公共实体)

可以降低维护成本,例如引入日期通用实体

[En]

Can reduce maintenance costs, such as the introduction of date common entities

第一步,”时间”实体推荐使用公共实体:sys.date。点击”引用公共实体”;

阿里云AI语音技能开发训练营第二天

第二步,输入sys.date进行搜索,找到 sys.date 公共实体,打开后面的”引用”按钮;

阿里云AI语音技能开发训练营第二天

第三步是返回到实体列表,并看到“time”实体已经创建。

[En]

The third step is to return to the list of entities and see that the “time” entity has been created.

阿里云AI语音技能开发训练营第二天

4.将参数和实体进行关联

我们对我们预料进行实体的标记。鼠标选中我们需要标注的词语,页面上会自动弹出支持标注的实体。如 “杭州今天天气怎么样”这句语料,我们分别标注”杭州”为”city”,”今天”为”sys.date(公共实体)”。标注后会自动生成参数名称”city”和”sys.date(公共实体)”。

参数是什么:参数是用户在使用意图语料库时用来引用实体值的动态变量。在上一步中,我们已经为“天气查询”的意图语料库中涉及的城市和时间参数设置了对应的实体。接下来,我们需要将参数与意向语料库中的实体关联,请按照上面的步骤进行操作。

[En]

What is the parameter: a parameter is a dynamic variable used by the user to refer to the entity value when using the intention corpus. In the previous step, we have set up the corresponding entities for the city and time parameters involved in the intention corpus of “Weather query”. Next, we need to associate the parameters with the entity in the intention corpus, please follow the steps above.

阿里云AI语音技能开发训练营第二天

5. 参数追问配置

虽然我们已经在意向语料库中设置了参数和关联实体,但很可能用户在日常语音交互过程中没有说出他们想要查询的城市或日期。在这种情况下,语音交互识别过程中缺少必要的参数,技能无法为用户提供精准的服务。此时,我们可以通过设置参数来完成一些必要的信息。

[En]

Although we have set parameters and associated entities in the intention corpus, it is very likely that users do not say the city or date they want to query in the process of daily voice interaction. In this case, the necessary parameters are missing in the process of speech interactive recognition, and the skills can not provide accurate services for users. At this time, we can complete some necessary information by setting parameters.

当语料库中没有必要的参数时,可以通过两种方式获取:1)为参数赋值:当用户语料库中没有该参数时,则默认为某个值。2)设置参数询问:然后通过一轮对话询问用户参数的值。

[En]

When the corpus does not contain the necessary parameters, there are two ways to obtain: 1) assign a default value to the parameter: when the user does not have this parameter in the corpus, it defaults to a certain value. 2) set parameter questioning: then ask the user for the value of the parameter through a round of dialogue.

1)给 date 参数设置默认值

阿里云AI语音技能开发训练营第二天

这里填写的”今天”就代表当用户使用语料”贵阳天气”进入意图后,默认用户查询的是今天的天气。 配置有默认值时,请求数据中一定会携带这个参数

2)缺少 city 参数时向用户追问

使用”精灵追问”,语音交互模型中就需要增加精灵追问的以下配置:

勾选参数前的 必选,

在 精灵追问 中添加至少一条追问语句。

阿里云AI语音技能开发训练营第二天

在平台配置好追问后,后端逻辑代码中就不需要判断 city 参数是否存在了。系统自动判断是否含有 city 参数,如果没有则会使用追问语句向用户询问,获取到必要参数后会统一发送给后端服务进行处理.

6. 配置多轮对话语料

增加语料

在意图配置中增加”那明天呢”,”那北京呢”语料。在用户日常聊天对话中,很多情况下仅凭单条语句是无法确认用户真实意图的,此时就需要结合对话的上下文来明确意图。

例如,在下图语音对话的互动过程中,无法将意图与句中的“明天怎么办”和“北京怎么办”区分开来。不过,结合前几轮对话的结果,可以确定,《明天怎么样》就是询问明天杭州的天气。

[En]

For example, in the interactive process of voice conversation in the following picture, it is impossible to distinguish the intention from the sentences of “what about tomorrow” and “what about Beijing”. However, combined with the results of previous rounds of dialogue, it can be confirmed that “what about tomorrow” is to inquire about the weather of Hangzhou tomorrow.

关联语料和实体

在”天气查询”意图的多轮对话的语料如下,并把明天和北京分别进行标注,明天标注为时间实体,北京标注为城市实体:

在所有配置完成后,提交预期配置。

[En]

Submit the intended configuration after all is configured.

阿里云AI语音技能开发训练营第二天

阿里云AI语音技能开发训练营第二天

为了获得更多的通用性,我们使用模板,如下图所示:

[En]

For more versatility, we use templates, as shown in the following figure:

阿里云AI语音技能开发训练营第二天

四、后端功能开发

其目的是要求后端服务为开发提供服务:

[En]

The intention is to require back-end services to provide services for development:

阿里云AI语音技能开发训练营第二天

阿里云AI语音技能开发训练营第二天

提交代码,进行部署

阿里云AI语音技能开发训练营第二天

阿里云AI语音技能开发训练营第二天

五、效果测试

阿里云AI语音技能开发训练营第二天

阿里云AI语音技能开发训练营第二天

阿里云AI语音技能开发训练营第二天

Original: https://blog.csdn.net/weixin_43276552/article/details/121111361
Author: 无敌小将
Title: 阿里云AI语音技能开发训练营第二天

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/512444/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球