A text correction method, device, computer equipment and storage medium

By integrating detection and error correction processing in the text detection model and performing secondary detection using confidence and error detection results, the problem of error correction in the existing text error correction algorithm is solved, and the accuracy and rationality of text correction are improved. .

CN118520871BActive Publication Date: 2024-11-08BEIJING JIANGSHU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410998776.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-11-08
Estimated Expiration
2044-07-24

AI Technical Summary

Technical Problem

Existing text error correction algorithms are prone to miscorrection problems during the error correction process, which affects the accuracy and effectiveness of error correction.

Method used

The text detection and error correction processing are fused in the text detection model, and the corrected character confidence and error detection results are used for secondary detection to determine the final text correction result.

Benefits of technology

It improves the integrity and correlation between detection and error correction, effectively avoids the miscorrection of characters after correction, and improves the accuracy and rationality of text correction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118520871B_ABST
    Figure CN118520871B_ABST
Patent Text Reader

Abstract

The present disclosure provides a text correction method, apparatus, computer equipment and storage medium, wherein the method comprises: obtaining a text to be detected; the text to be detected comprises at least one character to be detected; using a text detection model to perform error detection and error correction processing on the text to be detected, and obtaining a corrected character corresponding to each of the characters to be detected, and an error detection result corresponding to each of the characters to be detected; the error detection result is used to indicate whether there is an error in the character to be detected; and determining the text correction result corresponding to the text to be detected according to a first confidence level corresponding to each of the corrected characters and a second confidence level of each of the error detection results. The embodiment of the present application can realize secondary detection of the corrected characters by simultaneously integrating detection and error correction processing in the text detection model, thereby effectively avoiding the problem of miscorrection of the corrected characters and improving the rationality and accuracy of text correction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a text correction method, apparatus, computer equipment and storage medium. Background Art

[0002] Text error correction refers to the use of error correction programs to detect erroneous characters from text and correct the erroneous characters to obtain corrected text, thereby improving the quality, accuracy and readability of the text. Conventional text error correction algorithms can include error correction algorithms based on deep networks, error correction algorithms based on grammatical rules, etc. However, these text error correction algorithms often have the problem of being unable to avoid text error correction, which affects the accuracy and effect of text error correction. Summary of the invention

[0003] The embodiments of the present disclosure at least provide a text correction method, apparatus, computer device and storage medium.

[0004] In a first aspect, an embodiment of the present disclosure provides a text correction method, comprising:

[0005] Acquire a text to be detected; the text to be detected includes at least one character to be detected;

[0006] Using the text detection model to perform error detection and error correction processing on the text to be detected, to obtain a corrected character corresponding to each character to be detected, and an error detection result corresponding to each character to be detected; the error detection result is used to indicate whether there is an error in the character to be detected;

[0007] The text correction result corresponding to the text to be detected is determined according to the first confidence corresponding to each corrected character and the second confidence of each error detection result.

[0008] In a possible implementation, determining the text correction result corresponding to the text to be detected according to the first confidence corresponding to each corrected character and the second confidence of each error detection result includes:

[0009] For any of the characters to be detected, using a first confidence threshold and a first confidence of the corrected character corresponding to the character to be detected, and a second confidence threshold and a second confidence of the error detection result corresponding to the character to be detected, to determine a character error correction result of the character to be detected;

[0010] The text correction result is determined according to the character error correction result of each of the characters to be detected.

[0011] In a possible implementation, the determining of the character error correction result of the character to be detected by using the first confidence threshold and the first confidence of the corrected character corresponding to the character to be detected, and the second confidence threshold and the second confidence of the error detection result corresponding to the character to be detected, includes:

[0012] When the first confidence of the corrected character corresponding to the character to be detected is greater than the first confidence threshold, determining the character error correction result of the character to be detected to be the corrected character;

[0013] In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the first confidence threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the second confidence threshold, then determining that the character error correction result includes the character to be detected and the error detection result;

[0014] When the first confidence of the corrected character corresponding to the character to be detected is not greater than the first confidence threshold, if the second confidence of the error detection result corresponding to the character to be detected is not greater than the second confidence threshold, it is determined that the character error correction result includes the character to be detected.

[0015] In a possible implementation manner, the first confidence threshold includes a first sub-threshold and a second sub-threshold, and the first sub-threshold is greater than the second sub-threshold; the second confidence threshold includes a third sub-threshold and a fourth sub-threshold, and the third sub-threshold is greater than the fourth sub-threshold;

[0016] Determining the character error correction result of the character to be detected by using the first confidence threshold and the first confidence of the corrected character corresponding to the character to be detected, and the second confidence threshold and the second confidence of the error detection result corresponding to the character to be detected, comprises:

[0017] When the first confidence level of the corrected character corresponding to the character to be detected is greater than the first sub-threshold, determining the character error correction result of the character to be detected to be the corrected character;

[0018] In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold, then determining that the character error correction result of the character to be detected is the corrected character;

[0019] In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is less than the fourth sub-threshold, it is determined that the character error correction result includes the character to be detected;

[0020] In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold, then determining that the character error correction result includes the character to be detected and the error detection result;

[0021] When the first confidence of the corrected character corresponding to the character to be detected is not greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is not greater than the fourth sub-threshold, it is determined that the character error correction result includes the character to be detected.

[0022] In a possible implementation, before determining the character error correction result of the character to be detected by using the first confidence threshold and the first confidence of the corrected character corresponding to the character to be detected, and the second confidence threshold and the second confidence of the error detection result corresponding to the character to be detected, the method further includes:

[0023] When the corrected character corresponding to the character to be detected is consistent with the character to be detected, the first confidence of the corrected character is updated to a preset confidence.

[0024] In a possible implementation, the using of the text detection model to perform error detection and error correction processing on the text to be detected to obtain a corrected character corresponding to each character to be detected and an error detection result corresponding to each character to be detected includes:

[0025] Using the feature extraction layer in the text detection model, feature extraction is performed on each character to be detected in the text to be detected, so as to obtain character features corresponding to each character to be detected;

[0026] Using the error correction layer in the text detection model, according to each of the character features, determine the corrected character corresponding to each of the characters to be detected;

[0027] The error detection layer in the text detection model is used to determine the error detection result corresponding to each of the characters to be detected according to the features of each of the characters.

[0028] In a possible implementation, the method further includes the step of training the text detection model:

