A Chinese spelling correction method based on asymmetric double-path candidate gating

By employing an asymmetric dual-path candidate gating method, the problems of sentence correction and candidate editing permission control in Chinese spelling correction of large language models are solved, achieving high recall and low cost character-level error correction.

CN123050419APending Publication Date: 2026-11-06BEIJING INFORMATION SCI & TECH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611433625.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-16
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing Chinese spelling correction technologies based on large language models, under black-box operation conditions, suffer from modifications beyond the character level, such as sentence-level correction leading to expression refinement and sentence structure rewriting. Furthermore, the candidate editors who supplement the candidate generation path may be granted excessive modification privileges or lead to repeated modifications, increasing computational costs.

Method used

An asymmetric dual-path candidate gating method is adopted, which generates structured candidate edits through main candidate generation and supplementary candidate generation respectively, and sets source-specific conjunctive hard gating to separate candidate discovery and modification execution, control the number of calls to the large language model, and merge the edit sets to ensure that the modification is clearly positioned.

Benefits of technology

It effectively reduces the risk of over-correction, improves the recall capability of Chinese spelling correction, reduces computational costs, and ensures the reasonable allocation of modification permissions and the determinism of output.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123050419A_ABST
    Figure CN123050419A_ABST
Patent Text Reader

Abstract

A Chinese spelling correction method based on asymmetric dual-path candidate gating is proposed, belonging to the fields of natural language processing and Chinese text proofreading. Addressing the issues of insufficient recall, over-correction, candidate overlap, and high invocation costs in black-box large language model correction, a main candidate generation agent generates the main path correction text and a first candidate edit set. The candidate verification module forms a basic accept edit set according to a retention-first strategy. In the recall-enhanced operation mode, a supplementary candidate generation agent generates supplementary path correction text and a second candidate edit set. The rule processing module executes source-specific conjunctive hard gating according to a rejection-first strategy to form a supplementary accept edit set. The two accept edit sets are merged, and the output sentence is deterministically reconstructed from the Chinese sentence to be corrected. This method requires no special pre-training, fine-tuning, or knowledge editing of the large language model and can be used for Chinese text proofreading, input method correction, and text quality control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of natural language processing, Chinese text proofreading, and artificial intelligence, and particularly to a Chinese spelling correction method based on a large language model, an asymmetric dual-path candidate acceptance strategy, structured candidate editing generation, and source-specific conjunctive hard gating. Background Technology

[0002] Chinese spelling correction is used to identify and correct typos in Chinese text. Unlike English spelling errors, Chinese typos are usually still valid Chinese characters. There may be homophones, near-homophones, similar-looking characters, incorrect input method candidate selection, or partial word collocations between the incorrect and correct characters. Therefore, Chinese spelling correction not only needs to determine whether the sentence is fluent, but also needs to determine whether there are actual character-level spelling errors, their location, and the minimum necessary replacement characters.

[0003] Existing Chinese spelling correction methods mainly include rule-based and confusion set-based methods, statistical language model-based methods, methods based on specially trained deep learning models, and methods based on pre-trained language models or large language models. Rule-based and confusion set-based methods offer strong interpretability, but their correction scope is usually limited by the coverage of preset rules and confusion relationships. Methods based on statistical models or specially trained deep learning models typically require constructing training samples, updating model parameters, or accessing the model's internal probabilities, resulting in high implementation costs when training data is insufficient, the application domain changes, or the model backend only provides text input / output capabilities.

[0004] For Chinese text correction schemes using pre-trained language models or large language models, methods such as specialized pre-training, fine-tuning, knowledge editing, retrieval-enhanced generation, or prompt word guidance can be employed to improve correction capabilities. However, specialized pre-training, fine-tuning, and knowledge editing typically require access to training data and model parameters, or additional model update processes, making them difficult to directly apply to black-box large language models that only provide text input / output interfaces. Retrieval-enhanced generation requires building, retrieving, and maintaining external knowledge resources, and the retrieval results may not be directly converted into character-level correction operations with clearly defined original sentence positions and replacement boundaries. While prompt word guidance does not require modification of large language model parameters, it still necessitates constraints on the scope of modification to the model's generated results and the final execution permissions.

[0005] When generating corrected complete sentences directly through a large language model, the model may optimize the expression, adjust the style, rewrite the syntax, change entity names, modify punctuation, or modify the format of the original sentence while correcting typos. It may also add, delete, or rearrange characters. Such modifications exceed the minimum necessary scope for character-level Chinese spelling correction, easily leading to over-correction. Furthermore, since the large language model generates complete text, without a structured representation of the corresponding character positions, original character segments, and replacement character segments, the model output cannot directly form stable and verifiable character-level modification operations.

[0006] When employing conservative prompt words or candidate generation strategies to reduce the risk of over-correction, some homophone, near-homophone, or input method misselection errors may go undetected. To compensate for the omissions caused by a single conservative correction path, supplementary candidate discovery methods can be added, such as confusing relation retrieval, specialized prompt word processing, auxiliary candidate generation, or re-calling the large language model. However, supplementary candidate sources aimed at improving recall typically have a wider candidate discovery range than conservative candidate sources, and their output may include candidates lacking clear evidence of spelling errors. Therefore, candidate editing from different sources may differ in reliability, task objective, and risk level, and should not be granted the same modification permissions simply because they are all generated by the correction process.

[0007] When processing candidate edits from multiple sources, methods such as uniform thresholds, comprehensive scoring, ranking, voting, or model-based re-evaluation can be used to determine whether a candidate edit is accepted. However, if candidate edits from different sources are subject to the same acceptance criteria, supplementary candidates aimed at improving recall may be granted the same modification privileges as the main candidate, increasing the risk of unnecessary and erroneous modifications. Conversely, uniformly raising the acceptance threshold for all candidates may result in the rejection of genuine errors in the main or supplementary candidates, again leading to insufficient recall.

[0008] Furthermore, when a candidate's acceptance depends on the weighted result of multiple scoring items or the overall confidence level, a candidate editor may still reach the acceptance threshold even if it has issues such as out-of-bounds positioning, inconsistent character lengths, lack of evidence regarding pinyin or input method mechanisms, involvement of protected text elements, or positional overlap with already accepted editors, due to higher scores on other evaluation items. Therefore, character boundary conditions, security conditions, and conflict conditions may be compensated for by the degree to which other conditions are met, making it difficult to guarantee that every necessary constraint is enforced.

[0009] Therefore, for supplementary candidate generation paths aimed at improving recall, the candidate discovery process needs to be separated from the process of granting modification rights to candidates. The candidate edits output by the supplementary candidate generation path should be considered as modification proposals to be screened, rather than directly granting modification rights based solely on the output of the large language model, modification reasons, or confidence information. The candidate acceptance mechanism also needs to configure different acceptance strategies based on the candidate generation source, giving the main candidate generation path and the supplementary candidate generation path different acceptance priors and modification rights.

[0010] For supplementary candidate generation paths, the aforementioned candidate acceptance mechanism needs to be configured separately for each source, forming a source-specific candidate admission control. Conditions such as candidate source, position validity, character length equality, Chinese character attributes, evidence of pinyin or input method mechanisms, protected text security, and non-overlapping position with already accepted edits should each constitute necessary conditions for a candidate editor to obtain modification rights. These conditions are logically conjunctive, and candidate editing is only accepted when all conditions are met simultaneously. If any condition is not met, candidate editing is rejected, and it is not permissible to grant modification rights to candidate editors who do not meet the necessary conditions through weighting, voting, comprehensive scoring, or confidence compensation. This candidate control method, composed of source-specificity, condition conjunctiveness, and binary admission features, can be called a source-specific conjunctive hard gating.

[0011] On the other hand, continuously calling multiple large language models for each Chinese sentence to be corrected, or calling the large language model separately for each candidate edit in the same sentence for verification, will increase the number of calls, response time, and computational cost of online processing. If the large language model is called again to generate the final sentence after candidate selection, modifications rejected in previous stages may reappear in the final output. Therefore, it is also necessary to control the large language model calls based on whether the candidate set is empty and the preset operating mode, and to complete candidate edit selection, set merging, and output sentence reconstruction through a rule-based processing procedure that does not call the large language model.

