Text correction method and device, electronic equipment and storage medium
By segmenting the initial and modified text into words, sentences, and paragraphs, training text is generated to train the error correction model. This solves the problems of high manual editing costs and inaccurate automatic error text generation in existing technologies, achieving high efficiency and accuracy in text error correction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE CHENGDU INFORMATION & TELECOMM TECH CO LTD
- Filing Date
- 2021-08-23
- Publication Date
- 2026-05-29
AI Technical Summary
Existing deep learning models rely on training with a large number of correct and incorrect text pairs in the process of text grammar correction. However, manual editing is costly and requires a high level of expertise, while the erroneous text automatically generated by the program does not match reality, resulting in poor error correction performance.
By acquiring the text to be corrected, the error correction model is used for correction. The training text is generated by segmenting the initial text and the modified text into words, sentences, and segments to train the initial error correction model, thereby improving the training effect and accuracy of the error correction model.
It improves the accuracy of text correction, increases the scale, diversity, and relevance of training texts, reduces the model size, and improves the training effect of the error correction model.
Smart Images

Figure CN115719062B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of model training technology, and includes, but is not limited to, a text correction method, apparatus, electronic device, and storage medium. Background Technology
[0002] As the foundation of semantic recognition, grammatical error correction is one of the most important achievements of deep learning applications. Generally, deep learning models perform grammatical error correction on text, and during the training process, a large number of text pairs consisting of correct and incorrect text are needed as training text.
[0003] In related technologies, one method can process correct text using degree rules, such as replacing some identical words in correct text to create incorrect text, or extracting intermediate results from the training process of a deep learning model as incorrect text. This method is based on computer random numbers and generates random errors with completely equal probability, which does not match real-world errors at all.
[0004] In another approach, professionals can edit and proofread the essays of those who completed the material, correcting errors in the text. The content before and after the correction of the same text can be recorded as a set of correct-incorrect text pairs. This method requires a high level of professionalism from the participants, and professionals inevitably make mistakes in continuous work. Moreover, this method is based on the assumption that there is a "correct answer," which does not conform to the basic principle that there is no first place in literature. It has little tolerance for innovative forms of expression or even literary creation. Summary of the Invention
[0005] In view of this, embodiments of this application provide a text correction method, apparatus, electronic device, and storage medium.
[0006] In a first aspect, embodiments of this application provide a text correction method, the method comprising: acquiring text to be corrected; correcting the text to be corrected based on a trained correction model to obtain corrected text; wherein the trained correction model is obtained by training an initial correction model using training text; the training text is generated based on text obtained by text processing a first initial text and text obtained by text processing a first modified text; the first modified text is text modified from the first initial text.
[0007] Secondly, embodiments of this application provide a text correction device, comprising: a first acquisition module for acquiring text to be corrected; and an error correction module for correcting the text to be corrected based on a trained error correction model to obtain corrected text; wherein the trained error correction model is obtained by training an initial error correction model using training text; the training text is generated based on text obtained by text processing a first initial text and text obtained by text processing a first modified text; and the first modified text is text modified from the first initial text.
[0008] Thirdly, embodiments of this application provide an electronic device, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements the steps in any of the text correction methods described in the first aspect of this application.
[0009] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the text correction methods described in the first aspect of embodiments of this application.
[0010] In this embodiment of the application, training text is generated based on the text obtained after text processing of the first initial text and the first modified text to train the initial error correction model. This enables the trained error correction model to intelligently correct the text to be corrected, thereby improving the accuracy of the text. It can also increase the scale, diversity and relevance of the training text, improve the training effect of the error correction model and reduce the model size. Attached Figure Description
[0011] Figure 1 This is a flowchart illustrating a text correction method according to an embodiment of this application;
[0012] Figure 2 This is a flowchart illustrating a sentence pair generation method according to an embodiment of this application;
[0013] Figure 3 This is a schematic diagram illustrating the offline training process of a deep language model according to an embodiment of this application;
[0014] Figure 4 This is a schematic diagram of the composition structure of a text correction device according to an embodiment of this application;
[0015] Figure 5 This is a schematic diagram of a hardware entity of an electronic device according to an embodiment of this application. Detailed Implementation
[0016] The technical solution of this application will be further described in detail below with reference to the accompanying drawings and embodiments.
[0017] Figure 1 This is a flowchart illustrating a text correction method according to an embodiment of this application, as shown below. Figure 1 As shown, the method includes:
[0018] Step 102: Obtain the text to be corrected;
[0019] Among them, using deep learning models to correct the grammar of text as the foundation of semantic recognition is one of the important achievements of deep learning applications. The deep learning model can be called an error correction model. The text to be corrected can be the content edited by the material producer. The text to be corrected can be a student's composition or paper, a writer's writing, a paper or composition corrected by a teacher, or work materials edited by employees, etc.
[0020] Step 104: Correct the text to be corrected based on the trained error correction model to obtain the corrected text;
[0021] The trained error correction model is obtained by training the initial error correction model using training text; the training text is generated based on the text obtained after text processing of the first initial text and the text obtained after text processing of the first modified text; the first modified text is the text after modifying the first initial text; the text processing includes at least one of word segmentation, sentence segmentation and paragraph segmentation.
[0022] Wherein, the first initial text may be the essay data content submitted or modified by the content user through the content user terminal of the original data system; the first modified text may be the text generated by the grading user after reviewing and grading the essay data content through the grading user terminal of the original data system; the content user may be an unspecified user of the original data system, such as a student or employee; the grading user may be a user who grades the essay data content, such as a teacher or leader.
[0023] The log unit set on the original data system starts recording when the content user modifies the essay data content and / or when the grader records the graded essay data content. The recorded content includes the sentence and paragraph content before modification, during modification and after modification, and stores the first initial text and the first modified text after different text processing into the corresponding unit data block; the unit data blocks extracted under different text processing are independent of each other.
[0024] The text processing may be semantic recognition processing, which may include at least one of word segmentation, sentence segmentation, and paragraph segmentation.
[0025] In this embodiment, training text is generated based on the text obtained by text processing the first initial text and the first modified text to train the initial error correction model. This enables the trained error correction model to intelligently correct the text to be corrected, thereby improving the accuracy of the text. Since the text processing involves at least one of word segmentation, sentence segmentation, and paragraph segmentation, the scale, diversity, and relevance of the training text can be increased, thereby improving the training effect of the error correction model and reducing the model size.
[0026] This application also provides a text correction method, which includes the following steps:
[0027] Step S202: Perform text processing on the first initial text to obtain at least one second initial text; the text processing shall include at least one of word segmentation, sentence segmentation and paragraph segmentation.
[0028] Step S204: Perform text processing on the first modified text to obtain at least one second modified text;
[0029] Step S206: Generate the training text based on the at least one second initial text and the at least one second modified text;
[0030] The error correction model requires a large number of text pairs consisting of erroneous and correct texts during training. It can generate the correct text and the erroneous text corresponding to the correct text based on the at least one second initial text and the at least one second modified text, and use the text pairs consisting of the correct text and the erroneous text as training texts.
[0031] Step S208: Using the training text, train the initial error correction model to obtain the trained error correction model;
[0032] Step S210: Obtain the text to be corrected;
[0033] Step S212: Correct the text to be corrected based on the trained error correction model to obtain the corrected text.
[0034] In this embodiment of the application, training text is generated based on a second initial text and a second modified text obtained by text processing a first initial text and a first modified text. This can increase the scale, diversity, and relevance of the training text, improve the training effect of the error correction model, and reduce the model size.
[0035] This application also provides a text correction method, which includes the following steps:
[0036] Step S302: Obtain the first initial text and the first modified text;
[0037] Step S304: Perform word segmentation on the first initial text to obtain at least one second initial text;
[0038] The word segmentation process of the first initial text can be the extraction of fixed collocations of words in the first initial text, and the resulting second initial text can be "happy mood" and "bright sunshine", etc.; the fixed collocations of words can also be called structured fields.
[0039] Step S306: Perform the word segmentation process on the first modified text to obtain at least one second modified text;
[0040] Similarly, fixed word collocations can be extracted from the first modified text to obtain the second modified text.
[0041] Step S308: Determine at least one of the second initial text and at least one of the second modified text as the first correct text;
[0042] Step S310: Replace some of the same words in each of the first correct texts to obtain at least one corresponding first incorrect text;
[0043] Step S312: Generate a corresponding first text based on each first correct text and at least one corresponding first incorrect text;
[0044] Step S314: Generate the training text based on at least one of the first texts;
[0045] The first text serves as training text, primarily used for training the analysis and judgment of the meaning, expression, and application of words and phrases. Its structure is relatively fixed, with clear distinctions between "correct" and "incorrect." During text processing, if a richer variety of correct-incorrect text pairs is required, the "correct" unit data blocks (the first correct text determined by the second initial text and the second modified text) can be processed through random program replacement to generate a large number of "incorrect" forms (the first incorrect text), thus forming the first text.
[0046] Step S316: Using the training text, train the initial error correction model to obtain the trained error correction model;
[0047] Step S318: Obtain the text to be corrected;
[0048] Step S320: Correct the text to be corrected based on the trained error correction model to obtain the corrected text.
[0049] In this embodiment of the application, by performing word segmentation and generating training text based on the second initial text and the second modified text obtained after word segmentation, the meaning, expression, and application scenario analysis of words and phrases can be trained.
[0050] This application also provides a text correction method, which includes the following steps:
[0051] Step S402: Obtain the first initial text and the first modified text;
[0052] Step S404: Segment the first initial text to obtain at least one second initial text;
[0053] Sentence segmentation, also known as natural sentence extraction, can be achieved by using punctuation marks as dividing nodes and separating the content into unit data blocks. The punctuation marks include periods, commas, semicolons, etc.
[0054] Step S406: Perform the sentence segmentation process on the first modified text to obtain at least one second modified text;
[0055] Step S408: Determine at least one of the second initial texts and at least one of the second modified texts as the second correct subtexts;
[0056] Step S410: Replace some of the same words in each of the second correct sub-texts to obtain at least one corresponding first undetermined text;
[0057] Step S412: Perform a correctness analysis on each of the first texts to be determined, and obtain the analysis results for the corresponding texts to be determined;
[0058] Wherein, the analysis result of the first undetermined text is either the first undetermined text is correct text or the first undetermined text is incorrect text. In one embodiment, at least one target object with a weight greater than a preset weight threshold can be identified; each of the first undetermined texts is sent to the at least one target object so that each target object can perform a correctness analysis on the first undetermined text to obtain a corresponding analysis sub-result of the first undetermined text; at least one of the analysis sub-results is obtained; and based on the at least one analysis sub-result, an analysis result corresponding to the first undetermined text is generated.
[0059] The target audience can be content users (such as students) or grading users (such as teachers). The weights can include basic weights and additional weights. Basic weights can be obtained by analyzing and calculating system registration data, such as teacher identity, school, major, years of work experience, professional title, and honors received, as well as students' grades and past works. Additional weights can be set on top of the basic weights. These additional weights are generated during system usage and include the number of submitted works and the rating / score for each work. The additional weights for teacher users mainly come from the review conclusions on controversial issues.
[0060] Among these methods, the analysis result that appears most frequently in at least one analysis sub-result can be determined as the analysis result of the first text to be determined. Alternatively, the analysis sub-result of the target object with the highest weight can be determined as the analysis result of the first text to be determined. Or, the target objects can be sorted according to the decreasing order of their weights, and the analysis sub-result that appears most frequently among the top-ranked analysis sub-results can be determined as the analysis result of the first text to be determined.
[0061] Step S414: If the analysis result indicates that the first text to be determined is correct, generate a second correct text based on the second correct subtext and the first text to be determined; if the analysis result indicates that the first text to be determined is incorrect, generate a second correct text based on the second correct subtext; generate a second incorrect text based on the first text to be determined.
[0062] Step S416: Generate the corresponding second text based on each second correct text and the corresponding second incorrect text;
[0063] Step S418: Generate the training text based on at least one of the second texts;
[0064] In the natural sentence extraction process, the "correct" unit data blocks (second initial text and second modified text) can be processed by random program replacement to obtain the first undetermined text. As an aid, a large number of secondary unit data blocks (first undetermined text) with uncertain correctness can be confirmed by further analysis.
[0065] The extraction of natural sentences can also be called sentence extraction. Since sentences are more diverse in their expression than structured fields, and errors are less likely to be found, such expressions can be used as a separate extraction rule to form a second text. This allows for targeted data processing methods to be set, improving data usability and the amount of effective information in the data.
[0066] Step S420: Using the training text, train the initial error correction model to obtain the trained error correction model;
[0067] Step S422: Obtain the text to be corrected;
[0068] Step S424: Correct the text to be corrected based on the trained error correction model to obtain the corrected text.
[0069] In this embodiment, sentence segmentation is performed, and training text is generated based on the second initial text and the second modified text obtained after sentence segmentation. Since the expression of sentences is more diverse than that of structured fields, and "errors" are less likely to be detected, such expressions are treated as a separate processing method to form the second text, so as to set the data processing method in a targeted manner and improve the usability and effective information content of the data.
[0070] This application also provides a text correction method, which includes the following steps:
[0071] Step S502: Obtain the first initial text and the first modified text;
[0072] Step S504: Segment the first initial text to obtain at least one second initial text;
[0073] Among them, segmentation processing can also be called natural segment extraction, which uses segmentation symbols as dividing nodes and takes the content of natural segments as unit data blocks.
[0074] Step S506: Perform the segmentation process on the first modified text to obtain at least one second modified text;
[0075] Step S508: Determine the correctness of each of the second initial texts and each of the second modified texts;
[0076] Step S510: Determine the similarity between each of the second initial texts and the corresponding second modified texts;
[0077] Step S512: Based on each correctness and corresponding similarity, determine at least one third correct text and at least one third incorrect text corresponding to each third correct text from the at least one second initial text and the at least one second modified text;
[0078] Step S514: Generate the corresponding third text based on each of the third correct texts and at least one corresponding third incorrect text;
[0079] Step S516: Generate the training text based on at least one of the third texts;
[0080] For sentence pairs extracted from natural paragraphs, instead of directly classifying them into properties such as "correct", "incorrect" and "pending", the content can be preprocessed using a scoring mechanism (using correctness as the score).
[0081] In another embodiment, the proportion of modified content in the second modified text can be determined first. If the modification exceeds a certain proportion, the two parts of content before and after the modification (the second initial text and the second modified text) are used as the third text.
[0082] Furthermore, when using the modification ratio for screening, an additional prerequisite is added: determine whether there are obvious modifications to structured fields and / or natural sentences (i.e., whether the modifications exceed a certain ratio). If these two types of modifications exist, the modified natural sentences and the overall content of the fields will not be included in the calculation of the natural paragraph modification ratio.
[0083] Step S518: Using the training text, train the initial error correction model to obtain the trained error correction model;
[0084] Step S520: Obtain the text to be corrected;
[0085] Step S522: Correct the text to be corrected based on the trained error correction model to obtain the corrected text.
[0086] In this embodiment of the application, by segmenting, and generating training text based on the second initial text and the second modified text obtained after segmentation, since the expression of paragraphs is more diverse than that of structured fields and sentences, and is more related to the expression of the main idea of the essay, or is just for optimizing the expression, such expression is treated as a separate processing method to form a third text for optimizing the expression of the text.
[0087] This application also provides a text correction method, which includes the following steps:
[0088] Step S602: Obtain the first initial text and the first modified text;
[0089] Step S604: Segment the first initial text to obtain at least one second initial text;
[0090] Step S606: Perform the segmentation process on the first modified text to obtain at least one second modified text;
[0091] Step S608: Determine the correctness of each of the second initial texts and each of the second modified texts;
[0092] Step S610: Determine the similarity between each of the second initial texts and the corresponding second modified texts;
[0093] Step S612: Based on each correctness and corresponding similarity, select a second candidate initial text from the at least one second initial text;
[0094] Step S614: Determine the second modified text corresponding to the second candidate initial text as the second candidate modified text;
[0095] Step S616: Based on a preset accuracy threshold, determine a third correct subtext, a third incorrect subtext, and a third pending subtext from at least one second candidate initial text and the corresponding second candidate modified text;
[0096] Step S618: Perform a correctness analysis on each of the third undetermined sub-texts to obtain the analysis results of the corresponding third undetermined sub-texts;
[0097] Step S620: If the analysis result indicates that the third undetermined subtext is correct, generate a third correct text based on the third correct subtext and the third undetermined subtext; generate a third incorrect text based on the third incorrect subtext; if the analysis result indicates that the third undetermined subtext is incorrect, generate a third correct text based on the third correct subtext; generate a third incorrect text based on the third undetermined subtext and the third incorrect subtext.
[0098] Step S622: Generate the corresponding third text based on each of the third correct texts and at least one corresponding third incorrect text;
[0099] Step S624: Generate the training text based on at least one of the third texts;
[0100] Step S626: Using the training text, train the initial error correction model to obtain the trained error correction model;
[0101] Step S628: Obtain the text to be corrected;
[0102] Step S630: Correct the text to be corrected based on the trained error correction model to obtain the corrected text.
[0103] In this embodiment of the application, the text is filtered based on the correctness and similarity of the second initial text and the corresponding second modified text. This allows for the removal of the second initial text and the corresponding second modified text whose correctness after modification is lower than that before modification, or whose similarity between the text before and after modification is too low, thereby reducing the interference of bad training samples.
[0104] This application also provides a text correction method, which includes the following steps:
[0105] Step S702: Obtain the first initial text and the first modified text;
[0106] Step S704: Segment the first initial text to obtain at least one second initial text;
[0107] Step S706: Perform the segmentation process on the first modified text to obtain at least one second modified text;
[0108] Step S708: Input each of the second initial texts into the trained language model to obtain the accuracy of the corresponding second initial text;
[0109] Step S710: Input each of the second modified texts into the trained language model to obtain the correctness of the corresponding second modified text;
[0110] Step S712: Use word vectors to generate a word2vec model, convert each second initial text into a first vector, and convert the corresponding second modified text into a second vector;
[0111] Among them, word2vec (word to vector) can be a model used to generate word vectors, which can convert each second initial text into a 300-dimensional first vector and the corresponding second modified text into a 300-dimensional second vector.
[0112] Step S714: Determine the similarity between the corresponding second initial text and the second modified text based on the cosine similarity between each first vector and the corresponding second vector;
[0113] Step S716: From the at least one second initial text, determine the second initial text with an accuracy lower than the corresponding second modified text and a similarity greater than a preset similarity threshold as the second candidate initial text;
[0114] The similarity threshold can be 0.75, 0.8, or 0.85, etc. If the accuracy of the second initial text is not less than the accuracy of the corresponding second modified text, it can be considered that the modification is wrong, and the second initial text and the second modified text can be discarded, keeping only the second initial text and the corresponding second modified text with an accuracy less than the second modified text. If the similarity between the second initial text and the second modified text is not greater than the preset similarity threshold, it can be considered that the difference between the text before and after the modification is too large, and the second initial text and the second modified text can be discarded, keeping only the second initial text and the second modified text with a similarity greater than the preset similarity threshold.
[0115] Step S718: Determine the second modified text corresponding to the second candidate initial text as the second candidate modified text;
[0116] Step S720: Based on a preset accuracy threshold, determine a third correct subtext, a third incorrect subtext, and a third pending subtext from at least one second candidate initial text and the corresponding second candidate modified text;
[0117] Assuming the accuracy threshold includes a first accuracy threshold and a second accuracy threshold, and the first accuracy threshold is greater than the second accuracy threshold, and the first accuracy threshold can be 85% and the second accuracy threshold can be 70%, then the second candidate initial text or the second candidate modified text with an accuracy greater than 85% can be determined as the third correct subtext, the second candidate initial text or the second candidate modified text with an accuracy of no more than 85% but greater than 70% can be determined as the third undetermined subtext, and the second candidate initial text or the second candidate modified text with an accuracy of no more than 70% can be determined as the third incorrect subtext.
[0118] Step S722: Determine at least one target object whose weight is greater than a preset weight threshold;
[0119] Step S724: Send each of the third undetermined sub-texts to the at least one target object, so that each target object can perform a correctness analysis on the first undetermined text and obtain the corresponding analysis sub-result of the first undetermined text;
[0120] Step S726: Obtain at least one of the analysis sub-results;
[0121] Step S728: Based on at least one of the analysis sub-results, generate the analysis result corresponding to the third undetermined sub-text;
[0122] The analysis results for the third undetermined subtext can be obtained using the same method as for the first undetermined text.
[0123] Step S730: If the analysis result indicates that the third undetermined subtext is correct, generate a third correct text based on the third correct subtext and the third undetermined subtext; generate a third incorrect text based on the third incorrect subtext; if the analysis result indicates that the third undetermined subtext is incorrect, generate a third correct text based on the third correct subtext; generate a third incorrect text based on the third undetermined subtext and the third incorrect subtext.
[0124] Step S732: Generate the corresponding third text based on each of the third correct texts and at least one corresponding third incorrect text;
[0125] Step S734: Generate the training text based on at least one of the third texts;
[0126] Step S736: Using the training text, train the initial error correction model to obtain the trained error correction model;
[0127] Step S738: Obtain the text to be corrected;
[0128] Step S740: Correct the text to be corrected based on the trained error correction model to obtain the corrected text.
[0129] In this embodiment, by utilizing a trained language model, the correctness of the second initial text and the second modified text can be determined more accurately; by discarding texts with lower correctness after modification than before modification and texts with low similarity before and after modification, the quality of training samples can be improved; by using the target object to perform correctness analysis on the text to be determined according to the weight of the target object, the reliability of the text judgment can be improved.
[0130] As the foundation of semantic recognition, grammatical error correction is one of the important achievements of deep learning applications. Among them, the Grammatical Error Correction (GEC) system based on deep learning translation models proposes a model that automatically corrects the content of sentence segments using deep learning algorithms.
[0131] However, the actual implementation of the model requires the use of a large number of incorrect-correct sentence pairs during training as the basis for the deep learning algorithm's judgment. The final performance of the model obtained from training and the reliability of the sentence pair generation system are closely related to, and even completely dependent on, the number and accuracy of the sentence pairs.
[0132] Currently, there are two main methods for generating sentence pairs: manual editing and automatic generation by programs. Both methods typically involve analyzing large amounts of data sources. Taking essays as an example, sentence pairs are usually obtained by analyzing and extracting information from a large number of student essays.
[0133] The difference between these two sentence generation methods is:
[0134] Manual editing typically involves professionals (such as essay graders) editing and proofreading the essays written by the authors (students who completed the essays), correcting errors in the sentences. The original and corrected versions of the same sentence can then be recorded as a pair of correct and incorrect sentences.
[0135] There are two main methods for automatically generating programs:
[0136] The first method involves processing correct sentences using program rules, replacing some identical words to create errors. A typical approach is to first construct a candidate list of word replacements. For example, for the verb "mask," candidates include its various morphological forms such as "masks," "masked," and "masking"; for the adjective "good," candidates include comparative forms such as "better" and "best"; and for the noun "song," candidates include singular and plural forms of "songs." Then, 0 to 3 words are randomly selected from the correct sentence as candidate replacements. Alternatively, identical words can be randomly inserted or deleted to create different types of incorrect sentences.
[0137] The second method involves the program extracting intermediate results from the model training process as erroneous sentences and pairing them with the correct sentences. During deep learning training, the original sentences are analyzed to generate target sentences. If the target sentence does not match the correct sentence, it is considered erroneous, and it also forms a sentence pair with the correct sentence.
[0138] The shortcomings of the above solutions are:
[0139] In practice, manual editing methods are extremely costly in terms of manpower. Furthermore, they suffer from the following shortcomings: First, this method demands a high level of expertise from participants, and the quality of the generated sentence pairs is entirely dependent on their professional level. Second, professionals inevitably make mistakes in continuous work; given the extreme scarcity of human resources compared to the workload, a mechanism for error correction among professionals is virtually impossible, resulting in low-quality sentence pairs. Third, language expression is diverse, and different viewpoints exist regarding the meaning of texts. Manual editing is based on the assumption of a "correct answer," which contradicts the fundamental principle that there is no single correct answer in literature. It lacks tolerance for innovative expressions and even literary creation. Using this model as an evaluation standard will lead to the formalization and standardization of essay writing, a free-flowing form of literary expression, completely violating the essence of literary creation.
[0140] The method of automatic error generation by programs has two main drawbacks. Firstly, because program-generated errors are primarily based on random numbers generated by the computer, generating random errors with completely equal probability, this is entirely inconsistent with real-world errors. In reality, language errors are usually closely related to language environment, cognitive level, and lifestyle factors. Their occurrence also has clear correlations and constitutes a very small percentage of random computer errors. If computer program error pairs are used as the training basis, it may lead to an bloated model, computational complexity, and extremely low accuracy, because computer random enumeration cannot achieve exhaustive searching, and therefore cannot guarantee that the sentence pairs will include everyday error forms. Secondly, similar to the shortcomings of the "human editing method," the automatic generation method also basically assumes the existence of a "correct answer," assuming that sentences transformed from correct expressions are all "incorrect." However, due to the flexibility of language, in some cases, generated incorrect sentences may also be correct expressions. This type of data belongs to interference data.
[0141] The performance of deep learning models is greatly affected by sentence pairs; theoretically, the upper limit of the model's performance is the accuracy of sentence pairs. Therefore, while increasing the number of sentence pairs, ensuring their quality is crucial.
[0142] In this embodiment of the application, the sentence pair generation system uses open-ended essay content data as the original data system. The open-ended means that the users who submit the content are unspecified users. That is, unspecified users will continue to submit essay data with unspecified content to the original data system, and the data content will be added unspecifiedly.
[0143] The original data system had content users and grading users. Content users were unspecified users of the system itself, who were used to submit their created essay data to the original data system. Grading users were used to grade the essay data.
[0144] The original data system allows users to modify submitted data, while the grading system allows users to review, grade, and record specific or non-specific essay data.
[0145] The sentence pair generation system has a log unit on the original data system. The log unit starts recording when the content user modifies the content and / or when the censoring user records the content. The recorded content includes the sentence segment content before modification, during modification and after modification, and the sentence segment content is stored as unit data blocks according to certain rules (first rule).
[0146] The first rule includes one or more of the following rules:
[0147] The first method involves extracting fixed collocations of words, such as "happy mood" and "bright sunshine".
[0148] The second method is natural sentence extraction, which uses punctuation marks as dividing nodes and uses the content separated by punctuation marks as unit data blocks. Punctuation marks include periods, commas, semicolons, etc.
[0149] The third method is natural paragraph extraction, which uses the paragraph symbols as dividing nodes and treats the content of natural paragraphs as unit data blocks.
[0150] It should be noted that the extracted unit data blocks under different rules are independent of each other. The extraction of structured fields (fixed word collocations) is mainly used for training the analysis and judgment of the meaning, expression, and application context of words and phrases themselves; the structure is relatively fixed, and "correct" and "incorrect" are clearly defined. Under this rule, if a richer set of correct-incorrect sentence pairs is needed, the "correct" unit data blocks can be processed by random program replacement to generate a large number of "incorrect" forms, forming the first sentence pair.
[0151] Natural sentence extraction can begin by processing "correct" data blocks through random program replacement. As an auxiliary process, the numerous secondary data blocks with uncertain correctness generated require manual verification. Because sentences are more diverse in their expression than structured fields, and "errors" are less likely to be detected, such expressions are treated as a separate extraction rule, forming a second sentence pair. This allows for targeted data processing, improving data usability and the amount of effective information contained within the data.
[0152] Paragraph extraction, this type of data constitutes a smaller proportion compared to the two types mentioned above. It manifests as complete or significant changes to the expression of individual sentences, with a large proportion of modifications within a paragraph to revise the expression of the essay's main theme. The modified content may not contain any errors in expression from the sentence analysis alone; only the overall meaning may be flawed, or it may simply be an optimization. For example, it might be a complete re-expression of the entire paragraph describing the sunset, rather than a modification of a single sentence. This system extracts this type of modification separately. The extraction principle can be based on the paragraph as the criterion, judging the proportion of modified content within the paragraph. If the modification exceeds a certain proportion, the two paragraphs before and after the modification are treated as a third sentence pair.
[0153] Furthermore, when using the modification ratio for screening, a precondition can be added. The precondition could be to determine whether there are obvious modifications to structured fields and / or natural sentences in the paragraph. If these two types of modifications exist, the content of the corresponding modified natural sentences and fields will not be included in the calculation of the paragraph modification ratio, but will be classified as the corresponding natural sentence pairs or field pairs.
[0154] For sentence pairs extracted from natural paragraphs, instead of directly classifying them into "correct," "incorrect," and "pending" categories, a scoring mechanism can be used to preprocess the content and then use thresholds set by score to classify them into "correct," "incorrect," and "pending" categories. An example of a scoring method is as follows:
[0155] A deep learning algorithm is used to generate a grammatical correctness model, which is then used to score sentences in sentence pairs. Sentences with lower grammatical correctness after modification are considered to have been modified incorrectly and are discarded. Then, a word2vec model is used to calculate the similarity between the original and modified sentences in the sentence pair. Pairs with a similarity less than 0.8 are discarded because the difference between the original and modified sentences is too large; only sentence pairs with a similarity greater than 0.8 are retained as target sentence pairs. Figure 2 This is a flowchart illustrating a sentence pair generation method according to an embodiment of this application. See also... Figure 2 The method includes the following steps:
[0156] Step 201: Train a deep language model;
[0157] Step 202: Obtain the trained deep language model;
[0158] Step 203: Obtain the word2vec model;
[0159] Step 204: Extract candidate sentence pairs for modification from user logs;
[0160] Multiple candidate sentence pairs for modification can be extracted.
[0161] Step 205: Calculate the grammatical correctness of the sentence;
[0162] In this process, multiple candidate sentence pairs for modification can be input into a trained deep language model to obtain the grammatical correctness of the sentence before modification and the grammatical correctness of the sentence after modification in each candidate sentence pair.
[0163] Step 206: Calculate sentence similarity;
[0164] Among them, the word2vec model can be used to determine the similarity between the sentence before modification and the sentence after modification in each of the aforementioned candidate sentence pairs;
[0165] Step 207: Generate sentence pairs;
[0166] Specifically, target sentence pairs can be selected from the plurality of candidate sentence pairs based on the grammatical correctness of the sentence before modification and the sentence after modification in each candidate sentence pair, as well as the similarity between the sentence before modification and the sentence after modification in the corresponding candidate sentence pair.
[0167] In this process, if the grammatical correctness of the modified sentence in a candidate sentence pair is lower than that of the original sentence, it is considered an error and the candidate sentence pair is discarded. Then, the word2vec model is used to calculate the similarity between the original and modified sentences in the candidate sentence pair. If the similarity is less than 0.8, it indicates that the difference between the original and modified sentences is too large, and the candidate sentence pair is discarded. Only candidate sentence pairs where the grammatical correctness of the modified sentence is higher than that of the original sentence, and the similarity between the modified and original sentences is greater than 0.8, are retained as target sentence pairs.
[0168] This application embodiment can be based on the latest deep learning framework Transformer, trained on a large-scale corpus to obtain a deep language model. The number of model parameters is approximately 110*10^6. 6 While achieving better results than traditional statistical language models, the model size is greatly reduced.
[0169] The deep language model in this application mainly includes two parts: the offline training stage and the online running stage.
[0170] Figure 3 This is a schematic diagram illustrating the offline training process of a deep language model according to an embodiment of this application. See also... Figure 3 The offline training phase may include the following steps:
[0171] Step 301: Collect corpus.
[0172] The corpus can be derived from Chinese online resources, including news, blogs, forums, and student essays submitted over the years by some essay correction websites, totaling approximately 2 billion articles.
[0173] Step 302, Corpus processing.
[0174] The collected corpus can be processed using natural language processing techniques in three steps: segmentation, sentence segmentation, and word segmentation, converting the article into sentences composed of words and punctuation marks. Then, a vocabulary is constructed, with each word corresponding to a unit in the vocabulary. In this way, a sentence can be converted into a sequence of words composed of word IDs (Identity Documents).
[0175] Step 303: Build the model.
[0176] The deep language model can consist of 12 encoding layers, each with a hidden state size of 768, and 12 attention heads, for a total of 110*10^6 parameters. 6 ;
[0177] Step 304, parameter training.
[0178] This process involves feeding word sequences generated from sentences into the model. During this process, words at certain positions are converted into special [MASK] tags. The converted words are then used to predict the meaning of the sentence, thus training the language model.
[0179] Step 305: Use a deep language model to score the sentence;
[0180] The online operation phase mainly involves using the trained deep language model to score sentences.
[0181] The process of scoring sentences using deep models may include the following steps:
[0182] Step S801: Sentence preprocessing. After segmenting the sentence, the sentence is converted into a sequence of words using a vocabulary list;
[0183] Step S802: Input the word sequence into the deep language model, call the model function, and you can get a score for the sentence.
[0184] In one embodiment, the word2vec model can be used to generate a 300-dimensional vector for each modified candidate sentence pair, representing both the original and modified sentences. The cosine similarity between the two sentence vectors is then used as the similarity between the two sentences (the original and modified sentences).
[0185] In one embodiment, the log unit set on the original data system of the sentence pair generation system includes a content grouping module and a storage module. The content grouping module can generate a group code vector Xn according to the grouping rules, where n is a group identifier used to distinguish different unit data groups. The content grouping module also loads the group code vector into the unit data block corresponding to the grouping rules, forming group unit data with group code vector Xn. The storage module determines whether the group unit data is complete (whether it contains a group code vector). If it is complete, the group unit data is stored. In practice, group unit data with the same group code vector are the same sentence pair group. Multiple group unit data in the same sentence pair group represent the correct, incorrect, or undetermined form of the same object, which is used as a set of training data for deep learning.
[0186] The sentence pair generation system also includes a group unit for judging data. This unit judges the group data according to judgment rules and generates a property label vector N, Y, or P for each group. N represents the expression deemed "incorrect," Y represents the expression deemed "correct," and P represents the uncertainty of the expression's correctness. It's worth noting that the sentence pair generation system uses a P vector, representing a third category besides the explicitly "correct" and "incorrect" categories. This category is used as the basis for judging the training of the deep learning model. If errors or uncertain error rates exist, the generated model may contain unrecoverable or uncorrectable native errors, which may be amplified with use, ultimately rendering the model unusable. By setting the P vector, the training database and the deep learning model can evolve synchronously, which is an important measure for the long-term stability and reliability of the model.
[0187] Especially for sentence pairs of natural paragraphs, since there are no obvious criteria for judging correctness or error, the embodiments of this application can adopt a scoring system, using the score as a threshold filtering condition. The threshold is set based on the score to classify "correct," "incorrect," and undetermined categories, thus improving the rationality of the evaluation. A corresponding related technology involves direct binary classification of correct and incorrect judgments by humans or machine algorithms. In this process, because the boundary between correct and incorrect types is fuzzy, there are many uncertainties in subjective judgment. When only binary choices of correct and incorrect are available, it severely affects the judgment of participants (humans), leading to random results in classification. Using a scoring method, participants (individuals) will form a reasonable (comparable) score gradient by comparing scores before and after. After all scoring is completed, the result is presented as follows: "Even if there are differences in objective scores (such as the same object being rated as 5 points or 7 points), due to the continuity of the scoring process and the comparability before and after, the result is that the score relationship (high-low score relationship) between different objects is likely to remain unchanged (for example, object a is rated as 5 points, and corresponding object b is rated as 6 points; it is also possible that object a is rated as 3 points, and object b is rated as 4.5 points; the size relationship between object a and object b remains unchanged, and b's score is still higher than a's). After the scoring is completed, a reasonable dividing point (threshold) can be manually found to achieve the above classification result."
[0188] Regarding the reliability evolution of the sentence pair generation system, system users set dynamic user weights, including basic weights and additional weights. Basic weights can be calculated by analyzing system registration data, such as teacher identity, school, major, years of work experience, professional title, and honors received, as well as students' grades and past works. Additional weights can be set above the basic weights, generated during system usage, including the number of submitted works and the rating / scoring of each work. The additional weights for teacher users mainly come from the review conclusions of controversial issues. Therefore, the sentence pair generation system can set up a controversy extraction unit, that is, extracting group unit data labeled with vector P separately and randomly distributing it to users (mainly users whose system weight reaches a certain threshold, especially teacher users) through the system's display front-end. Through the display front-end, multiple users will simultaneously receive the same controversial issue, and each can answer independently. The sentence pair generation system sets a conclusion acceptance strategy, using the answers of each independently responding user as calculation variables, and calculates the acceptance conclusion through the acceptance strategy.
[0189] Essay correction websites receive millions of essays daily, allowing students to revise sentences during the writing process. This writing process can be recorded as user logs, and analyzing these logs can yield a large collection of sentence pairs: original sentences (before revision) and revised sentences. Deep learning methods can then be used to filter and select candidate sentence pairs, resulting in a target set of sentence pairs.
[0190] Since the sentences are completed by students during the writing process, any errors are problems that arise during the writing process itself. Therefore, these sentence pairs are practically meaningful for solving writing problems in learning. Furthermore, since the sentence pairs are revised by students during the process of perfecting their compositions, the quality of the sentence pairs can be ensured.
[0191] In this embodiment, the judgment unit judges the group unit data and generates a property label vector N, Y, or P, where N represents the expression form of the group unit data judged as "incorrect," Y represents the expression form of the group unit data judged as "correct," and P represents the expression form of the group unit data as "pending." For sentence pairs of natural paragraph type data, a scoring method is used, with the score serving as a threshold filtering condition. The dispute extraction unit extracts the group unit data labeled with vector P separately, randomly distributes it to users for independent responses through the display front end, uses the response results as calculation variables, and calculates the acceptance conclusion through an acceptance strategy. For sentence pairs of natural paragraph type, a deep language model is used to score the sentences, and an uncertainty vector is set to avoid the model uncertainty brought about by the uncertain results progressing to the deep learning model. Combining the deep model's scoring and similarity calculation, the quality of sentence pairs is calculated and filtered. This embodiment uses the actual occurrence of human behavior (writing process / revision process) as the basis for data classification, which is highly effective compared to the random error simulation of computers. At the same time, since people's actual behaviors are generally similar, finding these similar problems and the reasons behind them is also an important goal of education. This system can classify and extract massive amounts of users' actual behaviors.
[0192] Based on the foregoing embodiments, this application provides a text correction device, which includes the modules included, and can be implemented by a processor in an electronic device; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0193] Figure 4 This is a schematic diagram of the composition structure of a text correction device according to an embodiment of this application, as shown below. Figure 4 As shown, the device 400 includes a first acquisition module 401 and an error correction module 402, wherein:
[0194] The first acquisition module 401 is used to acquire the text to be corrected.
[0195] The error correction module 402 is used to correct the text to be corrected based on the trained error correction model to obtain the corrected text.
[0196] The trained error correction model is obtained by training the initial error correction model using training text; the training text is generated based on the text obtained by processing the first initial text and the text obtained by processing the first modified text; the first modified text is the text after modifying the first initial text.
[0197] In one embodiment, the text processing performs at least one of word segmentation, sentence segmentation, and paragraph segmentation.
[0198] In one embodiment, the apparatus further includes: a first processing module for processing the first initial text to obtain at least one second initial text; a second processing module for processing the first modified text to obtain at least one second modified text; a first generation module for generating the training text based on the at least one second initial text and the at least one second modified text; and a training module for training the initial error correction model using the training text to obtain the trained error correction model.
[0199] In one embodiment, the text processing is word segmentation; the training module includes: a first determination submodule, configured to determine at least one second initial text and at least one second modified text as first correct text; a first replacement submodule, configured to replace some identical words in each of the first correct texts to obtain at least one corresponding first incorrect text; a first generation submodule, configured to generate a corresponding first text based on each of the first correct texts and the corresponding at least one first incorrect text; and a second generation submodule, configured to generate the training text based on at least one of the first texts.
[0200] In one embodiment, the text processing is sentence segmentation; the training module includes: a second determination submodule, used to determine at least one second initial text and at least one second modified text as second correct subtexts; a second replacement submodule, used to replace some identical words in each second correct subtext to obtain at least one corresponding first undetermined text; a first analysis submodule, used to perform correctness analysis on each first undetermined text to obtain the analysis result of the corresponding first undetermined text; a third generation submodule, used to generate a second correct text based on the second correct subtext and the first undetermined text if the analysis result shows that the first undetermined text is correct; generate a second correct text based on the second correct subtext if the analysis result shows that the first undetermined text is incorrect; generate a second incorrect text based on the first undetermined text; a fourth generation submodule, used to generate a corresponding second text based on each second correct text and the corresponding second incorrect text; and a fifth generation submodule, used to generate the training text based on at least one second text.
[0201] In one embodiment, the first analysis submodule includes: a first determining unit, configured to determine at least one target object whose weight is greater than a preset weight threshold; a sending unit, configured to send each of the first pending texts to the at least one target object, so that each target object can perform a correctness analysis on the first pending texts to obtain a corresponding analysis sub-result for the first pending texts; an obtaining unit, configured to obtain at least one analysis sub-result; and a obtaining unit, configured to generate an analysis result corresponding to the first pending texts based on at least one analysis sub-result.
[0202] In one embodiment, the text processing is segmentation; the training module includes: a third determining submodule, configured to determine the correctness of each second initial text and each second modified text; a fourth determining submodule, configured to determine the similarity between each second initial text and the corresponding second modified text; a fifth determining submodule, configured to determine at least one third correct text and at least one third incorrect text corresponding to each third correct text from the at least one second initial text and the at least one second modified text based on each correctness and the corresponding similarity; a sixth generating submodule, configured to generate a corresponding third text based on each third correct text and the corresponding at least one third incorrect text; and a seventh generating submodule, configured to generate the training text based on at least one third text.
[0203] In one embodiment, the fifth determining submodule includes: a first filtering unit, configured to filter out a second candidate initial text from the at least one second initial text based on each correctness and corresponding similarity; a second determining unit, configured to determine a second modified text corresponding to the second candidate initial text as a second candidate modified text; a first classification unit, configured to determine a third correct subtext, a third incorrect subtext, and a third pending subtext from the at least one second candidate initial text and the corresponding second candidate modified text based on a preset correctness threshold; a first analysis unit, configured to perform correctness analysis on each of the third pending subtexts to obtain the analysis result of the corresponding third pending subtext; and a first generation unit, configured to generate a third correct text based on the third correct subtext and the third pending subtext when the analysis result indicates that the third pending subtext is correct; generate a third incorrect text based on the third incorrect subtext; generate a third correct text based on the third correct subtext when the analysis result indicates that the third pending subtext is incorrect; and generate a third incorrect text based on the third pending subtext and the third incorrect subtext.
[0204] In one embodiment, the third determining submodule includes: a first input unit, configured to input each of the second initial texts into a trained language model to obtain the correctness of the corresponding second initial text; a second input unit, configured to input each of the second modified texts into a trained language model to obtain the correctness of the corresponding second modified text; the fourth determining submodule includes: a conversion unit, configured to use word vectors to generate a word2vec model, converting each of the second initial texts into a first vector and converting the corresponding second modified text into a second vector; and a third determining unit, configured to determine the similarity between the corresponding second initial text and the second modified text based on the cosine similarity between each first vector and the corresponding second vector.
[0205] In one embodiment, the first filtering unit is configured to identify, from the at least one second initial text, a second initial text whose accuracy is less than the corresponding second modified text and whose similarity to the second modified text is greater than a preset similarity threshold as a second candidate initial text.
[0206] In one embodiment, the first analysis unit includes: a determining subunit for determining at least one target object whose weight is greater than a preset weight threshold; a sending subunit for sending each of the third undetermined subtexts to the at least one target object, so that each target object can perform a correctness analysis on the first undetermined subtext to obtain a corresponding analysis sub-result for the first undetermined subtext; an obtaining subunit for obtaining at least one analysis sub-result; and a obtaining subunit for generating an analysis result corresponding to the third undetermined subtext based on at least one analysis sub-result.
[0207] The descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0208] Correspondingly, embodiments of this application provide an electronic device, Figure 5 This is a schematic diagram of a hardware entity of an electronic device according to an embodiment of this application, such as... Figure 5 As shown, the hardware entity of the electronic device 500 includes a memory 501 and a processor 502. The memory 501 stores a computer program that can run on the processor 502. When the processor 502 executes the program, it implements the steps in the text correction method of the above embodiments.
[0209] The memory 501 is configured to store instructions and applications executable by the processor 502, and can also cache data to be processed or already processed (e.g., image data, audio data, voice communication data and video communication data) in the processor 502 and various modules in the electronic device 500. It can be implemented by flash memory or random access memory (RAM).
[0210] Correspondingly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in the text correction method provided in the above embodiments.
[0211] It should be noted that the descriptions of the storage medium and device embodiments above are similar to those of the method embodiments above, and have similar beneficial effects as the device embodiments. For technical details not disclosed in the storage medium and method embodiments of this application, please refer to the descriptions of the device embodiments of this application for understanding.
[0212] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0213] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0214] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0215] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, the functional units in the embodiments of this application may all be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the integrated unit may be implemented in hardware or in a combination of hardware and software functional units.
[0216] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks. Alternatively, if the integrated units of this application are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to the related technology, can be embodied in the form of software products. These computer software products are stored in a storage medium and include several instructions to cause computer devices (which may be mobile phones, tablets, desktops, personal digital assistants, navigators, digital phones, video phones, televisions, sensing devices, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0217] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined to obtain new method embodiments without conflict. The features disclosed in the several product embodiments provided in this application can be arbitrarily combined to obtain new product embodiments without conflict. The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined to obtain new method embodiments or device embodiments without conflict.
[0218] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A text error correction method, characterized in that, The method includes: The first initial text is segmented to obtain at least one second initial text; The first modified text is segmented to obtain at least one second modified text. Determine the correctness of each second initial text and each second modified text; the correctness is used to determine whether the second modified text has been modified incorrectly. Determine the similarity between each second initial text and its corresponding second modified text; the similarity is used to determine the magnitude of the text difference between the second modified text and the second initial text. Based on each correctness and corresponding similarity, a second candidate initial text is selected from the at least one second initial text; The second modified text corresponding to the second candidate initial text is determined as the second candidate modified text; Based on a preset accuracy threshold, a third correct subtext, a third incorrect subtext, and a third pending subtext are determined from at least one second candidate initial text and the corresponding second candidate modified text. A correctness analysis is performed on each of the aforementioned third undetermined subtexts to obtain the analysis results for the corresponding third undetermined subtexts; If the analysis result indicates that the third undetermined subtext is correct, then a third correct text is generated based on the third correct subtext and the third undetermined subtext; and a third incorrect text is generated based on the third incorrect subtext. If the analysis result indicates that the third undetermined subtext is incorrect, then a third correct text is generated based on the third correct subtext; and a third incorrect text is generated based on the third undetermined subtext and the third incorrect subtext. Generate the corresponding third text based on each of the third correct texts and at least one corresponding third incorrect text; Generate training text based on at least one of the third texts; Using the training text, the initial error correction model is trained to obtain the trained error correction model; Get the text to be corrected; The text to be corrected is corrected based on the trained error correction model to obtain the corrected text. The trained error correction model is obtained by training the initial error correction model using training text. The training text is generated based on the text obtained after processing the first initial text and the text obtained after processing the first modified text; the first modified text is the text after modifying the first initial text.
2. The method according to claim 1, characterized in that, The method further includes: At least one of the second initial texts and at least one of the second modified texts are both determined as the first correct texts; Replace some of the same words in each of the first correct texts to obtain at least one corresponding first incorrect text; Generate a corresponding first text based on each first correct text and at least one corresponding first incorrect text; The training text is generated based on at least one of the first texts.
3. The method according to claim 1, characterized in that, The method further includes: At least one of the second initial texts and at least one of the second modified texts are both determined as the second correct subtexts; Replace some of the same words in at least one second initial text and at least one second modified text to obtain at least one corresponding first pending text; Perform a correctness analysis on each of the first undetermined texts to obtain the analysis results for the corresponding first undetermined text; If the analysis result indicates that the first text to be determined is correct, then a second correct text is generated based on the second correct subtext and the first text to be determined; if the analysis result indicates that the first text to be determined is incorrect, then a second correct text is generated based on the second correct subtext; and a second incorrect text is generated based on the first text to be determined. Generate the corresponding second text based on each second correct text and the corresponding second incorrect text; The training text is generated based on at least one of the second texts.
4. The method according to claim 3, characterized in that, The step of performing a correctness analysis on each of the first undetermined texts to obtain the analysis result for the corresponding first undetermined text includes: Identify at least one target object whose weight is greater than a preset weight threshold; Each of the first undetermined texts is sent to the at least one target object, so that each target object can perform a correctness analysis on the first undetermined text and obtain the corresponding analysis sub-result of the first undetermined text; Obtain at least one of the analysis sub-results; Based on at least one of the analysis sub-results, an analysis result corresponding to the first pending text is generated.
5. The method according to claim 1, characterized in that, Determining the correctness of each of the second initial texts and each of the second modified texts includes: Each of the second initial texts is input into the trained language model to obtain the accuracy of the corresponding second initial text; Each of the second modified texts is input into the trained language model to obtain the accuracy of the corresponding second modified text; Determining the similarity between each of the second initial texts and the corresponding second modified texts includes: The word2vec model is generated using word vectors, converting each second initial text into a first vector and the corresponding second modified text into a second vector. The similarity between the corresponding second initial text and the second modified text is determined based on the cosine similarity between each of the first vectors and the corresponding second vectors.
6. The method according to claim 1, characterized in that, The step of selecting second candidate initial texts from the at least one second initial text based on each correctness and corresponding similarity includes: From the at least one second initial text, the second initial text with an accuracy lower than the corresponding second modified text and a similarity greater than a preset similarity threshold is determined as the second candidate initial text.
7. The method according to claim 1, characterized in that, The correctness analysis of each of the third undetermined sub-texts, to obtain the analysis result of the corresponding third undetermined sub-text, includes: Identify at least one target object whose weight is greater than a preset weight threshold; Each of the third undetermined sub-texts is sent to the at least one target object, so that each target object can perform a correctness analysis on the third undetermined sub-text and obtain the corresponding analysis sub-result of the first undetermined text. Obtain at least one of the analysis sub-results; Based on at least one of the analysis sub-results, an analysis result corresponding to the third undetermined sub-text is generated.
8. A text correction device, characterized in that, The device includes: The training module is used to segment a first initial text to obtain at least one second initial text; segment a first modified text to obtain at least one second modified text; determine the correctness of each second initial text and each second modified text; the correctness is used to determine whether the second modified text has been modified incorrectly; determine the similarity between each second initial text and its corresponding second modified text; the similarity is used to determine the magnitude of the text difference between the second modified text and the second initial text; based on each correctness and the corresponding similarity, select second candidate initial texts from the at least one second initial text; determine the second modified text corresponding to the second candidate initial text as the second candidate modified text; and determine a third correct subtext from the at least one second candidate initial text and its corresponding second candidate modified text based on a preset correctness threshold. A third erroneous subtext and a third undetermined subtext; perform correctness analysis on each of the third undetermined subtexts to obtain the analysis result of the corresponding third undetermined subtext; if the analysis result shows that the third undetermined subtext is correct, generate a third correct text based on the third correct subtext and the third undetermined subtext; generate a third erroneous text based on the third erroneous subtext; if the analysis result shows that the third undetermined subtext is erroneous, generate a third correct text based on the third correct subtext; generate a third erroneous text based on the third undetermined subtext and the third erroneous subtext; generate a corresponding third text based on each of the third correct texts and at least one corresponding third erroneous text; generate training text based on at least one of the third texts; train the initial error correction model using the training text to obtain the trained error correction model; The first acquisition module is used to acquire the text to be corrected. The error correction module is used to correct the text to be corrected based on the trained error correction model, so as to obtain the corrected text. The trained error correction model is obtained by training the initial error correction model using training text. The training text is generated based on the text obtained after processing the first initial text and the text obtained after processing the first modified text; the first modified text is the text after modifying the first initial text.
9. An electronic device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the text correction method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the text correction method according to any one of claims 1 to 7.