Text processing method and device

By combining text error detection rules and error correction models, joint error correction text is solved, and the problems of incomplete rules coverage and low flexibility in the existing technology are solved, and efficient and accurate text error correction is achieved.

CN114742050BActive Publication Date: 2025-02-28BEIJING KINGSOFT DIGITAL ENTERTAINMENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210436972.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-19
Publication Date
2025-02-28
Estimated Expiration
2042-04-19

AI Technical Summary

Technical Problem

The prior art has problems of incomplete rules coverage and low flexibility in text error correction, and it is difficult to effectively improve error correction efficiency and accuracy.

Method used

By combining preset text error detection rules and text error correction models, preliminary error detection and in-depth correction of error correction text is carried out to achieve joint error correction between rules and models.

Benefits of technology

It improves the accuracy and efficiency of text error correction, ensures the accuracy of the target correction text, and covers a wider range of error correction scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114742050B_ABST
    Figure CN114742050B_ABST
Patent Text Reader

Abstract

The present application provides a text processing method and device, wherein the text processing method comprises: obtaining a text to be corrected; processing the text to be corrected according to a preset text error detection rule to obtain an initial error correction text; inputting the initial error correction text into a text error correction model for processing, and determining a target correction text corresponding to the text to be corrected according to the processing result. The method improves the accuracy of error correction by combining rules and models for error correction, and covers a wider range of error correction, so as to solve the problem of difficulty in rule maintenance caused by using rule correction alone in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of text processing technology in the field of artificial intelligence, and in particular to a text processing method and device. Background Art

[0002] Artificial intelligence (AI) refers to the ability of engineered (i.e. designed and manufactured) systems to perceive the environment, as well as the ability to acquire, process, apply and represent knowledge. The development status of key technologies in the field of artificial intelligence includes key technologies such as machine learning, knowledge graphs, natural language processing, computer vision, human-computer interaction, biometric recognition, virtual reality / augmented reality, etc. Natural language processing is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between humans and computers using natural language. It involves many fields, mainly including machine translation (the process of using computers to convert one natural language (source language) into another natural language (target language)), machine reading comprehension (it means giving a context description and then a corresponding query. After reading the context, the machine gives the answer to the corresponding query), question answering system (Question Answering System, QA, is an advanced form of information retrieval system. It can answer questions raised by users in natural language accurately and concisely in natural language) and text error correction.

[0003] As a relatively basic natural language processing technology, text error correction is applied in more and more scenarios; error correction and proofreading is a common process for correcting texts. Its main task is to detect and proofread given text content, and to proofread grammatically correct texts and texts containing incorrect characters. Scenarios such as homework grading, file storage, and paper checking all involve error correction of text content to improve the quality of the text content. In the prior art, in order to improve the efficiency of text error correction, preset rules are usually used. In this process, a large number of rules need to be preset, which not only fails to cover all error correction scenarios, but also has the problem of low flexibility. Therefore, an effective solution is urgently needed to solve the above problems. Summary of the invention

[0004] In view of this, the embodiment of the present application provides a text processing method to solve the technical defects existing in the prior art. The embodiment of the present application also provides a text processing device, a computing device, and a computer-readable storage medium.

[0005] According to a first aspect of an embodiment of the present application, a text processing method is provided, comprising:

[0006] Get the text to be corrected;

[0007] Processing the text to be corrected according to a preset text error detection rule to obtain an initial error correction text;

[0008] The initial error correction text is input into a text error correction model for processing, and a target correction text corresponding to the text to be corrected is determined according to the processing result.

[0009] Optionally, the processing the text to be corrected according to a preset text error detection rule to obtain an initial error correction text includes:

[0010] Performing word segmentation processing on the text to be corrected to obtain multiple word units, and processing each word unit according to the structural error detection rule to obtain a first initial error correction text; and / or,

[0011] The text to be corrected is processed according to grammatical error detection rules to obtain a second initial error correction text.

[0012] Optionally, the step of inputting the initial error correction text into a text error correction model for processing, and determining a target corrected text corresponding to the to-be-corrected text according to the processing result, comprises:

[0013] Inputting the initial error-correcting text into the text error-correcting model;

[0014] Processing the initial error-corrected text by the detection unit in the text error-corrected model to obtain an intermediate error-corrected text;

[0015] Processing the intermediate error correction text by the error correction unit in the text error correction model to obtain an initial corrected text, and outputting the text error correction model;

[0016] According to the initial revised text, the initial error correction text is updated to the target revised text.

[0017] Optionally, updating the initial error-corrected text to the target corrected text according to the initial corrected text includes:

[0018] Parsing the initial revised text to obtain revision identification information;

[0019] The initial error correction text is updated according to the correction identification information and the initial correction text to obtain the target correction text.

[0020] Optionally, determining a target corrected text corresponding to the text to be corrected according to the processing result includes:

[0021] Determine the error correction character corresponding to the initial error correction text according to the processing result;

[0022] Selecting candidate characters corresponding to the error correction characters from a preset text library to form a candidate character sequence;

[0023] Updating the initial error correction text based on each candidate character in the candidate character sequence, and detecting each updated initial error correction text;

[0024] According to the detection result, a target error correction text is selected from the updated initial error correction text as the target revised text.

[0025] Optionally, after the step of obtaining the text to be corrected is performed, the method further includes:

[0026] Inputting the text to be corrected into the text correction model for processing to obtain an intermediate corrected text corresponding to the text to be corrected;

[0027] In the case where the intermediate revised text is inconsistent with the target revised text, text fusion is performed on the intermediate revised text, the target revised text and the initial error correction text;

[0028] The target text corresponding to the text to be corrected is determined according to the text fusion result.

[0029] Optionally, after the step of determining the target corrected text corresponding to the text to be corrected according to the processing result is performed, the method further includes:

[0030] Translating the target revised text to obtain a translated revised text corresponding to the first language;

[0031] Back-translating the translated revised text to obtain a back-translated revised text corresponding to the language of the target revised text;

[0032] The target corrected text is detected based on the back-translated corrected text, and the text error correction model is optimized according to the detection result.

[0033] Optionally, the training process of the text error correction model is as follows:

[0034] Extract sample text from a preset sample set;

[0035] Inputting the sample text into an initial text error correction model for processing to obtain a predicted corrected text;

[0036] Calculate an error detection loss value and a correction loss value according to the sample correction text corresponding to the sample text and the predicted correction text;