[0012] Therefore, a Chinese spelling correction technology solution is needed that can operate under black-box conditions and without specialized training. This solution should discover character-level correction candidates using different candidate generation paths without requiring reading or modifying the parameters, internal state, or training data of a large language model, or requiring specialized pre-training, fine-tuning, or knowledge editing of the large language model for the Chinese spelling correction task. It should also implement an asymmetric candidate acceptance strategy based on the candidate generation source, and apply source-specific conjunctive hard gating to supplementary path candidates. Furthermore, it should separate the candidate discovery and judgment capabilities of the large language model from the modification and execution permissions of the rule processing module. Through structured candidate editing and generation, main path candidate verification, supplementary path candidate screening, positional overlap exclusion, merging of the accepted editing set, and deterministic reconstruction starting from the Chinese sentence to be corrected, it should balance the recall capability of Chinese spelling correction, the risk of over-correction, and the cost of calling the large language model. Summary of the Invention

[0013] I. Technical problems to be solved

[0014] Existing Chinese spelling correction processing based on large language models still faces the following interrelated technical problems under black-box operation conditions, without reading or modifying the model parameters, internal state, or training data of the large language model, and without performing specific pre-training, fine-tuning, or knowledge editing for the Chinese spelling correction task.

[0015] When large language models directly generate sentence-corrected text, modifications that exceed the boundaries of character-level Chinese spelling correction may occur, such as expression polishing, sentence rewriting, format adjustment, entity name change, or semantic shift. At the same time, modifications in sentence-corrected text are usually difficult to directly serve as verifiable, filterable, mergeable, and executable editing instructions with clear character positions, original character segments, and replacement character segments.

[0016] While a more conservative candidate generation strategy can reduce the risk of over-correction, it may miss homophones, near-homophones, or input method misselection errors. Supplementary candidate generation paths designed to improve recall have a wider candidate discovery range, and the candidate edits they generate may differ from those generated by the main candidate generation path in terms of task objective and reliability. If candidate edits from different sources use the same acceptance criteria, supplementary path candidates may gain excessive modification authority; conversely, uniformly raising the acceptance criteria for all candidates may lead to the rejection of genuine errors. Furthermore, when the acceptance result of candidate edits is determined by weighted scoring, comprehensive confidence, or other compensable mechanisms, necessary conditions such as positional validity, character length equality, evidence of pinyin or input method mechanisms, protected text security, and positional non-overlap may be compensated for by the degree to which other conditions are met.

[0017] Multiple candidate editors may propose different modifications at the same or overlapping character positions. Without explicit position checks, modification permission controls, and set merging mechanisms, duplicate or conflicting modifications may occur. After candidate selection, if the final sentence is generated again by a large language model, previously rejected modifications may be reintroduced.

[0018] Furthermore, if all candidate generation and verification steps are run unconditionally for each Chinese sentence to be corrected, or if the large language model is called separately for each candidate edit in the same sentence, it will increase the number of large language model calls, processing latency and computational cost, which is not conducive to online deployment.

[0019] Therefore, the technical problem to be solved by this invention is: how to convert the whole sentence correction results generated by the large language model into structured candidate edits with clear positions under black-box and non-specialized training conditions, allocate different modification permissions according to the different task objectives of the main candidate generation path and the supplementary candidate generation path, separate candidate discovery from modification execution, implement access control for supplementary path candidates with each necessary condition being non-compensable, and complete the merging of candidate edits and deterministic reconstruction of the output sentence while controlling the number of times the large language model is called, thereby taking into account the recall capability, overcorrection risk and processing cost of Chinese spelling correction.

[0020] II. Technical Solution

[0021] To address the aforementioned technical problems, this invention provides a Chinese spelling error correction method based on asymmetric dual-path candidate gating. The method is executed by an electronic device and includes steps S1 to S6.

[0022] S1 Chinese sentence retrieval

[0023] Get the Chinese sentences that need correction ,in, This indicates the first Chinese sentence to be corrected. One character, This indicates the number of characters in the Chinese sentence to be corrected.

[0024] S2 Main Candidate Generation

[0025] The main candidate generator agent is generated through a large language model. Based on the Chinese sentence to be corrected and preset main path role constraints, suspected spelling errors are identified, and the main path correction text is obtained. The preset main path role constraints include, but are not limited to: limiting the processing object to Chinese spelling errors; requiring the generation of the main path correction text with minimal modifications; prohibiting modifications to the Chinese sentence to be corrected solely for the purpose of expression optimization, style adjustment, or format adjustment; and requiring the output of text identical to the Chinese sentence to be corrected when no suspected spelling errors are identified. The process of generating the main path correction text and the first candidate edit set can be represented as follows:

[0026] ,

[0027] ,

[0028] in, Indicates the primary candidate generation path. This indicates the number of characters in the main path correction text. This indicates the constraint on the generation of primary candidate roles. Representing a large language model Output main path correction text, Indicates the candidate edit generation function, This represents the first candidate edit set composed of the structured candidate edits. The candidate edit generation function is used to compare the input Chinese sentence to be corrected with the corresponding corrected text according to the character order, and identify the character parts with the same content and the character parts with different content; for each character part with different content, the corresponding start position and end position are determined based on the character position in the Chinese sentence to be corrected as the position recording reference, the corresponding character segment in the Chinese sentence to be corrected is determined as the original character segment, and the character segment in the corresponding corrected text is determined as the replacement character segment, thereby generating the structured candidate edit.

[0029] Chinese sentences to be corrected and main path correction text As a candidate edit generation function The input is used by the candidate edit generation function to generate structured candidate edits and form a first candidate edit set. When the main path correction text is the same as the Chinese sentence to be corrected, the first candidate edit set will be selected. Set to an empty set.

[0030] Each structured candidate editor At least include candidate identifiers Source identification Starting position End position Original character fragment and replace character fragments , can be expressed as:

[0031] ,

[0032] where the candidate identifier is used to distinguish different candidate edits in the same candidate edit set; the source identifier is used to indicate that the candidate edit comes from the main candidate generation path or the supplementary candidate generation path; the candidate edit occupies the character interval is determined by and , which can be expressed as ; the original character segment is the character segment in the Chinese sentence to be error-corrected determined by and .

[0033] When performing the above character comparison and structured candidate edit generation process, it is at least checked whether the start position and end position of the candidate edit are within the valid position range of the Chinese sentence to be error-corrected, and whether the original character segment of the candidate edit is consistent with the original character segment determined by the start position and end position in the Chinese sentence to be error-corrected. Different candidate edits generated by performing the above process on the same Chinese sentence to be error-corrected and the same main path correction text have non-overlapping occupied character intervals. The main candidate generation agent can also output modification reasons or confidence information, but the modification reasons or confidence information do not directly constitute a modification operation on the Chinese sentence to be error-corrected; the candidate edits that finally enter the first candidate edit set are subject to the different content parts identified in the above character comparison process and their position records in the Chinese sentence to be error-corrected.

[0034] S3 Candidate Verification

[0035] The candidate verification module uses a large language model to perform acceptance or rejection judgment on the existing candidate edits in the first candidate edit set, does not add new candidate edits outside the first candidate edit set, and forms a main accepted edit set according to the first acceptance strategy. The candidate verification module does not change the start position, end position, original character segment or replacement character segment of the candidate edit.

