Text error correction method and device based on large model, equipment and medium

By combining BERT model and large detection model, combined with preset components and format verification devices, the accuracy and adaptability of professional text error correction are solved, and high-quality text error correction effects are achieved.

CN120373293APending Publication Date: 2025-07-25SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510520856.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

When faced with professional text error correction technology, especially medical and legal documents, it is difficult to meet the requirements of error correction accuracy and adaptability. Ordinary text error correction solutions have problems of misjudgment and limited coverage.

Method used

The BERT model is used to combine preset grammar, spelling and comprehensive error detection large models, initial error correction is performed through preset components, and simple errors are recognized and corrected using regular expressions and N-gram language models. The field adaptation layer is used to accurately correct professional terms, and the specific information format is corrected through a format verifier.

Benefits of technology

It improves the accuracy and reliability of text error correction, ensures that errors in professional text are accurately positioned and repaired, while maintaining the professionalism and semantic consistency of the text, meeting the needs of diverse application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120373293A_ABST
    Figure CN120373293A_ABST
Patent Text Reader

Abstract

The invention discloses a text error correction method and device based on a large model, equipment and a medium, and relates to the technical field of artificial intelligence, and the method comprises the steps: obtaining a to-be-corrected text inputted by a user side, and carrying out the initial error correction of the to-be-corrected text based on a preset component, so as to obtain a first to-be-corrected text; analyzing the first to-be-corrected text by using the BERT model to locate an expected error existence position in the first to-be-corrected text, and detecting the text corresponding to the expected error existence position based on a preset grammar detection large model, a preset spelling detection large model and a preset comprehensive error detection large model to obtain error information, generating an error correction scheme corresponding to the error information, and performing error correction on the first to-be-corrected text according to the error correction scheme to obtain a second to-be-corrected text; and detecting the format of the specific information in the second to-be-corrected text to obtain format error information, and correcting the specific information in the second to-be-corrected text based on the format error information to obtain a corrected target text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and particularly to a text error correction method, device, equipment and medium based on a large model. Background Art

[0002] In the field of natural language processing, text error correction technology has been evolving with the development of NLP (Natural Language Processing) technology and deep learning models. In the early stage, rule-based text error correction methods dominated, which relied on manually written language rules and dictionaries to detect and correct errors. However, facing complex language phenomena, their limitations were obvious, being difficult to handle effectively and having a limited coverage. With the rise of data-driven methods, statistical model-based text error correction methods gradually became mainstream, such as Hidden Markov Models, Conditional Random Fields, etc. These methods correct errors by analyzing statistical patterns in large-scale corpora. However, they still perform poorly when dealing with complex grammar structures and long-distance dependencies. In recent years, large models have been widely used in text error correction, but most current text error correction solutions on the market overly rely on the inherent capabilities of large models and lack in-depth optimization for different application scenarios. In actual use, when facing professional field texts (such as medical and legal documents), due to complex professional terms and unique language styles, ordinary text error correction solutions are difficult to meet the requirements, and there are problems such as inaccurate error correction and misjudgment of professional vocabulary. Summary of the Invention

[0003] In view of this, the purpose of this application is to provide a text error correction method, device, equipment and medium based on a large model, which improves the accuracy and reliability of text error correction by optimizing the technical process to meet diverse actual application requirements. The specific solutions are as follows:

[0004] In the first aspect, this application provides a text error correction method based on a large model, including:

[0005] Obtain the text to be error-corrected input by the client, and perform initial error correction on the text to be error-corrected based on a preset component to obtain a first text to be error-corrected;

[0006] Use the BERT model to analyze the first text to be error-corrected to locate the positions where expected errors exist in the first text to be error-corrected, detect the text corresponding to the positions where expected errors exist based on a preset grammar detection large model, a preset spelling detection large model and a preset comprehensive error detection large model to obtain error information, generate an error correction plan corresponding to the error information, and correct the first text to be error-corrected according to the error correction plan to obtain a second text to be error-corrected;

[0007] Detect the format of specific information in the second text to be error-corrected to obtain format error information, and correct the specific information in the second text to be error-corrected based on the format error information to obtain the target text after error correction; the specific information includes date information and amount information.

[0008] Optionally, the initial error correction of the text to be error-corrected based on a preset component to obtain the first text to be error-corrected includes:

[0009] Identify duplicate information in the text to be error-corrected by using a preset symbol expression and a preset character expression defined by a regular expression through a preset rule engine to correct the duplicate information; the preset rule engine is used to perform initial error correction on the text to be error-corrected according to preset rules; the duplicate information includes punctuation mark duplicate information and character duplicate information;

[0010] Remove sensitive words from the text after correcting duplicate information by using sensitive word pairs defined in a custom word list through the preset rule engine;

[0011] Perform spelling error detection on the text after removing sensitive words based on an N-gram language model to correct the detected spelling errors, and correct similar-looking characters with errors in the text through the N-gram language model by using a preset character confusion matrix to obtain the first text to be error-corrected; the preset character confusion matrix is used to calculate the replacement probability between preset common similar-looking characters to determine whether the similar-looking characters in the text need to be replaced based on the replacement probability.

[0012] Optionally, the analysis of the first text to be error-corrected by using a BERT model to locate the position where an expected error exists in the first text to be error-corrected includes:

[0013] Analyze the first text to be error-corrected based on a BERT model trained on a preset data set, and assign a preset high attention weight to the text where an expected error appears in the first text to be error-corrected. Display the text with the preset high attention weight through visualization technology to locate the position where an expected error exists in the first text to be error-corrected.

[0014] Optionally, the detection of the text corresponding to the position where an expected error exists based on a preset grammar detection large model, a preset spelling detection large model, and a preset comprehensive error detection large model to obtain error information, and generate an error correction scheme corresponding to the error information. Correct the first text to be error-corrected according to the error correction scheme to obtain the second text to be error-corrected, including:

[0015] The large model for preset grammar detection detects the text corresponding to the position where the expected error exists, so as to obtain grammar error information and generate a corresponding grammar correction plan;

[0016] The large model for preset spelling detection detects the text corresponding to the position where the expected error exists, so as to obtain spelling error information and generate a corresponding spelling correction plan;

[0017] The large model for preset comprehensive error detection detects the text corresponding to the position where the expected error exists, so as to obtain comprehensive error information other than the grammar error information and the spelling error information and generate a corresponding comprehensive error correction plan;

[0018] Based on the grammar correction plan, the spelling correction plan, and the comprehensive error correction plan, determine the target correction plan corresponding to each error-prone sentence in the first text to be corrected; where at least one target correction plan corresponds to one error-prone sentence;

[0019] For any error-prone sentence, determine the target sentence after the error-prone sentence is corrected by the corresponding target correction plans, and based on the error-prone sentence and the target sentence, determine the perplexity and semantic similarity corresponding to each target sentence, determine the comprehensive score corresponding to each target sentence according to the perplexity and the semantic similarity, and use the target sentence with the highest comprehensive score as the final target sentence, and correct the first text to be corrected based on the final target sentence to obtain a second text to be corrected;

[0020] Among them, the perplexity corresponding to the target sentence is determined based on a preset language model; the semantic similarity corresponding to the target sentence is determined based on the Sentence-BERT model.

[0021] Optionally, detecting the format of specific information in the second text to be corrected to obtain format error information, and correcting the specific information in the second text to be corrected based on the format error information includes:

[0022] Based on a preset format validator, detect the date information and amount information in the second text to be corrected to obtain date format error information and amount format error information, and correct the date information and the amount information according to the corresponding format standards based on the date format error information and the amount format error information.

[0023] Optionally, after correcting the date information and the amount information according to the corresponding format standards based on the date format error information and the amount format error information, it further includes:

[0024] Perform a punctuation balancing operation on the second text to be corrected after format error correction to obtain the target text; wherein, the punctuation balancing operation is used to ensure that quotation marks and parentheses appear in pairs.

[0025] Optionally, the large model-based text error correction method further includes:

[0026] Obtain the feedback from the client for the corrected target text, and update the preset grammar detection large model, the preset spelling detection large model, and the preset comprehensive error detection large model based on the feedback.

[0027] In a second aspect, the present application provides a large model-based text error correction device, including:

[0028] A text preprocessing module, configured to obtain the text to be corrected input by the client, and perform initial error correction on the text to be corrected based on a preset component to obtain a first text to be corrected;

[0029] A text core error correction module, configured to analyze the first text to be corrected by using a BERT model to locate the position where the expected error exists in the first text to be corrected, detect the text corresponding to the position where the expected error exists based on a preset grammar detection large model, a preset spelling detection large model, and a preset comprehensive error detection large model to obtain error information, generate an error correction scheme corresponding to the error information, correct the first text to be corrected according to the error correction scheme, and obtain a second text to be corrected;

[0030] A text postprocessing module, configured to detect the format of specific information in the second text to be corrected to obtain format error information, and correct the specific information in the second text to be corrected based on the format error information to obtain the corrected target text; the specific information includes date information and amount information.

[0031] In a third aspect, the present application provides an electronic device, including:

[0032] A memory, configured to store a computer program;

[0033] A processor, configured to execute the computer program to implement the foregoing large model-based text error correction method.

[0034] In a fourth aspect, the present application provides a computer-readable storage medium, configured to store a computer program, wherein the computer program, when executed by a processor, implements the foregoing large model-based text error correction method.

[0035] In this application, the text to be corrected input by the user terminal is obtained, and initial correction is performed on the text to be corrected based on a preset component to obtain a first text to be corrected; the BERT model is used to analyze the first text to be corrected to locate the position where the expected error exists in the first text to be corrected, and the text corresponding to the position where the expected error exists is detected based on a preset grammar detection large model, a preset spelling detection large model, and a preset comprehensive error detection large model to obtain error information, and a correction scheme corresponding to the error information is generated. The first text to be corrected is corrected according to the correction scheme to obtain a second text to be corrected; the format of specific information in the second text to be corrected is detected to obtain format error information, and the specific information in the second text to be corrected is corrected based on the format error information to obtain the corrected target text; the specific information includes date information and amount information. As can be seen from the above, this application first performs initial correction on the text to be corrected based on a preset component to obtain a first text to be corrected, quickly corrects simple errors in the text to be corrected through the preset component, reduces the load of subsequent model correction, and realizes the preprocessing of the text to be corrected; then, based on a preset grammar detection large model, a preset spelling detection large model, and a preset comprehensive error detection large model, various types of errors in the first text to be corrected are intelligently identified and corrected to accurately locate and modify subtle errors in complex contexts, and the core correction of the first text to be corrected is realized; finally, the specific information in the corrected second text to be corrected is corrected to further review and optimize the second text to be corrected to obtain the corrected target text, ensuring that all errors are correctly repaired and no new problems are introduced, and the post-processing of the second text to be corrected is realized. In this way, through the preprocessing, core correction, and post-processing of the text to be corrected input by the user terminal, the accuracy and reliability of the text correction project are generally improved, meeting the user's demand for high-quality text correction. Description of the Drawings

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the provided drawings.

