Intervention dictionaries for spelling correction
An intervention dictionary lets you define custom correction behavior when the system cannot correct spelling errors properly. To intervene in spelling correction, create an intervention dictionary and select it when you configure the spell check feature in query analysis.
Usage
You can manually intervene in the built-in spelling correction dictionary of the system. The intervention process usually consists of the following four steps:
Create an intervention dictionary for spelling correction. Go to
Search Algorithm Center--->Retrieval Configuration--->Dictionary Managementto open the query analysis intervention dictionary page, and click Create in the upper-right corner of the page. Select a dictionary type and enter a name for the dictionary. After the intervention dictionary is created, it appears in the dictionary list on the page.Add and manage intervention entries in the intervention dictionary. After the dictionary is created, click the dictionary name in the list or click Manage for the dictionary to go to the details page of the intervention dictionary. On the details page, you can add and manage intervention entries. You can perform two types of intervention on a query:
Add a correction: If you add a correction for a query, the system rewrites the query to the added correction to retrieve results when the query is searched.
Block a correction: If you block a correction for a query, the system no longer rewrites the query to the blocked correction to retrieve results when the query is searched.
Use the intervention dictionary. After you create and populate the intervention dictionary for spelling correction, you can select it in a query rule of any application.
Test and publish the intervention dictionary. After a query analysis rule uses the intervention dictionary, we recommend that you test the search results before you apply the rule online to evaluate whether the results meet your intervention expectations.
Order in which intervention entries take effect
1. The intervention entry that appears earlier in the query takes precedence:
For example, the intervention entries are china constuction->china construction and constuction bnak->construction bank, and the query is china constuction bnak. Both intervention entries match consecutive semantic terms in the query. However, because the two intervention entries overlap in the query, the entry that appears earlier takes effect. The final correction result is china construction bnak.
2. If entries start at the same position, the longer intervention entry (the one with more semantic terms) takes precedence:
For example, the intervention entries are opn->own and opn serch->open search, and the query is opn serch is excellent. The final correction result is open search is excellent.
3. Multiple contains-matched interventions can take effect for a single query.
Note:
If any user intervention applies, the confidence of the spell check is high.
For successfully matched intervention entries, the system passes the query, after replacement by the intervention entries, through the correction model. The model corrects the parts that are not covered by the intervention while retaining the user's correction intervention. Example:
Intervention entry:
phone chrager->phone chargerQuery:
query: which phone chrager brnad is bestResult: The result after intervention is which phone charger brnad is best. This query is then corrected by the system model. While ensuring that the phone chrager->phone charger intervention remains in effect, the system performs further correction and returns which phone charger brand is best.
Hands-on example
Business scenario: An e-commerce shopping guide business configures a query analysis rule in its OpenSearch application instance. The rule includes the spelling correction feature. However, a bad case is found online, so the business decides to use the intervention feature.
Bad case: When a user searches for the query "Fujain", only a few results are returned, and all of them contain the complete keyword "Fujian". In fact, many relevant results for this query are not retrieved.
Diagnosis: The query entered by the user is misspelled. The correct spelling is "Fujian", but the spelling correction of the system does not recognize the misspelling.
Solution: Create an intervention dictionary for spelling correction, add the correction "Fujian" for the query "Fujain", and then apply the spelling correction dictionary to the query analysis rule that is used online.
Procedure:
1. In the console, choose Search Algorithm Center > Retrieval Configuration > Dictionary Management, and create a spelling correction dictionary:
Enter a "Name" and select "Spelling Correction" as the dictionary type:
Set Name to dic_error, and set Dictionary Type to Spelling Correction.
2. In the newly created intervention dictionary for spelling correction, add an intervention entry. Enter "Fujain" in the Query field, enter "Fujian" in the Correction field, and select "Add" as the intervention type.
3. On the query analysis page, apply the newly created intervention dictionary for spelling correction to a query analysis rule that is not yet online so that you can test the search results:
In the Add Rule dialog box, configure the following parameters:
Rule Name: Enter
test_error.Index Scope: Select default.
Industry Type: Select General.
Features: Select Spelling Correction.
Intervention Dictionary: Select
dic_error.
After the configuration is complete, click OK.
4. Run a search test to check whether the results meet expectations. The search retrieves results for the query rewritten to "Fujian", which meets expectations.
Usage notes
The dictionary type and name cannot be modified after the dictionary is created.
When you add an intervention entry, the query that you enter must not duplicate a query that already has an intervention in the intervention list.
The same intervention dictionary can be used by multiple query analysis rules.
The current intervention dictionary works as a patch on top of the built-in dictionary of the system. Therefore, when you use an intervention dictionary, the option to use the built-in system dictionary is selected by default.
An intervention dictionary for spelling correction currently takes effect based on contains matching. An intervention takes effect only if one or more (up to 5) consecutive, complete semantic terms in the query match the query in an intervention entry. Contains matching is not fully equivalent to substring matching of strings.
An intervention dictionary that is used by any query rule (whether online or not) cannot be deleted. To delete it, you must first remove it from use.
Limits
You can create a total of 20 intervention dictionaries for spelling correction.
Each time you add an intervention entry for spelling correction, you can enter only one query, and only one correction for that query.
Each intervention dictionary for spelling correction can contain up to 1,000 intervention entries.
An intervention entry for spelling correction takes effect only if the intervened query exactly matches the search query. For example, if you add the spelling correction "Wuhan" for the query "Wuhna", a search for "Wuhna" is rewritten to "Wuhan" for retrieval. However, a search for "travel to Wuhna" is not rewritten and is still retrieved based on the original query.
All added intervention content is normalized for case and character width. Uppercase letters are normalized to lowercase, and full-width characters are normalized to half-width.