[0029] Obtaining a sample text and a label character and a label error detection result corresponding to each sample character in the sample text;

[0030] Using the text detection model to be trained, error detection and error correction processing is performed on the sample text to obtain a predicted character corresponding to each of the sample characters and a predicted error detection result corresponding to each of the sample characters;

[0031] Determine the prediction loss using the predicted character, the predicted error detection result, the label character and the label error detection result;

[0032] The text detection model to be trained is iteratively trained using the prediction loss until a preset cutoff condition is met, thereby obtaining a trained text detection model.

[0033] In a possible implementation manner, the predicted loss includes a first loss, a second loss, and a third loss;

[0034] The step of determining the prediction loss by using the predicted character, the prediction error detection result, the label character and the label error detection result comprises:

[0035] Determine a first loss of the error correction layer by using a cross entropy between the predicted character and the label character;

[0036] Determine a second loss of the error detection layer by using a cross entropy between the predicted error detection result and the label error detection result;

[0037] determining a third loss according to the first loss and the second loss;

[0038] The method of iteratively training the text detection model to be trained by using the prediction loss until a preset cutoff condition is met to obtain a trained text detection model includes:

[0039] The error correction layer is iteratively trained using the first loss, the error detection layer is iteratively trained using the second loss, and the text detection model to be trained is iteratively trained using the third loss until a training cutoff condition is met, thereby obtaining a trained text detection model.

[0040] In a second aspect, the present disclosure also provides a text correction device, including:

[0041] An acquisition module, used for acquiring a text to be detected; the text to be detected includes at least one character to be detected;

[0042] A detection module, used for performing error detection and error correction processing on the text to be detected by using a text detection model, and obtaining a corrected character corresponding to each character to be detected, and an error detection result corresponding to each character to be detected; the error detection result is used to indicate whether there is an error in the character to be detected;

[0043] The error correction module is used to determine the text correction result corresponding to the text to be detected according to the first confidence corresponding to each corrected character and the second confidence of each error detection result.

[0044] In a third aspect, an optional implementation of the present disclosure further provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the machine-readable instructions perform the steps of the above-mentioned first aspect, or any possible implementation of the first aspect.

[0045] In a fourth aspect, an optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are executed.

[0046] For a description of the effects of the above-mentioned text correction device, computer equipment, and computer-readable storage medium, please refer to the description of the above-mentioned text correction method, which will not be repeated here.

[0047] The text correction method, device, computer equipment and storage medium provided by the embodiments of the present disclosure can improve the integrity and correlation between detection and error correction by simultaneously integrating detection and error correction processing in the text detection model. In addition, after obtaining the corrected characters and the error detection results, the first confidence of the corrected characters and the second confidence of the error detection results can be used to achieve secondary detection of the corrected characters, thereby effectively avoiding the problem of miscorrection of the corrected characters and improving the rationality and accuracy of text correction.

[0048] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.

[0050] Figure 1 A flowchart of a text correction method provided by an embodiment of the present disclosure is shown;

[0051] Figure 2 The structure and prediction diagram of a text detection model provided by an embodiment of the present disclosure are shown;

[0052] Figure 3 A specific implementation flow chart of a text correction method provided by an embodiment of the present disclosure is shown;

[0053] Figure 4 A schematic diagram of a text correction device provided by an embodiment of the present disclosure is shown;

[0054] Figure 5 A schematic diagram of the structure of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.

[0056] In addition, the terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. The "plurality or several" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.

[0057] Research has found that the traditional text correction process is mostly divided into two types. One is end-to-end error correction, that is, after the text is input into the neural network on the end side, the corrected text is directly obtained; the other is two-stage error correction, that is, the error position of the erroneous text is first detected by the detection module, and then the text at the error position is corrected by the correction module. Among them, the end-to-end error correction method has poor controllability, and it is difficult to further improve the error correction text predicted by the neural network, which leads to the problem of text miscorrection. The two-stage error correction has the problem of error transmission. Once the detection module detects an error, the error correction module will also give an incorrect correction result, affecting the accuracy of text correction.

[0058] Based on the above research, the present disclosure provides a text correction method, device, computer equipment and storage medium, which can improve the integrity and correlation between detection and error correction by integrating detection and error correction processing in the text detection model. In addition, after obtaining the corrected characters and the error detection results, the first confidence of the corrected characters and the second confidence of the error detection results can be used to achieve secondary detection of the corrected characters, thereby effectively avoiding the problem of miscorrection of the corrected characters and improving the rationality and accuracy of text correction.

[0059] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.

[0060] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0061] For ease of understanding this embodiment, first, a text correction method disclosed in the embodiments of the present disclosure will be introduced in detail. The execution subject of the text correction method provided in the embodiments of the present disclosure is generally a terminal device or other processing devices with certain computing capabilities. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a personal digital assistant (PDA), a handheld device, a computer device, etc.; in some possible implementation manners, the text correction method can be implemented by a processor invoking computer-readable instructions stored in a memory.

[0062] Next, the text correction method provided in the embodiments of the present disclosure will be described by taking the execution subject as a computer device as an example.

[0063] As Figure 1 shown, it is a flowchart of a text correction method provided in the embodiments of the present disclosure, which may include the following steps:

[0064] S101: Obtain the text to be detected; the text to be detected includes at least one character to be detected.

[0065] Here, the text to be detected may include at least one character, and this character can be defined as a character to be detected. The character to be detected can be any character, for example, Chinese characters, letters, pinyin, words, punctuation marks, etc. Exemplarily, the text to be detected can be "The weather is sunny.", and the characters to be detected are "天 (tiān)", "器 (qì)", "晴 (qíng)", "朗 (lǎng)" and "。 (period)".

[0066] In specific implementation, when there is a need for text error correction, the text that needs to be corrected can be obtained and used as the text to be detected.

[0067] S102: Use the text detection model to detect and correct the text to be detected, and obtain the corrected character corresponding to each character to be detected and the error detection result corresponding to each character to be detected; the error detection result is used to indicate whether the character to be detected has an error.

[0068] Here, the corrected character is the character output by the text detection model after detecting and correcting the character to be detected. One character to be detected corresponds to one corrected character. The corrected character can be the same as the character to be detected or a character obtained by modifying the character to be detected.