[0037] Figure 1 Flowchart of a text correction method based on a large model disclosed in the present application;

[0038] Figure 2 Schematic diagram of a specific text correction disclosed in the present application;

[0039] Figure 3Schematic structural diagram of a text error correction device based on a large model disclosed in the present application;

[0040] Figure 4 Schematic structural diagram of an electronic device disclosed in the present application. Detailed implementation manners

[0041] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.

[0042] In the field of natural language processing, text error correction technology has evolved continuously with the development of NLP technology and deep learning models. In the early stage, rule-based text error correction methods dominated, but faced with complex language phenomena, they were difficult to handle effectively and had limited coverage. With the rise of data-driven methods, text error correction methods based on statistical models gradually became the mainstream. However, they still performed poorly when dealing with complex grammar structures and long-distance dependency relationships. In recent years, large models have been widely applied to text error correction, but most of the current text error correction solutions on the market overly rely on the inherent capabilities of large models and lack in-depth optimization for different application scenarios. Therefore, the present application provides a text error correction method based on a large model, which improves the accuracy and reliability of text error correction by optimizing the technical process to meet diverse practical application requirements.

[0043] See Figure 1 As shown, the embodiments of the present application disclose a text error correction method based on a large model, including:

[0044] Step S11: Obtain the text to be error-corrected input by the user side, and perform initial error correction on the text to be error-corrected based on a preset component to obtain a first text to be error-corrected.

[0045] In this embodiment, first, initial error correction is performed on the text to be corrected input by the user terminal based on a preset component to preprocess the text to be corrected. Specifically, first, the preset rule engine can use the preset symbol expression and preset character expression defined by regular expressions to identify duplicate information in the text to be corrected, so as to correct the duplicate information. Among them, the preset rule engine is used to perform initial error correction on the text to be corrected according to the preset rules. The duplicate information includes punctuation mark duplicate information and character duplicate information. Then, the preset rule engine uses the sensitive word pairs defined in the custom word list to remove sensitive words from the text after correcting the duplicate information. Further, based on the N-gram language model, spelling error detection is performed on the text after removing sensitive words, so as to correct the detected spelling errors, and the N-gram language model uses the preset character confusion matrix to correct the similar-looking characters with errors in the text, obtaining the first text to be corrected. Among them, the preset character confusion matrix is used to calculate the replacement probability between preset common similar-looking characters, so as to judge whether the similar-looking characters in the text need to be replaced based on the replacement probability.

[0046] It can be understood that in this embodiment, the text to be corrected is first preliminarily filtered by the preset rule engine. The core is the application of regular expressions. The application of regular expressions can efficiently identify and match strings in a specific format. Therefore, the preset symbol expression can be used to identify the repeated use of punctuation marks (such as!!), and the preset character expression can be used to identify the repeated occurrence of characters (such as "non-very-very"). On the other hand, regular expressions can also be used to identify dates and times (such as \d{4} year \d{1,2} month) to detect whether there are errors in dates and times. In addition, the introduction of the custom word list can enhance the flexibility and adaptability of the system. On the one hand, the sensitive words defined in the custom word list can effectively remove inappropriate or illegal content in the text. On the other hand, a white list of domain-specific nouns (such as medical and legal terms) can be defined in the custom word list to ensure that the professional vocabulary in the text will not be mismodified during the text error correction process based on the white list of domain-specific nouns in the custom word list.

[0047] Furthermore, the text can be detected for spelling errors based on the N-gram language model. The N-gram language model discovers potential spelling errors based on the statistical results of low-frequency combinations in a large-scale corpus. This method relies on pattern recognition in a large amount of real data and can effectively capture character combinations that are unlikely to appear. At the same time, the construction of a preset character confusion matrix provides additional error correction capabilities for similar characters. The preset character confusion matrix pre-calculates the replacement probability between common similar characters (for example, the probability of interchange between "未" and "末"), and determines whether the similar characters in the text need to be replaced based on the replacement probability, which helps to improve the accuracy of the N-gram language model in correcting text errors. Furthermore, the character confusion matrix can also be changed to a multi-level confusion matrix to improve the model's ability to identify and correct common writing errors based on the multi-level confusion matrix. For example, a multi-level confusion matrix is constructed, which contains multiple types of data such as similar characters, homophones, and stroke order errors. For example, "未" may be mistakenly written as "末" or "来", which is a typical case of similar characters; the confusion between "在" and "再" and "载" is a homophone problem; and for the case of "酒" being mistakenly written as "洒", it involves a stroke order error. By constructing a multi-level confusion matrix, the model can be effectively guided to learn how to distinguish and correct these common writing errors, thereby improving the accuracy and comprehensiveness of error correction.

[0048] Step S12: Analyze the first text to be corrected by using a BERT (Bidirectional Encoder Representations from Transformers) model to locate expected error locations in the first text to be corrected, detect the text corresponding to the expected error locations based on a preset grammar detection large model, a preset spelling detection large model, and a preset comprehensive error detection large model to obtain error information, generate an error correction scheme corresponding to the error information, correct the first text to be corrected according to the error correction scheme, and obtain a second text to be corrected.