[0037] The initial text error correction model is adjusted based on the error detection loss value and the correction loss value until the text error correction model that meets the training stop condition is obtained.

[0038] According to a second aspect of an embodiment of the present application, there is provided a text processing device, including:

[0039] A text acquisition module is configured to acquire the text to be corrected;

[0040] A text processing module is configured to process the text to be corrected according to a preset text error detection rule to obtain an initial error correction text;

[0041] The error correction processing module is configured to input the initial error correction text into the text error correction model for processing, and determine the target corrected text corresponding to the text to be corrected according to the processing result.

[0042] According to a third aspect of an embodiment of the present application, a computing device is provided, including:

[0043] Memory and processor;

[0044] The memory is used to store computer-executable instructions, and the processor implements the steps of the text processing method when executing the computer-executable instructions.

[0045] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the text processing method are implemented.

[0046] According to a fifth aspect of an embodiment of the present application, a chip is provided, which stores a computer program, and the computer program implements the steps of the text processing method when executed by the chip.

[0047] The text processing method provided by the present application can, after obtaining the text to be corrected, first perform preliminary error correction processing on the text to be corrected according to preset text error detection rules to obtain an initial error-corrected text; then, input the initial error-corrected text into a text error correction model for processing, and determine the target correction text corresponding to the text to be corrected according to the processing result, thereby realizing the processing of the text to be corrected by a joint error correction method of rules and models, which can not only improve the accuracy of error correction, but also avoid omissions of errors, thereby ensuring the accuracy of the target correction text. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 is a flowchart of a text processing method provided by an embodiment of the present application;

[0049] Figure 2 is a schematic diagram of a text processing method provided by an embodiment of the present application;

[0050] Figure 3 It is a processing flow chart of a text processing method applied to an English composition correction scenario provided by an embodiment of the present application;

[0051] Figure 4 is a structural schematic diagram of a text processing device provided by an embodiment of the present application;

[0052] Figure 5 It is a structural block diagram of a computing device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0053] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.

[0054] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.

[0055] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.

[0056] First, the terms involved in one or more embodiments of the present invention are explained.

[0057] NER (Named Entity Recognition): used to identify entities in a sentence and predict an entity type label for each word in the sentence.

[0058] Text to be corrected: text containing grammar, spelling, missing word units and other problems.

[0059] Target correction text: refers to the text generated after proofreading and correcting the text to be corrected that does not conform to grammar or contains incorrect characters.

[0060] In the present application, a text processing method is provided. The present application also relates to a text processing apparatus, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0061] Figure 1 A flowchart of a text processing method provided according to an embodiment of the present application is shown, which specifically includes the following steps:

[0062] Step S102, obtaining the text to be corrected.

[0063] Specifically, the text to be corrected specifically refers to the text containing problems that need to be corrected, which can be in text format, word format or PDF format, etc., and is a text paragraph composed of character units contained in the text format. Such as text containing grammatical errors, text containing spelling errors, text containing many words, text containing few words, etc.; wherein, the text to be corrected can be the text that needs to be detected and corrected uploaded by the user through the client, such as essays, articles, comments, etc.; it can also be a sample text that needs to be detected and corrected in the model training stage. Text that needs to be corrected in any scenario can use the text processing method provided in this embodiment to implement the error correction processing operation.

[0064] This embodiment is described by taking the text to be corrected as the text corresponding to English as an example. The correction implementation corresponding to different languages ​​in other scenarios can refer to the same or corresponding description content of this embodiment, and no further details are given here.

[0065] Step S104, processing the text to be corrected according to a preset text error detection rule to obtain an initial error correction text.

[0066] Specifically, after obtaining the text to be corrected as mentioned above, further, in order to be able to accurately correct the text to be corrected in the future, preliminary error detection processing can be performed through text error detection rules to preliminarily correct some relatively easy-to-find problems in the text to be corrected through rule detection.

[0067] Among them, the text error detection rules specifically refer to the rules for preliminary error detection and correction of the error-corrected text, including but not limited to detecting problems such as extra words, missing words, and spelling errors. In practical applications, the text error detection rules can be set according to the actual application scenario. Correspondingly, the initial error-corrected text specifically refers to the error-corrected text obtained after preliminary error detection and correction through the text error detection rules, and the initial error-corrected text can be used for secondary error detection and correction through the model later.

[0068] Based on this, the text to be corrected is processed according to the text error detection rules, that is, preliminary detection is performed on the errors contained in the text to be corrected, and preliminary corrections are performed to give priority to the errors that are easier to find in the text to be corrected. In specific implementation, the operation of processing the text to be corrected according to the rules can be achieved through the edit distance; that is, the edit distance can be used to calculate the shortest operation distance between the character unit contained in the text to be corrected and the correct character unit. One operation is defined as one distance, and the shortest edit distance is to find the minimum number of operations between two character units, so as to complete preliminary detection and correction through the rules. In this process, it is achieved according to the minimum component elements of adding, deleting, and replacing character units.

[0069] Accordingly, compared with the text to be corrected, the initial correction text after preliminary processing by the text error detection rules is actually an initial correction text with correct spelling and no more words, no less words, etc. after correcting the problems of extra words, missing words, and spelling errors in the text to be corrected. In other words, if the text to be corrected contains extra words, the extra words can be deleted by the text error detection rules, and the obtained initial correction text will not contain extra words; or if the text to be corrected contains wrong words, the wrong words can be corrected by the text error detection rules, and the obtained initial correction text will not contain wrong words; or if the text to be corrected lacks words, the missing words can be determined and corrected by the text error detection rules, and the obtained initial correction text will contain the missing words.

[0070] For example, the text to be corrected is "go school". The text to be corrected is processed according to the text error detection rules, that is, a set number of texts are first selected, and the shortest edit distance between them and the text to be corrected is calculated. According to the calculation result, the shortest edit distance is determined to be 2, and the corresponding text is "go to school". Therefore, when correcting, the word "to" can be added to the text to be corrected to obtain the initial correction text "go to school" for subsequent processing. Similarly, when there are multiple words or words in the text to be corrected, the words to be deleted and the correctly spelled words can be determined by calculating the shortest edit distance. Based on this, the text to be corrected is corrected to obtain the initial correction text for subsequent processing.