[0069] The error detection result is used to indicate whether there is an error in the character to be detected in the text to be detected, that is, it can indicate whether the character to be detected is an error character. One character to be detected corresponds to one error detection result. The error detection result can be represented by a preset value, for example, a first preset value is used to represent that there is no error in the character to be detected, and a second preset value is used to represent that there is an error in the character to be detected. Exemplarily, the first preset value can be 0, and the second preset value can be 1.

[0070] The text detection model is a pre-trained neural network model that can simultaneously perform error correction and detection processing on the text to be detected, so as to simultaneously output the corrected characters for each character to be detected and the error detection results for each character to be detected. The error correction processing is used to correct the errors of the characters to be detected, and the detection processing is used to detect the characters to be detected that have errors.

[0071] In specific implementation, after obtaining the text to be detected, the text to be detected can be input into a text detection model, and the text detection model can be used to extract features of the text to be detected, and error correction and error detection processing can be performed based on the extracted features to obtain the corrected characters corresponding to each character to be detected in the text to be detected, as well as the error detection results corresponding to each character to be detected.

[0072] In one embodiment, the above S102 may be implemented according to the following steps:

[0073] S102-1: Using the feature extraction layer in the text detection model, extract features from each character to be detected in the text to be detected, and obtain character features corresponding to each character to be detected.

[0074] Here, the character feature is the feature vector corresponding to each character to be detected, which can semantically represent the character to be detected. The feature extraction layer is a network layer in the text detection model, which is used to extract features of the characters to be detected. In specific implementations, the feature extraction layer can be a Bert layer, a Convolutional Neural Networks (CNN) layer, or a Long Short-Term Memory (LSTM) layer. Among them, Bert stands for Bidirectional Encoder Representations from Transformers.

[0075] In a specific implementation, after the text to be detected is input into the text detection model, the feature extraction layer can be used to extract features of each character to be detected to obtain the character features corresponding to the character to be detected.

[0076] S102-2: using the error correction layer in the text detection model, according to the features of each character, determining the corrected character corresponding to each character to be detected;

[0077] S102-3: Using the error detection layer in the text detection model, according to the features of each character, determine the error detection result corresponding to each character to be detected.

[0078] Here, in the text detection model, the network layer used for error detection processing is different from the network layer used for error correction processing. Exemplarily, the network layer used for error detection processing can be called an error detection layer (or error detection head), and the network layer used for error correction processing can be called an error correction layer (or error correction head). Both the error correction layer and the error detection layer are linear layers, and can have full connection functions and normalization functions. There is no strict execution order between S102-2 and S102-3, and the two steps can be executed synchronously or asynchronously.