[0036] The candidate verification module includes an adjudicating agent and at least one specialized verification agent. The specialized verification agents include one or more of the following: a pinyin and input method verification agent, a character shape verification agent, and a context and overcorrection risk verification agent. The at least one specialized verification agent receives candidate edits and their corresponding contexts from a first candidate edit set, and generates verification results for each candidate edit. The pinyin and input method verification agent determines whether the candidate edit has evidence of homophones, near-homophones, or incorrect input method candidate selection; the character shape verification agent determines whether the candidate edit has evidence of character shape, component, or visual similarity; the context and overcorrection risk verification agent determines whether the candidate edit involves character-level Chinese spelling correction, and whether it involves style polishing, grammatical rewriting, punctuation changes, capitalization or format changes, entity name changes, character insertion, character deletion, character order adjustment, or semantic shift. The adjudicating agent receives the first candidate edit set and the verification results generated by each specialized verification agent participating in the verification, and based on the verification results, determines whether to accept or reject each candidate edit according to a first acceptance strategy. Each special verification agent and adjudication agent does not add any candidate edits outside the first candidate edit set, and does not change the start position, end position, original character fragment, or replaced character fragment of the candidate edits.

[0037] Before the candidate verification module makes its judgment, at least one piece of local linguistic evidence can be extracted from the local context covering the character range occupied by the candidate edit. Local linguistic evidence includes one or more of the following: identical pinyin evidence, similar pinyin evidence, confusion caused by misselection of a preset input method, similar character shape evidence, evidence of local word changes before and after replacement, and evidence of local collocation changes before and after replacement. Local linguistic evidence is used to assist in determining whether a candidate edit is a Chinese spelling error and is not used to generate new candidate edits outside the first candidate edit set.

[0038] The first acceptance strategy is a retention-first strategy, meaning it retains candidate edits on the main path by default and rejects them if they are deemed to have a high risk of over-correction or violate character-level Chinese spelling correction boundaries. The candidate acceptance function for the first acceptance strategy is expressed as follows:

[0039] ,

[0040] ,

[0041] in, The first acceptance strategy is aimed at candidate editors. The binary acceptance decision function, Indicates acceptance of candidate editor , Indicates rejection of candidate editor , This indicates that the main acceptor of the edit set, and All values ​​belong to The binary decision quantity.

[0042] This indicates whether the candidate edit meets the character-level Chinese spelling correction boundary; when the start and end positions of the candidate edit are within the valid position range of the Chinese sentence to be corrected, the original character fragment is consistent with the original character fragment determined by the start and end positions, and the candidate edit does not involve character insertion, character deletion, character order adjustment, punctuation or format modification, or pure expression polishing, ,otherwise .

[0043] This indicates whether the candidate edit has a high risk of over-correction; when the candidate verification module clearly determines that the candidate edit has at least one of the following conditions: the original expression is still valid, it only makes the expression more natural or more common, it lacks a clear need for correction, it involves protected text elements or context, or it may change the semantics, facts, or expressive intent of the original sentence. ,otherwise .

[0044] The decision to reject the intelligent agent should be implemented as follows: or Do not set independent of and A third candidate rejection condition besides [previous conditions]. Only when [the following conditions are met]. and At that time, the candidate editor is added to the main accepting editor set.

[0045] When using the budget control strategy, if the first candidate edit set is empty, the candidate verification module does not perform text generation and sets the main receiving edit set to empty. If the first candidate edit set is not empty, all candidate edits in the first candidate edit set and their corresponding contexts are combined into a verification input in units of sentences, so that the candidate verification module generates text according to the preset verification role, instead of processing each candidate edit separately.

[0046] S4 Supplementary Candidate Generation

[0047] When the preset operating mode is the recall enhancement operating mode, the supplementary candidate generation agent is generated through the large language model. Based on the Chinese sentence to be corrected and the pre-defined supplementary path role constraints, the system obtains supplementary path correction text for homophones, near-homophones, or input method misselection. (Large Language Model) With large language models It can be the same large language model, or it can be different large language models.

[0048] The pre-defined supplementary path role constraints include at least the following: limiting the discovery scope of supplementary candidates to misuse of homophones, misuse of near-homophones, or incorrect selection of input methods; prohibiting expression polishing, sentence rewriting, or format modification unrelated to this limitation; and requiring the output of text identical to the Chinese sentence to be corrected when no corresponding error is identified. In one embodiment, the pre-defined supplementary path role constraints may further include prohibiting the addition, deletion, rearrangement of character order, or modification of punctuation. Local fixed collocation information can serve as contextual auxiliary evidence for determining whether a candidate is valid, but is not considered an independent type of supplementary candidate generation.

[0049] Subsequently, the Chinese sentence to be corrected and the supplementary path correction text are compared according to the order of characters to identify the different character parts. For each different character part, the character position in the Chinese sentence to be corrected is used as the position recording benchmark to determine the corresponding start and end positions. The corresponding character segment in the Chinese sentence to be corrected is identified as the original character segment, and the corresponding character segment in the supplementary path correction text is identified as the replacement character segment. This generates a structured candidate edit, and a supplementary path source identifier is added to the structured candidate edit to form a second candidate edit set. The supplementary path correction text is only used to form the second candidate edit set and is not directly used as the final output sentence.

[0050] When the preset operating mode is safe operating mode, the supplementary candidate generation agent is not run, the supplementary path correction text is not calculated, and the second candidate editing set is... and supplementary collection of editable files Set to an empty set.

[0051] The process of generating supplementary path correction text and corresponding candidate edit sets can be represented as follows:

[0052] ,

[0053] ,

[0054] in, Indicates the supplementary candidate generation path, This indicates the number of characters in the supplementary path correction text. This indicates the pre-defined supplementary path role constraints. This represents the supplementary path correction text output by the corresponding large language model. This refers to the aforementioned candidate edit generation function, which in this step uses the Chinese sentence to be corrected. and supplementary path correction text As input, and output the second candidate edit set. .

[0055] S5 Candidate Editor Screening

[0056] In the enhanced recall operation mode, source-specific conjunctive hard gating is applied to each candidate editor in the second candidate editor set according to the second acceptance strategy to determine whether each candidate editor has the permission to modify the Chinese sentence to be corrected. In the safe operation mode, the source-specific conjunctive hard gating is not applied, and the second candidate editor set and the supplementary accepting editor set remain empty sets.

[0057] The source-specific conjunctive hard gating is a binary candidate admission control process set for the supplementary candidate generation path. "Source-specific" means that the gating is used to determine whether the candidate edits generated by the supplementary candidate generation path have modification rights, and does not directly apply the first acceptance strategy adopted by the main candidate generation path to the candidate edits of the supplementary path; "conjunctive" means that each preset gating condition constitutes a necessary condition for the candidate edit to obtain modification rights, and the preset gating conditions are logically conjunctive; "hard gating" means that the gating result is a binary result of acceptance or rejection, and the candidate edit is accepted only when all preset gating conditions are met simultaneously, and the candidate edit is rejected when any preset gating condition is not met, and there is no weighting, voting or confidence compensation among the preset gating conditions.

[0058] The second acceptance strategy is a rejection-first strategy, meaning that supplementary path candidate editors do not have modification permissions by default when generated, and are only added to the supplementary accepting editor set if they simultaneously meet all of the following conditions:

[0059] 1. Candidate editors have supplementary path source identifiers;

[0060] 2. The starting and ending positions of the candidate edit are within the valid position range of the Chinese sentence to be corrected, and the original character fragment is completely consistent with the original character fragment determined by the starting and ending positions;

[0061] 3. Both the original character fragment and the replacement character fragment are not empty and have the same number of characters;

[0062] 4. Both the original character fragment and the replacement character fragment are composed of Chinese characters;

[0063] 5. Evidence exists that there is a pinyin or input method mechanism between the original character fragment and the replacement character fragment;

[0064] 6. Candidate editing does not involve preset protected text elements or context;

[0065] 7. There is no overlap in position between the candidate editor and the candidate editor in the main accepting editor set, as well as the candidate editor that has been added to the supplementary accepting editor set.

[0066] The candidate acceptance function of the second acceptance strategy is expressed as:

[0067] ,

[0068] ,

[0069] in, The second acceptance strategy is aimed at candidate editors. The binary acceptance decision function, Indicates acceptance of candidate editor , Indicates rejection of candidate editor , This indicates that the supplementary set accepts editing. , , , , , and All values ​​belong to The binary decision quantity.

