如何添加模式以提高预测准确性How to add patterns to improve prediction accuracy

在 LUIS 应用接收到终结点话语后,请使用模式提高话语(按字词顺序和字词选择呈现模式)的预测准确性。After a LUIS app receives endpoint utterances, use a pattern to improve prediction accuracy for utterances that reveal a pattern in word order and word choice. 模式使用特定语法指示实体、实体角色和可选文本的位置。Patterns use specific syntax to indicate the location of: entities, entity roles, and optional text.

注意

模式仅包括机器学习实体父项,而不包括子实体。Patterns only include machine-learning entity parents, not subentities.

使用正确的语法添加模板言语Add template utterance using correct syntax

  1. 登录到 LUIS 门户,选择“订阅”**** 和“创作资源”**** 以查看分配给该创作资源的应用。Sign in to the LUIS portal, and select your Subscription and Authoring resource to see the apps assigned to that authoring resource.

  2. 在“我的应用”页上选择应用名称以打开应用****。Open your app by selecting its name on My Apps page.

  3. 在左侧面板中,选择“改进应用性能”下的“模式”**** ****。Select Patterns in the left panel, under Improve app performance.

  4. 为模式选择正确意向。Select the correct intent for the pattern.

  5. 在模板文本框中,键入模板表述,然后按 Enter。In the template textbox, type the template utterance and select Enter. 如果要输入实体名称,请使用正确的模式实体语法。When you want to enter the entity name, use the correct pattern entity syntax. 使用以 { 开头的实体语法。Begin the entity syntax with {. 实体列表随即显示。The list of entities displays. 选择正确的实体。Select the correct entity.

    模式实体的屏幕截图Screenshot of entity for pattern

    如果实体中包含角色,请在实体名称后用一个冒号 (:) 指示该角色,例如 {Location:Origin}If your entity includes a role, indicate the role with a single colon, :, after the entity name, such as {Location:Origin}. 实体的角色列表将以列表形式显示。The list of roles for the entities displays in a list. 选择该角色,然后按 Enter。Select the role, and then select Enter.

    包含角色的实体的屏幕截图Screenshot of entity with role

    选择正确的实体后,请完成模式输入,然后按 Enter。After you select the correct entity, finish entering the pattern, and then select Enter. 模式输入完成后,请培训应用。When you are done entering patterns, train your app.

    包含两种实体类型的已输入模式的屏幕截图Screenshot of entered pattern with both types of entities

创建 pattern.any 实体Create a pattern.any entity

Pattern.any 实体仅在模式中有效,在意向的示例言语中无效。Pattern.any entities are only valid in patterns, not intents' example utterances. 此类实体有助于 LUIS 查找不同长度和字词选择的实体结尾。This type of entity helps LUIS find the end of entities of varying length and word choice. 由于此实体会在模式中使用,因此,LUIS 可识别实体末尾在话语模板中的位置。Because this entity is used in a pattern, LUIS knows where the end of the entity is in the utterance template.

  1. 登录到 LUIS 门户,选择“订阅”**** 和“创作资源”**** 以查看分配给该创作资源的应用。Sign in to the LUIS portal, and select your Subscription and Authoring resource to see the apps assigned to that authoring resource.

  2. 在“我的应用”页上选择应用名称以打开应用****。Open your app by selecting its name on My Apps page.

  3. 在“生成”部分的左侧面板中选择“实体”,然后选择“+ 创建”**** **** ****。From the Build section, select Entities in the left panel, and then select + Create.

  4. 在“选择实体类型”对话框中,在“名称”框中输入实体名称,然后选择“Pattern.Any”作为“类型”,然后选择“创建”**** **** **** **** ****。In the Choose an entity type dialog box, enter the entity name in the Name box, and select Pattern.Any as the Type then select Create.

在对模型进行模式更改后对应用进行培训Train your app after changing model with patterns

添加、编辑、删除或重新分配模式后,请针对更改来培训发布应用以影响终结点查询。After you add, edit, remove, or reassign a pattern, train and publish your app for your changes to affect endpoint queries.

使用上下文工具栏Use contextual toolbar

使用模式列表上方的上下文工具栏可以:The contextual toolbar above the patterns list allows you to:

  • 搜索模式Search for patterns
  • 编辑模式Edit a pattern
  • 为其他意向重新分配一个模式Reassign individual pattern to different intent
  • 为其他意向重新分配多个模式Reassign several patterns to different intent
  • 删除单个模式Delete-a-single-pattern
  • 删除多个模式Delete several patterns
  • 按实体筛选模式列表Filter pattern list by entity
  • 按意向筛选模式列表Filter-pattern-list-by-intent
  • 删除实体或意向筛选器Remove entity or intent filter
  • 在意向或实体页上通过现有表述添加模式Add pattern from existing utterance on intent or entity page

后续步骤Next steps

  • 了解如何按照教程生成模式(使用 pattern.any 和角色)。Learn how to build a pattern with a pattern.any and roles with a tutorial.
  • 了解如何培训应用。Learn how to train your app.