[0049] In this embodiment, core error correction is performed on the first text to be error-corrected. Among them, using the BERT model to analyze the first text to be error-corrected to locate the position where the expected error exists in the first text to be error-corrected may include: analyzing the first text to be error-corrected based on the BERT model trained on a preset data set, and assigning a preset high attention weight to the text where an error is expected to occur in the first text to be error-corrected, and displaying the text with the preset high attention weight through visualization technology to locate the position where the expected error exists in the first text to be error-corrected. Then, the text corresponding to the position where the expected error exists can be detected by a preset grammar detection large model to obtain grammar error information and generate a corresponding grammar error correction scheme; the text corresponding to the position where the expected error exists can be detected by a preset spelling detection large model to obtain spelling error information and generate a corresponding spelling error correction scheme; the text corresponding to the position where the expected error exists can be detected by a preset comprehensive error detection large model to obtain comprehensive error information other than grammar error information and spelling error information and generate a corresponding comprehensive error correction scheme.

[0050] Furthermore, the target error correction scheme corresponding to each error-correction statement in the first text to be error-corrected can be determined based on the grammar error correction scheme, the spelling error correction scheme, and the comprehensive error correction scheme; among them, an error-correction statement corresponds to at least one target error correction scheme; for any error-correction statement, determine the target statement after the error-correction statement is corrected by the corresponding target error correction schemes, and determine the perplexity and semantic similarity corresponding to each target statement based on the error-correction statement and the target statement, determine the comprehensive score corresponding to each target statement according to the perplexity and semantic similarity, and use the target statement with the highest comprehensive score as the final target statement, and correct the first text to be error-corrected based on the final target statement to obtain the second text to be error-corrected; among them, the perplexity corresponding to the target statement can be determined based on a preset language model; the semantic similarity corresponding to the target statement can be determined based on the Sentence-BERT model.

[0051] It can be understood that in core error correction, the work of the error detection module is carried out first. A fine-tuned BERT model can be used and trained using the ConfusionSet data set. Among them, fine-tuning refers to further adjusting the model parameters on the basis of a pre-trained BERT model for a specific error correction task to make it more adaptable to the need of detecting text errors. The ConfusionSet data set contains various examples of easily confused word combinations, grammar errors, etc., which helps the model learn error patterns so that it can accurately locate the error position in the text. In this way, the BERT model can accurately locate the error position in the text. Using the attention mechanism of the BERT model, it is possible to intuitively display through visualization means which parts need to be focused on, thereby further refining the error location process.

[0052] Subsequent error correction generation modules can adopt a model integration strategy. For example, they can combine the advantages of a preset comprehensive error detection large model (such as the T5 model), a preset grammar detection large model (such as GPT-3.5 / 4, Generative Pre-Trained Transformer-3.5 / 4), and a preset spelling detection large model (such as the Seq2Seq model, i.e., the Sequence to Sequence model). Among them, the T5 model is good at open-ended generation of candidate corrections. It can generate various possible comprehensive error correction solutions according to the input error text, providing rich choices for error correction; GPT-3.5 / 4 can provide grammar optimization suggestions and generate grammar error correction solutions; the Seq2Seq model can perform targeted corrections for spelling errors and generate spelling error correction solutions. The three work together to provide a comprehensive and accurate error correction solution.

[0053] Based on the generated grammar error correction solution, spelling error correction solution, and comprehensive error correction solution, determine the target error correction solution corresponding to each error-prone statement in the first error-prone text. Then, determine the target statement after each error-prone statement is corrected by the corresponding target error correction solution. And based on the error-prone statement and the target statement, determine the perplexity and semantic similarity corresponding to each target statement. Among them, the perplexity of the target statement can be calculated based on a preset language model. The lower the perplexity, the more in line with language habits the statement is. The Sentence-BERT model can be used to calculate the semantic similarity between the target statement and the original error-prone statement to ensure that the corrected statement is semantically consistent with the original sentence. Finally, determine the final target statement corresponding to each error-prone statement according to the perplexity and semantic similarity, and correct the first error-prone text based on the final target statement to obtain the second error-prone text. In this way, it can be ensured that the corrected second error-prone text is not only closer to the standard language specification in form but also consistent with the original intention in meaning.

[0054] Step S13: Detect the format of specific information in the second error-prone text to obtain format error information, and correct the specific information in the second error-prone text based on the format error information to obtain the corrected target text; the specific information includes date information and amount information.

[0055] In this embodiment, the second text to be corrected can be post-processed, wherein the format of the specific information in the second text to be corrected is detected to obtain format error information, and the specific information in the second text to be corrected is corrected based on the format error information, which can include: firstly, the date information and the amount information in the second text to be corrected are detected based on a preset format checker to obtain date format error information and amount format error information, and then the date information and the amount information are corrected based on the date format error information and the amount format error information and in accordance with the corresponding format standard. After correcting the date information and the amount information based on the date format error information and the amount format error information and in accordance with the corresponding format standard, it can also include: performing a punctuation balancing operation on the second text to be corrected after the format correction to obtain the target text; wherein the punctuation balancing operation is used to ensure that quotation marks and brackets appear in pairs.