[0070] When the candidate editor has a supplementary path source identifier ,otherwise .

[0071] When the starting and ending positions of the candidate editor are within the valid position range of the Chinese sentence to be corrected, and the original character fragment is completely consistent with the original character fragment at the corresponding position, ,otherwise .

[0072] When both the original character segment and the replacement character segment are not empty and have the same number of characters. ,otherwise .

[0073] When all characters in both the original character fragment and the replacement character fragment fall within the preset range of Chinese characters. ,otherwise .

[0074] When the original character fragment and the replacement character fragment meet the preset rules for determining whether the pinyin is the same or similar, or when the preset input method misselection confusion relationship is hit, ,otherwise .

[0075] When the candidate editor does not match the preset protected text element or context. ,otherwise .

[0076] When the character range occupied by a candidate editor does not intersect with the positions of all candidate editors in the main accepting editor set and all candidate editors currently added to the supplementary accepting editor set. ,otherwise .

[0077] The rule processing module processes candidate edits in ascending order of their starting positions in the second candidate edit set; when the starting positions are the same, they are processed in ascending order of their ending positions; when both the starting and ending positions are the same, they are processed according to a preset order determined by the candidate identifier. For the currently processed candidate edit, the rule processing module determines the values ​​of each of the aforementioned binary decision quantities, and determines the acceptance or rejection result of the candidate edit based on the logical conjunction result of each binary decision quantity.

[0078] If and only if , , , , , and When all are 1, let And add the candidate edits to the supplementary accept edit set; when any binary decision is 0, let The rule processing module does not sum, weight, vote, or compensate for the binary decision variables, nor does it replace the conditions that any binary decision variable should satisfy with the modification reasons or confidence information output by the large language model.

[0079] Therefore, the behavior of the supplementary candidate generation agent in discovering candidate edits is separated from the behavior of the candidate edits obtaining final modification rights. The candidate edits output by the supplementary candidate generation agent only constitute modification proposals to be screened and cannot be directly used to modify the Chinese sentences to be corrected; only candidate edits that pass the source-specific conjunctive hard gating and enter the supplementary accepting edit set can participate in the subsequent merging of accepting edit sets and reconstruction of the output sentence. Through the above processing, while improving the recall capability of homophone, near-homophone, or input method misselection errors by utilizing the supplementary candidate generation path, the modification rights of candidate edits in the supplementary path are restricted, preventing the failure of any security condition or character boundary condition from being offset by the satisfaction of other conditions.

[0080] S6 Edit Collection Merge

[0081] The primary accept-edit set and the supplementary accept-edit set are merged to form the final accept-edit set:

[0082] .

[0083] Different candidate edits generated by performing the above character comparison and structured candidate edit generation process on the same Chinese sentence to be corrected and the same main path correction text do not overlap in their character ranges; supplementary path candidate edits have already been processed in S5. Therefore, the character ranges occupied by any two candidate edits in the final accept edit set do not overlap, and the same character position corresponds to at most one candidate edit.

[0084] The output sentence is represented as:

[0085] ,

[0086] in, This represents the deterministic output reconstruction function. For candidate edits... ,by , and These represent the starting position, ending position, and replacement character segment determined by character numbering starting from 1, respectively, and:

[0087] .

[0088] Output the first part of the sentence Each character is represented as:

[0089] ,

[0090] in, Indicates replacement of character fragments The first in The rule processing module starts with the Chinese sentence to be corrected and performs replacements according to the starting position order of each candidate edit in the final accepting edit set to reconstruct the output sentence. When the final accepting edit set is empty, the Chinese sentence to be corrected is used as the output sentence.

[0091] After forming the final set of accepted edits and the output sentences, candidate edit processing records can be generated. Each candidate edit processing record includes at least the candidate identifier, source identifier, start position, end position, original character fragment, replaced character fragment, acceptance or rejection result and its corresponding reason, and, based on the source of the candidate edit and its processing history, records one or more of the following: character-level Chinese spelling correction boundary judgment result, over-correction risk judgment result, Pinyin or input method mechanism evidence judgment result, protected text element or context judgment result, and position overlap judgment result.

[0092] III. Beneficial Effects

[0093] Compared with the prior art, the present invention has at least the following beneficial effects:

[0094] 1. By adopting an asymmetric acceptance strategy that prioritizes retention in the main path and rejection in the supplementary path, high-precision basic error correction and restricted recall are separated to avoid candidates from different sources having the same modification permissions;

[0095] 2. By comparing the Chinese sentence to be corrected with the corresponding corrected text according to the order of characters, each character part with different content is converted into a structured candidate edit with the original sentence position record, reducing the impact of the fluctuation of the whole sentence output format of the large language model on the execution result;

[0096] 3. For candidate edits generated by the supplementary candidate generation path, a source-specific conjunctive hard gate is set to separate the discovery behavior of supplementary candidates from the final modification permission. By setting the source, position, length, Chinese characters, Pinyin or input method mechanism evidence, protected text security and position non-overlapping as binary necessary conditions that cannot be mutually compensated, the candidate edits that do not meet any gate condition cannot enter the supplementary accept editing set, avoiding the large language model confidence information, voting results or other satisfied conditions from offsetting the non-satisfaction of character boundaries and security conditions;

[0097] 4. By excluding candidates whose positions overlap with the basic accepted edits and accepted supplementary edits during the supplementary path conjunction hard gating stage, and performing only the merging of accepted edit sets and deterministic reconstruction based on the original sentence in subsequent stages, we avoid reintroducing character additions and deletions, punctuation changes, position conflicts, or already rejected modifications in the final output stage.

[0098] 5. By skipping verification without candidates and using rule-based post-processing, the amount of calls to large language models in a normally open multi-agent cascade is reduced;

[0099] 6. It uses only a black-box text interface and does not rely on the model's internal probabilities, gradients, or hidden states, making it easy to replace different large language model backends;

[0100] 7. No special pre-training, fine-tuning, or parameter editing is required for the large language model being used, specifically for Chinese spelling correction tasks;

[0101] 8. The candidate editing process record saves the candidate source, acceptance or rejection results and corresponding reasons, as well as the corresponding character-level Chinese spelling correction boundaries, high overcorrection risk, Pinyin or input method mechanism evidence, protected text elements or context, and position overlap judgment results, to improve the interpretability, reproducibility and auditability of the correction process;

[0102] 9. By using a secure operating mode and a recall-enhanced operating mode, the method can select different operating points based on application risk and call budget. Attached Figure Description

[0103] Figure 1This is a step-by-step illustration of a Chinese spelling error correction method based on asymmetric dual-path candidate gating according to the present invention.

[0104] Figure 2 This is an overall flowchart of a Chinese spelling error correction method based on asymmetric dual-path candidate gating according to the present invention.

[0105] Figure 3 This is a flowchart illustrating the final process of accepting edit set merging and outputting sentence deterministic reconstruction in this invention. Detailed Implementation

[0106] The present invention will be further described below with reference to specific embodiments. It should be understood that the embodiments are used to illustrate the technical solutions of the present invention, and not to limit the scope of protection of the present invention. Where there is no technical conflict, the technical features of the various embodiments can be combined with each other.

[0107] In this specification, "agent" can be a program unit that generates text using a large language model based on preset role instructions, input structure, and output structure; "candidate verification module" is a processing module that includes an adjudicating agent and at least one specialized verification agent, and is used to make acceptance or rejection judgments on the first candidate edit set; "rule processing module" is a deterministic program module that runs on the processor and does not call the large language model; "main path candidate" and "supplementary path candidate" represent candidate edits derived from the main candidate generation path and the supplementary candidate generation path, respectively.

