LUIS 的迭代应用设计Iterative app design for LUIS

语言理解 (LUIS) 应用可以使用迭代进行学习并最高效地执行。A Language Understanding (LUIS) app learns and performs most efficiently with iteration. 下面是典型的迭代周期:Here's a typical iteration cycle:

  • 创建新版本Create new version
  • 编辑 LUIS 应用架构。Edit the LUIS app schema. 这包括:This includes:
    • 意向和示例言语Intents with example utterances
    • 实体Entities
    • 功能Features
  • 训练、测试和发布Train, test, and publish
    • 在预测终结点上进行主动学习测试Test at the prediction endpoint for active learning
  • 从终结点查询收集数据Gather data from endpoint queries


生成 LUIS 架构Building a LUIS schema

应用的架构定义用户的需求是什么(意图或意向),以及意向的哪些部分提供有助于确定答案的详细信息(称为实体)。 An app's schema defines what the user is asking for (the intention or intent ) and what parts of the intent provide details (called entities) that are used to help determine the answer.

应用架构必须特定于应用域,以此确定相关的单词和短语,并确定典型的单词顺序。The app schema must be specific to the app domains to determine words and phrases that are relevant, as well as to determine typical word ordering.

示例言语表示应用在运行时所需的用户输入,例如识别的语音或文本。Example utterances represent user inputs, such as recognized speech or text, that the app expects at runtime.

架构需要意向,并且应该包含实体。 The schema requires intents, and should have entities.

意向的示例架构Example schema of intents

最常见的架构是使用意向组织的意向架构。The most common schema is an intent schema organized with intents. 此类架构使用 LUIS 来确定用户的意图。This type of schema uses LUIS to determine a user's intention.

如果意向架构类型有助于 LUIS 确定用户的意图,则此类型可以包含实体。The intent schema type may have entities if it helps LUIS determine the user's intention. 例如,发货实体(作为意向的描述符)可帮助 LUIS 确定发货意图。For example, a shipping entity (as a descriptor to an intent) helps LUIS determine a shipping intention.

实体的示例架构Example schema of entities

实体架构侧重于实体,是从用户言语中提取的数据。An entity schema focuses on entities, which is the data that is extracted from user utterances. 例如,如果用户说“我想要订三份披萨”。For example, if a user was to say, "I'd like to order three pizzas." 将会提取两个实体:“三份”和“披萨”。 There are two entities that would be extracted: three and pizzas. 这些实体有助于实现意图,即订餐。These are used to help fulfill the intention, which was to make an order.

在实体架构方面,言语的意图对于客户端应用程序而言不太重要。For an entity schema, the intention of the utterance is less important to the client application.

组织实体架构的常用方法是将所有示例言语添加到 None 意向。A common method of organizing an entity schema is to add all example utterances to the None intent.

混合架构的示例Example of a mixed schema

最强大且成熟的架构是包含完整实体和特征的意向架构。The most powerful and mature schema is an intent schema with a full range of entities and features. 此架构可用作意向架构或实体架构的起点,并可以不断扩充以包含两者的概念,因为客户端应用程序需要这些信息片段。This schema can begin as either an intent or entity schema and grow to include concepts of both, as the client application needs those pieces of information.

将示例言语添加到意向Add example utterances to intents

LUIS 需要在每个意向中添加几个示例言语。LUIS needs a few example utterances in each intent. 示例言语需要有足够的单词选择和单词顺序方面的变化,才能确定言语表达的意向。The example utterances need enough variation of word choice and word order to be able to determine which intent the utterance is meant for.


请不要批量添加示例言语。Do not add example utterances in bulk. 先添加 15 到 30 个具体的且有变化的示例。Start with 15 to 30 specific and varying examples.

需要为每个示例言语设计任何需要提取的数据,并将这些数据标记为实体Each example utterance needs to have any required data to extract designed and labeled with entities.