[0071] Furthermore, when processing the text to be corrected through text error detection rules, in order to improve the efficiency of preliminary error detection and the accuracy of finding problems, error detection rules that can complete some problems in a shorter time can be set according to needs, such as structural error detection rules and / or grammatical error detection rules, which are specifically implemented as follows:

[0072] The text to be corrected is segmented to obtain multiple word units, and each word unit is processed according to the structural error detection rules to obtain a first initial error correction text; and / or, the text to be corrected is processed according to the grammatical error detection rules to obtain a second initial error correction text.

[0073] Specifically, the structural error detection rules specifically refer to the rules for detecting whether the structure of each word unit in the text to be corrected is correct, such as detecting whether the word unit is spelled incorrectly, whether there are missing characters or multiple characters, etc. It should be noted that the structural error detection rules need to be completed in combination with a pre-established dictionary, that is, by comparing each word unit with the word units included in the preset dictionary, the correctness of each word unit can be determined, and then the erroneous word units are selected for correction to obtain the first initial error correction text.

[0074] Correspondingly, the grammar error checking rules specifically refer to the rules for checking whether the grammar in the text to be corrected is correct, such as checking whether the text is fluent, whether the word unit structure is correct, etc. It should be noted that the grammar error checking rules can be set according to the actual application scenario, and the set rule content can be dynamically increased or decreased.

[0075] In addition, the text to be corrected may have both grammatical and structural problems. Therefore, when processing the text to be corrected through text error detection rules, it can be completed by combining grammatical error detection rules and structural error detection rules at the same time, or preliminary error correction and correction can be completed in sequence.

[0076] For example, an English article text {…go see the sun tomorrow…} is received from a user and then a preliminary error check is performed on the text according to the preset structural error detection rules and grammatical error detection rules {detecting whether a word has extra letters, detecting whether a word has fewer letters, detecting whether a word is misspelled}. If it is determined that the word "to" is missing from the text, the word "to" can be added to the text to obtain an initial error-corrected text {…go to see the sun tomorrow…}, so that a secondary error correction can be performed in combination with the model later to provide the user with an English article text without errors.

[0077] In summary, by combining grammatical error detection rules and structural error detection rules to perform preliminary error detection on the text to be corrected, we can prioritize correcting simpler problems in the text to be corrected, and then use the model for secondary error correction, which can greatly improve the text correction efficiency and accuracy, and can cover a wider range of error correction problems, further ensuring the accuracy of the corrected text.

[0078] Step S106, inputting the initial error correction text into a text error correction model for processing, and determining a target corrected text corresponding to the text to be corrected according to the processing result.

[0079] Specifically, after obtaining the initial error correction text processed and corrected by the text error detection rules, in order to further improve the accuracy of error correction and fully discover all errors in the text to be corrected, the text error correction model can be combined for error correction processing. That is, the initial error correction text is input into the pre-trained text error correction model for processing, and the problems in the initial error correction text are marked and corrected by the text error correction model, and the target correction text corresponding to the text to be corrected can be obtained according to the processing results.

[0080] In specific implementation, the text correction model is a model created based on the BERT model structure. When the initial correction text is processed by the model, the initial correction text is output to the pre-trained BERT model, and then the initial correction text is encoded through the encoding layer to obtain the encoding vector corresponding to the initial correction text; secondly, the encoding vector is decoded by the decoding unit to obtain the decoding vector corresponding to the initial correction text. Finally, based on the decoding vector, the prediction result corresponding to each word position in the initial correction text is output through the output layer in the model, that is, a prediction result is given for each word position in the output layer, and the prediction result for each position can be "remain unchanged", "delete", "replace", "add", etc. Finally, the text is corrected according to the prediction result to obtain the target corrected text that meets the downstream business usage needs, that is, the text that does not contain error information.

[0081] Based on this, in the process of determining the target corrected text corresponding to the text to be corrected according to the processing results of the model, the proofreading results of each word position in the text are actually output by the model. For example, whether a word at a certain position in the text remains unchanged, replaced, deleted or added, etc., and then the text to be corrected will be processed subsequently according to the proofreading results, that is, the text to be corrected will be corrected according to the proofreading results. The correction includes keeping the same, replacing words, deleting words or adding words, so as to obtain the target corrected text that meets the correction requirements.

[0082] In practical applications, the text correction model can be implemented using a NER-based sequence labeling model. That is to say, the text correction model can be used to perform sequence labeling on each character unit in the initial correction text. Based on the labeling results corresponding to each word unit, it can be determined whether there is a problem. Then, the word unit corresponding to the problematic labeling result is selected for correction to obtain the target corrected text.

[0083] That is to say, using the NER sequence annotation model as a text correction model, the proofreading results corresponding to each word position in the initial correction text can be predicted in the processing stage, and then the initial correction text can be adjusted according to the proofreading results, such as keeping the words unchanged, replacing words, deleting words, or adding words; after all proofreading results are processed, the target corrected text can be obtained.

[0084] In this process, the NER sequence labeling model is implemented as follows: the initial error correction text is input into the model, and the encoding unit in the model encodes it to obtain an encoding vector, which is then input into the decoding unit. At this time, the encoding vector is processed by the decoding unit based on each word, and the proofreading result corresponding to each word is output. The proofreading result is the decoding vector corresponding to each word; finally, it is output through the output layer, and the decoding vector corresponding to each word can be converted into a proofreading result, which can be used to generate the target corrected text according to the proofreading result.

[0085] Furthermore, in order to enable the text error correction model to complete error correction processing while labeling problems, a multi-task learning method can be adopted in the model training stage, so that the model learns both problem labeling and error correction capabilities, thereby meeting the error correction processing operations in the application stage. In this embodiment, the specific implementation is as shown in steps S1082 to S1088.

[0086] Step S1082, extracting sample text from a preset sample set;

[0087] Step S1084, inputting the sample text into the initial text error correction model for processing to obtain a predicted corrected text;

[0088] Step S1806, calculating an error detection loss value and a correction loss value according to the sample correction text corresponding to the sample text and the predicted correction text;

[0089] Step S1088, adjusting the parameters of the initial text error correction model based on the error detection loss value and the correction loss value until the text error correction model that meets the training stop condition is obtained.