[0079] like Figure 2 As shown, it is a schematic diagram of the structure and prediction of a text detection model provided by an embodiment of the present application. Among them, the model structure of the text detection model may include a Bert feature extraction layer, an error detection layer and an error correction layer. The Bert layer is used to extract the character features of each character to be detected in the text to be detected. The correction layer is used to predict the corrected character corresponding to the character to be detected based on the character features extracted by the Bert layer; the error detection layer is used to predict whether there is an error in the character to be detected based on the character feature vector extracted by the Bert layer. For the error correction layer, the error correction layer will output the distribution probability (in Figure 2 In the figure, the blank circle under the error correction layer is the distribution probability of the character to be detected under multiple preset characters. Then, according to the distribution probability, the preset character with the highest distribution probability can be selected from the multiple preset characters as the corrected character corresponding to the character to be detected. The preset character can be a common character that is preset. For example, the preset characters can include 5000 common characters. For the error detection layer, the error detection layer will output the distribution probability (in Figure 2 In the figure, the blank circle below the error detection layer is the distribution probability of the character to be detected under 0 and 1 respectively), and then the value with the largest distribution probability can be used as the error detection result corresponding to the character to be detected.

[0080] For example, in Figure 2In this case, after obtaining the text to be detected, "The sky is clear.", the text to be detected can be input into the text detection model. After passing through the Bert layer, the character features corresponding to each character to be detected are obtained. Then, the error correction layer can be used to perform a fully connected process and a normalization process on the character features, so as to obtain the corrected character corresponding to each character to be detected (that is, the predicted result "The weather is clear."); at the same time, the error detection layer can be used to perform a fully connected process and a normalization process on the character features, so as to obtain the error detection result corresponding to each character to be detected (that is, "01000").

[0081] S103: Determine the text correction result corresponding to the text to be detected according to the first confidence corresponding to each corrected character and the second confidence of each error detection result.

[0082] Here, the text correction result is the final error correction result determined for the text to be detected. It may include the target corrected character corresponding to each character to be detected, or may include both the target corrected character corresponding to each character to be detected and the target error detection result corresponding to each character to be detected. Among them, the target corrected character corresponding to the character to be detected may be the same as or different from the corrected character corresponding to the character to be detected. The target error detection result corresponding to each character to be detected may be the same as or different from the error detection result corresponding to the character to be detected.

[0083] When the error correction head outputs each corrected character, it will also output the confidence corresponding to the corrected character, which is defined as the first confidence; when the error detection head outputs the error detection result corresponding to each character to be detected, it will also output the confidence of the error detection result, which is defined as the second confidence. In specific implementation, the first confidence may specifically be the distribution probability corresponding to the corrected character, and the second confidence may specifically be the distribution probability corresponding to the error detection result.

[0084] Exemplarily, for each character to be detected, if the first confidence of the corrected character corresponding to the character to be detected is greater than the preset confidence threshold, and the second confidence of the detection result corresponding to the character to be detected is also greater than the preset confidence threshold, and the detection result indicates that the character to be detected has an error, then the corrected character can be used as the target corrected character of the character to be detected, and it is determined that the character to be detected has an error. On the contrary, when the first confidence is not greater than the preset confidence threshold, and / or, the second confidence is not greater than the preset confidence, the target corrected character is determined to be the character to be detected itself. In this way, based on the first confidence and the second confidence, the target corrected character corresponding to each character to be detected can be determined, and then the text correction result can be determined according to the target corrected character.

[0085] In this way, by integrating detection and error correction processing in the text detection model, the integrity and correlation between detection and error correction can be improved. Moreover, after obtaining the corrected characters and the error detection results, the first confidence of the corrected characters and the second confidence of the error detection results can be used to achieve secondary detection of the corrected characters, thereby effectively avoiding the problem of miscorrection of the corrected characters and improving the rationality and accuracy of text correction.

[0086] In one embodiment, the above S102 may be implemented according to the following steps:

[0087] S102-1: For any character to be detected, determine the character error correction result of the character to be detected using a first confidence threshold and a first confidence of the corrected character corresponding to the character to be detected, and a second confidence threshold and a second confidence of the error detection result corresponding to the character to be detected.

[0088] Here, a first confidence threshold can be set in advance for the error correction layer, and a second confidence threshold can be set for the error detection layer. Wherein, the first confidence threshold and the second confidence threshold can both be set based on experience, and the embodiments of the present application are not specifically limited. The character error correction result is used to indicate the target corrected character corresponding to each character to be detected and / or the error detection result corresponding to the character to be detected. Wherein, when the confidence level is different, the value of the target corrected character is also different. Exemplarily, the target corrected character can be consistent with the character to be detected, or it can be the corrected character corresponding to the character to be detected.

[0089] In a specific implementation, for each character to be detected, the character error correction result of the character to be detected can be determined based on the relationship between the first confidence of the corrected character corresponding to the character to be detected and the first confidence threshold, and the relationship between the second confidence of the error detection result corresponding to the character to be detected and the second confidence threshold.

[0090] For example, when the first confidence is greater than the first confidence threshold and the second confidence is greater than the second confidence threshold, if the error detection result indicates that there is an error in the character to be detected, then the character error correction result corresponding to the character to be detected is determined to be the corrected character; if the detection result indicates that there is no error in the character to be detected, then when the first confidence is greater than the second confidence, the character error correction result is determined to be the corrected character, and when the first confidence is not greater than the second confidence, the character error correction result is determined to be the character to be detected itself.

[0091] When the first confidence level is not greater than the first confidence level threshold and the second confidence level is greater than the second confidence level threshold, if the error detection result indicates that there is an error in the character to be detected, then it is determined that the character error correction result corresponding to the character to be detected is the character to be detected and the error detection result; if the error detection result indicates that there is no error in the character to be detected, then it is determined that the character error correction result corresponding to the character to be detected is the character to be detected.

[0092] When the first confidence level is greater than the first confidence level threshold and the second confidence level is not greater than the second confidence level threshold, it is determined that the character error correction result corresponding to the character to be detected is the corrected character. When the first confidence level is not greater than the first confidence level threshold and the second confidence level is also not greater than the second confidence level threshold, it is determined that the character error correction result corresponding to the character to be detected is the character to be detected.

[0093] S102-2: Determine the text correction result according to the character error correction result of each character to be detected.

[0094] In specific implementation, after obtaining the character error correction result corresponding to each character to be detected by using S102-1, the character error correction results corresponding to each character to be detected can be combined in the order of the characters to be detected to obtain the text correction result.

[0095] In one embodiment, for the above S102-1, when comparing the first confidence level, the second confidence level, the first confidence level threshold, and the second confidence level threshold, there may be different comparison results. For different comparison results, different methods can be used to determine the character error correction result. The following will separately describe various comparison results:

[0096] Case 1: When the first confidence level of the corrected character corresponding to the character to be detected is greater than the first confidence level threshold, it is determined that the character error correction result corresponding to the character to be detected is the corrected character.

[0097] For example, for the character to be detected "器" in the text to be detected "天器晴朗。", when the first confidence level of the corrected character "气" corresponding to the character to be detected "器" is greater than the first confidence level threshold, regardless of whether the second confidence level of the detection result corresponding to the character to be detected "器" is greater than the second confidence level threshold, it can be directly determined that "气" is the character error correction result.

[0098] Case 2: When the first confidence level of the corrected character corresponding to the character to be detected is not greater than the first confidence level threshold, if the second confidence level of the error detection result corresponding to the character to be detected is greater than the second confidence level threshold, then it is determined that the character error correction result includes the character to be detected and the error detection result.

[0099] Exemplarily, when the first confidence of the corrected character corresponding to the character to be detected is not greater than the first confidence threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the second confidence threshold, and the error detection result indicates that there is an error in the character to be detected, then it can be determined that the character error correction result includes the character to be detected itself and the error detection result; conversely, if the error detection result indicates that there is no error in the character to be detected, then it can be determined that the character error correction result includes the character to be detected itself.

[0100] That is, when the first confidence of the corrected character is not greater than the first confidence threshold and the second confidence of the error detection result is greater than the second confidence threshold, if the error detection result indicates that the character is wrong, the character to be detected may not be corrected (i.e., the original character to be detected is retained) and the result indicating that the character is wrong is returned; if the error detection result indicates that the character is not wrong, the character to be detected itself may be directly returned. Optionally, if the error detection result indicates that the character is not wrong, the character to be detected itself and the result indicating that the character is not wrong may also be returned.

[0101] Case 3: When the first confidence of the corrected character corresponding to the character to be detected is not greater than the first confidence threshold, if the second confidence of the error detection result corresponding to the character to be detected is not greater than the second confidence threshold, it is determined that the character error correction result includes the character to be detected.

[0102] Exemplarily, when the first confidence of the corrected character corresponding to the character to be detected is not greater than the first confidence threshold, and the second confidence of the error detection result corresponding to the character to be detected is not greater than the second confidence threshold, it means that the output results of the error correction layer and the error detection layer are unreliable. In order to avoid the problem of miscorrection, the character error correction result can be directly determined as the character to be detected.

[0103] In another embodiment, in order to further improve the accuracy and rationality of text correction, the first confidence threshold can be further subdivided into a first sub-threshold and a second sub-threshold, wherein the first sub-threshold is greater than the second sub-threshold; at the same time, the second confidence threshold can be further subdivided into a third sub-threshold and a third sub-threshold, wherein the third sub-threshold is greater than the fourth sub-threshold. That is, for both the error correction layer and the error detection layer, two high and low thresholds can be pre-set, namely, the first sub-threshold and the second sub-threshold corresponding to the error correction layer, and the third sub-threshold and the fourth sub-threshold corresponding to the error detection layer.

[0104] Among them, the first sub-threshold, the second sub-threshold, the third sub-threshold and the fourth sub-threshold can all be set according to experience, and are not specifically limited in the embodiments of the present application. As shown in Table 1 below, a schematic table of high and low sub-thresholds corresponding to an error correction layer and an error detection layer provided in an embodiment of the present application is provided:

[0105]

[0106] (Table 1)

[0107] It is understandable that the sub-thresholds in the above table 1 are only used as an example. In specific implementation, the sub-thresholds can be adjusted according to actual error correction needs.

[0108] In the case of setting a high and low confidence threshold, the above S102-1 can determine the character error correction result according to different comparison results as shown below:

[0109] Case a: when the first confidence of the corrected character corresponding to the character to be detected is greater than the first sub-threshold, the character error correction result of the character to be detected is determined to be the corrected character.

[0110] Exemplarily, when the first confidence level of the corrected character corresponding to the character to be detected is greater than the first sub-threshold, it means that the error correction result of the error correction layer is relatively reliable. Therefore, the second confidence level can be considered to meet the preset situation. Regardless of the second confidence level of the error detection result corresponding to the character to be detected, and regardless of whether the error detection result indicates that there is an error in the character to be detected, the output of the error correction layer can be directly used, that is, the character error correction result of the character to be detected can be determined to be the corrected character.

[0111] Case b: when the first confidence of the corrected character corresponding to the character to be detected is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold, then the character error correction result of the character to be detected is determined to be the corrected character.

[0112] Exemplarily, when the first confidence of the corrected character corresponding to the character to be detected is between the second sub-threshold and the first sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold (that is, the second confidence is greater than the corresponding low confidence), at this time, regardless of whether the error detection result indicates that there is an error in the character to be detected, it can be determined that the character error correction result of the character to be detected is the corrected character.

[0113] Case c: when the first confidence of the corrected character corresponding to the character to be detected is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is less than the fourth sub-threshold, the character correction result is determined to be the character to be detected.

[0114] Exemplarily, when the first confidence level of the corrected character corresponding to the character to be detected is between the second sub-threshold and the first sub-threshold, if the second confidence level of the error detection result corresponding to the character to be detected is not greater than the fourth sub-threshold (that is, the second confidence level is not greater than the corresponding low confidence level), it can be explained that the outputs of the error correction layer and the error detection layer are unreliable at this time, and therefore the character error correction result can be directly determined to be the character to be detected.

[0115] Case d: when the first confidence of the corrected character corresponding to the character to be detected is not greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold, then it is determined that the character correction result includes the character to be detected and the error detection result.

[0116] Exemplarily, when the first confidence of the corrected character corresponding to the character to be detected is not greater than the second sub-threshold, it means that the error correction result output by the error correction layer is unreliable. At this time, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold (that is, the second confidence is not greater than the corresponding low confidence), it can be said that the error detection result output by the error detection layer is relatively reliable, so it can be determined that the character error correction result includes the character to be detected and the error detection result.

[0117] Further, in situation d, if the error detection result indicates that there is no error in the character to be detected, then the character error correction result can be determined as the character to be detected; if the error detection result indicates that there is an error in the character to be detected, then the character error correction result can be determined as the character to be detected and the error detection result, that is, at this time, the result that there is an error in the character to be detected can be output, but no correction suggestions for the character to be detected are given.

[0118] Case e: when the first confidence of the corrected character corresponding to the character to be detected is not greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is not greater than the fourth sub-threshold, it is determined that the character error correction result includes the character to be detected.

[0119] Exemplarily, when situation e occurs, it indicates that the outputs of the error correction layer and the error detection layer are both unreliable, so the character error correction result can be directly determined as the character to be detected.

[0120] To facilitate understanding of the above-mentioned situations a to e, the present application embodiment also provides the following Table 2 to illustrate the various situations:

[0121]

[0122] Table 2

[0123] Among them, CH represents the first sub-threshold, CL represents the second sub-threshold, DH represents the third sub-threshold, and DL represents the fourth sub-threshold. Adopting the error correction result means determining that the character error correction result corresponding to the character to be detected is the corrected character, adopting the error detection result means determining that the character error correction result corresponding to the character to be detected includes the character to be detected and the error detection result; considering it normal means determining that the character error correction result corresponding to the character to be detected is the character to be detected.

[0124] In this way, by integrating character error detection and character error correction and using different fusion strategies for error correction, it is possible to achieve secondary correction of the error correction results, reduce the probability of false correction problems, and improve the accuracy of text correction.

[0125] In one embodiment, before executing S102-1, the first confidence of the corrected character can be updated to a preset confidence when the corrected character corresponding to the character to be detected is consistent with the character to be detected. Here, the preset confidence can be any confidence that is less than the second sub-threshold, for example, the preset confidence can be 0. In this way, when the corrected character corresponding to the character to be detected is consistent with the character to be detected, by updating the first confidence of the corrected character to the preset confidence, when the first confidence and the second confidence are used for comparison in the subsequent comparison, no matter what the comparison result is, the target corrected character in the returned character error correction result is the character to be detected itself.

[0126] For example, when the text to be detected is "seats should be given to the elderly on the bus", the error correction layer predicts "sit" as "seat", and the first confidence is 0.95. The error detection layer outputs an error detection result indicating that "sit" has an error and the second confidence is 0.7. At this time, according to the fusion strategy corresponding to Table 2 above, the text correction result obtained is "seats should be given to the elderly on the bus". For another example, when the text to be detected is "User A once gave an upper couplet, which stumped many people", the error correction layer predicts "will" as "by", and the first confidence is 0.7. The error detection layer outputs an error detection result indicating that "will" has an error and the second confidence is 0.8. At this time, according to the fusion strategy corresponding to Table 2 above, the text correction result obtained is "User A once gave an upper couplet, which stumped many people".

[0127] In one embodiment, the present application also provides a method for training a text detection model, which may include the following steps:

[0128] Step 1: Obtain sample text and label characters and label error detection results corresponding to each sample character in the sample text.

[0129] Here, the sample text is the text used to train the model, and the sample text may include at least one sample character. A sample character corresponds to a label character and a label error detection result, wherein the label character is the correct character corresponding to the sample character, and the label error detection result is used to indicate whether there is an error in the sample character.

[0130] Exemplarily, a certain number of sample texts, as well as label characters and label error detection results corresponding to each sample text may be obtained.

[0131] Step 2: Use the text detection model to be trained to perform error detection and error correction on the sample text to obtain the predicted character corresponding to each sample character and the predicted error detection result corresponding to each sample character.

[0132] Here, the predicted character is the corrected character predicted after the text detection model to be trained performs error correction processing on the sample character; the predicted error detection result is the predicted detection result after the text detection model to be trained performs error detection processing on the sample character.

[0133] Exemplarily, the sample text can be input into the text detection model to be trained, and the error correction layer in the text detection model to be trained is used to output the predicted character corresponding to each sample character in the sample text, and the error detection layer in the text detection model to be trained is used to output the predicted error detection result corresponding to each sample character in the sample text.

[0134] Step 3: Determine the prediction loss using the predicted characters, prediction error detection results, label characters, and label error detection results.

[0135] In specific implementation, the prediction loss of the text error detection model to be trained can be calculated by using the difference between the predicted character and the label character corresponding to each sample character, and the difference between the predicted error detection result and the label detection result corresponding to each sample character.

[0136] Step 4: Use the prediction loss to iteratively train the text detection model to be trained until the preset cutoff condition is met to obtain a trained text detection model.

[0137] Here, the preset cutoff condition may be that the number of iterative training rounds reaches a preset number of rounds, and / or the prediction accuracy of the trained text detection model reaches a preset accuracy.

[0138] Exemplarily, the calculated prediction loss can be used to iteratively train the text detection model to be trained, and when a preset cutoff condition is met, the trained text detection model is used as the trained text detection model.

[0139] In one embodiment, the predicted loss may include a first loss, a second loss, and a third loss. The above step 3 may be implemented as follows:

[0140] Sub-step 1: Use the cross entropy between the predicted characters and the label characters to determine the first loss of the error correction layer.

[0141] Here, the first loss is used to characterize the prediction loss of the error correction layer in the text detection model to be trained.

[0142] Exemplarily, the cross entropy between the predicted character and the label character can be calculated based on the distribution probability of the predicted character corresponding to each sample character in the sample text and the distribution probability corresponding to the label character (i.e., 1), and the calculated cross entropy can be used to determine the first loss of the error correction layer.

[0143] Sub-step 2: Use the cross entropy between the predicted error detection results and the label error detection results to determine the second loss of the error detection layer.

[0144] Here, the second loss is used to characterize the prediction loss of the error detection layer in the text detection model to be trained.

[0145] Exemplarily, the cross entropy between the predicted error detection result and the label error detection result can be calculated based on the distribution probability of the predicted error detection result corresponding to each sample character in the sample text (i.e., the predicted probabilities of 0 and 1), and the distribution probability corresponding to the label error detection result (i.e., the probabilities corresponding to label 0 and label 1, respectively, where, when there is no error in the sample character, the distribution probability of label 0 is 1, and the distribution probability of label 1 is 0; when there is an error in the sample character, the distribution probability of label 0 is 0, and the distribution probability of label 1 is 1), and the second loss of the error detection layer is determined using the calculated cross entropy.

[0146] Sub-step three: determine the third loss based on the first loss and the second loss.

[0147] Exemplarily, the weighted weights set for the error correction layer and the error detection layer may be used to perform weighted sum processing on the first loss and the second loss to obtain the third loss.

[0148] Furthermore, after obtaining the first loss, the second loss and the third loss, the above step 4 can be implemented as follows:

[0149] The error correction layer is iteratively trained using the first loss, the error detection layer is iteratively trained using the second loss, and the text detection model to be trained is iteratively trained using the third loss until the training cutoff condition is met to obtain a trained text detection model.

[0150] Exemplarily, the first loss can be used to iteratively train the error correction layer in the text detection model to be trained to improve the error correction accuracy of the error correction layer. At the same time, the second loss can be used to iteratively train the error detection layer in the text detection model to be trained to improve the detection accuracy of the detection layer. Moreover, the third loss can be used to train the text detection model to be trained as a whole to improve the overall robustness of the model (or the third loss can be used to train the Bert layer in the text detection model to be trained to improve the feature extraction accuracy of the Bert layer). In this way, by iteratively training the model using the first loss, the second loss, and the third loss, a text detection model with reliable accuracy can be obtained.

[0151] Optionally, the error correction layer may be iteratively trained using only the first loss, and the error detection layer may be iteratively trained using the second loss. In the process of training the error correction layer and the error detection layer, the Bert layer may also be trained, thereby improving the feature extraction accuracy of the Bert layer.

[0152] like Figure 3 As shown, a specific implementation flow chart of a text correction method provided in an embodiment of the present application may include the following steps:

[0153] S301: Acquire a text to be detected; the text to be detected includes at least one character to be detected.

[0154] S302: Utilize the error correction layer in the text detection model to output the corrected character and the first confidence level corresponding to each character to be detected.

[0155] S303: Using the error detection layer in the text detection model, output the error detection result and the second confidence level corresponding to each character to be detected.

[0156] There is no strict execution order between S302 and S303 , and they can be executed synchronously or asynchronously.

[0157] S304: Determine a character error correction result of each character to be detected by using the first confidence level, the second confidence level, the first sub-threshold, the second sub-threshold, the third sub-threshold and the fourth sub-threshold.

[0158] Among them, the process of determining the character error correction result can be divided into:

[0159] Case a: when the first confidence level is greater than the first sub-threshold, determining the character error correction result as the corrected character;

[0160] Case b: when the first confidence is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence is greater than the fourth sub-threshold, the character error correction result is determined to be the corrected character;

[0161] Case c: when the first confidence is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence is less than the fourth sub-threshold, the character error correction result is determined to be the character to be detected;

[0162] Case d: when the first confidence level is not greater than the second sub-threshold, if the second confidence level is greater than the fourth sub-threshold, it is determined that the character error correction result includes the character to be detected and the error detection result;

[0163] Case e: when the first confidence is not greater than the second sub-threshold, if the second confidence is not greater than the fourth sub-threshold, it is determined that the character error correction result is the character to be detected.

[0164] S305: Determine a text correction result corresponding to the text to be detected according to the character error correction result of each character to be detected.

[0165] Regarding the specific implementation steps of the above S301~S305, reference may be made to the above embodiments and will not be repeated here.

[0166] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0167] Based on the same inventive concept, a text correction device corresponding to the text correction method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned text correction method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0168] like Figure 4 FIG. 1 is a schematic diagram of a text correction device provided by an embodiment of the present disclosure, comprising:

[0169] The acquisition module 401 is used to acquire the text to be detected; the text to be detected includes at least one character to be detected;

[0170] The detection module 402 is used to perform error detection and error correction processing on the text to be detected using a text detection model to obtain a corrected character corresponding to each character to be detected and an error detection result corresponding to each character to be detected; the error detection result is used to indicate whether there is an error in the character to be detected;

[0171] The error correction module 403 is used to determine the text correction result corresponding to the text to be detected according to the first confidence corresponding to each corrected character and the second confidence of each error detection result.

[0172] In a possible implementation, the error correction module 403, when determining the text correction result corresponding to the text to be detected according to the first confidence corresponding to each corrected character and the second confidence of each error detection result, is used to:

[0173] For any of the characters to be detected, using a first confidence threshold and a first confidence of the corrected character corresponding to the character to be detected, and a second confidence threshold and a second confidence of the error detection result corresponding to the character to be detected, to determine a character error correction result of the character to be detected;

[0174] The text correction result is determined according to the character error correction result of each of the characters to be detected.

[0175] In a possible implementation manner, the error correction module 403, when determining the character error correction result of the character to be detected by using the first confidence threshold and the first confidence of the corrected character corresponding to the character to be detected, and the second confidence threshold and the second confidence of the error detection result corresponding to the character to be detected, is used to:

[0176] When the first confidence of the corrected character corresponding to the character to be detected is greater than the first confidence threshold, determining the character error correction result of the character to be detected to be the corrected character;

[0177] In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the first confidence threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the second confidence threshold, then determining that the character error correction result includes the character to be detected and the error detection result;

[0178] When the first confidence of the corrected character corresponding to the character to be detected is not greater than the first confidence threshold, if the second confidence of the error detection result corresponding to the character to be detected is not greater than the second confidence threshold, it is determined that the character error correction result includes the character to be detected.

[0179] In a possible implementation manner, the first confidence threshold includes a first sub-threshold and a second sub-threshold, and the first sub-threshold is greater than the second sub-threshold; the second confidence threshold includes a third sub-threshold and a fourth sub-threshold, and the third sub-threshold is greater than the fourth sub-threshold;

[0180] The error correction module 403, when determining the character error correction result of the character to be detected by using the first confidence threshold and the first confidence of the corrected character corresponding to the character to be detected, and the second confidence threshold and the second confidence of the error detection result corresponding to the character to be detected, is used to:

[0181] When the first confidence level of the corrected character corresponding to the character to be detected is greater than the first sub-threshold, determining the character error correction result of the character to be detected to be the corrected character;

[0182] In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold, then determining that the character error correction result of the character to be detected is the corrected character;