[0108] In this specification, "source-specific conjunctive hard gating" refers to a candidate modification permission control mechanism specifically set for the source of candidate editing. In this invention, the source-specific conjunctive hard gating is applicable to candidate editing generated by supplementary candidate generation paths, while candidate editing generated by the main candidate generation path is processed according to the first acceptance strategy. "Conjunctive" means that gating conditions such as source, location, equal length, Chinese characters, Pinyin or input method mechanism evidence, protected text security, and non-overlapping locations constitute necessary conditions for candidate editing to obtain modification permission, and the conditions are logically conjunctive. "Hard gating" means that the gating result is a binary result of acceptance or rejection. Candidate editing is accepted only when all gating conditions are met simultaneously, and candidate editing is rejected when any gating condition is not met. There is no weighting, voting, or confidence compensation among the gating conditions.

[0109] Example 1: Overall Error Correction Process

[0110] The following uses a specific Chinese sentence that needs to be corrected to illustrate the overall processing procedure of this invention.

[0111] It should be noted that this embodiment is only used to illustrate the data transmission and processing relationship between the steps, and does not constitute a limitation on the number of candidate edits, error types or the called large language model.

[0112] S1 Chinese sentence acquisition

[0113] The Chinese sentence to be corrected in this embodiment is:

[0114]

[0115] According to the character numbering starting from 1, the character "yi" (以) in this sentence is located at the 2nd character position, and the character "shu" (属) is located at the 8th character position. This sentence contains two possible character-level Chinese spelling errors: the character "yi" (以) in "yi jing" (以经) should be replaced with "yi" (已), and the character "shu" (属) in "bu shu" (部属) should be replaced with "shu" (署).

[0116] S2 Main candidate generation

[0117] The main candidate generation agent passes through the large language model to obtain the main path corrected text:

[0118]

[0119] The rule processing module compares the Chinese sentence to be corrected and the main path corrected text in the order of characters, and identifies the character parts with the same content and the character parts with different content between the two. The comparison result shows that the two differ only in the content at the 2nd character position of the Chinese sentence to be corrected. The rule processing module takes the character position of the Chinese sentence to be corrected as the position recording reference, determines the 2nd character position as the start position and the end position, determines the character "yi" (以) at this position in the Chinese sentence to be corrected as the original character fragment, and determines the corresponding character "yi" (已) in the main path corrected text as the replacement character fragment, thereby generating a candidate edit . The candidate edit has a candidate identifier of , the source identifier is the main candidate generation path, both the start position and the end position are 2, the original character fragment is "yi" (以), the replacement character fragment is "yi" (已), and the occupied character interval is . Therefore:

[0120] .

[0121] S3 Candidate verification

[0122] The candidate verification module only performs processing on the candidate edit perform an acceptance or rejection judgment. The pinyin and input method verification agent judges that "以" and "已" have a homophonic relationship; the context and over-correction risk verification agent judges that replacing "以经" with "已经" belongs to character-level Chinese spelling correction, and does not belong to style polishing, grammar rewriting or semantic offset; the adjudication agent receives the candidate edit and the verification results generated by the special verification agents participating in the verification, and determines the candidate edit according to the first acceptance strategy to make an acceptance or rejection judgment.

[0123] The start position and end position of the candidate edit are both 2, which are within the valid position range of the Chinese sentence to be corrected. The original character fragment "以" is consistent with the original text character fragment determined by the start position and the end position, and the candidate edit does not involve character insertion, character deletion, character sequence adjustment, punctuation or format modification, and pure expression polishing, therefore:

[0124] .

[0125] The candidate verification module does not determine that the candidate edit has a high over-correction risk, therefore:

[0126] .

[0127] According to the first acceptance strategy:

[0128] .

[0129] Thus, the candidate edit is added to the main accepted edit set, obtaining:

[0130]

[0131] S4 Supplementary candidate generation

[0132] In this embodiment, the preset operation mode is set to the recall enhanced operation mode, so the supplementary candidate generation agent is operated to generate a second candidate edit set.

[0133] The supplementary candidate generation agent passes through the large language model to obtain a supplementary path correction text:

[0134]

[0135] The rule processing module compares the Chinese sentence to be error-corrected with the supplementary path correction text in the sequential order of characters, and identifies the character parts with different contents between the two. The comparison result shows that the two differ only in the content at the 8th character position of the Chinese sentence to be error-corrected. The rule processing module takes the character positions of the Chinese sentence to be error-corrected as the position recording reference, determines the 8th character position as the start position and the end position, determines the character "属" at this position in the Chinese sentence to be error-corrected as the original character fragment, determines the corresponding character "署" in the supplementary path correction text as the replacement character fragment, and thereby generates a candidate edit , and assigns a supplementary path source identifier to the candidate edit . The candidate edit has a candidate identifier of , the start position and the end position are both 8, the original character fragment is "属", the replacement character fragment is "署", and the occupied character interval is . Therefore:

[0136] .

[0137] S5 Candidate Edit Screening

[0138] The rule processing module executes a source-specific conjunctive hard gating on the candidate edits in the second candidate edit set according to the second acceptance strategy . The specific determination process for the candidate edit is as follows:

[0139] 1. The candidate edit is formed through the above character comparison and structured candidate edit generation process, and is assigned a supplementary path source identifier at the time of generation, therefore:

[0140] ;

[0141] 2. The start position and the end position of the candidate edit are both 8, which is within the valid position range of the Chinese sentence to be error-corrected, and the original character fragment "属" is completely consistent with the original character at the 8th character position of the Chinese sentence to be error-corrected, therefore:

[0142] ;

[0143] 3. Neither the original character fragment "属" nor the replacement character fragment "署" is empty, and each contains exactly one character, therefore:

[0144] ;

[0145] 4. Both the original character fragment "属" and the replacement character fragment "署" fall within the preset Chinese character range, therefore:

[0146] ;

[0147] 5. "Shu" and "Shu" have the same pinyin relationship conforming to preset rules, and can form a pinyin mechanism evidence, therefore:

[0148] ;

[0149] 6. The candidate edit does not hit a name, place name, organization name, product name, domain term, number, time, English character, formula, code, cited content, word in the preset user dictionary or other preset protected text elements and the context, therefore:

[0150] ;

[0151] 7. The candidate edit occupies the 8th character position, and the candidate edit in the main accepted edit set occupies the 2nd character position, and there is no position intersection between the two; there are no other candidate edits in the current supplementary accepted edit set, therefore:

[0152] ;

[0153] The candidate edit simultaneously meets all the gating conditions specified by the second acceptance strategy, therefore:

[0154] ;

[0155] Accordingly, the candidate edit is added to the supplementary accepted edit set:

[0156] .

[0157] S6 Edit set merging

[0158] The rule processing module merges the main accepted edit set and the supplementary accepted edit set to form a final accepted edit set:

[0159] .

[0160] The candidate edit occupies the 2nd character position, the candidate edit occupies the 8th character position, and the occupied character intervals of the two candidate edits in the final accepted edit set do not overlap with each other.

[0161] The rule processing module starts from the Chinese sentence to be error-corrected, and performs replacement in the order of the starting positions of candidate edits: first replaces "以" at the 2nd character position with "已", then replaces "属" at the 8th character position with "署", so as to reconstruct and obtain the output sentence:

[0162]

[0163] The above process of set merging and output sentence reconstruction does not invoke a large language model, and no independent candidate priority comparison or conflict resolution is performed. The positional overlaps between supplementary path candidate edits and the candidate edits in the main accepted edit set, as well as with the candidate edits that have been added to the supplementary accepted edit set at present, have already been addressed in S5's determination to exclude such cases.

[0164] As a supplementary note, if the supplementary candidate generation agent additionally proposes a candidate edit of replacing "计划" with "规划", since this candidate edit does not have the prescribed evidence of identical pinyin, similar pinyin or input method misselection mechanism, its corresponding . This candidate edit cannot pass the conjunctive hard gating, shall not be added to the supplementary accepted edit set, and "计划" in the original sentence remains unchanged.

[0165] When the preset operation mode is the safe operation mode, the supplementary candidate generation agent is not operated, supplementary path correction text is not generated, and both the second candidate edit set and the supplementary accepted edit set are set to empty sets, that is:

[0166] .

[0167] At this time, the final accepted edit set only includes the candidate edits in the main accepted edit set , and the output sentence is:

[0168]