[0090] Specifically, the sample set specifically refers to a collection of texts that contains a large number of different problems. Accordingly, the sample text specifically refers to the text from the sample set in the training model stage; accordingly, the initial text error correction model specifically refers to the model that learns sequence labeling and error correction capabilities in the training stage, and the model has not yet been trained; accordingly, the predicted corrected text specifically refers to the text obtained after the sample text is sequence labeled and corrected by the initial text error correction model. Correspondingly, the sample corrected text specifically refers to the correct text corresponding to the sample text. Correspondingly, the error detection loss value specifically refers to the loss value of calculating the initial text error correction model's ability in sequence labeling, and the correction loss value specifically refers to the loss value of calculating the initial text error correction model's ability in correction, and the loss value can be calculated using the maximum entropy loss function or the cross entropy loss function, etc. Among them, the training stop conditions include but are not limited to the comparison of loss values, the number of iterations, etc. In actual applications, they can be selected according to application requirements.

[0091] Accordingly, adjusting the parameters of the initial text error correction model specifically refers to adjusting the hyperparameters in the initial text error correction model, including but not limited to the learning rate, batch_size and other parameters of the initial error correction model during the learning process. By adjusting the parameters, the loss of the text error correction model on the validation set can be minimized until convergence to obtain a text error correction model that meets the stopping conditions. Among them, the validation set refers to the set for verifying the currently trained text error correction model after each training cycle, which is used to verify the prediction ability of the text error correction model in the current cycle, so as to ensure that the text error correction model can have better prediction ability to meet the use in the application stage.

[0092] It should be noted that the process of the initial text error correction model processing the sample text in the training phase is similar to the process of the above-mentioned text error correction model processing the initial error correction text set, which will not be repeated here.

[0093] Based on this, in the model training stage, we can first extract sample text from the preset sample set, and then input it into the constructed initial text error correction model for processing, so as to obtain the predicted corrected text according to the processing results. Secondly, we calculate the error detection loss value and the correction loss value according to the sample corrected text and the predicted corrected text corresponding to the sample text; finally, we adjust the parameters of the initial text error correction model according to the error detection loss value and the correction loss value, and so on, until we obtain a text error correction model that meets the training stop conditions.

[0094] It should be noted that in the training phase, the sample correction text is a text containing annotation information, which is used to complete the training of the model's sequence annotation ability. In the application phase, the model can be set not to output the target correction text containing annotation information. At the same time, the annotation information in the sample correction text is annotated in units of character units, that is, each character unit will correspond to a label, and different labels express different meanings, such as O for unchanged, R for deletion, D for rewrite, and A for addition; so that the model can process the text according to the label content in the prediction phase, and then adjust the correction ability to output the target correction text that meets the error correction requirements.

[0095] In summary, by adopting a multi-task learning approach to train the text error correction model, the model can learn both error detection and correction capabilities, thereby quickly completing the text error correction processing operation and achieving the correct target correction text feedback in a relatively short period of time.

[0096] Furthermore, when the initial correction text is corrected through the text correction model, error detection is actually performed first and then correction processing is performed, so that the target corrected text that meets the correction requirements can be output. In this embodiment, the specific implementation method is such as steps S1182 to S1188.

[0097] Step S1182, inputting the initial error correction text into the text error correction model;

[0098] Step S1184, processing the initial error correction text by the detection unit in the text error correction model to obtain an intermediate error correction text;

[0099] Step S1186, processing the intermediate error correction text by the error correction unit in the text error correction model to obtain an initial corrected text, and outputting the text error correction model;

[0100] Step S1188 updates the initial error correction text to the target correction text according to the initial correction text.

[0101] Specifically, the intermediate text to be corrected refers to the text containing annotation information, and the annotation information corresponds to each character unit in the text. Different annotation information expresses different problem types, such as O for unchanged, R for deletion, D for rewriting, A for addition, etc.; correspondingly, the initial correction text refers to the text that can correct the intermediate correction text carrying annotation information.

[0102] That is to say, when the initial error correction text is processed by the detection unit in the text error correction model, the error correction unit actually calls the preset spelling error detection library, and the initial error correction text is error-checked and corrected by the spelling error detection library, so as to determine the intermediate error correction text according to the error detection and correction results. Among them, the spelling error detection library stores common words in the same field, which are used to correct misspelled words in the initial error correction text.

[0103] Based on this, after obtaining the initial error correction text, it can be input into the trained text error correction model, and the initial error correction text can be processed by the detection unit in the text error correction model to obtain an intermediate error correction text carrying annotation information; then the intermediate error correction text is processed by the error correction unit to determine the correct answers corresponding to different questions according to the annotation information carried in the intermediate error correction text, that is, the initial corrected text, and finally it is output to the text error correction model, and the initial corrected text is used to update the text to be corrected to obtain the target corrected text.

[0104] Among them, the error correction unit processes the intermediate error correction text to actually generate the initial correction text based on the error detection results. That is, since the intermediate error correction text contains annotation information, the error correction unit can determine whether the word in the current position needs to remain unchanged, replaced, deleted or added by traversing the annotation information. Then, the initial correction text can be generated according to the annotation information to record the correction operation corresponding to the word at each position in the text, and finally the correction processing can be performed based on this. In other words, after the initial correction text is obtained, the words corresponding to each position of the error correction text can be corrected according to the annotation information recorded in the initial correction text, so as to update the words that are deleted, replaced and added in the error correction text, and the target correction text can be obtained according to the update result.

[0105] In summary, by using the detection and correction capabilities of the text error correction model to process the initial error correction text, not only can error detection and correction be achieved, but the error correction efficiency can also be effectively improved, so as to accurately and efficiently feedback accurate text content to users.

[0106] Furthermore, when the initial error correction text is updated based on the initial revised text, in order to ensure that the corrected text is correct and to avoid excessive error correction text content, repeated content, and errors in the correction position, the update processing operation can be completed in combination with the correction identification information. In this embodiment, the specific implementation is as follows: Steps S11882 to S11884.

[0107] Step S11882, parsing the initial revised text to obtain revision identification information;

[0108] Step S11884, updating the initial error correction text according to the correction identification information and the initial correction text to obtain the target correction text.

[0109] Specifically, the correction identification information specifically refers to the information that identifies the correction position. The position of the content to be corrected in the initial correction text can be determined through the correction identification information. Based on this, after obtaining the initial correction text, it can be parsed to determine the correction identification information corresponding to the correction position, and then the initial correction text can be updated according to the correction identification information and the text content in the initial correction text to obtain the target correction text corresponding to the text to be corrected.