[0056] It is understandable that when the second text to be corrected is post-processed, a preset format checker can be used to force the format of specific information such as date (such as using the YYYY-MM-DD format) and amount to ensure that the text meets the established standards. At the same time, the text can be checked for punctuation balance to ensure that quotation marks, brackets, etc. appear in pairs to avoid reading difficulties caused by missing or redundant punctuation.

[0057] It should be noted that in the process of post-processing the second text to be corrected, the domain term protection and modification mechanism can also be used, which can not only prevent the proper nouns from being modified incorrectly during the correction process, but more importantly, it can more accurately locate and correct the errors in the field, which is particularly important for maintaining the professionalism and accuracy of the text. Specifically, a domain adaptation layer can be specially designed for the model. Through the domain adaptation layer, the model can automatically adjust its prediction and understanding strategies according to the specific field of the input text. When the input is a medical document, the model will more accurately locate and correct the errors in the text based on the knowledge and terminology characteristics of the medical field. For example, for the sentence "He was diagnosed with heart disease", the ordinary model may find it difficult to determine where the "heart disease" is wrong, but the model after domain adaptation can quickly identify that "藏" is a typo and should be changed to "污" because it understands medical terms. In the processing of legal documents, for "This contract is invalid due to force majeure", the model can correct "抗抗里" to "力玛". "Force majeure" in the legal field knowledge. This enables the model to automatically adjust its prediction and understanding strategies based on the specific domain of the input text, significantly improving the processing effect on professional texts.

[0058] Furthermore, the target text can be returned to the client, and feedback from the client on the corrected target text can be obtained. Then, based on the feedback, the pre-set grammar detection large model, the pre-set spelling detection large model, and the pre-set comprehensive error detection large model can be updated to iteratively optimize the model in combination with the user's feedback, further improving the error correction ability and application scope of the model.

[0059] In this embodiment, the performance of the text error correction system can be comprehensively evaluated, and the text error correction system can be optimized based on the evaluation results, so that the text error correction system can better perform text error correction. For example, a multi-dimensional evaluation system can be adopted, which covers three aspects: accuracy metrics, error type analysis, and efficiency metrics.

[0060] First, in terms of accuracy metrics, not only the character-level accuracy, that is, the precision of the system in correcting errors at the single-character level, needs to be concerned, but also the sentence-level perfect accuracy should be emphasized, which measures whether the whole sentence is processed without any errors. The character-level accuracy can reflect the system's ability to recognize and correct each character in detail, while the sentence-level perfect accuracy provides a more macroscopic perspective to ensure that each output sentence meets the expected standard.

[0061] Second, for error type analysis, a structured framework can be designed to classify and count different types of errors. For example, define a dictionary error_types that contains spelling errors, punctuation errors, semantic errors, and format errors. Through this classification method, not only can it be clearly understood in which aspects the system's performance needs to be improved, but also specific directions can be provided for subsequent model optimization. For example, if the proportion of spelling errors is found to be high, the training of the confusion matrix can be further enhanced; if there are many punctuation errors, the punctuation balance detection algorithm can be improved, etc.

[0062] Finally, in terms of efficiency metrics, it is necessary to ensure that the response speed and service capacity of the system meet the requirements of actual applications. For example, the single-sentence processing delay should be controlled within 200 milliseconds to ensure the smoothness of the user experience; at the same time, the concurrent processing capacity also needs to reach the standard of more than 50 queries per second (QPS), indicating that the system can still maintain an efficient and stable working state under high concurrency. These two metrics jointly ensure that the system can not only meet high standards in terms of quality, but also handle the needs of large-scale user access in terms of processing speed and capacity.

[0063] As can be seen from the above, in the embodiments of the present application, first, the text to be corrected is initially corrected based on a preset component to obtain a first text to be corrected, and the simple errors in the text to be corrected are quickly corrected by the preset component, reducing the load of subsequent model correction and realizing the preprocessing of the text to be corrected; then, based on a preset grammar detection large model, a preset spelling detection large model, and a preset comprehensive error detection large model, various types of errors in the first text to be corrected are intelligently identified and corrected to accurately locate and modify the subtle errors in complex contexts, realizing the core correction of the first text to be corrected; finally, the specific information in the second text to be corrected after correction is corrected to further review and optimize the second text to be corrected to obtain the corrected target text, ensuring that all errors are correctly repaired and no new problems are introduced, realizing the post-processing of the second text to be corrected. In this way, through the preprocessing, core correction, and post-processing of the text to be corrected input by the user side, the accuracy and reliability of the text correction project are generally improved, meeting the user's needs for high-quality text correction. The entire process, from preliminary screening to precise correction and then to final verification, through a series of meticulous steps, ensures the comprehensive improvement of text quality and finally outputs high-quality text content.

[0064] Next, taking the deployment solution based on the two major strategies of service-oriented architecture and model lightweighting as an example, the technical solutions in the present application will be described.

[0065] First, in terms of the service-oriented architecture, a hierarchical service architecture design can be set up. After the client initiates a text correction request, these requests are first received through the API gateway (API Gateway; API, that is, Application Programming Interface, the application programming interface), and intelligent routing is performed according to the error type of the text. The routing mechanism here can distinguish between simple errors and complex errors: for simple errors, such as format problems or obvious spelling mistakes, they can be directly processed by the rule engine in the text correction system; for complex semantic errors, first, the text to be corrected is initially filtered based on the rule engine in the text correction system, then the text is core-corrected based on the large model in the system, and finally, the specific information in the text is corrected to perform post-processing on the text. After that, for both simple errors and complex errors, the generated results are sent to the result aggregation module, where they are integrated and optimized, and the comprehensive result is returned to the client. This hierarchical processing mechanism not only reduces the load on a single model but also combines the basic accuracy of the rule method and the powerful processing ability of the large model for complex semantic problems, enabling the entire system to provide efficient and accurate solutions when facing different types of errors.

