Entity recognition intervention dictionaries

Updated at:

Entity recognition intervention currently includes two types: intervention in the entity recognition results themselves and intervention in the importance of entity types. If entity recognition results are inaccurate, you can use entity recognition intervention to resolve the issue.

Concepts

Entity recognition intervention

You can intervene in entity recognition results by creating an entity intervention dictionary and configuring it in the entity recognition feature of query analysis. Because semantic entities are closely related to analyzers, you must select an analyzer when you create an intervention dictionary. When you configure query analysis, you can use the dictionary only if the analyzer of the index is the same as the analyzer of the intervention dictionary.

Important
  • When you create an entity recognition intervention dictionary, custom model analyzers can be configured only for exclusive applications.

  • You can select exact match or partial match for the queries in an intervention dictionary.

  • You can create up to 1,000 intervention entries in each intervention dictionary.

  • When you add an intervention entry, the query that you add must be normalized (uppercase letters converted to lowercase and full-width characters converted to half-width characters). Otherwise, the intervention entry can be added but does not take effect during queries.

  • When you configure an entity recognition intervention dictionary in query analysis, you can specify whether to ignore spaces in queries.

  • In some cases, such as after the system upgrades an analyzer, the tokenization result of some queries during search may differ from the tokenization result when the intervention dictionary was created. In this case, the intervention does not take effect, and the query returns error code 6612. If this error code is returned, you must modify the intervention entry in the console.

Entity importance intervention

For ease of use, the system provides a default entity importance configuration. You can adjust the configuration based on your business requirements. These adjustments affect the query rewriting rules.

  • If a query matches multiple intervention entries, the intervention entry with the higher matching weight takes effect first.

  • If the matching weights are the same, the intervention entry at the earlier position takes effect first.

  • If the matching positions are the same, the intervention entry with more semantic terms is used first.

Important
  • When you configure importance, High and Medium cannot both be empty. Otherwise, the feature that rewrites queries based on entity recognition does not take effect.

  • Entities of different importance levels cannot conflict. That is, each entity can have only one importance level.

Usage

You can manually intervene in the built-in entity recognition dictionary of the system. The intervention process typically consists of the following four steps:

  1. Create an entity recognition intervention dictionary. Go to Search Algorithm Center--->Retrieval Configuration--->Dictionary Management. On the query analysis intervention dictionary page, click Create in the upper-right corner. Select a dictionary type and specify a name for the dictionary. After the intervention dictionary is created, it appears in the dictionary list on the page.

  2. Add and manage intervention entries in the intervention dictionary. After the dictionary is created, click the dictionary name or click Manage for the dictionary in the list to go to the details page of the intervention dictionary. On the details page, you can add and manage intervention entries.

  3. Use the intervention dictionary. After you create and populate the entity recognition intervention dictionary, you can select it in the query analysis settings of your application.

  4. Test the intervention dictionary and apply it online. After a query analysis rule uses the intervention dictionary, we recommend that you test search results before you apply the rule online to evaluate whether the results meet your intervention expectations.

Practical example

Business scenario: An e-commerce shopping guide business configured a query analysis rule in its OpenSearch application instance. The rule includes the entity recognition feature. However, a bad case was found online, so the business decided to use the intervention feature.

Bad case: A user searches for the query "chanel cushion". The default entity recognition classifies "chanel" as a "common word" and "cushion" as a "material". The rewritten query is title:'cushion' RANK title:'chanel'. However, for this business, "chanel" is not a common word. Diagnosis: This is a business-specific proper noun, so entity recognition intervention is required.

Solution: Create an entity recognition intervention dictionary, and then apply the intervention dictionary to the query analysis rule that is used online.

Procedure:

  1. In the console, go to Search Algorithm Center > Retrieval Configuration > Dictionary Management and create an entity recognition dictionary:

    Enter a name. Set the dictionary type to Entity Recognition, and set the analysis type to Built-in Analyzer/Custom Analyzer based on the analyzer type configured in query analysis. Eligible analyzers are automatically filtered and displayed in the associated analyzer list. Entity recognition can be configured only for the E-commerce Tokenization type.

    If the index configured in query analysis uses a custom model analyzer, set the analyzer type to Custom Model Analyzer, set the instance to Ha3 Engine, select the corresponding application name, and make sure that the associated analyzer is the same as the analyzer configured in query analysis.

  2. In the new entity recognition intervention dictionary, add an intervention entry, enter the query, and modify the system recognition result:

    Original incorrect entity recognition result:

    The query is chanel cushion. The system recognizes chanel as a common word and cushion as a material. Result after intervention: The query is chanel cushion. After you click Get System Recognition Result, the system recognizes the entity chanel as a brand and cushion as a material.

    If the entity recognition dictionary is created based on a custom model analyzer, you must select the analyzer version when you add an intervention entry. The analyzer version is the model version used by the custom retrieval model.

    Important

    For the intervention type, Exact Match means that intervention is performed when the input query is exactly the same as the intervention query; Partial Match means that intervention is performed when the input query contains the intervention query.

  3. On the query analysis page, first apply the entity recognition intervention dictionary that you created to a query analysis rule that is not online, so that you can test search results:

    In the Query Analysis Configuration list, find the target query analysis rule that is not online, and click Configure in the Actions column to go to the configuration details page. Select the Entity Recognition feature, select dic_entity from the intervention dictionary drop-down list, set Ignore Spaces to Yes, and then click OK.

    Important

    The Ignore Spaces feature specifies whether to ignore spaces in the query when entity recognition intervention is used. This feature is disabled by default. Example: The input query is "\u8fde\u8863\u88d9 \u5973" (Chinese for "dress women", with a space), and the intervention entry is "\u8fde\u8863\u88d9\u5973" (the same words without a space). These values are written as Unicode escapes; decode them into the actual Chinese characters before you enter them. If you select Yes, intervention is performed based on the entity words in the intervention dictionary. If you select No, no intervention is performed.

  4. Run a search test to check whether the results meet expectations (documents related to "chanel cushion" are retrieved):

    On the search test page, enter title:'chanel cushion' in the query field and set the qp parameter to test_entity. After the search, the actual query is rewritten as (name:"chanel" AND name:"cushion"), which indicates that the query analysis plug-in has taken effect. One matching document, "Chanel New Hydrating Gel Fashion Nude Glow Jelly Cushion Compact BB Cream", is returned.