[0110] It should be noted that when parsing the initial corrected text, what is actually being done is to determine the identification information corresponding to each word in the text to be corrected in the initial corrected text, that is, to extract the identification information corresponding to each word from the initial corrected text, so that the identification information and the initial corrected text can be combined to correct each word in the initial correction text in the subsequent process, so as to obtain the target corrected text based on the processing results.

[0111] Using the above example, after obtaining the initial error correction text {…go to see the sun tomorrow…}, the initial error correction text is input into the trained text error correction model, and processed by the detection unit in the text error correction model, that is, the detection unit determines the shortest edit distance between each word in the initial error correction text and the correct word by calculating the shortest edit distance, so as to determine whether each word has an error according to the shortest edit distance, and obtain the intermediate error correction text {…go(O)to(O)see(O)the(O)sun(D)tomorrow(O)…} carrying the annotation information, and then the error correction unit in the text error correction model processes the intermediate error correction text carrying the annotation information, and determines that the words go, to, see, the, and tomorrow have no problems and do not need to be corrected, and the sun corresponds to the annotation information D, indicating that it needs to be rewritten, and the initial correction text sunrise is determined according to the rewriting result of the error correction unit, and finally it is output to the text error correction model.

[0112] Furthermore, in order to accurately correct the errors in the text, the fifth word in the initial error correction text that needs to be corrected can be determined based on the initial correction text, and then the initial correction text can be used to update the initial error correction text to obtain the target correction text {…go to see the sunrisetomorrow…}, which can be used for subsequent users to publish English articles.

[0113] In summary, by processing the initial error correction text in combination with the correction identification information, not only can the problem of slow correction traversal speed when there is too much initial correction text be avoided, but also when there is a lot of repeated content in the initial correction text, the content that needs to be corrected can be accurately processed to ensure the accuracy of the target correction text.

[0114] In addition, considering that the text correction model outputs the text content to be corrected, and this content is the result of the model output, there is a certain error probability. If it is directly reused, it may affect the correctness of the target corrected text. Therefore, the target corrected text can be determined by candidate detection. In this embodiment, the specific implementation is as follows: steps S1282 to S1288.

[0115] Step S1282, determining the error correction character corresponding to the initial error correction text according to the processing result;

[0116] Step S1284, selecting candidate characters corresponding to the error correction characters in a preset text library to form a candidate character sequence;

[0117] Step S1286, updating the initial error correction text based on each candidate character in the candidate character sequence, and detecting each updated initial error correction text;

[0118] Step S1288, selecting a target error correction text from the updated initial error correction text as the target revised text according to the detection result.

[0119] Specifically, the error correction character specifically refers to the predicted character that can replace the erroneous character after the text error correction model performs error detection and correction processing on the initial error correction text; accordingly, the text library specifically refers to a database that integrates a large number of similar characters, where similar characters can be similar in pronunciation, semantics or glyphs; accordingly, the candidate character specifically refers to the character similar to the error correction character, and the candidate character sequence is a set of candidate characters. Accordingly, the detection of the updated initial error correction text specifically refers to the processing operation of detecting the grammatical / semantic correctness of each candidate character after replacing the erroneous character in the initial error correction text.

[0120] In specific implementation, the detection processing operation can be implemented through a grammar model, that is, the updated initial error correction texts are scored through the grammar model, and the text with the highest score is selected as the target correction text. It should be noted that the candidate character sequence includes error correction characters.

[0121] Based on this, when the error-correction characters corresponding to the initial error-corrected text output by the text error-correction model are obtained, considering that there is also a probability of error in the output result of the text error-correction model, the correctness detection and in-depth correction processing can be realized through the candidate character sequence; that is, select candidate characters corresponding to the error-correction characters from the preset text library to form a candidate character sequence, and then update the initial error-corrected text based on each candidate character included in the candidate character sequence to obtain each initial error-corrected text containing candidate characters, and then detect each initial error-corrected text containing candidate characters, so that the initial error-corrected text with the highest score containing candidate characters can be selected as the target corrected text according to the detection result.

[0122] For example, the initial error-corrected text is "Your age is so big", and the error-correction character corresponding to the initial error-corrected text is determined as "龄" through the text error-correction model; then select candidate characters corresponding to the error-correction character "龄" from the preset text library to form a candidate character sequence {"龄;另;领"}; then add each candidate character to the initial error-corrected text to obtain the first initial error-corrected text "Your age is so big", the second initial error-corrected text "Your year another is so big" and the third initial error-corrected text "Your year lead is so big"; then score each error-corrected text, determine that the score of the first initial error-corrected text is S1, the score of the second initial error-corrected text is S2, and the score of the third initial error-corrected text is S3, and S1>S3>S2. Determine that the first initial error-corrected text "Your age is so big" has the highest score, then this text can be selected as the target corrected text, that is, this text is the corrected text corresponding to the initial error-corrected text "Your age is so big".

[0123] In summary, by using candidate characters to correct the text, not only can the accuracy of text error correction be improved, but also the error correction omission can be avoided when the text error-correction model makes a wrong prediction, so that a more accurate error-corrected text can be guaranteed to be fed back to the user.

[0124] In addition, considering that there is a problem of non-crossing error correction between the text error detection rule and the text error-correction model, if only the progressive method is used for error correction, there may be omissions. Therefore, after both of them complete error correction, the correction results of the two can be combined to determine the target text. In this embodiment, the specific implementation is as steps S1382 to S1386.

[0125] Step S1382, input the text to be error-corrected into the text error-correction model for processing to obtain an intermediate corrected text corresponding to the text to be error-corrected;

[0126] Step S1384, in the case that the intermediate corrected text is inconsistent with the target corrected text, perform text fusion on the intermediate corrected text, the target corrected text, and the initial error-corrected text;

[0127] Step S1386, determining the target text corresponding to the text to be corrected according to the text fusion result.

[0128] Specifically, the intermediate corrected text refers to the text after the text correction model directly corrects the text to be corrected. Correspondingly, the target text refers to the text obtained by integrating the three correction results.

[0129] Based on this, after the target correction text is obtained by combining the text error detection rules and the text error correction model, in order to ensure the accuracy of error correction, the text to be corrected can also be processed by the text error correction model to obtain the intermediate correction text corresponding to the text to be corrected. If the intermediate correction text is inconsistent with the target correction text, it means that the text error detection rules have also corrected other problems. At this time, the intermediate correction text, the target correction text and the initial correction text can be merged to select the text content that is the same among the three to form the target text, so that the target text can be formed from the three correction processing results and all the correct results to ensure the correctness of the target text. If the intermediate correction text is consistent with the target correction text, it means that the correction result is correct, and no processing is required.