[0066] Secondly, to further improve the system's response speed and reduce resource consumption, the model used in the system can adopt model lightweighting technology, which refers to using knowledge distillation technology to compress the model. For example, BERT is used as the teacher model, while TinyBERT is used as the student model. The knowledge of the teacher model can be "distilled" into the student model through the Distiller tool, enabling the student model to significantly reduce the computational load and memory occupancy while maintaining high accuracy. This process effectively reduces the model size, making it more suitable for the rapid response requirements in the actual deployment environment.

[0067] As can be seen from the above, in this embodiment, based on the two major strategies of service-oriented architecture and model lightweighting, the efficiency and performance of the text error correction system are improved, ensuring that the system can not only efficiently process various errors but also maintain low resource consumption.

[0068] See Figure 2 As shown in the figure, taking a specific text error correction schematic diagram as an example, the technical solution in this application will be described below.

[0069] First, the text error correction system obtains the text to be corrected input by the user and detects the error type of the text to be corrected. For simple errors, such as format problems or obvious spelling mistakes, they can be directly corrected quickly by the rule engine in the text error correction system; for complex semantic errors, first, the text to be corrected is preprocessed based on the rule engine in the text error correction system for preliminary filtering, then the text is core-corrected based on the T5 model, GPT-3.5 / 4, and Seq2Seq models in the system, and finally, specific information in the text is corrected for post-processing of the text. After that, for both simple and complex errors, the generated results are sent to the correction result aggregation module, where they are integrated and optimized to obtain the corrected target text. The confidence of the target text is evaluated. Among them, the higher the confidence, the more reasonable the target text. If the confidence of the target text is greater than the preset confidence threshold, it is determined to be a high confidence, and at this time, it can be directly output and returned to the user side. If the confidence of the target text is not greater than the preset confidence threshold, it is determined to be a low confidence, and at this time, manual review can be performed to correct the target text and return the corrected target text to the user side. After receiving the corrected target text, the user side gives feedback, enabling the system to perform online learning based on the feedback and update itself to improve the error correction ability and application scope of the system.

[0070] As can be seen from the above, taking a specific text error correction schematic diagram as an example, this embodiment proposes a more efficient technical solution. This technical solution significantly improves the accuracy and reliability of the text error correction scenario by optimizing the technical process, thus better meeting the requirements of actual applications.

[0071] See Figure 3 As shown, an embodiment of the present application also discloses a text error correction device based on a large model, including:

[0072] A text preprocessing module 11, configured to obtain the text to be error-corrected input by the user terminal, and perform initial error correction on the text to be error-corrected based on a preset component to obtain a first text to be error-corrected;

[0073] A text core error correction module 12, configured to analyze the first text to be error-corrected by using a BERT model to locate the position where an expected error exists in the first text to be error-corrected, detect the text corresponding to the position where the expected error exists based on a preset grammar detection large model, a preset spelling detection large model, and a preset comprehensive error detection large model to obtain error information, generate an error correction scheme corresponding to the error information, and perform error correction on the first text to be error-corrected according to the error correction scheme to obtain a second text to be error-corrected;

[0074] A text postprocessing module 13, configured to detect the format of specific information in the second text to be error-corrected to obtain format error information, and perform error correction on the specific information in the second text to be error-corrected based on the format error information to obtain a target text after error correction; the specific information includes date information and amount information.

[0075] As can be seen from the above, the present application first performs initial error correction on the text to be error-corrected based on a preset component to obtain a first text to be error-corrected, quickly corrects simple errors in the text to be error-corrected through the preset component, reduces the load of subsequent model error correction, and realizes the preprocessing of the text to be error-corrected; then, based on a preset grammar detection large model, a preset spelling detection large model, and a preset comprehensive error detection large model, it intelligently identifies and corrects various types of errors in the first text to be error-corrected to accurately locate and modify subtle errors in complex contexts, and realizes the core error correction of the first text to be error-corrected; finally, error correction is performed on the specific information in the second text to be error-corrected after error correction to further review and optimize the second text to be error-corrected to obtain a target text after error correction, ensuring that all errors are correctly repaired and no new problems are introduced, and realizing the postprocessing of the second text to be error-corrected. In this way, through the preprocessing, core error correction, and postprocessing of the text to be error-corrected input by the user terminal, the accuracy and reliability of the text error correction project are generally improved, meeting the user's demand for high-quality text error correction.

[0076] In some specific embodiments, the text preprocessing module 11 includes:

[0077] The first error correction unit is used to identify duplicate information in the text to be error-corrected by using a preset symbol expression and a preset character expression defined by a regular expression through a preset rule engine, so as to correct the duplicate information; the preset rule engine is used to perform initial error correction on the text to be error-corrected according to preset rules; the duplicate information includes punctuation mark duplicate information and character duplicate information;

[0078] The second error correction unit is used to remove sensitive words from the text after duplicate information correction by using sensitive word pairs defined in a custom word list through the preset rule engine;