关键元素Key element 目的Purpose
IntentIntent 将用户言语分类成单一意图或操作。Classify user utterances into a single intention, or action. 示例包括 BookFlightGetWeatherExamples include BookFlight and GetWeather.
实体Entity 从言语中提取实现意图所需的数据。Extract data from utterance required to complete intention. 示例包括旅行日期和时间以及地点。Examples include date and time of travel, and location.

可以通过将言语分配到 None 意向,将 LUIS 应用设计为忽略与应用域不相关的言语。A LUIS app can be designed to ignore utterances that aren't relevant to an app's domain by assigning the utterance to the None intent.

测试并训练应用Test and train your app

在每个意向中添加 15 到 30 个不同的示例言语并标记所需的实体后,需要测试并训练 LUIS 应用。After you have 15 to 30 different example utterances in each intent, with the required entities labeled, you need to test and train your LUIS app.

发布到预测终结点Publish to a prediction endpoint

必须发布 LUIS 应用,使之出现在预测终结点区域列表中。The LUIS app must be published so that it's available to you in the list prediction endpoint regions.

测试已发布的应用Test your published app

可以从 HTTPS 预测终结点测试已发布的 LUIS 应用。You can test your published LUIS app from the HTTPS prediction endpoint.

为每个周期创建新版本Create a new version for each cycle

每个版本是 LUIS 应用的即时快照。Each version is a snapshot in time of the LUIS app. 在对应用进行更改之前,请创建新版本。Before you make changes to the app, create a new version. 恢复旧版本比尝试将意向和言语转移到以前的状态要更容易。It is easier to go back to an older version than to try to remove intents and utterances to a previous state.

版本 ID 由字符、数字或“.”组成,且长度不得超过 10 个字符。The version ID consists of characters, digits or '.' and cannot be longer than 10 characters.

初始版本 (0.1) 是默认活动版本。The initial version (0.1) is the default active version.

首先克隆现有版本Begin by cloning an existing version

克隆现有版本,用作每个新版本的起点。Clone an existing version to use as a starting point for each new version. 克隆版本后,新版本将成为活动版本。After you clone a version, the new version becomes the active version.

发布槽Publishing slots

可以发布到过渡槽和/或生产槽。You can publish to either the stage and/or production slots. 每个槽可以具有不同的版本或相同的版本。Each slot can have a different version or the same version. 这样,在将更改发布到可供机器人或其他 LUIS 调用应用使用的生产槽之前,可以方便地验证这些更改。This is useful for verifying changes before publishing to production, which is available to bots or other LUIS calling apps.

训练的版本在 LUIS 应用的终结点中不会自动可用。Trained versions aren't automatically available at your LUIS app's endpoint. 要使某个版本在 LUIS 应用终结点中可用,必须发布或重新发布该版本。You must publish or republish a version in order for it to be available at your LUIS app endpoint. 可以发布到“过渡”和“生产”槽,从而提供两个在终结点中可用的应用版本。 You can publish to Staging and Production, giving you two versions of the app available at the endpoint. 如果需要更多应用版本在终结点上可用,应导出版本并将其重新导入到新的应用。If more versions of the app need to be available at an endpoint, you should export the version and reimport it to a new app. 新的应用具有不同的应用 ID。The new app has a different app ID.

导入和导出版本Import and export a version

可以在应用级别导入版本。A version can be imported at the app level. 该版本将成为活动版本,并使用应用文件的 versionId 属性中的版本 ID。That version becomes the active version and uses the version ID in the versionId property of the app file. 也可以在版本级别导入到现有应用。You can also import into an existing app, at the version level. 新版本将成为活动版本。The new version becomes the active version.

也可以在应用或版本级别导出版本。A version can be exported at the app or version level as well. 唯一的区别是应用级别导出的版本是当前活动版本,而在版本级别,可以在“设置”页上选择任意要导出的版本 。The only difference is that the app-level exported version is the currently active version while at the version level, you can choose any version to export on the Settings page.

导出的文件包含:The exported file doesn't contain:

了解有关协作的概念。Learn concepts about collaboration.