[0169] The safe operation mode prioritizes reducing the over-correction risk caused by supplementary candidates, but may retain errors that are not identified by the main path; the recall-enhanced operation mode improves the recall capability for errors of homophone, near-homophone or input method misselection types through the supplementary candidate generation path constrained by the source-specific conjunctive hard gating.

[0170] Embodiment 2: Candidate verification module

[0171] The rule processing module compares the Chinese sentence to be corrected with the main path correction text according to the order of characters, identifying the identical and different character parts. For each different character part, the starting and ending positions are determined based on the character position in the Chinese sentence to be corrected. The corresponding character segment in the Chinese sentence to be corrected is identified as the original character segment, and the corresponding character segment in the main path correction text is identified as the replacement character segment. This generates structured candidate edits and forms the first candidate edit set. Subsequently, the rule processing module checks whether the starting and ending positions of each candidate edit are within the valid position range of the Chinese sentence to be corrected, whether the original character segment is consistent with the original character segment at the corresponding position, and whether the character ranges occupied by different candidate edits formed through the same character comparison and structured candidate edit generation process do not overlap. The candidate edits that have passed the above checks, along with their corresponding context, pinyin encoding, and local obfuscation resource hit information, are used to form the verification input in sentences.

[0172] In one implementation, the candidate verification module includes an adjudicating agent, a pinyin and input method verification agent, a character shape verification agent, and a context and overcorrection risk verification agent. The three specialized verification agents each read the same sentence-level verification input but generate verification results only from their respective responsible dimensions. The adjudicating agent receives a first set of candidate edits and the verification results generated by the three specialized verification agents, and determines whether to accept or reject each candidate edit according to a first acceptance strategy. Neither the specialized verification agents nor the adjudicating agent add any candidate edits outside the first set of candidate edits, nor change the start or end position, original character fragment, or replaced character fragment of a candidate edit.

[0173] For candidate editors who violate the character-level Chinese spelling correction boundaries, [they will be]... Set to 0; for candidate editors who are clearly identified as having a high risk of overcorrection, set them to 0. Set to 1. Only when and hour, And add the candidate editor to the main accept editor set; otherwise The candidate for editing is rejected. Therefore, the rejection result of the adjudicating agent is consistent with the binary decision quantity in the first acceptance function.

[0174] For the same Chinese sentence to be corrected, all candidate edits in the first candidate edit set and their corresponding contexts can be combined into a sentence-based verification input, which is then submitted to each specialized verification agent participating in the verification. Each specialized verification agent generates a verification result covering all candidate edits and associates each candidate edit and its verification result through a candidate identifier. The adjudication agent receives the first candidate edit set and the verification results generated by each specialized verification agent, and generates an acceptance or rejection judgment for each candidate edit on a sentence-by-sentence basis, without generating text for each candidate edit separately. When the first candidate edit set is empty, the candidate verification module does not perform text generation and sets the main accepting edit set to empty.

[0175] Example 3: Source-specific conjunction hard gating

[0176] The supplementary candidate generation agent aims to improve the recall capability for homophones, near-homophones, or input method misselection errors. The candidate edits it generates only indicate the potential existence of corresponding spelling errors and do not have modification permissions by default. The rule processing module applies source-specific conjunctive hard gating to the candidate edits in the second candidate edit set. "Source-specific" means that this gating only applies to candidate edits generated through the supplementary candidate generation path; "conjunctive" means that all gating conditions are necessary for accepting the candidate edit; and "hard gating" means that both conditions and acceptance results are determined using binary judgments, and if any condition is not met, the corresponding candidate edit is immediately rejected without granting modification permissions through weighting or other compensation.

[0177] The rule processing module first determines the processing order of candidate edits in the second candidate edit set according to the ascending order of the start position, the ascending order of the end position, and the preset order of the candidate identifier. Then, it sequentially checks whether the candidate edit has a supplementary path source identifier, whether its start and end positions are within the valid position range of the Chinese sentence to be corrected, whether the original character fragment is consistent with the original character fragment at the corresponding position, whether the original character fragment and the replacement character fragment are not empty and of equal length, whether both are composed of Chinese characters, whether there is evidence of pinyin or input method mechanisms, whether it involves protected text elements or context, and whether its position overlaps with candidate edits in the main accepting edit set and candidate edits currently added to the supplementary accepting edit set. Only when all the above conditions are met is the corresponding candidate edit accepted and added to the supplementary accepting edit set; if any condition is not met, the corresponding candidate edit is rejected.

[0178] The rule processing module can record one or more reasons for rejection for rejected candidate edits, including missing supplementary path source identifier, location outside the valid range, inconsistency between the original character fragment and the corresponding original character fragment, unequal length between the original character fragment and the replacement character fragment, inclusion of non-Chinese characters, lack of evidence of pinyin or input method mechanism, involvement of protected text elements or context, and location overlap with accepted candidate edits.

[0179] Evidence regarding the Pinyin or input method mechanism can be expressed as follows:

[0180]

[0181] in, This indicates that the original character segment and the replacement character segment have exactly the same pinyin. This indicates that the pinyin of the two words meets the preset similarity conditions in terms of initial consonant, final vowel, or tone, or meets the preset conditions of retroflex consonants, front and back nasal consonants, lateral consonants and nasal consonants, easy confusion in dialects, or other similar syllables. This indicates a misselection confusion relationship between the two input methods. The near-sound condition and the misselection confusion relationship between the preset input methods are determined before deployment and are not dynamically adjusted at runtime using the standard answers of the test samples to be processed.

[0182] In one deterministic protection implementation, the rule processing module determines the location range of the protected text element based on named entity recognition results, a user dictionary, a terminology dictionary, or pre-marked immutable character ranges. When the character range occupied by a candidate edit intersects with the location range of the protected text element, or when the corresponding character of the candidate edit is within a preset protected context, [the following is executed / processed]. Set to 0.

[0183] Example 4: Budget Invocation and Experimental Verification

[0184] In one implementation of budget control, the primary candidate generator performs a generation task once for each Chinese sentence to be corrected. When the first candidate edit set is empty, the candidate verification module does not perform text generation and sets the primary accepting edit set to empty. When the first candidate edit set is not empty, the candidate verification module processes all candidate edits and their corresponding contexts on a sentence-by-sentence basis. In the recall-enhanced operation mode, a limited number of supplementary candidate generation tasks are set for each Chinese sentence to be corrected. The above character comparison and structured candidate edit generation process, supplementary path conjunctive hard gating, accepting edit set merging, and output sentence reconstruction do not invoke the large language model.

[0185] On a test dataset containing 5000 Chinese sentences, the main candidate generation agent performed 5000 calls. The main path proposed at least one candidate edit on 1793 sentences, therefore the pinyin and input method verification agent, character shape verification agent, context and overcorrection risk verification agent, and adjudication agent together performed [the following actions]. The number of calls is: The average number of end-to-end large language model calls in safe operating mode is:

[0186] .

[0187] The recall enhancement mode adds one supplementary candidate generation task for each of the 5000 sentences, and its end-to-end average number of large language model calls is:

[0188] .

[0189] When reusing the calculated results of the safe operating mode, the incremental call count for the supplementary path experiment itself is once per sentence, but this incremental call count is not the same as the complete online end-to-end call count.

[0190] On the 5000 test data points, the character-level error correction F1 score in the safe operating mode was 0.713, precision was 0.861, recall was 0.608, and overcorrection rate was 0.056; 151 out of 2698 correct sentences were corrected. The character-level error correction F1 score in the recall-enhanced operating mode was 0.768, precision was 0.850, recall was 0.700, and overcorrection rate was 0.073; 198 out of 2698 correct sentences were corrected. The supplementary path accepted 279 new candidate edits, of which 220 were correct and 59 were incorrect. Compared to the safe operating mode, the recall-enhanced operating mode improved the character-level error correction F1 score by approximately 0.055, the recall by approximately 0.092, and the overcorrection rate by approximately 0.017.