[0079] The first text to be error-corrected determination unit is used to perform spelling error detection on the text after removing sensitive words based on an N-gram language model, so as to correct the detected spelling errors, and correct similar-looking characters with errors in the text by using a preset character confusion matrix through the N-gram language model, to obtain a first text to be error-corrected; the preset character confusion matrix is used to calculate the replacement probability between preset common similar-looking characters, so as to judge whether the similar-looking characters in the text need to be replaced based on the replacement probability.

[0080] In some specific embodiments, the text core error correction module 12 includes:

[0081] The error location unit is used to analyze the first text to be error-corrected based on a BERT model trained with a preset data set, and assign a preset high attention weight to the text where an error is expected to occur in the first text to be error-corrected, and display the text with the preset high attention weight through a visualization technique, so as to locate the position where an expected error exists in the first text to be error-corrected.

[0082] In some specific embodiments, the text core error correction module 12 includes:

[0083] The first solution determination unit is used to detect the text corresponding to the position where an expected error exists through a preset grammar detection large model, so as to obtain grammar error information and generate a corresponding grammar error correction solution;

[0084] The second solution determination unit is used to detect the text corresponding to the position where an expected error exists through a preset spelling detection large model, so as to obtain spelling error information and generate a corresponding spelling error correction solution;

[0085] The third solution determination unit is used to detect the text corresponding to the position where an expected error exists through a preset comprehensive error detection large model, so as to obtain comprehensive error information other than the grammar error information and the spelling error information and generate a corresponding comprehensive error correction solution;

[0086] A target solution determination unit, configured to determine a target error correction solution corresponding to each error correction statement in the first text to be error corrected based on the grammar error correction solution, the spelling error correction solution, and the comprehensive error correction solution; wherein, at least one target error correction solution corresponds to one error correction statement;

[0087] A second text to be error corrected determination unit, configured to, for any error correction statement, determine a target statement after correcting the error correction statement through the corresponding various target error correction solutions, determine the perplexity and semantic similarity corresponding to each target statement based on the error correction statement and the target statement, determine the comprehensive score corresponding to each target statement according to the perplexity and the semantic similarity, and use the target statement with the highest comprehensive score as the final target statement, and correct the first text to be error corrected based on the final target statement to obtain a second text to be error corrected;

[0088] Wherein, the perplexity corresponding to the target statement is determined based on a preset language model; the semantic similarity corresponding to the target statement is determined based on the Sentence-BERT model.

[0089] In some specific embodiments, the text post-processing module 13 includes:

[0090] A third error correction sub-module, configured to detect the date information and amount information in the second text to be error corrected based on a preset format validator to obtain date format error information and amount format error information, and correct the date information and the amount information according to the corresponding format standards based on the date format error information and the amount format error information.

[0091] In some specific embodiments, the third error correction sub-module further includes:

[0092] A target text determination unit, configured to perform a punctuation balance operation on the second text to be error corrected after format error correction to obtain a target text; wherein, the punctuation balance operation is used to ensure that quotation marks and parentheses appear in pairs.

[0093] In some specific embodiments, the large model-based text error correction device includes:

[0094] A model update unit, configured to obtain feedback from the user side on the error corrected target text, and update the preset grammar detection large model, the preset spelling detection large model, and the preset comprehensive error detection large model based on the feedback.

[0095] Furthermore, an embodiment of the present application also discloses an electronic device, Figure 4 It is a structural diagram of an electronic device 20 shown according to an exemplary embodiment, and the content in the figure cannot be considered as any limitation to the scope of use of the present application.

[0096] Figure 4 This is a schematic structural diagram of an electronic device 20 provided by an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the text correction method based on a large model disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0097] In this embodiment, the power supply 23 is used to provide a working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of the present application, and no specific limitation is imposed on it here; the input / output interface 25 is used to obtain external input data or output data to the outside, and its specific interface type can be selected according to specific application needs, and no specific limitation is made here.

[0098] In addition, as a carrier for resource storage, the memory 22 may be a read-only memory, a random access memory, a magnetic disk, or an optical disc, etc., and the resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.

[0099] Among them, the operating system 221 is used to manage and control each hardware device and the computer program 222 on the electronic device 20, and it may be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the text correction method based on a large model executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks.

[0100] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the text correction method based on a large model disclosed above. For the specific steps of this method, reference may be made to the corresponding content disclosed in the foregoing embodiments, and details will not be repeated here.

[0101] In this specification, the various embodiments are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method section.

[0102] Those skilled in the art can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of the examples have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0103] The steps of the methods or algorithms described in combination with the embodiments disclosed in this article can be directly implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.

[0104] Finally, it should also be noted that in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprises", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising a..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.

[0105] The above has introduced the technical solutions provided by this application in detail. Specific examples are used in this article to elaborate on the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to this application.

Claims

1. A text error correction method based on a large model, characterized in that Including: Obtain the text to be corrected input by the user terminal, and perform initial correction on the text to be corrected based on a preset component to obtain a first text to be corrected; Use the BERT model to analyze the first text to be corrected to locate the position where an expected error exists in the first text to be corrected. Based on a preset grammar detection large model, a preset spelling detection large model, and a preset comprehensive error detection large model, detect the text corresponding to the position where the expected error exists to obtain error information, and generate a correction plan corresponding to the error information. Correct the first text to be corrected according to the correction plan to obtain a second text to be corrected; Detect the format of specific information in the second text to be corrected to obtain format error information, and correct the specific information in the second text to be corrected based on the format error information to obtain the corrected target text; the specific information includes date information and amount information.