[0130] For example, the text to be corrected is {123456}, and the initial correction text {123456} is obtained by modifying the rules. 1}, and then process the initial error correction text through the text error correction model to obtain the target correction text {12345 1 6 1}; At this time, the text to be corrected {123456} can be directly input into the text correction model for processing to obtain the intermediate corrected text {1234 1 5 1 6}; By comparing the intermediate correction text with the target correction text, it is determined that the two are different. In order to ensure the output of accurate correction text, the initial error correction text {123456 1}、Intermediate correction text{1234 1 5 1 6} and target correction text {12345 1 6 1} to be fused, so that the target text {123456} corresponding to the text to be corrected is obtained according to the fusion result. 1 5 1 6 1}. That is, the target text contains all the corrected results.

[0131] In summary, by fusing the intermediate correction text, the target correction text and the initial error correction text, all correction results can be integrated together, which can further improve the correction accuracy, thereby providing users with sufficiently accurate text content feedback.

[0132] In addition, in order to improve the error correction accuracy of the text error correction model, the model can be optimized by back-translation processing after the error correction is completed. In this embodiment, the specific implementation method is as shown in steps S1482 to S1486.

[0133] Step S1482, translating the target revised text to obtain a translated revised text corresponding to the first language;

[0134] Step S1484, back-translating the translated revised text to obtain a back-translated revised text corresponding to the language of the target revised text;

[0135] Step S1486: Detect the target corrected text based on the back-translated corrected text, and optimize the text error correction model according to the detection result.

[0136] Specifically, the target correction text is first translated to obtain a translation correction text corresponding to the first language; secondly, the translation correction text is back-translated to obtain a back-translated correction text corresponding to the language of the target correction text; finally, the target correction text is detected based on the back-translated correction text. If the two are consistent, it means that the error correction accuracy of the text error correction model is high and no processing is required. If there is a difference between the two, it means that the error correction accuracy of the text error correction model can be improved, and it can be optimized according to the detection results. In practical applications, the optimization of the text error correction model specifically refers to the adjustment of the parameters of the text error correction model so that the text error correction model can still guarantee the error correction accuracy under back-translation detection.

[0137] In actual applications, when translating the target revised text and back-translating the translated revised text, a trained translation model can be used. It should be clear that the translation model needs to satisfy the translation from the source language to the target language and the back-translation from the target language to the source language. In addition, it can also be achieved through third-party translation software, that is, input the target revised text into the third-party translation software, and obtain the translated revised text after selecting the target language; then re-input the translated revised text into the third-party translation software and obtain the back-translated revised text after selecting the source language. In actual applications, translation processing and back-translation processing can be selected according to actual needs.

[0138] In addition, the target correction text is detected based on the back-translated correction text. In fact, it is to determine whether there is a difference between the back-translated correction text and the target correction text by calculating the shortest edit distance. If the shortest edit distance is 0, it means that the back-translated correction text and the target correction text are exactly the same, and no processing is required. If the shortest edit distance is not 0, it means that there are different words between the back-translated correction text and the target correction text. In order to improve the error correction accuracy of the text error correction model, the text error correction model can be adjusted according to the detection results, that is, the learning rate, batch_size and other parameters can be adjusted. By adjusting the parameters, the loss of the text error correction model on the validation set can be minimized until convergence to obtain a text error correction model that meets the conditions.

[0139] For example, if the target correction text corresponds to English, it can be translated into the corresponding translation correction text in Chinese; then the corresponding Chinese translation correction text is back-translated to obtain the corresponding English back-translation correction text, and finally the target correction text is detected based on the back-translation correction text. If the two are inconsistent, the text error correction model can be optimized.

[0140] See also Figure 2 As shown in the schematic diagram, after obtaining the text to be corrected, the text to be corrected can be preliminarily corrected according to the preset text error detection rules to obtain the initial correction text; then the initial correction text is input into the text correction model for processing, and the target correction text corresponding to the text to be corrected is determined according to the processing result, and fed back to the provider of the text to be corrected, thereby realizing the processing of the text to be corrected by the joint correction of rules and models, which can not only improve the accuracy of correction, but also avoid errors and omissions, thereby ensuring the accuracy of the target correction text.

[0141] The following combination Figure 3 Taking the application of the text processing method provided by this application in the English essay correction scenario as an example, the text processing method is further explained. Figure 3 A processing flow chart of a text processing method applied to an English essay correction scenario provided by an embodiment of the present application is shown, which specifically includes the following steps:

[0142] Step S302: obtain an English sample, and label the English sample to obtain a sample label.

[0143] In practical applications, when correcting English texts, most people use preset correction rules or use models to correct errors alone. Although the correction rules can correct English texts, due to the large number of error causes, it is difficult for the correction rules to achieve comprehensive coverage, and the correction rules require a lot of manpower and material resources when they are preset. If the model is used alone, the accuracy of the correction will be affected due to the single means. Therefore, an effective solution is urgently needed to solve the above problems.

[0144] The text processing method provided in this embodiment will adopt a combination of error correction rules and models to implement English text error correction, which can not only ensure the accuracy of error correction, but also cover a larger error correction scenario, thereby generating a corrected text that meets user needs and effectively improves the user's participation experience.

[0145] Based on this, we obtain English samples {I love chine, I am an student, I went to see the as sunrise}. At this time, by marking each word in each English sample, we determine that chine in the first sample corresponds to a spelling error label; an in the second sample corresponds to a grammatical error label; and a in the third sample corresponds to a multi-word label.

[0146] It should be noted that different English samples in different scenarios will have different problems, such as fewer words, more words, grammatical errors, spelling errors, etc. Words with different problems will be given different labels to train a text detection model with wider coverage; and when labeling, the sample label of each English text can be determined by calculating the shortest edit distance, that is, by calculating the shortest edit distance between the English text and the correct text, the label corresponding to each word in the English text is determined.

[0147] Step S304, training the text detection model based on the sample labels, the English samples and the corrected samples corresponding to the English samples until a target text detection model that meets the training stop condition is obtained.

[0148] Specifically, in order to be able to not only check the English text for errors but also correct the errors in the subsequent application process; during the training phase, a multi-task learning method will be used to enable the text detection model to learn the ability to determine and correct errors so as to output correct English text.

