You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

LUIS技术咨询:单Utterance中多复合实体归属识别问题

Fixing Multiple Composite Entity Attribution in LUIS for Order Scenarios

Hey there! As someone who's wrestled with LUIS's entity recognition quirks before, I feel your pain when multiple items in a single utterance don't get mapped to their correct composite entities. Let's walk through how to get your order scenario working right with that test phrase: "purchase for me 2 red hot chilli pepper albuns and an amazing spiderman figure please"

Step 1: Verify Your Composite Entity Structure

First, make sure you've set up a parent composite entity (let's call it OrderItem) that wraps all the child entities relevant to a single order line. Your structure should look something like this:

  • Parent Entity: OrderItem (Composite type)
    • Child Entities:
      • Quantity (can use the prebuilt Number entity or a custom one)
      • ProductName (custom entity for the item's specific name)
      • ProductType (custom entity for categories like "albums", "figure")

If you haven't layered your entities this way, LUIS won't know how to group attributes to individual items.

Step 2: Correctly Label Utterances with Entity Boundaries

This is the most critical part—LUIS learns from how you label examples. For your test utterance, you need to explicitly label two separate OrderItem instances, each with their own child entities:

  1. Highlight "2 red hot chilli pepper albuns" and assign it to OrderItem:
    • Inside this, label "2" as Quantity
    • Label "red hot chilli pepper" as ProductName
    • Label "albuns" as ProductType
  2. Highlight "an amazing spiderman figure" and assign it to a second OrderItem:
    • Label "an" as Quantity (you can map this to the value 1 in your post-processing code)
    • Label "amazing spiderman" as ProductName
    • Label "figure" as ProductType

Add 5-10 more similar utterances with multiple items, each labeled consistently. Examples like:

  • "buy 3 harry potter books and 2 star wars action figures"
  • "order 1 large pizza and 2 bottles of soda"

Step 3: Use Patterns to Reinforce Repeatable Structures

LUIS patterns help it recognize recurring sentence structures. Create a pattern like this to teach it to expect multiple OrderItem instances:

purchase for me {OrderItem} and {OrderItem} please

You can add variations too, like:

buy {OrderItem} and {OrderItem}
order {OrderItem}, {OrderItem}, and {OrderItem}

Step 4: Check for Entity Conflicts

If you're using prebuilt entities (like Number), make sure they're properly associated with your composite entity. Sometimes prebuilt entities can override custom labels—double-check that in your entity settings, the child entities are set to be part of the OrderItem composite, not standalone.

Step 5: Test and Iterate

After labeling examples and adding patterns, train your LUIS app, then test your utterance again. Look at the returned JSON's entities array—you should see two distinct OrderItem instances, each containing their respective Quantity, ProductName, and ProductType values. If something's off, go back to your labeled utterances and make sure boundaries are correct (no overlapping labels, no missing child entity assignments).


内容的提问来源于stack exchange,提问作者Bruno Alves

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:29:57