2. The text error correction method based on a large model according to claim 1, characterized in that, The performing initial correction on the text to be corrected based on a preset component to obtain a first text to be corrected includes: Use a preset rule engine to identify duplicate information in the text to be corrected by using a preset symbol expression and a preset character expression defined by a regular expression, so as to correct the duplicate information; the preset rule engine is used to perform initial correction on the text to be corrected according to preset rules; the duplicate information includes punctuation mark duplicate information and character duplicate information; Use the preset rule engine to remove sensitive words from the text after correcting duplicate information by using sensitive word pairs defined in a custom word list; Perform spelling error detection on the text after removing sensitive words based on the N-gram language model to correct the detected spelling errors, and use the N-gram language model to correct similar-looking characters with errors in the text by using a preset character confusion matrix to obtain a first text to be corrected; the preset character confusion matrix is used to calculate the replacement probability between preset common similar-looking characters, so as to judge whether the similar-looking characters in the text need to be replaced based on the replacement probability.

3. The method for text error correction based on a large model according to claim 1, wherein The using the BERT model to analyze the first text to be corrected to locate the position where an expected error exists in the first text to be corrected includes: Analyze the first text to be corrected based on the BERT model trained with a preset data set, and assign a preset high attention weight to the text where an expected error appears in the first text to be corrected. Display the text with the preset high attention weight through visualization technology to locate the position where an expected error exists in the first text to be corrected.

4. The method for text error correction based on a large model according to any one of claims 1 to 3, characterized in that, The detecting the text corresponding to the position where the expected error exists based on a preset grammar detection large model, a preset spelling detection large model, and a preset comprehensive error detection large model to obtain error information, and generating a correction plan corresponding to the error information, and correcting the first text to be corrected according to the correction plan to obtain a second text to be corrected includes: Detect the text corresponding to the position where the expected error exists through a preset grammar detection large model to obtain grammar error information and generate a corresponding grammar correction plan; Detect the text corresponding to the position where the expected error exists through a preset spelling detection large model to obtain spelling error information and generate a corresponding spelling correction plan; Detect the text corresponding to the position where the expected error exists through a preset comprehensive error detection large model to obtain comprehensive error information other than the grammar error information and the spelling error information and generate a corresponding comprehensive error correction plan; Determine the target correction plan corresponding to each error-correction statement in the first error-correction text based on the grammar correction plan, the spelling correction plan, and the comprehensive error correction plan; where at least one target correction plan corresponds to one error-correction statement; For any error-correction statement, determine the target statement after correcting the error-correction statement through the corresponding target correction plans, and determine the perplexity and semantic similarity corresponding to each target statement based on the error-correction statement and the target statement. Determine the comprehensive score corresponding to each target statement according to the perplexity and the semantic similarity, and use the target statement with the highest comprehensive score as the final target statement. Correct the first error-correction text based on the final target statement to obtain a second error-correction text; Among them, the perplexity corresponding to the target statement is determined based on a preset language model; the semantic similarity corresponding to the target statement is determined based on the Sentence-BERT model.

5. The text error correction method based on a large model according to claim 1, characterized in that Detect the format of the specific information in the second error-correction text to obtain format error information, and correct the specific information in the second error-correction text based on the format error information, including: Detect the date information and amount information in the second error-correction text through a preset format validator to obtain date format error information and amount format error information, and correct the date information and the amount information based on the date format error information and the amount format error information according to the corresponding format standards.

6. The method for text error correction based on a large model according to claim 5, wherein After correcting the date information and the amount information based on the date format error information and the amount format error information according to the corresponding format standards, it further includes: Perform a punctuation balancing operation on the second error-correction text after format correction to obtain a target text; where the punctuation balancing operation is used to ensure that quotation marks and parentheses appear in pairs.

7. The method for text error correction based on a large model according to claim 1, wherein It further includes: Obtain the feedback from the client on the corrected target text, and update the preset grammar detection large model, the preset spelling detection large model, and the preset comprehensive error detection large model based on the feedback.

8. A text error correction device based on a large model, characterized in that, It includes: A text preprocessing module, configured to obtain the error-correction text input by the client, and perform initial error correction on the error-correction text based on a preset component to obtain a first error-correction text; A text core error correction module, which is used to analyze the first text to be error-corrected by using a BERT model to locate the position where an expected error exists in the first text to be error-corrected, and detect the text corresponding to the position where the expected error exists based on a preset grammar detection large model, a preset spelling detection large model, and a preset comprehensive error detection large model to obtain error information, and generate an error correction scheme corresponding to the error information, and correct the first text to be error-corrected according to the error correction scheme to obtain a second text to be error-corrected; A text post-processing module, which is used to detect the format of specific information in the second text to be error-corrected to obtain format error information, and correct the specific information in the second text to be error-corrected based on the format error information to obtain a corrected target text; the specific information includes date information and amount information.

9. An electronic device, characterized in that, Comprising: A memory, which is used to store a computer program; A processor, which is used to execute the computer program to implement the large model-based text error correction method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, For storing a computer program, which when executed by a processor implements the large model-based text error correction method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Chinese spelling error correction method based on multi-modal enhancement

    CN120579543A