[0183] In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is less than the fourth sub-threshold, it is determined that the character error correction result includes the character to be detected;

[0184] In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold, then determining that the character error correction result includes the character to be detected and the error detection result;

[0185] When the first confidence of the corrected character corresponding to the character to be detected is not greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is not greater than the fourth sub-threshold, it is determined that the character error correction result includes the character to be detected.

[0186] In a possible implementation manner, the error correction module 403, before determining the character error correction result of the character to be detected by using the first confidence threshold and the first confidence of the corrected character corresponding to the character to be detected, and the second confidence threshold and the second confidence of the error detection result corresponding to the character to be detected, is further configured to:

[0187] When the corrected character corresponding to the character to be detected is consistent with the character to be detected, the first confidence of the corrected character is updated to a preset confidence.

[0188] In a possible implementation, the detection module 402, when performing error detection and error correction processing on the text to be detected using the text detection model to obtain a corrected character corresponding to each character to be detected and an error detection result corresponding to each character to be detected, is used to:

[0189] Using the feature extraction layer in the text detection model, feature extraction is performed on each character to be detected in the text to be detected, so as to obtain character features corresponding to each character to be detected;

[0190] Using the error correction layer in the text detection model, according to each of the character features, determine the corrected character corresponding to each of the characters to be detected;

[0191] The error detection layer in the text detection model is used to determine the error detection result corresponding to each of the characters to be detected according to the features of each of the characters.

[0192] In a possible implementation, the device further includes:

[0193] The training module 404 is used to train the text detection model according to the following steps:

[0194] Obtaining a sample text and a label character and a label error detection result corresponding to each sample character in the sample text;

[0195] Using the text detection model to be trained, error detection and error correction processing is performed on the sample text to obtain a predicted character corresponding to each of the sample characters and a predicted error detection result corresponding to each of the sample characters;

[0196] Determine the prediction loss using the predicted character, the predicted error detection result, the label character and the label error detection result;

[0197] The text detection model to be trained is iteratively trained using the prediction loss until a preset cutoff condition is met, thereby obtaining a trained text detection model.

[0198] In a possible implementation manner, the predicted loss includes a first loss, a second loss, and a third loss;

[0199] The training module 404, when determining the prediction loss by using the predicted character, the predicted error detection result, the label character and the label error detection result, is used to:

[0200] Determine a first loss of the error correction layer by using a cross entropy between the predicted character and the label character;

[0201] Determine a second loss of the error detection layer by using a cross entropy between the predicted error detection result and the label error detection result;

[0202] determining a third loss according to the first loss and the second loss;

[0203] And, when the text detection model to be trained is iteratively trained by using the prediction loss until a preset cutoff condition is met to obtain a trained text detection model, it is used to:

[0204] The error correction layer is iteratively trained using the first loss, the error detection layer is iteratively trained using the second loss, and the text detection model to be trained is iteratively trained using the third loss until a training cutoff condition is met, thereby obtaining a trained text detection model.

[0205] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0206] Based on the same technical concept, the embodiment of the present application also provides a computer device. Figure 5FIG. 1 is a schematic diagram of a computer device provided in an embodiment of the present application, including:

[0207] Processor 501, memory 502 and bus 503. The memory 502 stores machine-readable instructions executable by the processor 501, and the processor 501 is used to execute the machine-readable instructions stored in the memory 502. When the machine-readable instructions are executed by the processor 501, the processor 501 performs the following steps: S101: obtaining a text to be detected; the text to be detected includes at least one character to be detected; S102: using a text detection model to perform error detection and error correction processing on the text to be detected, and obtaining a corrected character corresponding to each character to be detected, and an error detection result corresponding to each character to be detected; the error detection result is used to indicate whether there is an error in the character to be detected; and S103: determining a text correction result corresponding to the text to be detected according to a first confidence level corresponding to each corrected character and a second confidence level of each error detection result.

[0208] The above-mentioned memory 502 includes a memory 5021 and an external memory 5022; the memory 5021 here is also called an internal memory, which is used to temporarily store the calculation data in the processor 501, as well as the data exchanged with the external memory 5022 such as a hard disk. The processor 501 exchanges data with the external memory 5022 through the memory 5021. When the computer device is running, the processor 501 communicates with the memory 502 through the bus 503, so that the processor 501 executes the execution instructions mentioned in the above method embodiment.