[0149] Based on this, the corrected sample corresponding to the first sample is I love china, the corrected text corresponding to the second sample is Iam a student, and the corrected text corresponding to the third sample is I went to see the sunrise; based on this, the text detection model is initially trained in combination with the English samples and the labels corresponding to the words they contain, so that the model has the ability to detect errors in English text; then the model is trained again in combination with the English samples and their corresponding corrected samples, so that the model learns the ability to correct English text, until the target text detection model that meets the training stop conditions is trained.

[0150] Step S306, obtaining the English composition uploaded by the user that contains the English text to be checked for errors.

[0151] Specifically, after the target text detection model is trained, the model can be used to detect any English text to accurately identify the problem and modify it.

[0152] Based on this, the English text to be checked for errors uploaded by the user is obtained as "...he is nniversity student..."; it should be noted that the English text to be checked for errors is an English composition uploaded by the user. Since the English composition contains more content, this embodiment only takes the English content of a paragraph in the English composition as an example for description for the convenience of description. The error checking process of other parts can refer to the same or corresponding description content of this embodiment, and will not be elaborated on here.

[0153] Step S308, processing the English text to be detected according to the preset file error detection rules to obtain an initial error detection English text.

[0154] Specifically, in order to accurately correct the error-detected English text in the subsequent process, the text error-detection rules may be used to make preliminary corrections to the text before correcting it.

[0155] Based on this, first read the preset text error detection rules, and determine the rules as {detect whether a word has extra letters, detect whether a word has fewer letters, detect whether a word is misspelled}; then perform preliminary error detection on the English text to be detected "he is nniversity student" based on the text error detection rules, and determine through semantic analysis and word error detection that the word "nniversity" in the English text to be detected is misspelled, and the corresponding correct word should be "university", then replace "nniversity" in the English text to be detected according to the correct word, and update the English text to be detected according to the replacement result, so as to obtain the initial error detection English text "he is university student" for subsequent deep error detection.

[0156] In practical applications, text error detection rules can be set according to actual application scenarios and can be updated at any time to ensure the accuracy of error detection.

[0157] Step S310, inputting the initial error-detected English text into the target text detection model for processing to obtain the target corrected text.

[0158] After obtaining the initial error-detected English text "he is a university student", the initial error-detected English text can be input into the target text detection model obtained through the above training for processing, so as to determine that the initial error-detected English text has grammatical errors according to the detection results of the model, and correct it based on the model to obtain the modified text "he is a university student".

[0159] Step S312, updating the English composition based on the target revised text, obtaining the target English composition and feeding back to the user.

[0160] After obtaining the corrected text "he is a university student", the corresponding description content in the English composition can be replaced based on the description of this paragraph, so that the user can obtain a target English composition without grammatical problems and wrong words.

[0161] In summary, in order to improve the error correction accuracy of English text, a multi-task learning method will be adopted in the training stage to enable the text detection model to learn the ability of error correction and revision; then in the application scenario, the English text to be detected is processed simultaneously by combining the text error detection rules and the text detection model, which can not only improve the error detection accuracy, but also cover more error correction scenarios, effectively improving the user participation experience.

[0162] Corresponding to the above method embodiment, the present application also provides a text processing device embodiment, Figure 4 FIG. 1 shows a schematic diagram of the structure of a text processing device provided by an embodiment of the present application. Figure 4 As shown, the device comprises:

[0163] A text acquisition module 402 is configured to acquire the text to be corrected;

[0164] The text processing module 404 is configured to process the text to be corrected according to a preset text error detection rule to obtain an initial error correction text;

[0165] The error correction processing module 406 is configured to input the initial error correction text into a text error correction model for processing, and determine a target corrected text corresponding to the text to be corrected according to the processing result.

[0166] In an optional embodiment, the text processing module 404 is further configured to:

[0167] The text to be corrected is segmented to obtain multiple word units, and each word unit is processed according to the structural error detection rules to obtain a first initial error correction text; and / or, the text to be corrected is processed according to the grammatical error detection rules to obtain a second initial error correction text.

[0168] In an optional embodiment, the error correction processing module 406 is further configured to:

[0169] The initial error correction text is input into the text error correction model; the initial error correction text is processed by the detection unit in the text error correction model to obtain an intermediate error correction text; the intermediate error correction text is processed by the error correction unit in the text error correction model to obtain an initial revised text, and the text error correction model is output; according to the initial revised text, the initial error correction text is updated to the target revised text.

[0170] In an optional embodiment, the error correction processing module 406 is further configured to:

[0171] The initial revised text is parsed to obtain revision identification information; the initial error correction text is updated according to the revision identification information and the initial revised text to obtain the target revised text.

[0172] In an optional embodiment, the error correction processing module 406 is further configured to:

[0173] Determine the error correction character corresponding to the initial error correction text according to the processing result; select candidate characters corresponding to the error correction character in a preset text library to form a candidate character sequence; update the initial error correction text based on each candidate character in the candidate character sequence, and detect each updated initial error correction text; select a target error correction text as the target correction text in the updated initial error correction text according to the detection result.

[0174] In an optional embodiment, the text processing device further includes:

[0175] The fusion module is configured to input the text to be corrected into the text correction model for processing to obtain an intermediate corrected text corresponding to the text to be corrected; when the intermediate corrected text is inconsistent with the target corrected text, perform text fusion on the intermediate corrected text, the target corrected text and the initial corrected text; and determine the target text corresponding to the text to be corrected according to the text fusion result.

[0176] In an optional embodiment, the text processing device further includes:

[0177] The optimization module is configured to translate the target revised text to obtain a translation revised text corresponding to the first language; back-translate the translation revised text to obtain a back-translated revised text corresponding to the language of the target revised text; detect the target revised text based on the back-translated revised text, and optimize the text error correction model according to the detection result.

[0178] In an optional embodiment, the training process of the text error correction model is as follows:

[0179] Extract sample text from a preset sample set; input the sample text into an initial text error correction model for processing to obtain a predicted corrected text; calculate an error detection loss value and a correction loss value based on a sample corrected text corresponding to the sample text and the predicted corrected text; adjust the parameters of the initial text error correction model based on the error detection loss value and the correction loss value until the text error correction model that meets the training stop condition is obtained.