[0191] When the same supplementary path hard-gating mechanism is used on another large language model backend, the character-level error correction F1 score improves from 0.650 to 0.697, and the recall rate improves from 0.543 to 0.612. The end-to-end call count for the recall-enhanced running mode is approximately 3.511 times per sentence. These results demonstrate that the asymmetric dual-path structure can improve the recall of true misspelled words with controllable call costs without training or fine-tuning a large language model. The recall-enhanced running mode incurs a quantifiable over-correction cost compared to the safe running mode; therefore, the two running modes correspond to different risk preferences and do not necessarily mean that the recall-enhanced running mode is superior to the safe running mode in all safety metrics.

[0192] The above embodiments are only used to illustrate the technical solutions of the present invention. Those skilled in the art can make equivalent substitutions or adjustments to the number of intelligent agents, the combination of specialized verification intelligent agents, the model backend, pinyin or input method resources, the type of protected text elements, the running mode selection conditions, and the candidate editing data structure without departing from the concept of the present invention. The scope of protection of the present invention is defined by the claims.

Claims

1. A Chinese spelling correction method based on asymmetric double-path candidate gating, characterized in that, Performed by an electronic device, including the following steps: S1 Chinese Sentence Retrieval: Retrieve Chinese sentences that need correction. ,in, This indicates the first Chinese sentence to be corrected. One character, This indicates the number of characters in the Chinese sentence to be corrected; S2 main candidate generation: the main candidate generation agent generates a main candidate by using a large language model identify suspected spelling errors based on the to-be-corrected Chinese sentence and a preset main path role constraint, and obtain a main path corrected text, and generate a first candidate edit set based on character differences between the to-be-corrected Chinese sentence and the main path corrected text wherein, consisting of zero or more structured candidate edit elements, The generation process of the main path corrected text and the corresponding candidate edit set can be represented as: , , in, Indicates the primary candidate generation path. This indicates the number of characters in the main path correction text. This indicates the constraint on the generation of primary candidate roles. Representation of large language models Output main path correction text, This represents a candidate edit generation function. The candidate edit generation function compares the input Chinese sentence to be corrected with the corresponding corrected text according to the character order, identifies the identical and different character parts, and for each different character part, uses the character position in the Chinese sentence to be corrected as the position recording benchmark to determine the corresponding start and end positions. The corresponding character segment in the Chinese sentence to be corrected is determined as the original character segment, and the character segment in the corresponding corrected text is determined as the replacement character segment, thereby generating a structured candidate edit. When the main path corrected text is the same as the Chinese sentence to be corrected, the first candidate edit set is selected. The empty set; the character range occupied by the candidate edit is a set of continuous character positions from its start position to its end position, including the start position and the end position; different candidate edits generated by performing the character comparison once on the same Chinese sentence to be corrected and the same corresponding corrected text do not overlap in their character ranges; S3 Candidate Validation: The candidate validation module uses the large language model... The candidate edits in the first candidate edit set are judged for acceptance or rejection without adding new candidate edits, and a main accepting edit set is formed according to the first acceptance strategy. The first acceptance strategy is to retain candidate edits by default and reject candidate edits when they are judged to have a high risk of over-correction or violate the character-level Chinese spelling correction boundary. The candidate acceptance function of the first acceptance strategy is expressed as follows: , , in, The first acceptance strategy is aimed at candidate editors. The binary acceptance decision function, Indicates acceptance of candidate editor , Indicates rejection of candidate editor , This indicates that the main accepts the edit set; For the value to belong to The binary decision quantity represents the candidate editor. Does it meet the character-level Chinese spelling correction boundary, when the candidate editor When the starting and ending positions are within the valid position range of the Chinese sentence to be corrected, the original character fragment is consistent with the original character fragment determined by the starting and ending positions, and the candidate edit does not involve character insertion, character deletion, character order adjustment, punctuation or format modification, or pure expression polishing, ,otherwise ; For the value to belong to The binary decision quantity represents the candidate editor. Is there a high risk of overcorrection when the candidate verification module explicitly determines the candidate edit? When the original expression is equally valid, merely makes the expression more natural or common, lacks a clear need for correction, involves protected text elements or context, or may alter at least one of the following situations: the original meaning, the facts, or the intended expression. ,otherwise ; S4 Supplementary Candidate Generation: When the preset operating mode is recall enhancement operating mode, the supplementary candidate generation agent uses the large language model. Based on the Chinese sentence to be corrected and the preset supplementary path role constraints, supplementary path correction text is obtained for homophones, near-homophones, or input method misselection. The large language model... With large language models For the same large language model or different large language models; based on the character differences between the Chinese sentence to be corrected and the text corrected by the supplementary path, a second candidate edit set with supplementary path source identifiers is generated. ,in, Consists of zero or more structured candidate edit elements Composition; When the preset operating mode is the safe operating mode, the supplementary candidate generation agent is not run, and the second candidate editing set and the supplementary accepting editing set are set to empty sets; The process of generating the supplementary path correction text and the corresponding candidate edit set can be represented as follows: , , in, Indicates the supplementary candidate generation path, This indicates the number of characters in the supplementary path correction text. This indicates the pre-defined supplementary path role constraints. Representation of large language models The output includes supplementary path correction text. This indicates the candidate edit generation function, which in this step uses the Chinese sentence to be corrected. and supplementary path correction text As input, and output the second candidate edit set. No calculation is performed in safe operating mode. and make It is an empty set; S5 Candidate Editor Screening: In the recall-enhanced operation mode, source-specific conjoint hard gating is performed on each candidate editor in the second candidate editor set according to the second acceptance strategy; The source-specific conjunctive hard gating is a binary candidate admission control process set for the supplementary candidate generation path. "Source-specific" means that the conjunctive hard gating is used to determine whether the candidate edits generated by the supplementary candidate generation path have modification rights, and it differs from the first acceptance strategy used by the main candidate generation path. "Conjunctive" means that each preset gating condition constitutes a necessary condition for the candidate edit to obtain modification rights, and the preset gating conditions are logically conjunctive. "Hard gating" means that candidate edits are accepted only when all preset gating conditions are simultaneously met, and candidate edits are rejected when any preset gating condition is not met. Furthermore, the degree of satisfaction of other preset gating conditions or the confidence information of the candidate edit cannot compensate for the unmet preset gating condition. The second acceptance strategy is to reject candidate edits by default and add them to the supplementary acceptable edit set only if the candidate edits simultaneously meet the following conditions: the candidate edit has the supplementary path source identifier; the start and end positions of the candidate edit are within the valid position range of the Chinese sentence to be corrected; the original character fragment is completely identical to the original character fragment determined by the start and end positions; the original character fragment and the replacement character fragment are of equal length and both consist of Chinese characters; the candidate edit has evidence of Pinyin or input method mechanism; the candidate edit does not involve protected text elements or context; and the candidate edit does not overlap in position with the main acceptable edit set and the candidate edits already added to the supplementary acceptable edit set. The candidate acceptance function of the second acceptance strategy is expressed as: , , in, The second acceptance strategy is aimed at candidate editors. The binary acceptance decision function, Indicates acceptance of candidate editor , Indicates rejection of candidate editor , This indicates that the supplement accepts the edit set; , , , , , and All values ​​belong to The binary decision quantity. When the candidate editor has a supplementary path source identifier ,otherwise ; When the starting and ending positions of the candidate editor are within the valid position range of the Chinese sentence to be corrected, and the original character fragment is completely consistent with the original character fragment at the corresponding position, ,otherwise ; When both the original character segment and the replacement character segment are not empty and have the same number of characters. ,otherwise ; When all characters in both the original character fragment and the replacement character fragment fall within the preset range of Chinese characters. ,otherwise ; When the original character fragment and the replacement character fragment meet the preset rules for determining whether the pinyin is the same or similar, or when the preset input method misselection confusion relationship is matched, ,otherwise ; When the candidate editor does not match the preset protected text element or context ,otherwise ; When the character range occupied by a candidate editor does not intersect with the positions of all candidate editors in the main accepting editor set and all candidate editors currently added to the supplementary accepting editor set. ,otherwise ; S6 Merging of Edit Sets: The main accepting edit set and the supplementary accepting edit set are merged to form the final accepting edit set. The character ranges occupied by any two candidate edits in the final accepting edit set do not overlap. Then, starting from the Chinese sentence to be corrected, the replacement is performed in the order of the starting positions of each candidate edit in the final accepting edit set to reconstruct the output sentence. When the final accepting edit set is empty, the Chinese sentence to be corrected is used as the output sentence.