[0209] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the text correction method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0210] The computer program product of the text correction method provided in the embodiments of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the steps of the text correction method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.

[0211] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK).

[0212] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.

[0213] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0214] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0215] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0216] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.

[0217] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A text error correction method, characterized in that: include: Acquire a text to be detected; the text to be detected includes at least one character to be detected; Using the text detection model to perform error detection and error correction processing on the text to be detected, to obtain a corrected character corresponding to each character to be detected, and an error detection result corresponding to each character to be detected; the error detection result is used to indicate whether there is an error in the character to be detected; For any of the characters to be detected, using a first confidence threshold and a first confidence of the corrected character corresponding to the character to be detected, and a second confidence threshold and a second confidence of the error detection result corresponding to the character to be detected, to determine a character error correction result of the character to be detected; Determining the text error correction result according to the character error correction result of each of the characters to be detected; The first confidence threshold includes a first sub-threshold and a second sub-threshold, and the first sub-threshold is greater than the second sub-threshold; the second confidence threshold includes a third sub-threshold and a fourth sub-threshold, and the third sub-threshold is greater than the fourth sub-threshold; Determining the character error correction result of the character to be detected by using the first confidence threshold and the first confidence of the corrected character corresponding to the character to be detected, and the second confidence threshold and the second confidence of the error detection result corresponding to the character to be detected, comprises: When the first confidence level of the corrected character corresponding to the character to be detected is greater than the first sub-threshold, determining the character error correction result of the character to be detected to be the corrected character; In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold, then determining that the character error correction result of the character to be detected is the corrected character; In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is less than the fourth sub-threshold, it is determined that the character error correction result includes the character to be detected; In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold, then determining that the character error correction result includes the character to be detected and the error detection result; When the first confidence of the corrected character corresponding to the character to be detected is not greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is not greater than the fourth sub-threshold, it is determined that the character error correction result includes the character to be detected.

2. The method according to claim 1, characterized in that Before determining the character error correction result of the character to be detected by using the first confidence threshold and the first confidence of the corrected character corresponding to the character to be detected, and the second confidence threshold and the second confidence of the error detection result corresponding to the character to be detected, the method further includes: When the corrected character corresponding to the character to be detected is consistent with the character to be detected, the first confidence of the corrected character is updated to a preset confidence.

3. The method according to claim 1, characterized in that The method of using the text detection model to perform error detection and error correction processing on the text to be detected to obtain a corrected character corresponding to each character to be detected and an error detection result corresponding to each character to be detected includes: Using the feature extraction layer in the text detection model, feature extraction is performed on each character to be detected in the text to be detected, so as to obtain character features corresponding to each character to be detected; Using the error correction layer in the text detection model, according to each of the character features, determine the corrected character corresponding to each of the characters to be detected; The error detection layer in the text detection model is used to determine the error detection result corresponding to each of the characters to be detected according to the features of each of the characters.

4. The method according to claim 3, characterized in that The method further comprises the step of training the text detection model: Obtaining a sample text and a label character and a label error detection result corresponding to each sample character in the sample text; Using the text detection model to be trained, error detection and error correction processing is performed on the sample text to obtain a predicted character corresponding to each of the sample characters and a predicted error detection result corresponding to each of the sample characters; Determine the prediction loss using the predicted character, the predicted error detection result, the label character and the label error detection result; The text detection model to be trained is iteratively trained using the prediction loss until a preset cutoff condition is met, thereby obtaining a trained text detection model.

5. The method according to claim 4, characterized in that The predicted loss includes a first loss, a second loss and a third loss; The step of determining the prediction loss by using the predicted character, the prediction error detection result, the label character and the label error detection result comprises: Determine a first loss of the error correction layer by using a cross entropy between the predicted character and the label character; Determine a second loss of the error detection layer by using a cross entropy between the predicted error detection result and the label error detection result; Determine a third loss based on the first loss and the second loss; The method of iteratively training the text detection model to be trained by using the prediction loss until a preset cutoff condition is met to obtain a trained text detection model includes: The error correction layer is iteratively trained using the first loss, the error detection layer is iteratively trained using the second loss, and the text detection model to be trained is iteratively trained using the third loss until a training cutoff condition is met, thereby obtaining a trained text detection model.

6. A text error correction device, characterized in that: include: An acquisition module, used for acquiring a text to be detected; the text to be detected includes at least one character to be detected; A detection module, used for performing error detection and error correction processing on the text to be detected by using a text detection model, and obtaining a corrected character corresponding to each character to be detected, and an error detection result corresponding to each character to be detected; the error detection result is used to indicate whether there is an error in the character to be detected; An error correction module, for determining, for any of the characters to be detected, a character error correction result of the character to be detected using a first confidence threshold and a first confidence of a corrected character corresponding to the character to be detected, and a second confidence threshold and a second confidence of the error detection result corresponding to the character to be detected; Determining the text error correction result according to the character error correction result of each of the characters to be detected; The first confidence threshold includes a first sub-threshold and a second sub-threshold, and the first sub-threshold is greater than the second sub-threshold; the second confidence threshold includes a third sub-threshold and a fourth sub-threshold, and the third sub-threshold is greater than the fourth sub-threshold; The error correction module, when determining the character error correction result of the character to be detected by using the first confidence threshold and the first confidence of the corrected character corresponding to the character to be detected, and the second confidence threshold and the second confidence of the error detection result corresponding to the character to be detected, is used to: When the first confidence level of the corrected character corresponding to the character to be detected is greater than the first sub-threshold, determining the character error correction result of the character to be detected to be the corrected character; In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold, then determining that the character error correction result of the character to be detected is the corrected character; In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the first sub-threshold and greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is less than the fourth sub-threshold, it is determined that the character error correction result includes the character to be detected; In the case where the first confidence of the corrected character corresponding to the character to be detected is not greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is greater than the fourth sub-threshold, then determining that the character error correction result includes the character to be detected and the error detection result; When the first confidence of the corrected character corresponding to the character to be detected is not greater than the second sub-threshold, if the second confidence of the error detection result corresponding to the character to be detected is not greater than the fourth sub-threshold, it is determined that the character error correction result includes the character to be detected.

7. A computer device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor executes the steps of the text correction method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program. When the computer program is executed by a computer device, the computer device executes the steps of the text error correction method according to any one of claims 1 to 5.