[0180] The text processing device provided by the present application can, after obtaining the text to be corrected, first perform preliminary error correction processing on the text to be corrected according to preset text error detection rules to obtain an initial error-corrected text; then input the initial error-corrected text into a text error correction model for processing, and determine the target correction text corresponding to the text to be corrected according to the processing result, thereby realizing the processing of the text to be corrected by a joint error correction method of rules and models, which can not only improve the accuracy of error correction, but also avoid omissions of errors, thereby ensuring the accuracy of the target correction text.

[0181] The above is a schematic scheme of a text processing device of the present embodiment. It should be noted that the technical scheme of the text processing device and the technical scheme of the above-mentioned text processing method belong to the same concept. For details not described in detail in the technical scheme of the text processing device, please refer to the description of the technical scheme of the above-mentioned text processing method. In addition, each component in the device embodiment should be understood as a functional module that must be established to implement each step of the program flow or each step of the method, and each functional module is not an actual functional division or separation definition. The device claim defined by such a group of functional modules should be understood as a functional module architecture that mainly implements the solution through the computer program recorded in the specification, and should not be understood as a physical device that mainly implements the solution through hardware.

[0182] Figure 5The block diagram of a computing device 500 provided according to an embodiment of the present application is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.

[0183] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0184] In one embodiment of the present application, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.

[0185] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 500 may also be a mobile or stationary server.

[0186] The processor 520 is used to execute the following computer executable instructions:

[0187] Get the text to be corrected;

[0188] Processing the text to be corrected according to a preset text error detection rule to obtain an initial error correction text;

[0189] The initial error correction text is input into a text error correction model for processing, and a target correction text corresponding to the text to be corrected is determined according to the processing result.

[0190] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above text processing method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above text processing method.

[0191] An embodiment of the present application further provides a computer-readable storage medium storing computer instructions, which are used when executed by a processor to:

[0192] Get the text to be corrected;

[0193] Processing the text to be corrected according to a preset text error detection rule to obtain an initial error correction text;

[0194] The initial error correction text is input into a text error correction model for processing, and a target correction text corresponding to the text to be corrected is determined according to the processing result.

[0195] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above text processing method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above text processing method.

[0196] An embodiment of the present application further provides a chip storing a computer program, which implements the steps of the text processing method when executed by the chip.

[0197] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0198] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0199] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0200] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0201] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the present application. The present application selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is only limited by the claims and their full scope and equivalents.

Claims

1. A text processing method, characterized in that: include: Get the text to be corrected; Processing the text to be corrected according to a preset text error detection rule to obtain an initial error correction text; Inputting the initial error correction text into a text error correction model for processing, determining a target correction text corresponding to the text to be corrected according to the processing result, and inputting the text to be corrected into the text error correction model for processing to obtain an intermediate correction text corresponding to the text to be corrected; In the case that the intermediate revised text is inconsistent with the target revised text, text fusion is performed on the intermediate revised text, the target revised text and the initial error correction text, and the target text corresponding to the text to be corrected is determined according to the text fusion result.

2. The text processing method according to claim 1, characterized in that: The step of processing the text to be corrected according to a preset text error detection rule to obtain an initial error correction text includes: Performing word segmentation processing on the text to be corrected to obtain multiple word units, and processing each word unit according to the structural error detection rule to obtain a first initial error correction text; and / or, The text to be corrected is processed according to grammatical error detection rules to obtain a second initial error correction text.

3. The text processing method according to claim 1, characterized in that: The step of inputting the initial error correction text into a text error correction model for processing, and determining a target correction text corresponding to the to-be-corrected text according to the processing result, comprises: Inputting the initial error-correcting text into the text error-correcting model; Processing the initial error-corrected text by the detection unit in the text error-corrected model to obtain an intermediate error-corrected text; Processing the intermediate error correction text by the error correction unit in the text error correction model to obtain an initial corrected text, and outputting the text error correction model; According to the initial revised text, the initial error correction text is updated to the target revised text.

4. The text processing method according to claim 3, characterized in that: The updating of the initial error correction text to the target correction text according to the initial correction text includes: Parsing the initial revised text to obtain revision identification information; The initial error correction text is updated according to the correction identification information and the initial correction text to obtain the target correction text.

5. The text processing method according to claim 1, characterized in that: The step of determining the target corrected text corresponding to the text to be corrected according to the processing result includes: Determine the error correction character corresponding to the initial error correction text according to the processing result; Selecting candidate characters corresponding to the error correction characters from a preset text library to form a candidate character sequence; Updating the initial error correction text based on each candidate character in the candidate character sequence, and detecting each updated initial error correction text; According to the detection result, a target error correction text is selected from the updated initial error correction text as the target revised text.

6. The text processing method according to claim 1, characterized in that: After the step of determining the target correction text corresponding to the text to be corrected according to the processing result is performed, the method further includes: Translating the target revised text to obtain a translated revised text corresponding to the first language; Back-translating the translated revised text to obtain a back-translated revised text corresponding to the language of the target revised text; The target corrected text is detected based on the back-translated corrected text, and the text error correction model is optimized according to the detection result.

7. The text processing method according to any one of claims 1 to 6, characterized in that: The training process of the text error correction model is as follows: Extract sample text from a preset sample set; Inputting the sample text into an initial text error correction model for processing to obtain a predicted corrected text; Calculate an error detection loss value and a correction loss value according to the sample correction text corresponding to the sample text and the predicted correction text; The initial text error correction model is adjusted based on the error detection loss value and the correction loss value until the text error correction model that meets the training stop condition is obtained.

8. A text processing device, characterized in that: include: A text acquisition module is configured to acquire the text to be corrected; A text processing module is configured to process the text to be corrected according to a preset text error detection rule to obtain an initial error correction text; The error correction processing module is configured to input the initial error correction text into the text error correction model for processing, and determine the target corrected text corresponding to the text to be corrected according to the processing result; A fusion module is configured to input the text to be corrected into the text correction model for processing to obtain an intermediate corrected text corresponding to the text to be corrected; In the case that the intermediate revised text is inconsistent with the target revised text, text fusion is performed on the intermediate revised text, the target revised text and the initial error correction text, and the target text corresponding to the text to be corrected is determined according to the text fusion result.

9. A computing device, characterized in that include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of any one of the methods of claims 1 to 7.

10. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Text error correction method and device, equipment and medium

    CN112380840A

  • Method for grammar error correction and training method and product for grammar error correction model

    CN112765968A