2. The method according to claim 1, characterized in that, In S2, the preset main path role constraints include, but are not limited to: limiting the processing object to Chinese spelling errors, requiring the generation of the main path correction text with minimal modifications, prohibiting modifications to the Chinese sentence to be corrected solely for the purpose of expression optimization, style adjustment, or format adjustment, and requiring the output of text identical to the Chinese sentence to be corrected when no suspected spelling errors are identified; the large language model It only provides text input and text output capabilities, and does not require reading or modifying the model parameters, internal state or training data of the corresponding large language model, nor does it require special pre-training, fine-tuning or knowledge editing of the large language model for Chinese spelling error correction tasks.

3. The method according to claim 1, characterized in that, In step S2, generating the first candidate edit set includes: comparing the Chinese sentence to be corrected and the main path correction text according to the character order, identifying the character parts with the same content and the character parts with different content; for each character part with different content, using the character position in the Chinese sentence to be corrected as the position recording benchmark, determining the corresponding start position and end position, determining the corresponding character segment in the Chinese sentence to be corrected as the original character segment, and determining the corresponding character segment in the main path correction text as the replacement character segment, thereby generating a structured candidate edit; the structured candidate edit includes at least a candidate identifier, The candidate edits are defined as follows: source identifier, start position, end position, original character fragment, and replacement character fragment. The candidate identifier distinguishes different candidate edits within the first candidate edit set. The source identifier indicates that the candidate edit originates from the main candidate generation path. The original character fragment is a character fragment within the Chinese sentence to be corrected, determined by the start and end positions. The character range occupied by each candidate edit is determined based on the start and end positions. Different candidate edits formed by performing the above character comparison and structured candidate edit generation process on the same Chinese sentence to be corrected and the same main path correction text do not overlap in their character ranges.

4. The method according to claim 1, characterized in that, In step S3, the candidate verification module includes an adjudication agent and at least one specialized verification agent. The specialized verification agent includes one or more of the following: a pinyin and input method verification agent, a character shape verification agent, and a context and overcorrection risk verification agent. The at least one specialized verification agent receives candidate edits and their corresponding contexts from the first candidate edit set and generates verification results for the candidate edits respectively. The pinyin and input method verification agent is used to determine whether the candidate edit has evidence of homophones, near-homophones, or incorrect selection of input method candidates. The character shape verification agent is used to determine whether the candidate edit has evidence of character shape, component, or visual similarity. The context and overcorrection risk verification agent is used to determine whether the candidate edit belongs to character-level Chinese spelling correction, and whether it involves style polishing, grammatical rewriting, punctuation change, capitalization or format change, entity name change, character insertion, character deletion, character order adjustment, or semantic offset. The adjudication agent receives the verification results generated by the first candidate edit set and each participating special verification agent, and determines the acceptance or rejection judgment for each candidate edit based on the verification results and the first acceptance strategy. The special verification agent and the adjudication agent only process the candidate edits in the first candidate edit set, do not add candidate edits outside the first candidate edit set, and do not change the start position, end position, original character fragment, or replaced character fragment of the candidate edit.

5. The method according to claim 1, characterized in that, In step S3, before the candidate verification module makes a judgment, at least one type of local linguistic evidence is extracted from the local context covering the character range occupied by the candidate edit. The local linguistic evidence includes one or more of the following: evidence of identical pinyin, evidence of similar pinyin, confusion relationship due to misselection of preset input method, evidence of similar character shape, evidence of local word changes before and after replacement, and evidence of local collocation changes before and after replacement. The local linguistic evidence is used to assist in judging whether the candidate edit belongs to Chinese spelling error, and is not used to generate new candidate edits outside the first candidate edit set.

6. The method according to claim 1, characterized in that, In S3, a budget control strategy is adopted. When the first candidate editing set is an empty set, the candidate verification module does not perform text generation and sets the main accepting editing set to an empty set. When the first candidate edit set is not empty, all candidate edits in the first candidate edit set and their corresponding contexts are combined into a verification input in units of sentences, so that the candidate verification module generates text according to the preset verification role, instead of processing each candidate edit separately.

7. The method according to claim 1, characterized in that, In step S4, the pre-defined supplementary path role constraints include at least the following: limiting the detection scope of supplementary candidates to misuse of homophones, misuse of near-homophones, or incorrect selection of input methods; prohibiting expression polishing, sentence rewriting, or format modification unrelated to the defined scope; and requiring the output of text identical to the Chinese sentence to be corrected when no corresponding error is identified; the large language model used by the supplementary candidate generation agent. It only provides text input and text output capabilities, and does not require reading or modifying the model parameters, internal state, or training data of the corresponding large language model, nor does it require modifications to the large language model for Chinese spelling correction tasks. Specialized pre-training, fine-tuning, or knowledge editing is performed; generating the second candidate edit set includes: comparing the Chinese sentence to be corrected and the supplementary path correction text according to the character order, identifying the character parts with different content in the two; for each character part with different content, using the character position in the Chinese sentence to be corrected as the position recording benchmark, determining the corresponding start position and end position, determining the corresponding character segment in the Chinese sentence to be corrected as the original character segment, and determining the corresponding character segment in the supplementary path correction text as the replacement character segment, thereby generating a structured candidate edit, and adding a supplementary path source identifier to the structured candidate edit.

8. The method according to claim 1, characterized in that, In step S5, the pinyin or input method mechanism evidence includes at least one of the following: the pinyin of the original character segment and the replacement character segment are completely identical; the pinyin of the original character segment and the replacement character segment meets a preset near-phonetic condition in terms of initial consonant, final vowel, or tone; the original character segment and the replacement character segment meet a preset condition of easy confusion in terms of retroflex consonants, nasal consonants, lateral consonants, nasal consonants, or other dialects; the original character segment and the replacement character segment hit a preset input method misselection confusion relationship; when the candidate editor has at least one of the aforementioned pieces of evidence, the mechanism evidence judgment value corresponding to the candidate editor is... Set to 1 otherwise set to 0; the protected text element or context includes one or more of the following: name, place name, organization name, product name, domain terminology, number, time, English characters, formula, code, quoted content, and words from a preset user dictionary; when the character range occupied by the candidate edit intersects with the position range of any protected text element, or when the corresponding character of the candidate edit is in a preset protected context, the security determination value corresponding to the candidate edit is set to 1. Set to 0, otherwise set to 1.

9. The method according to claim 1, characterized in that, In step S5, the candidate edits in the second candidate edit set are processed in ascending order of their starting positions; when the starting positions are the same, they are processed in ascending order of their ending positions; when both the starting and ending positions are the same, they are processed in a preset order determined by the candidate identifier; for the currently processed candidate edit, it is detected whether its occupied character range intersects with the occupied character ranges of each candidate edit in the main accepting edit set, and with the occupied character ranges of each candidate edit that has been added to the supplementary accepting edit set. When there is no intersection between the positions, the candidate edit corresponding to Set to 1 otherwise set to 0; the second acceptance strategy is executed by the rule processing module that does not call the large language model.

10. The method according to claim 1, characterized in that, In step S6, the final accepted edit set and the output sentence are respectively represented as follows: , , in, This indicates the final set of accepted edits. This indicates that the deterministic output reconstruction function of the large language model is not invoked; for candidate edits ,by , and These represent the starting position, ending position, and replacement character segment determined by character numbering starting from 1, respectively. Then output the sentence. The Middle Each character is represented as: , The character ranges occupied by any two candidate edits in the final accepted edit set do not overlap, and the same character position corresponds to at most one candidate edit.