Chinese text error correction method, device and equipment based on context fusion thinking chain
Through the combination of multi-grained feature fusion and chain thinking reasoning, the problem of insufficient feature fusion and inexplicable error correction process in Chinese text error correction technology is solved, and the accuracy and practicality of Chinese text error correction is improved, especially the ability to handle complex error types, and a clear basis for error correction is provided.
Patent Information
- Application Number
- CN202510456241.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-04-11
AI Technical Summary
The existing Chinese text error correction technology has problems such as insufficient fusion of feature, unexplained error correction process, weak complex error handling capabilities and insufficient utilization of Chinese language characteristics, resulting in low error correction accuracy and insufficient practicality.
The method based on context fusion thinking chain is adopted, word-level and word-level features are integrated through a multi-grained feature fusion mechanism, and error correction process is generated by combining chain thinking reasoning to enhance the interpretability of text semantic understanding and error correction process.
It improves the accuracy of Chinese text error correction, especially the ability to handle complex error types, and provides clear error correction basis, which significantly improves the practicality and user experience of the error correction system.
Smart Images

Figure CN120449866A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing technology, and in particular to a Chinese text error correction method, device and equipment based on context-integrated thinking chains. Background Art
[0002] Chinese text error correction is a crucial foundational technology in natural language processing. Its goal is to automatically detect and correct a variety of errors in text, including spelling errors, similar-looking characters, similar-sounding characters, idiom errors, and grammatical errors. Due to the complexity of the Chinese language, including the large number of homographs and homophones, and the flexibility of its grammatical structure, Chinese text error correction technology faces numerous challenges.
[0003] In the related art, traditional Chinese text error correction methods are mainly based on rule matching, n-gram language models or statistical machine learning methods. These methods perform well in dealing with simple spelling errors or fixed-pattern errors, but have obvious limitations in dealing with complex context-related errors. With the development of deep learning technology, text error correction methods based on neural networks have made significant progress. The current mainstream methods usually use pre-trained language models, such as BERT (Bidirectional Encoder Representations from Transformers, a bidirectional pre-trained language model based on Transformer encoders), RoBERTa (Robustly optimized BERT approach, a model that optimizes the BERT pre-training method), etc. as the basis to build a detection-correction pipeline model, that is, first detect the error position and then predict the correct character.
[0004] However, the relevant technologies still have the following technical problems that need to be solved urgently:
[0005] First, there is insufficient fusion of character-level features and word-level features. Existing methods often use single-granularity (usually character-level) feature representations, lacking comprehensive consideration of multi-granularity language units (words, words, and phrases). This leads to insufficient understanding of contextual semantics, and in particular, low accuracy when dealing with semantically related errors.
[0006] Second, there is a lack of explainable error correction reasoning. Current deep learning models typically operate as "black boxes," unable to provide clear error correction evidence and reasoning. This makes it difficult for users to understand and verify the rationality of the correction results, limiting their application value in professional scenarios such as education and editing.
[0007] Third, the ability to handle complex error types is limited. Existing methods perform well in handling simple spelling errors, but the accuracy of identifying and correcting complex error types such as idiom errors, grammatical errors, and semantic inconsistencies is low, making it difficult to meet practical application needs.
[0008] Fourth, there is a lack of in-depth utilization of the characteristics of the Chinese language. The unique characteristics of the Chinese language (such as the association between form, sound, and meaning, and the fixed collocation of idioms) are not fully reflected and utilized in the model design, resulting in insufficient generalization and robustness of the model.
[0009] To sum up, there is an urgent need for a text correction technology solution that can fully utilize multi-granularity feature fusion, has explainable reasoning capabilities, can effectively handle complex error types, and deeply utilize the characteristics of the Chinese language, so as to improve the accuracy, explainability and practicality of Chinese text correction. Summary of the Invention
[0010] The present application provides a Chinese text error correction method, device and equipment based on context-fusion thinking chain to solve the problems of insufficient feature fusion, unexplainable error correction process, weak complex error handling capability and insufficient utilization of Chinese language characteristics in existing Chinese text error correction technology. It enhances text feature representation through a multi-granularity feature fusion mechanism based on context perception, combines chain thinking reasoning to generate an analysis process for error correction, and effectively improves the accuracy and interpretability of Chinese text error correction.
[0011] The first embodiment of the present application provides a Chinese text error correction method based on context-integrated thinking chains, comprising the following steps:
[0012] Acquiring Chinese text data to be corrected, and performing feature encoding on the Chinese text data to be corrected to obtain an initial context representation;
[0013] Based on the initial context representation, extracting character-level features of the Chinese text data to be corrected, performing word segmentation processing on the Chinese text data to be corrected, extracting word-level features of the Chinese text data to be corrected, fusing the character-level features with the word-level features to generate a fused context representation, and enhancing the fused context representation to obtain an enhanced context representation;
[0014] Based on the enhanced context representation, identifying at least one erroneous character in the Chinese text data to be corrected, and determining an error type corresponding to each erroneous character;
[0015] Generate a chain thinking reasoning process according to each incorrect character and the error type corresponding to each incorrect character;
[0016] According to the thought chain reasoning process and the enhanced context representation, each erroneous character is corrected to obtain a corrected text and a thought chain error correction basis corresponding to the corrected text.
[0017] According to one embodiment of the present application, fusing the character-level features and the word-level features to generate a fused context representation includes:
[0018] Mapping the character-level features to a preset feature space, and mapping the word-level features to the preset feature space, and aligning the time sequence of the mapped word-level features with the mapped character-level features based on a preset linear interpolation strategy to obtain aligned word-level features;
[0019] The feature fusion weight of the mapped character-level features and the aligned word-level features is calculated, and the mapped character-level features and the aligned word-level features are weightedly fused based on the feature fusion weight to obtain the fused context representation.
[0020] According to one embodiment of the present application, generating a chained reasoning process based on the error type corresponding to each incorrect character includes:
[0021] Obtaining context information of each erroneous character, and inferring an error cause of each erroneous character based on the context information of each erroneous character;
[0022] Determining the error type complexity and context complexity corresponding to each erroneous character according to the error type corresponding to each erroneous character and the context information of each erroneous character;
[0023] Determining a target thought chain template according to the error type complexity corresponding to each incorrect character and the context complexity;
[0024] According to the context information of each erroneous character, the predicted correction candidate and the error cause of each erroneous character, the target thinking chain template is filled to generate the chain thinking reasoning process.
[0025] According to one embodiment of the present application, correcting each erroneous character to obtain a corrected text includes:
[0026] Based on the enhanced context representation, each incorrect character is mapped to a preset word table space to obtain a character prediction probability distribution for each incorrect character, and a preset number of characters with the highest probability are selected from the character distribution probabilities as first candidate correction items;
[0027] generating a second candidate correction item from the thought chain reasoning process, and obtaining a candidate correction set based on the first candidate correction item and the second candidate correction item;
[0028] Calculating a rationality score for each candidate item in the candidate correction set based on a preset language knowledge base;
[0029] Determining at least one target corrected character based on the character prediction probability distribution of each incorrect character and the rationality score of each candidate;
[0030] Each of the erroneous characters is replaced by the at least one target corrected character to generate the corrected text.
[0031] According to an embodiment of the present application, the error type includes at least one of spelling errors, errors in similar-looking characters, errors in similar-sounding characters, errors in idioms, errors in grammar, errors in punctuation, and incoherent meanings.
[0032] According to the Chinese text error correction method based on context-fused thought chain according to the embodiment of the present application, the Chinese text data to be corrected is feature-encoded, multi-granularity feature fusion is performed, and the context representation is enhanced. The position of the erroneous character is detected and the error type is determined based on the enhanced context representation; the error analysis process is dynamically generated; the error is corrected in combination with the thought chain reasoning process, and the corrected text and the corresponding thought chain error correction basis are generated. Thus, through the innovative combination of multi-granularity feature fusion and thought chain reasoning, not only the accuracy of Chinese text error correction is improved, especially the processing capability of complex error types, but also the interpretability of the error correction process is achieved, providing users with a clear and understandable error correction basis, significantly improving the practicality and user experience of the error correction system.
[0033] The second embodiment of the present application provides a Chinese text error correction device based on context-integrated thinking chains, including:
[0034] An acquisition module, configured to acquire Chinese text data to be corrected, and perform feature encoding on the Chinese text data to be corrected to obtain an initial context representation;
[0035] a processing module, configured to extract character-level features of the Chinese text data to be corrected based on the initial context representation, perform word segmentation on the Chinese text data to be corrected, extract word-level features of the Chinese text data to be corrected, fuse the character-level features with the word-level features to generate a fused context representation, and enhance the fused context representation to obtain an enhanced context representation;
[0036] an identification module, configured to identify at least one erroneous character in the Chinese text data to be corrected based on the enhanced context representation, and determine an error type corresponding to each erroneous character;
[0037] A generating module, configured to generate a chain thinking reasoning process according to each incorrect character and the error type corresponding to each incorrect character;
[0038] The correction module is used to correct each erroneous character according to the thought chain reasoning process and the enhanced context representation, and obtain the corrected text and the thought chain error correction basis corresponding to the corrected text.
[0039] According to one embodiment of the present application, the processing module is configured to:
[0040] Mapping the character-level features to a preset feature space, and mapping the word-level features to the preset feature space, and aligning the time sequence of the mapped word-level features with the mapped character-level features based on a preset linear interpolation strategy to obtain aligned word-level features;
[0041] The feature fusion weight of the mapped character-level features and the aligned word-level features is calculated, and the mapped character-level features and the aligned word-level features are weightedly fused based on the feature fusion weight to obtain the fused context representation.
[0042] According to one embodiment of the present application, the generating module is configured to:
[0043] Obtaining context information of each erroneous character, and inferring an error cause of each erroneous character based on the context information of each erroneous character;
[0044] Determining the error type complexity and context complexity corresponding to each erroneous character according to the error type corresponding to each erroneous character and the context information of each erroneous character;
[0045] Determining a target thought chain template according to the error type complexity corresponding to each incorrect character and the context complexity;
[0046] According to the context information of each erroneous character, the predicted correction candidate and the error cause of each erroneous character, the target thinking chain template is filled to generate the chain thinking reasoning process.
[0047] According to one embodiment of the present application, the correction module is configured to:
[0048] Based on the enhanced context representation, each incorrect character is mapped to a preset word table space to obtain a character prediction probability distribution for each incorrect character, and a preset number of characters with the highest probability are selected from the character distribution probabilities as first candidate correction items;
[0049] generating a second candidate correction item from the thought chain reasoning process, and obtaining a candidate correction set based on the first candidate correction item and the second candidate correction item;
[0050] Calculating a rationality score for each candidate item in the candidate correction set based on a preset language knowledge base;
[0051] Determining at least one target corrected character based on the character prediction probability distribution of each incorrect character and the rationality score of each candidate;
[0052] Each of the erroneous characters is replaced by the at least one target corrected character to generate the corrected text.
[0053] According to an embodiment of the present application, the error type includes at least one of spelling errors, errors in similar-looking characters, errors in similar-sounding characters, errors in idioms, errors in grammar, errors in punctuation, and incoherent meanings.
[0054] According to the Chinese text error correction device based on context-fused thought chain of the embodiment of the present application, the Chinese text data to be corrected is feature-encoded, multi-granularity feature fusion is performed, and the context representation is enhanced. The position of the erroneous character is detected and the error type is determined based on the enhanced context representation; the error analysis process is dynamically generated; the error is corrected in combination with the thought chain reasoning process, and the corrected text and the corresponding thought chain error correction basis are generated. Thus, through the innovative combination of multi-granularity feature fusion and thought chain reasoning, not only the accuracy of Chinese text error correction is improved, especially the processing capability of complex error types, but also the interpretability of the error correction process is achieved, providing users with a clear and understandable error correction basis, significantly improving the practicality and user experience of the error correction system.
[0055] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the Chinese text error correction method based on context-fusion thinking chain as described in the above embodiment.
[0056] The fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored. The program is executed by a processor to implement the Chinese text error correction method based on context-fusion thinking chain as described in the above embodiment.
[0057] The fifth aspect of the present application provides a computer program product, including a computer program, which is executed by a processor to implement the Chinese text error correction method based on context-fusion thinking chain as described in the above embodiment.
[0058] Compared with the prior art, the technical solution provided by the present invention has the following beneficial effects:
[0059] (1) Through the multi-granularity feature fusion mechanism, character-level features and word-level features are effectively integrated, which enhances the model's ability to understand text semantics, especially for context-related errors with higher recognition accuracy;
[0060] (2) The introduction of a chain-thinking reasoning generation module provides an explainable reasoning process for the error correction results, enhancing the transparency and credibility of the system and making it easier for users to understand and verify the rationality of the error correction results;
[0061] (3) Based on the multi-level thinking chain template and error complexity assessment mechanism, different analysis strategies are adopted for different types of errors, which significantly improves the system's ability to handle complex error types (such as idiom errors and grammatical errors);
[0062] (4) Build a rich language knowledge base, deeply utilize the form, sound and meaning characteristics of the Chinese language, combine the advantages of deep learning and symbolic knowledge, and enhance the error correction accuracy and generalization ability of the model;
[0063] (5) Through the multi-task joint learning framework and contrastive learning mechanism, the model training process is optimized and the model's adaptability to unprecedented error types and contexts is improved.
[0064] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0066] Figure 1 A flowchart of a Chinese text error correction method based on context-integrated thinking chains provided according to an embodiment of the present application;
[0067] Figure 2 This is a schematic diagram of the structure of a chain thinking reasoning generation module according to one embodiment of the present application;
[0068] Figure 3 Schematic diagram of a Chinese text error correction method based on context-integrated thinking chains according to one embodiment of the present application;
[0069] Figure 4 This is an architecture diagram of a Chinese text error correction system based on context-integrated thinking chains according to one embodiment of the present application;
[0070] Figure 5 Schematic diagram of the structure of a multi-granularity feature fusion module according to one embodiment of the present application;
[0071] Figure 6 A schematic diagram of the web interface and result display of a Chinese text error correction system according to one embodiment of the present application;
[0072] Figure 7 Schematic diagram of a Chinese text error correction device based on context-integrated thinking chain according to an embodiment of the present application;
[0073] Figure 8 Schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0074] The following describes in detail embodiments of the present application. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0075] The following describes the Chinese text error correction method, device and equipment based on context fusion thinking chain according to the embodiment of the present application with reference to the accompanying drawings. In response to the problems of insufficient feature fusion, unexplainable error correction process, weak complex error processing capability and insufficient utilization of Chinese language characteristics in the Chinese text error correction technology mentioned in the above background technology, the present application provides a Chinese text error correction method based on context fusion thinking chain. In this method, feature encoding is performed on the Chinese text data to be corrected, multi-granularity feature fusion is performed, and context representation is enhanced. The position of the erroneous character is detected and the error type is determined based on the enhanced context representation; an error analysis process is dynamically generated; the error is corrected in combination with the thinking chain reasoning process, and the corrected text and the corresponding thinking chain error correction basis are generated. Therefore, through the innovative combination of multi-granularity feature fusion and thinking chain reasoning, not only the accuracy of Chinese text error correction is improved, especially the processing capability of complex error types, but also the interpretability of the error correction process is achieved, providing users with a clear and understandable error correction basis, and significantly improving the practicality and user experience of the error correction system.
[0076] Specifically, Figure 1 A flowchart of a Chinese text error correction method based on context-integrated thinking chains provided in an embodiment of the present application.
[0077] It should be noted that the context-integrated thought chain-based Chinese text error correction method provided by the embodiments of the present invention is applicable to a variety of text error correction scenarios, including online document editing, intelligent input methods, and intelligent writing assistance systems. This method can effectively detect and correct various types of errors in Chinese text, including spelling errors, errors in similar-looking characters, errors in similar-sounding characters, errors in idioms, and grammatical errors, while providing clear and explainable correction evidence, significantly improving user experience and text quality.
[0078] It can be understood that Chain-of-Thought (CoT) refers to a structured reasoning process that simulates the step-by-step analysis process when humans think about problems, making the reasoning process more transparent and explainable. Context Fusion (CF) refers to the organic fusion of language unit features of different granularities (such as character level and word level) to enhance the semantic understanding ability of text representation. The present invention combines Chain-of-Thought reasoning with context fusion technology to construct an efficient and accurate Chinese text error correction solution.
[0079] like Figure 1 As shown, the Chinese text error correction method based on context fusion thinking chain includes the following steps:
[0080] In step S101, Chinese text data to be corrected is obtained, and feature encoding is performed on the Chinese text data to be corrected to obtain an initial context representation.
[0081] Specifically, the system receives Chinese text input from the user or retrieves Chinese text data to be corrected from files, databases, and other sources. The Chinese text data to be corrected can be a single sentence, paragraph, or complete document. The system supports multiple input methods, including direct input, file upload, and API (Application Programming Interface) calls.
[0082] In some embodiments, the system receives user text input from an input device (such as a keyboard, touch screen, etc.), or reads a text file specified by the user. The system can also be designed to receive text data passed by other applications through an API interface to achieve system integration. For batch processing scenarios, the system can receive and process multiple text fragments at a time to meet the needs of large-scale text error correction; and perform preprocessing at the input stage to remove special characters or formatting tags and extract plain text content for subsequent processing.
[0083] Furthermore, a pre-trained Chinese language model is used to perform feature encoding on the Chinese text data to be corrected. In a preferred embodiment, MacBERT can be used as the base encoder. This model is a BERT variant optimized specifically for Chinese corpora and has excellent performance on multiple Chinese natural language processing tasks. During implementation, the system inputs the Chinese text sequence to be corrected into the pre-trained language model after word segmentation, and obtains the hidden state representation of the last layer of the model as the initial context representation.
[0084] It should be noted that the initial context representation is a high-dimensional vector, typically with a dimension of 768 or 1024, which contains rich semantic, syntactic, and contextual information. These vector representations provide the basic features for subsequent error detection and correction.
[0085] In some embodiments, the system can select pre-trained models of different scales based on actual computing resource limitations, such as lightweight ALBERT-Chinese, medium-sized MacBERT-base, large-scale RoBERTa-large, etc., to achieve a balance between performance and efficiency, which is not specifically limited here.
[0086] In step S102, based on the initial context representation, the character-level features of the Chinese text data to be corrected are extracted, and the Chinese text data to be corrected is segmented, and the word-level features of the Chinese text data to be corrected are extracted, the character-level features and the word-level features are fused to generate a fused context representation, and the fused context representation is enhanced to obtain an enhanced context representation.
[0087] Furthermore, in some embodiments, character-level features and word-level features are fused to generate a fused context representation, including: mapping character-level features to a preset feature space, and mapping word-level features to a preset feature space, and based on a preset linear interpolation strategy, aligning the time sequence of the mapped word-level features with the mapped character-level features to obtain aligned word-level features; calculating the feature fusion weights of the mapped character-level features and the aligned word-level features, and performing weighted fusion of the mapped character-level features and the aligned word-level features based on the feature fusion weights to obtain a fused context representation.
[0088] Specifically, the system first extracts features through two processing processes: character-level and word-level. The character process splits the original Chinese text to be corrected into character sequences, and then uses a pre-trained character encoder to extract character-level features. Correspondingly, the word-level process first uses a word segmentation tool (such as Jieba) to segment the text into word sequences, and then uses a word encoder to extract word-level features.
[0089] For example, for the input text "We need to improve work efficiency", the character process will process it into a character sequence of ['I', 'we', 'need', 'want', 'improve', 'work', 'efficiency', 'rate'], while the word-level process obtains a word sequence of ['we', 'need', 'improve', 'work', 'efficiency'] after word segmentation.
[0090] Next, through their respective feature mapping layers, the system projects the character-level features and word-level features into a unified preset feature space to ensure that the dimensions of the two features are consistent, facilitating subsequent fusion operations.
[0091] Since word-level sequences are usually shorter than character-level sequences (a word may contain multiple characters), feature alignment is required. In a preferred embodiment, the system adopts a word-to-character linear interpolation mechanism to map word-level features to their corresponding character positions. For example, for the word "工作" (work), its word-level features will be mapped to the positions of the characters "工" (work) and "作" (do) respectively.
[0092] After feature alignment, the system calculates the fusion weights through a fusion gating network. Specifically, first, the character-level features and the aligned word-level features are concatenated and input into a fully connected layer, and then the sigmoid activation function is applied to obtain fusion weight values within the range of 0-1. This weight determines the relative importance of character-level features and word-level features in the final representation, assigns different importance to character-level and word-level features for different text positions, thereby generating a richer fused context representation, which can capture both character-level details and word-level semantic information.
[0093] It can be understood that the fusion weights are calculated dynamically and there will be different weight values for characters at different positions. For example, for positions where character-shape similarity errors are likely to occur, the system may assign higher weights to character-level features; while for positions where idiom errors may exist, the system may be more inclined to word-level features.
[0094] Finally, the system performs a weighted combination of character-level features and word-level features based on the calculated fusion weights, and applies residual connection and layer normalization to obtain the final fused context representation. Residual connection ensures the retention of the original information, while layer normalization helps with training stability and convergence speed.
[0095] The advantage of the multi-granularity feature fusion in the embodiments of this application is as follows: Character-level features capture fine-grained information at the character level, which is beneficial for identifying spelling errors, character-shape similarity errors, etc.; word-level features provide more macroscopic semantic unit information, which helps to understand the context and collocation relationship of words and is particularly important for identifying complex errors such as idiom errors and semantic incoherence. By fusing these two different-granularity features, the system can more comprehensively understand the text content and improve the accuracy of error detection and correction.
[0096] Furthermore, a context-aware attention mechanism is applied to enhance the fused context representation. Specifically, the system adopts a multi-head self-attention mechanism to capture the long-range dependencies between different positions in the sequence.
[0097] In one embodiment, the multi - head attention layer constructed in the embodiments of the present application includes 8 attention heads, namely: semantic association head, syntactic structure head, word co - occurrence head, topic consistency head, entity relationship head, context coherence head, grammatical dependency head, and discourse cohesion head. Each head performs independent attention calculation for different linguistic features of the text, and then combines the results. Among them, the semantic association head focuses on capturing word - meaning relevance, the syntactic structure head pays attention to the structural dependencies in the syntactic tree, the word co - occurrence head identifies common collocation patterns, the topic consistency head maintains topic coherence, the entity relationship head tracks the relationships between entities, the context coherence head keeps the paragraph logic, the grammatical dependency head marks grammatical relationships, and the discourse cohesion head handles long - distance anaphoric relationships. The attention calculation process first maps the input features into query vectors (Q), key vectors (K), and value vectors (V), then calculates the dot product of the query vector Q and the key vector K. After scaling and softmax normalization, attention weights are obtained. Finally, these weights are used to perform weighted summation on the value vector V.
[0098] Exemplarily, for a long sentence containing a grammar error, such as "His new invention has made great contributions to the development of science and technology" (where "贡现" should be "贡献" in Chinese), through the multi - head attention mechanism, the system can establish a long - distance association between "发明" (invention) and "贡现", which helps to identify that "贡现" is a misspelling. Specifically, the semantic association head will recognize the common collocation relationship between "做出" (make) and "贡献" (contribution), the grammatical dependency head will mark the incoordination of "贡现" in the verb - object structure, and the entity relationship head will focus on the semantic mismatch between "发明" as the subject and "贡现" as the object.
[0099] To enhance the position - awareness ability, the system adds position encoding to the input features. In implementation, fixed position encoding generated by sine and cosine functions can be used, or learnable position embeddings can be adopted. Position information is crucial for correctly understanding the relative positions of elements in the text sequence, especially for handling word - order errors.
[0100] Furthermore, the output of the attention layer undergoes projection transformation through a fully - connected layer to adjust the feature dimension, then is added to the original input features (residual connection), and finally layer normalization is applied to obtain an enhanced context representation. This context - enhanced representation can better capture long - distance dependencies and complex semantic structures in the text.
[0101] Thus, the core advantage of the context - aware attention mechanism in the embodiments of the present application is that it can capture long - distance dependencies in the text, especially having a significant effect on handling grammar errors and semantic errors that span multiple characters or words. Through this mechanism, the system can enhance the context of the representation at each position in the text, making it contain richer context semantic information.
[0102] In step S103, based on the enhanced context representation, at least one error character in the Chinese text data to be corrected is identified, and the error type corresponding to each error character is determined.
[0103] Among them, in some embodiments, the error types include at least one of spelling mistakes, similar-looking character mistakes, homophone mistakes, idiom mistakes, grammar mistakes, punctuation mistakes, and semantic incoherence.
[0104] Specifically, based on the enhanced context representation, the error character positions in the text are identified by an error detection module. The error detection adopts a sequence annotation mode, and each character position is classified into two categories (0 indicates correct, 1 indicates wrong).
[0105] Specifically, the enhanced context representation is input into a fully connected layer to obtain the logits of the binary classification, and then converted into a probability distribution through the softmax function. If the error probability at a certain position exceeds a preset threshold (default is 0.5), it is determined that there is an error at that position.
[0106] In an optimized embodiment, the system can dynamically adjust the detection threshold according to the requirements of different application scenarios. For example, for applications that require high accuracy, the preset threshold can be increased to 0.7 or higher; while for scenarios that pursue high recall rate, the preset threshold can be reduced to 0.3 or lower.
[0107] Furthermore, for the detected error positions, the specific error type is determined by an error type classification module. The error type classification is a multi-classification problem, and the system inputs the enhanced context representation into another classification head to predict the specific type of the error.
[0108] In one embodiment, the system supports the following 8 error types:
[0109] Spelling mistake: General writing of wrong characters, such as writing "tomorrow" as "明填";
[0110] Similar-looking character mistake: Confusion caused by similar-looking characters, such as writing "已经" as "己经";
[0111] Homophone mistake: Confusion caused by similar pronunciation, such as writing "起来" as "气来";
[0112] Idiom mistake: Improper use of idioms, such as writing "无动于衷" as "无动于忠";
[0113] Grammar mistake: Improper grammar structure, such as misuse of "的", "地", "得";
[0114] Punctuation mistake: Improper use of punctuation marks, such as mixing commas and periods;
[0115] Semantic incoherence: The sentence expression is not smooth or the semantics are contradictory;
[0116] Other errors: Other errors not categorized into the above types.
[0117] It should be noted that the determination of the error type is crucial for the subsequent generation of targeted thought chain reasoning. Different types of errors require different analysis strategies and correction methods.
[0118] In step S104, a chain thinking reasoning process is generated according to each incorrect character and the error type corresponding to each incorrect character.
[0119] Furthermore, in some embodiments, a chain thinking reasoning process is generated according to the error type corresponding to each incorrect character, including: obtaining the context information of each incorrect character, and inferring the error cause of each incorrect character based on the context information of each incorrect character; determining the error type complexity and context complexity corresponding to each incorrect character according to the error type corresponding to each incorrect character and the context information of each incorrect character; determining the target thinking chain template according to the error type complexity and context complexity corresponding to each incorrect character; filling in the target thinking chain template according to the context information of each incorrect character, the predicted correction candidates and the error cause of each incorrect character to generate a chain thinking reasoning process.
[0120] In a specific embodiment, the chain thinking reasoning generation module first obtains the error character, position and type information, and then combines the language knowledge base and context information to generate a structured reasoning process.
[0121] Among them, the structure of the chain thinking reasoning generation module is as follows Figure 2 As shown, it includes: a language knowledge base, which includes a knowledge base of similar-looking characters, a knowledge base of similar-sounding characters, an idiom dictionary, a word collocation dictionary and a professional terminology dictionary; an error analysis component, which infers the cause and type of the error based on the language knowledge base and context features; a thinking chain template library, which includes multi-level thinking chain templates, and the multi-level thinking chain templates are divided into basic templates and advanced templates according to the error type and complexity; dynamically selects the appropriate thinking chain template based on the error type and error complexity; fills in the selected thinking chain template according to the error context, error characters, correction characters and inferred error causes, and generates a thinking chain error correction basis containing reasoning steps.
[0122] Exemplarily, the language knowledge base contains multiple sub-knowledge bases, including a knowledge base of similar-looking characters, a knowledge base of similar-sounding characters, an idiom dictionary, a collocation dictionary, and a professional terminology dictionary, etc. These knowledge bases provide the necessary linguistic knowledge support for thought chain reasoning.
[0123] The method for constructing a language knowledge base includes:
[0124] Build a knowledge base of similar - shaped characters, collect pairs of Chinese characters with similar glyphs, and calculate the glyph similarity;
[0125] Build a knowledge base of near - homophone characters, and collect Chinese characters with similar pronunciations grouped by pinyin or phonetic notations;
[0126] Build an idiom dictionary, collect common idioms and their meanings, usages, and error - prone forms;
[0127] Build a collocation dictionary of words, and record the correct collocation relationships of common words;
[0128] Build a dictionary of technical terms, collect technical terms in various fields and their standard spellings;
[0129] The language knowledge base is used for error type inference, thinking chain generation, and providing correction candidates.
[0130] For example, the knowledge base of similar - shaped characters records pairs of Chinese characters with similar shapes, such as "已" and "己", "土" and "士", etc.; the knowledge base of near - homophone characters records Chinese characters with similar pronunciations, such as "的", "地", "得", etc.; the idiom dictionary includes common idioms and their meanings, usages, and common error forms.
[0131] Based on the error type and the context information of each error character, first conduct an error complexity assessment. The complexity assessment considers two factors: the complexity of the error type (idiom errors and grammar errors usually have higher complexity) and the context complexity (sentence length, structural complexity, etc.).
[0132] Among them, the error complexity is determined through the following steps:
[0133] First, analyze the error type, and determine idiom errors, grammar errors, and semantic - incoherence errors as high - complexity errors;
[0134] Second, analyze the structural complexity of the error context, including sentence length, the number of punctuation marks, and the depth of nested structures;
[0135] Third, comprehensively consider the error type and context complexity to determine the complexity level of the error;
[0136] Finally, the thinking chain reasoning generation module selects a basic template or an advanced template according to the determined error complexity level.
[0137] Specifically, according to the evaluated complexity, select a suitable target thinking chain template from the thinking chain template library. In one embodiment, the template library includes two types: basic templates and advanced templates. The basic template has a relatively simple structure and is applicable to spelling errors, similar - shaped / near - homophone character errors, etc.; the advanced template includes more detailed analysis steps and is applicable to complex error types such as idiom errors and grammar errors.
[0138] Fill in the selected target thinking chain template based on the error context, error characters, corrected characters, and inferred error reasons to generate a complete thinking chain reasoning process. The thinking chain usually includes links such as error phenomenon description, context analysis, reason inference, candidate solution generation, final selection, and reasons.
[0139] It should be noted that for different types of errors, the thinking chain template has different structures:
[0140] For spelling errors, the thinking chain template includes context analysis, listing of candidate correct characters, and reasons for the final selection; for similar-shaped character errors, the thinking chain template includes analysis of shape similarity, explanation of confusing parts, and reasons for the correct selection; for near-homophone errors, the thinking chain template includes analysis of pronunciation similarity, explanation of semantic differences, and reasons for the correct selection; for idiom errors, the thinking chain template includes idiom recognition, comparison with similar idioms, explanation of idiom meanings, and reasons for the correct selection; for grammar errors, the thinking chain template includes grammar rule explanation, error analysis, and correct expression forms; for semantic incoherence errors, the thinking chain template includes broader context semantic analysis, reasons for incoherence, and semantic explanation after modification.
[0141] Exemplarily, for the similar-shaped character error "提搞工作效率" (should be "提高工作效率"), the thinking chain generated by the system may be:
[0142] "Analysis detected a similar-shaped character error: the character '搞' at the position
[0143] ↓ Analyze the context and semantics
[0144] The context indicates that here it needs to express the meaning of "improving work efficiency"
[0145] ↓ Consider possible correct options
[0146] Based on the context and semantics, the possible correct characters are: 高, 升, 增
[0147] ↓ Determine the best choice
[0148] The most appropriate one should be '高'
[0149] ↓ Verify the result
[0150] After changing '搞' to '高', the sentence becomes "我们需要提高工作效率" (We need to improve work efficiency), which meets the semantic requirements
[0151] Conclusion: The character '搞' at this position is a similar-shaped character error and should use '高' because '提高' is the correct collocation of words, indicating the meaning of promotion and increase.
[0152] In step S105, each incorrect character is corrected according to the thought chain reasoning process and the enhanced context representation to obtain a corrected text and a thought chain error correction basis corresponding to the corrected text.
[0153] Furthermore, in some embodiments, each erroneous character is corrected to obtain a corrected text, including: based on the enhanced context representation, mapping each erroneous character to a preset word table space, obtaining a character prediction probability distribution for each erroneous character, and selecting a preset number of characters with the highest probability from the character distribution probability as a first candidate correction item; generating a second candidate correction item from a thought chain reasoning process, and obtaining a candidate correction set based on the first candidate correction item and the second candidate correction item; calculating a rationality score for each candidate item in the candidate correction set based on a preset language knowledge base; determining at least one target correction character based on the character prediction probability distribution of each erroneous character and the rationality score of each candidate item; and replacing each erroneous character with the at least one target correction character to generate a corrected text.
[0154] Specifically, the correction prediction module combines the thought chain reasoning process with the enhanced context representation to perform the final correction on the detected errors. First, based on the enhanced context representation, the features of each error position are mapped to the vocabulary space through a fully connected layer, and the character prediction probability distribution for each error position is obtained. From this character prediction probability distribution, the top K characters with the highest probability are selected as the first candidate correction items. Simultaneously, the second candidate correction items generated by the thought chain reasoning process are extracted and combined to form a complete candidate correction set.
[0155] In one embodiment, a plausibility score is calculated for each candidate in the candidate set based on a linguistic knowledge base. This plausibility assessment considers multiple factors, including semantic coherence, collocational conventions, and word frequency. For example, for idiom errors, the system prioritizes characters in the corresponding position in the correct idiom; for similar-looking or similar-sounding character errors, the system considers the semantic fit between the candidate character and the context.
[0156] Furthermore, the system combines the character distribution probability and rationality score to select the optimal correction character to replace the incorrect character in the original text, generating the corrected text. Finally, the corrected text and the corresponding thought chain correction basis are output, making it easier for users to understand the correction process and basis.
[0157] In addition, the Chinese text error correction method based on context-integrated thinking chain in the embodiment of the present application also includes constructing a multi-task joint loss function, specifically including:
[0158] False detection loss, which calculates the difference between the false detection result and the true label through the cross entropy loss function;
[0159] Error type classification loss, which calculates the difference between the error type prediction and the actual error type through the cross entropy loss function;
[0160] Correction prediction loss, which calculates the difference between the corrected character prediction and the true corrected character through the cross entropy loss function;
[0161] Thought chain generation loss, which calculates the difference between the thought chain encoding representation and the target representation through the mean square error loss function;
[0162] Contrastive learning loss, which calculates the contrast between the incorrect text representation and the correct text representation through cosine similarity;
[0163] Therefore, by comprehensively weighting the various losses, a multi-task joint loss function is constructed for end-to-end training of the model.
[0164] Furthermore, the calculation steps of contrastive learning loss include: extracting feature representations of error positions in error text as anchor samples; extracting feature representations of the same positions in the corresponding correct text as positive samples; extracting feature representations of other positions or other texts in the batch as negative samples; calculating the cosine similarity between the anchor samples and the positive samples, and the cosine similarity between the anchor samples and each negative sample; adjusting the similarity distribution based on the temperature parameter and constructing a contrastive learning objective function; maximizing the similarity between the anchor samples and the positive samples, while minimizing the similarity between the anchor samples and the negative samples.
[0165] In order to facilitate those skilled in the art to more clearly and intuitively understand the Chinese text error correction method based on context fusion thinking chain proposed in this application, the following is combined with Figure 3 , taking the Chinese text error correction method based on context fusion thinking chain executed by the terminal as an example, the Chinese text error correction method based on context fusion thinking chain provided by the embodiment of the present invention is introduced. Figure 3 , Figure 3 A flowchart of a Chinese text error correction method based on context-integrated thinking chains provided by an embodiment of the present invention is shown. The method includes the following steps:
[0166] S301, obtaining Chinese text data to be corrected.
[0167] S302 , performing feature encoding on the Chinese text to be corrected based on a pre-trained Chinese language model to obtain an initial context representation of the text sequence.
[0168] S303 , performing multi-granularity feature fusion, fusing the character-level features of the text sequence with the word-level features obtained through word segmentation, and generating a fused context representation.
[0169] S304: Apply a context-aware attention mechanism to enhance the fused context representation, capture long-distance dependencies, and generate an enhanced context representation.
[0170] S305 , based on the enhanced context representation, performing binary classification on each character position in the text through an error detection module, identifying the erroneous character position, and outputting an error detection result.
[0171] S306: For each identified erroneous character position, determine its error type through an error type classification module.
[0172] S307, for each detected error, based on the chain thinking reasoning generation module, dynamically generate a thinking chain reasoning process according to the error type, error context and language knowledge base.
[0173] S308, combining the thought chain reasoning process with the enhanced context representation, correcting each detected error through the correction prediction module, and generating a corrected text and a corresponding thought chain error correction basis.
[0174] The following introduces a Chinese text error correction system based on context-fusion thinking chain involved in the Chinese text error correction method based on context-fusion thinking chain in an embodiment of the present application.
[0175] Specifically, the Chinese text error correction system based on context-fusion thinking chain is based on the core technical method of the present invention, that is, the Chinese text error correction method based on context-fusion thinking chain, which realizes the complete processing flow from text input to error detection, analysis and correction, and provides users with high-precision and explainable Chinese text error correction services. Figure 4 As shown in the figure, the system adopts a layered architecture design, with each functional layer working closely together to form an efficient error correction processing pipeline. The system mainly includes the following core modules:
[0176] The input layer receives various forms of text to be corrected. It supports single-text input, batch processing, and file import. It also performs text encoding normalization and preprocessing to provide standardized input for subsequent processing. The encoding layer integrates a pretrained language model, a word segmentation module, and a feature encoding unit to convert the input text into a high-dimensional semantic representation and construct an initial feature space. The core processing layer is the key technical implementation area of the system. It includes two core functional units: multi-granularity feature fusion and context-aware attention. It generates enhanced contextual representations through dynamic fusion of word-level features and modeling of long-range dependencies. The error handling layer performs precise error localization and classification, identifying various types of errors in the text through binary classification detection and multi-classification analysis. The knowledge base layer provides external knowledge support for the system, integrating knowledge resources from multiple languages and thought chain templates to provide the necessary basis for the reasoning process. The output layer is responsible for result presentation and user interaction, providing various forms of error correction result display and interface services.
[0177] Among them, the structure of the multi-granularity feature fusion module is as follows Figure 5 As shown in the figure, the character-level features are mapped to the feature space through the character-level feature projection layer; the word-level features are mapped to the same feature space as the character-level features through the word-level feature projection layer; the temporal alignment of the word-level features to the character-level features is achieved through linear interpolation or attention mechanism; the feature fusion weights of the character-level features and the aligned word-level features are calculated; the feature fusion weights are obtained through a gating mechanism based on splicing features; the character-level features and the aligned word-level features are weightedly fused based on the feature fusion weights to obtain a fused context representation, and residual connection and layer normalization are applied to the fused context representation to ensure the stability of the features.
[0178] Furthermore, the context-aware attention mechanism includes: constructing a multi-head self-attention layer, which contains multiple attention heads, and each attention head independently calculates the attention weight between the query vector, key vector and value vector; adding position encoding to the text sequence to incorporate position information; projecting the output of the multi-head self-attention layer through a fully connected layer; applying residual connection to add the projected features to the original input features; applying layer normalization to the added features to improve feature stability and obtain enhanced context representation.
[0179] In order to realize the practical deployment and user-friendly interaction of the system, the present invention designs a complete interface interaction and user experience process. Figure 6As shown, the system provides an intuitive and user-friendly web interface for text correction and result review. The interface design features clear divisions and a well-organized functional layout, including a text input area, a parameter setting area, a result display area, and a thought chain analysis area. Users can submit text to be corrected in the input area and adjust detection thresholds and thought chain generation options in the parameter area. After real-time processing, the system highlights errors and corrections in the results area and displays a structured error analysis process in the thought chain area, enabling users to clearly understand the correction basis and reasoning logic.
[0180] The system implements a standardized RESTful API interface design, supporting single-text error correction and batch processing, facilitating integration with third-party applications. The interface uses JSON format for data exchange, and responses include complete information such as the original text, correction results, error list, and thought chain analysis, meeting system integration requirements in various scenarios.
[0181] In practical applications, this system can be widely applied in various scenarios. In the field of intelligent writing assistance, the system can be integrated into online document editors to provide users with real-time error correction suggestions and error analysis. In the field of education, the system can serve as an auxiliary tool for Chinese writing teaching, helping students improve their writing quality and language comprehension. In the fields of professional publishing and content production, the system can significantly improve the efficiency and quality of text proofreading and reduce the cost of manual proofreading.
[0182] The system of this invention adopts a modular design, with functional units connected via standardized interfaces, offering excellent scalability and flexibility. The system can be configured and adjusted based on actual application needs, supporting deployments of varying scales and scenarios, from lightweight deployments for individual users to high-concurrency cluster deployments at the enterprise level, meeting the performance requirements of various application scenarios.
[0183] Through the implementation of the aforementioned system, this invention achieves three core technological breakthroughs in the field of Chinese text error correction technology: First, a multi-granularity feature fusion mechanism dynamically integrates and enhances word-level semantic features, significantly improving the ability to detect complex semantic errors; second, a context-aware attention mechanism effectively captures long-range dependencies, enhancing the system's accuracy in understanding grammatical structure and context; and finally, chained reasoning technology provides a clear and traceable analysis path for the error correction process, breaking through the "black box" limitations of traditional error correction systems and making the correction results highly interpretable and trustworthy. These technological innovations work together to create a Chinese text error correction solution with both theoretical depth and practical value.
[0184] Through the above description of the embodiments, those skilled in the art will clearly understand that the various embodiments of the present invention can be implemented via software or through dedicated hardware design. The technical solution of the present invention, through innovative interdisciplinary integration, organically blends deep neural network technology with symbolic reasoning systems, achieving an excellent balance between language processing accuracy and system interpretability, providing a new theoretical perspective and practical path for the development of language artificial intelligence technology.
[0185] According to the Chinese text error correction method based on context-fused thought chain according to the embodiment of the present application, the Chinese text data to be corrected is feature-encoded, multi-granularity feature fusion is performed, and the context representation is enhanced. The position of the erroneous character is detected and the error type is determined based on the enhanced context representation; the error analysis process is dynamically generated; the error is corrected in combination with the thought chain reasoning process, and the corrected text and the corresponding thought chain error correction basis are generated. Thus, through the innovative combination of multi-granularity feature fusion and thought chain reasoning, not only the accuracy of Chinese text error correction is improved, especially the processing capability of complex error types, but also the interpretability of the error correction process is achieved, providing users with a clear and understandable error correction basis, significantly improving the practicality and user experience of the error correction system.
[0186] Next, a Chinese text error correction device based on context-integrated thinking chains proposed in accordance with an embodiment of the present application will be described with reference to the accompanying drawings.
[0187] Figure 7 It is a block diagram of a Chinese text error correction device based on context-fusion thinking chain according to an embodiment of the present application.
[0188] like Figure 7 As shown, the Chinese text error correction device 10 based on context-integrated thinking chain includes: an acquisition module 100, a processing module 200, a recognition module 300, a generation module 400 and a correction module 500.
[0189] Among them, the acquisition module 100 is used to acquire the Chinese text data to be corrected, and perform feature encoding on the Chinese text data to be corrected to obtain an initial context representation; the processing module 200 is used to extract the character-level features of the Chinese text data to be corrected based on the initial context representation, and perform word segmentation on the Chinese text data to be corrected, extract the word-level features of the Chinese text data to be corrected, fuse the character-level features and the word-level features to generate a fused context representation, and enhance the fused context representation to obtain an enhanced context representation; the recognition module 300 is used to identify at least one erroneous character in the Chinese text data to be corrected based on the enhanced context representation, and determine the error type corresponding to each erroneous character; the generation module 400 is used to generate a chain thinking reasoning process according to each erroneous character and the error type corresponding to each erroneous character; the correction module 500 is used to correct each erroneous character according to the thinking chain reasoning process and the enhanced context representation, and obtain the corrected text and the thinking chain correction basis corresponding to the corrected text.
[0190] Furthermore, in some embodiments, the processing module 200 is used to: map character-level features to a preset feature space, and map word-level features to a preset feature space, and based on a preset linear interpolation strategy, align the time sequence of the mapped word-level features with the mapped character-level features to obtain aligned word-level features; calculate the feature fusion weights of the mapped character-level features and the aligned word-level features, and perform weighted fusion of the mapped character-level features and the aligned word-level features based on the feature fusion weights to obtain a fused context representation.
[0191] Furthermore, in some embodiments, the generation module 400 is used to: obtain the context information of each erroneous character, and infer the error cause of each erroneous character based on the context information of each erroneous character; determine the error type complexity and context complexity corresponding to each erroneous character according to the error type corresponding to each erroneous character and the context information of each erroneous character; determine the target thinking chain template according to the error type complexity and context complexity corresponding to each erroneous character; fill in the target thinking chain template according to the context information of each erroneous character, the predicted correction candidate and the error cause of each erroneous character, and generate a chain thinking reasoning process.
[0192] Furthermore, in some embodiments, the correction module 500 is used to: map each erroneous character to a preset word table space based on the enhanced context representation, obtain a character prediction probability distribution for each erroneous character, and select a preset number of characters with the highest probability from the character distribution probability as a first candidate correction item; generate a second candidate correction item from the thought chain reasoning process, and obtain a candidate correction set based on the first candidate correction item and the second candidate correction item; calculate the rationality score of each candidate item in the candidate correction set based on a preset language knowledge base; determine at least one target correction character based on the character prediction probability distribution of each erroneous character and the rationality score of each candidate item; and replace each erroneous character with at least one target correction character to generate a corrected text.
[0193] Furthermore, in some embodiments, the error type includes at least one of a spelling error, an error in a similar-looking character, an error in a similar-sounding character, an idiom error, a grammatical error, a punctuation error, and a lack of semantics.
[0194] It should be noted that the above explanation of the embodiment of the Chinese text error correction method based on context fusion thinking chain is also applicable to the Chinese text error correction device based on context fusion thinking chain of this embodiment, and will not be repeated here.
[0195] According to the Chinese text error correction device based on context-fused thought chain of the embodiment of the present application, the Chinese text data to be corrected is feature-encoded, multi-granularity feature fusion is performed, and the context representation is enhanced. The position of the erroneous character is detected and the error type is determined based on the enhanced context representation; the error analysis process is dynamically generated; the error is corrected in combination with the thought chain reasoning process, and the corrected text and the corresponding thought chain error correction basis are generated. Thus, through the innovative combination of multi-granularity feature fusion and thought chain reasoning, not only the accuracy of Chinese text error correction is improved, especially the processing capability of complex error types, but also the interpretability of the error correction process is achieved, providing users with a clear and understandable error correction basis, significantly improving the practicality and user experience of the error correction system.
[0196] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include:
[0197] A memory 801 , a processor 802 , and a computer program stored in the memory 801 and executable on the processor 802 .
[0198] When the processor 802 executes the program, the Chinese text error correction method based on context-fusion thinking chain provided in the above embodiment is implemented.
[0199] Furthermore, the electronic device further includes:
[0200] The communication interface 803 is used for communication between the memory 801 and the processor 802 .
[0201] The memory 801 is used to store computer programs that can be run on the processor 802.
[0202] The memory 801 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0203] If the memory 801, the processor 802, and the communication interface 803 are implemented independently, the communication interface 803, the memory 801, and the processor 802 can be connected to each other via a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0204] Optionally, in a specific implementation, if the memory 801, the processor 802 and the communication interface 803 are integrated on a chip, the memory 801, the processor 802 and the communication interface 803 can communicate with each other through an internal interface.
[0205] The processor 802 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0206] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned Chinese text error correction method based on context-fusion thinking chain.
[0207] An embodiment of the present application also provides a computer program product, including a computer program, which is executed by a processor to implement the above-mentioned Chinese text error correction method based on context-fusion thinking chain.
[0208] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.
[0209] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features. Throughout the description of this application, "plurality" means at least two, for example, two, three, etc., unless otherwise specifically defined.
[0210] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A Chinese text error correction method based on context-integrated thinking chain, characterized by: The following steps are involved: Acquiring Chinese text data to be corrected, and performing feature encoding on the Chinese text data to be corrected to obtain an initial context representation; Based on the initial context representation, extracting character-level features of the Chinese text data to be corrected, performing word segmentation processing on the Chinese text data to be corrected, extracting word-level features of the Chinese text data to be corrected, fusing the character-level features with the word-level features to generate a fused context representation, and enhancing the fused context representation to obtain an enhanced context representation; Based on the enhanced context representation, identifying at least one erroneous character in the Chinese text data to be corrected, and determining an error type corresponding to each erroneous character; Generate a chain thinking reasoning process according to each incorrect character and the error type corresponding to each incorrect character; According to the thought chain reasoning process and the enhanced context representation, each erroneous character is corrected to obtain a corrected text and a thought chain error correction basis corresponding to the corrected text.
2. The Chinese text error correction method based on context-integrated thinking chain according to claim 1 is characterized in that: The fusing of the character-level features and the word-level features to generate a fused context representation includes: Mapping the character-level features to a preset feature space, and mapping the word-level features to the preset feature space, and aligning the time sequence of the mapped word-level features with the mapped character-level features based on a preset linear interpolation strategy to obtain aligned word-level features; The feature fusion weight of the mapped character-level features and the aligned word-level features is calculated, and the mapped character-level features and the aligned word-level features are weightedly fused based on the feature fusion weight to obtain the fused context representation.
3. The Chinese text error correction method based on context-integrated thinking chain according to claim 1 is characterized in that: Generating a chain thinking reasoning process according to the error type corresponding to each incorrect character includes: Obtaining context information of each erroneous character, and inferring an error cause of each erroneous character based on the context information of each erroneous character; Determining the error type complexity and context complexity corresponding to each erroneous character according to the error type corresponding to each erroneous character and the context information of each erroneous character; Determining a target thought chain template according to the error type complexity corresponding to each incorrect character and the context complexity; According to the context information of each erroneous character, the predicted correction candidate and the error cause of each erroneous character, the target thinking chain template is filled in to generate the chain thinking reasoning process.
4. The Chinese text error correction method based on context-integrated thinking chain according to claim 1 is characterized in that: The step of correcting each erroneous character to obtain a corrected text includes: Based on the enhanced context representation, each incorrect character is mapped to a preset word table space to obtain a character prediction probability distribution for each incorrect character, and a preset number of characters with the highest probability are selected from the character distribution probabilities as first candidate correction items; generating a second candidate correction item from the thought chain reasoning process, and obtaining a candidate correction set based on the first candidate correction item and the second candidate correction item; Calculating a rationality score for each candidate item in the candidate correction set based on a preset language knowledge base; Determining at least one target corrected character based on the character prediction probability distribution of each incorrect character and the rationality score of each candidate; Each of the erroneous characters is replaced by the at least one target corrected character to generate the corrected text.
5. The Chinese text error correction method based on context-integrated thinking chain according to any one of claims 1 to 4, characterized in that: The error type includes at least one of a spelling error, an error in a similar-looking character, an error in a similar-sounding character, an idiom error, a grammatical error, a punctuation error, and a lack of semantics.
6. A Chinese text error correction device based on context-integrated thinking chain, characterized in that: include: An acquisition module, configured to acquire Chinese text data to be corrected, and perform feature encoding on the Chinese text data to be corrected to obtain an initial context representation; a processing module, configured to extract character-level features of the Chinese text data to be corrected based on the initial context representation, perform word segmentation on the Chinese text data to be corrected, extract word-level features of the Chinese text data to be corrected, fuse the character-level features with the word-level features to generate a fused context representation, and enhance the fused context representation to obtain an enhanced context representation; an identification module, configured to identify at least one erroneous character in the Chinese text data to be corrected based on the enhanced context representation, and determine an error type corresponding to each erroneous character; A generating module, configured to generate a chain thinking reasoning process according to each incorrect character and the error type corresponding to each incorrect character; The correction module is used to correct each erroneous character according to the thought chain reasoning process and the enhanced context representation, and obtain the corrected text and the thought chain error correction basis corresponding to the corrected text.
7. The Chinese text error correction device based on context-integrated thinking chain according to claim 6 is characterized in that: The processing module is used to: Mapping the character-level features to a preset feature space, and mapping the word-level features to the preset feature space, and aligning the time sequence of the mapped word-level features with the mapped character-level features based on a preset linear interpolation strategy to obtain aligned word-level features; The feature fusion weight of the mapped character-level features and the aligned word-level features is calculated, and the mapped character-level features and the aligned word-level features are weightedly fused based on the feature fusion weight to obtain the fused context representation.
8. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the Chinese text error correction method based on context-fusion thinking chain as described in any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer program is executed by a processor to implement the Chinese text error correction method based on context-integrated thinking chains as described in any one of claims 1 to 5.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the Chinese text error correction method based on context-fusion thinking chain as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Artificial intelligence-based text error correction method and device and computer readable medium
CN108052499A
Fusion language model generation method and device, word error correction method and electronic equipment
CN112651230A
Multi-granularity Chinese text error correction method and device
CN116127952A
Text error correction method, system and equipment and storage medium
CN116822464A
Chinese spelling error correction model training method and storage medium
CN118133813A
Cited By
Large model training method, system and equipment for low-code development and medium
CN121031672A
A large model training method, system, device and medium for low-code development
CN121031672B