Text error correction method and device based on post-processing discriminator, equipment and medium
By introducing a post-processing discriminator into text error correction technology, combining the Chinese spelling correction model and confidence similarity decoder, the problem of low text error correction accuracy in automatic speech recognition technology is solved, and higher error correction accuracy and lower error correction rate are achieved.
Patent Information
- Application Number
- CN202411662108.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-20
AI Technical Summary
The existing automatic speech recognition technology has problems with low accuracy in text error correction, especially due to the confusion of words with similar pronunciation but different semantics caused by the absence of space separators between Chinese characters, as well as excessive correction.
The text error correction method based on the post-processing discriminator is adopted. By obtaining the text to be analyzed and dividing sentences, the sentence-level error checker and confidence similarity decoder in the pre-constructed Chinese spelling correction model are used for sentence error checking, and character error checking is performed in combination with the character-level error checker, and the results are fused through the fusion strategy, and the original text is finally corrected based on the target results.
Improve the accuracy of text error correction, reduce the error correction rate, and avoid excessive correction, thereby improving customer experience and work efficiency.
Smart Images

Figure CN119623459A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a text error correction method, device, equipment and medium based on a post-processing discriminator. Background Art
[0002] In current insurance business scenarios or medical scenarios, automatic speech recognition (ASR) text correction technology plays an important role. Specifically, customers input medical information through voice, and ASR text correction technology is used to automatically identify medical information and correct incorrect words or phrases in the medical information, so that customers can input medical information more smoothly, improving customer experience and work efficiency. Furthermore, the CSC model based on the pre-trained language model (PLM) also shows a strong error correction ability, but it also causes the problem of correct characters in many medical texts being incorrectly corrected. In particular, in real application scenarios, the problem of over-correction is particularly serious.
[0003] Since errors introduced by automatic speech recognition (ASR) usually affect the execution of downstream tasks such as voice search and voice translation, it is necessary to reduce the errors caused by automatic speech recognition. Specifically, the existing automatic speech recognition technology has the following two defects and shortcomings: one is the problem of speech feature confusion. Since there is no space separator between Chinese characters, it leads to confusion between multiple words with similar pronunciation but different semantics; the other is the problem of over-correction. Since the error rate of sentences is generally low, many correct characters are incorrectly corrected during the sentence correction process, resulting in over-correction of sentences. In summary, the existing technology has the problem of low accuracy of text error correction. Summary of the invention
[0004] The present invention provides a text error correction method, device, equipment and medium based on a post-processing discriminator, the main purpose of which is to solve the problem of low accuracy of text error correction.
[0005] To achieve the above object, the present invention provides a text error correction method based on a post-processing discriminator, comprising:
[0006] Obtaining a text to be analyzed, dividing the text to be analyzed into sentences, and obtaining original text sentences;
[0007] Perform sentence error checking on the original text sentence using a sentence-level error checker and a confidence similarity decoder in a pre-built Chinese spelling correction model to obtain a first checking result, wherein the Chinese spelling correction model includes a sentence-level error checker, a character-level error checker, a fusion strategy, and a confidence similarity decoder;
[0008] Performing character error checking on the original text sentence using the character-level error checker and the confidence similarity decoder to obtain a second checking result;
[0009] Using the fusion strategy to fuse the first inspection result and the second inspection result to obtain a target result;
[0010] The original text sentence is corrected according to the target result to obtain a corrected text sentence, and a plurality of the corrected text sentences are integrated to obtain a corrected text.
[0011] Optionally, dividing the text to be analyzed into sentences to obtain original text sentences includes:
[0012] Extracting text symbols from the text to be analyzed, matching the text symbols with a preset symbol library to obtain target symbols;
[0013] The text to be analyzed is segmented according to the target symbol to obtain original text sentences.
[0014] Optionally, the sentence error check of the original text sentence using the sentence-level error checker and the confidence similarity decoder in the pre-built Chinese spelling correction model to obtain a first check result includes:
[0015] Performing an initial error check on the original text sentence using the sentence-level error checker to obtain an initial check result;
[0016] When the initial check result is that the original text sentence has no spelling errors, decoding the original text sentence according to the confidence similarity decoder to obtain a sentence sequence and sentence confidence;
[0017] Calculating the speech similarity of the sentence sequence, and assigning weights to the sentence confidence and the speech similarity to obtain a first weight and a second weight;
[0018] Calculating the character similarity corresponding to the sentence sequence according to the sentence confidence, the speech similarity, the first weight, and the second weight, and reordering the sentence sequence using the character similarity to obtain an updated sentence sequence;
[0019] Correcting the original text sentence according to the updated sentence sequence to obtain a corrected sentence, and performing error checking on the corrected sentence using the sentence-level error checker to obtain a corrected checking result;
[0020] The initial inspection result and the revised inspection result are integrated to obtain a first inspection result.
[0021] Optionally, the using the character-level error checker and the confidence similarity decoder to perform character error checking on the original text sentence to obtain a second checking result includes:
[0022] Using the character-level error checker to perform an initial character error check on the original text sentence to obtain an initial character check result;
[0023] When the initial check result is that there are no spelling errors in the characters of the original text sentence, using the character-level error checker to extract character features from the original text sentence to obtain text character features;
[0024] Decoding the text character features using the confidence similarity decoder to obtain a character sequence and character confidence;
[0025] Calculating the character similarity of the character sequence, and setting a first weight ratio and a second weight ratio corresponding to the character similarity and the character confidence;
[0026] Calculating the feature similarity corresponding to the text character feature according to the character similarity, the character confidence, the first weight ratio and the second weight ratio;
[0027] Performing sequence updating on the character sequence based on the feature similarity to obtain an updated character sequence, and performing sentence updating on the original text sentence according to the updated character sequence to obtain an updated sentence;
[0028] The character-level error checker is used to check spelling errors of characters in the updated sentence to obtain an update check result, and the initial character check result and the update check result are summarized to obtain a second check result.
[0029] Optionally, the using the fusion strategy to fuse the first inspection result and the second inspection result to obtain a target result includes:
[0030] Determining whether the initial inspection result and the revised inspection result in the first inspection result have spelling errors based on the fusion strategy;
[0031] When the initial check result does not have spelling errors but the revised check result does have spelling errors, determining that the target result is over-corrected;
[0032] When the initial check result does not have spelling errors and the revised check result does not have spelling errors, determining whether the initial character check result and the updated check result in the second check result have character spelling errors;
[0033] When the initial character check result does not have a character spelling error but the updated character check result does have a character spelling error, determining that the target result is over-corrected;
[0034] When the initial character check result does not have a character spelling error and the updated check result does not have a spelling error, determining that the target result is over-corrected;
[0035] When there are spelling errors in the initial check result in the first check result or there are no spelling errors in the initial check result in the first check result and there are no spelling errors in the revised check result but there are character spelling errors in the initial character check result in the second check result, the target result is determined to be correctly modified.
[0036] Optionally, the correcting the original text sentence according to the target result to obtain a corrected text sentence includes:
[0037] When the target result is over-correction, it means that the original text sentence does not need to be corrected, and the original text sentence is used as the corrected text sentence;
[0038] When the target result is a correct modification, performing an initial modification on the original text sentence according to the modified inspection result in the first inspection result to obtain an initial corrected sentence;
[0039] The initial corrected sentence is modified for a second time according to the updated check result in the second check result to obtain a corrected text sentence.
[0040] Optionally, the step of integrating the plurality of corrected text sentences to obtain a corrected text comprises:
[0041] Extracting a text sequence of original text sentences corresponding to a plurality of the corrected text sentences in the text to be analyzed;
[0042] A plurality of the corrected text sentences are concatenated according to the text sequence to obtain a corrected text.
[0043] In order to solve the above problems, the present invention also provides a text error correction device based on a post-processing discriminator, the device comprising:
[0044] A sentence segmentation module is used to obtain the text to be analyzed, and to segment the text to be analyzed into sentences to obtain original text sentences;
[0045] A sentence error checking module, used to perform sentence error checking on the original text sentence using a sentence-level error checker and a confidence similarity decoder in a pre-built Chinese spelling correction model to obtain a first checking result, wherein the Chinese spelling correction model includes a sentence-level error checker, a character-level error checker, a fusion strategy, and a confidence similarity decoder;
[0046] A character error checking module, used for performing character error checking on the original text sentence using the character-level error checker and the confidence similarity decoder to obtain a second checking result;
[0047] A result fusion module, used to fuse the first inspection result and the second inspection result by using the fusion strategy to obtain a target result;
[0048] The sentence integration module is used to correct the original text sentence according to the target result to obtain a corrected text sentence, and integrate multiple corrected text sentences to obtain a corrected text.
[0049] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0050] at least one processor; and,
[0051] a memory communicatively connected to the at least one processor; wherein,
[0052] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the text error correction method based on the post-processing identifier described above.
[0053] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned text error correction method based on the post-processing identifier.
[0054] The embodiment of the present invention can accurately obtain the original text sentences by dividing the text to be analyzed into sentences; the sentence-level error checker and the confidence similarity decoder in the Chinese spelling correction model can accurately obtain the first check result by checking the original text sentences for sentence errors; the character-level error checker and the confidence similarity decoder can accurately obtain the second check result by checking the original text sentences for character errors; the sentence-level error checker and the character-level error checker can combine coarse-grained and fine-grained features, and can better identify the situation of over-correction, thereby improving the accuracy of Chinese spelling correction and avoiding miscorrection; the first check result and the second check result are fused by the fusion strategy, and the target result can be accurately obtained, thereby improving the computer processing efficiency; the original text sentence is corrected by the target result, and the corrected text sentence can be accurately obtained, thereby accurately obtaining the corrected text. Therefore, the text error correction method, device, equipment and medium based on the post-processing discriminator proposed by the present invention can solve the problem of low accuracy of text error correction. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 A schematic diagram of a flow chart of a text error correction method based on a post-processing discriminator provided in one embodiment of the present invention;
[0056] Figure 2 A schematic diagram of a flow chart of dividing a text to be analyzed into sentences to obtain original text sentences provided by an embodiment of the present invention;
[0057] Figure 3 A schematic diagram of a process for correcting an original text sentence according to a target result to obtain a corrected text sentence provided by an embodiment of the present invention;
[0058] Figure 4 A functional module diagram of a text error correction device based on a post-processing discriminator provided by an embodiment of the present invention;
[0059] Figure 5 A schematic diagram of the structure of an electronic device for implementing the text error correction method based on a post-processing identifier provided by an embodiment of the present invention.
[0060] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0061] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0062] The embodiment of the present application provides a text error correction method based on a post-processing discriminator. The execution subject of the text error correction method based on the post-processing discriminator includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. In other words, the text error correction method based on the post-processing discriminator can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
[0063] Reference Figure 1 FIG. 1 is a flow chart of a text error correction method based on a post-processing discriminator provided by an embodiment of the present invention. In this embodiment, the text error correction method based on a post-processing discriminator includes:
[0064] S1. Obtain a text to be analyzed, divide the text to be analyzed into sentences, and obtain original text sentences.
[0065] In the embodiment of the present invention, the text to be analyzed includes news report text, notice text, subject classification text, product review text, medical data text, etc.
[0066] See also Figure 2 In the embodiment of the present invention, the sentence division of the text to be analyzed to obtain original text sentences includes:
[0067] S21, extracting text symbols from the text to be analyzed, matching the text symbols with a preset symbol library, and obtaining target symbols;
[0068] S22. Segment the text to be analyzed according to the target symbol to obtain original text sentences.
[0069] In an embodiment of the present invention, the text symbols include a period, a question mark, a bracket, an exclamation mark, etc.; the symbol library contains a plurality of symbols representing sentence separations, for example, a period, an exclamation mark, etc.; the text symbols are compared one by one with the plurality of symbols representing sentence separations in the symbol library, and the symbols in the text symbols that are matched consistently are used as target symbols; the target symbols are used to segment the text to be analyzed to obtain a plurality of original text sentences.
[0070] In the embodiment of the present invention, the text to be analyzed is divided into sentences, so that the original text sentences can be accurately obtained and the efficiency of subsequent text analysis can be improved.
[0071] S2. Perform sentence error checking on the original text sentence using a sentence-level error checker and a confidence similarity decoder in a pre-built Chinese spelling correction model to obtain a first checking result, wherein the Chinese spelling correction model includes a sentence-level error checker, a character-level error checker, a fusion strategy, and a confidence similarity decoder.
[0072] In an embodiment of the present invention, the Chinese spelling correction model consists of an original CSC model and a post-processing model, including at least one sentence-level error checker, at least one character-level error checker, at least one fusion strategy and at least one confidence similarity decoder.
[0073] Furthermore, the sentence-level error checker (SEC) refers to a binary classification model that can check whether there are spelling errors in a sentence; the character-level error checker (CEC) refers to a binary classifier that can detect whether there are spelling errors in each character in a sentence; the fusion strategy can fuse the results of SEC and CEC and determine whether there are any over-corrections in the sentence; the confidence similarity decoder (CSD) refers to a sentence decoder that can use context confidence and character phonetic similarity to improve the decoding effect of the Chinese spelling correction model.
[0074] In the embodiment of the present invention, the Chinese spelling correction model further comprises, before use, calculating the loss of the Chinese spelling correction model using a cross entropy loss function to obtain a correction loss value, updating the Chinese spelling correction model according to the correction loss value to obtain an updated Chinese spelling correction model, and further setting a training sample (X, Y), wherein X represents a sentence sequence of the original text sentence, and Y represents a corrected sentence sequence, and calculating the correction loss value using the following formula:
[0075] γ i = -logp(Y i |X i )
[0076] Among them, γi represents the correction loss value corresponding to the i-th sentence sequence, X i represents the i-th sentence sequence, Y i represents the i-th corrected sentence sequence, and p represents the preset output distribution.
[0077] In the embodiment of the present invention, the sentence error checker and the confidence similarity decoder in the pre-built Chinese spelling correction model are used to check the original text sentence for sentence errors to obtain a first check result, including:
[0078] Performing an initial error check on the original text sentence using the sentence-level error checker to obtain an initial check result;
[0079] When the initial check result is that the original text sentence has no spelling errors, decoding the original text sentence according to the confidence similarity decoder to obtain a sentence sequence and sentence confidence;
[0080] Calculating the speech similarity of the sentence sequence, and assigning weights to the sentence confidence and the speech similarity to obtain a first weight and a second weight;
[0081] Calculating the character similarity corresponding to the sentence sequence according to the sentence confidence, the speech similarity, the first weight, and the second weight, and reordering the sentence sequence using the character similarity to obtain an updated sentence sequence;
[0082] Correcting the original text sentence according to the updated sentence sequence to obtain a corrected sentence, and performing error checking on the corrected sentence using the sentence-level error checker to obtain a corrected checking result;
[0083] The initial inspection result and the revised inspection result are integrated to obtain a first inspection result.
[0084] In an embodiment of the present invention, the initial inspection result includes that the original text sentence has no spelling errors and that the original text sentence has spelling errors, wherein when the original text sentence has no spelling errors, when correcting the original text sentence, it is necessary to determine whether the corrected sentence is over-corrected; the phonetic similarity of the sentence sequence can be calculated by calculating the edit distance of the sentence sequence, that is, using the Levenshtein Distance algorithm to calculate the minimum number of editing operations between two adjacent character strings in the sentence sequence, wherein the smaller the edit distance, the greater the similarity.
[0085] Furthermore, the AHP hierarchical method and the priority diagram method, that is, the subjective assignment method, can be used to assign weights to the sentence confidence and the speech similarity. Specifically, the sentence confidence can be assigned to 0.4 and the speech similarity can be assigned to 0.6 to calculate the character similarity corresponding to the sentence sequence.
[0086] In the embodiment of the present invention, the character similarity corresponding to the sentence sequence is calculated using the following formula:
[0087] η=a×A+b×B
[0088] Among them, η represents the character similarity corresponding to the sentence sequence, a represents the first weight, A represents the sentence confidence, b represents the second weight, and B represents the sentence similarity.
[0089] In an embodiment of the present invention, the sentence sequence is reordered using the character similarity to obtain an updated sentence sequence, which means setting a character threshold, wherein the character threshold refers to a pre-set standard similarity, and judging whether the character similarity is less than the character threshold. When the character similarity is less than the character threshold, it indicates that the sentence sequence does not need to be reordered, and the sentence sequence is used as an updated sentence sequence; when the character similarity is greater than or equal to the character threshold, it indicates that the sentence sequence needs to be reordered, and the sentence sequence is sorted according to the size of the character similarity to obtain an updated sentence sequence; the original text sentences are reordered in the order of the updated sentence sequence to obtain corrected sentences.
[0090] In an embodiment of the present invention, the sentence-level error checker performs an error check on the revised sentence to obtain a revised check result, which includes two results: one is that the revised sentence has no spelling errors and the other is that the revised sentence has spelling errors; the initial check result and the revised check result are summarized to obtain a first check result; further, when the revised sentence is a correct sentence, the revised sentence can be marked as 0; when the revised sentence is an incorrect sentence, the revised sentence can be marked as 1, which can avoid subsequent repeated processing and improve computer operating efficiency.
[0091] In the embodiment of the present invention, sentence error checking is performed on the original text sentences according to the sentence-level error checker and the confidence similarity decoder, and the first checking result can be accurately obtained, thereby improving the computer processing efficiency.
[0092] S3. Perform a character error check on the original text sentence using the character-level error checker and the confidence similarity decoder to obtain a second check result.
[0093] In the embodiment of the present invention, the character-level error checker and the confidence similarity decoder are used to perform character error check on the original text sentence to obtain a second check result, including:
[0094] Using the character-level error checker to perform an initial character error check on the original text sentence to obtain an initial character check result;
[0095] When the initial check result is that there are no spelling errors in the characters of the original text sentence, using the character-level error checker to extract character features from the original text sentence to obtain text character features;
[0096] Decoding the text character features using the confidence similarity decoder to obtain a character sequence and character confidence;
[0097] Calculating the character similarity of the character sequence, and setting a first weight ratio and a second weight ratio corresponding to the character similarity and the character confidence;
[0098] Calculating the feature similarity corresponding to the text character feature according to the character similarity, the character confidence, the first weight ratio and the second weight ratio;
[0099] Performing sequence updating on the character sequence based on the feature similarity to obtain an updated character sequence, and performing sentence updating on the original text sentence according to the updated character sequence to obtain an updated sentence;
[0100] The character-level error checker is used to check spelling errors of characters in the updated sentence to obtain an update check result, and the initial character check result and the update check result are summarized to obtain a second check result.
[0101] In an embodiment of the present invention, the initial character check result includes two results: there are no spelling errors in the characters of the original text sentence and there are spelling errors in the characters of the original text sentence; when there are no spelling errors in the characters of the original text sentence, character features are extracted for the original text sentence according to the feature extractor included in the character-level error checker to obtain text character features; calculating the character similarity of the character sequence is consistent with the step of calculating the speech similarity of the sentence sequence in S2 above; the first weight ratio and the second weight ratio can be set by the entropy method, wherein the first weight ratio is lower than the value assigned to the sentence confidence, and the second weight ratio is higher than the value assigned to the speech similarity, for example, the first weight ratio can be set to 0.2, and the second weight ratio can be set to 0.8.
[0102] In an embodiment of the present invention, calculating the feature similarity corresponding to the text character feature is consistent with the step of calculating the character similarity corresponding to the sentence sequence in the above S2, and will not be elaborated on here; updating the character sequence based on the feature similarity to obtain an updated character sequence refers to setting a feature similarity threshold, and judging whether the feature similarity is less than the feature similarity threshold. When the feature similarity is less than the feature similarity threshold, it indicates that the character sequence does not need to be updated, and the character sequence is used as an updated character sequence; when the feature similarity is greater than or equal to the feature similarity threshold, it indicates that the character sequence needs to be updated, and the character sequence is reordered according to the size of the feature similarity to obtain an updated character sequence; the updated character sequence replaces the character sequence corresponding to the original text sentence to obtain an updated sentence.
[0103] In an embodiment of the present invention, the update check result includes the problem that the characters of the updated sentence have no spelling errors and the problem that the characters of the updated sentence have spelling errors, wherein if the updated sentence has no spelling errors, the updated sentence is marked as 0; if the updated sentence has spelling errors, the updated sentence is marked as 1; the second check result includes that the original text sentence has spelling errors, the original text sentence has no spelling errors but the updated sentence has spelling errors, and the original text sentence has no spelling errors and the updated sentence has no spelling errors.
[0104] In an embodiment of the present invention, the original text sentence is checked for character errors through a character-level error checker and a confidence similarity decoder, and the second check result can be accurately obtained; by combining the sentence level and the character level, that is, combining coarse-grained and fine-grained features at two different levels to determine whether the original text sentence needs to be corrected, over-correction can be avoided, thereby improving the efficiency of text correction.
[0105] S4. Use the fusion strategy to fuse the first inspection result and the second inspection result to obtain a target result.
[0106] In the embodiment of the present invention, the step of fusing the first inspection result and the second inspection result using the fusion strategy to obtain a target result includes:
[0107] Determining whether the initial inspection result and the revised inspection result in the first inspection result have spelling errors based on the fusion strategy;
[0108] When the initial check result does not have spelling errors but the revised check result does have spelling errors, determining that the target result is over-corrected;
[0109] When the initial check result does not have spelling errors and the revised check result does not have spelling errors, determining whether the initial character check result and the updated check result in the second check result have character spelling errors;
[0110] When the initial character check result does not have a character spelling error but the updated character check result does have a character spelling error, determining that the target result is over-corrected;
[0111] When the initial character check result does not have a character spelling error and the updated check result does not have a spelling error, determining that the target result is over-corrected;
[0112] When there are spelling errors in the initial check result in the first check result or there are no spelling errors in the initial check result in the first check result and there are no spelling errors in the revised check result but there are character spelling errors in the initial character check result in the second check result, the target result is determined to be correctly modified.
[0113] In an embodiment of the present invention, the situations predicted by the fusion strategy can be divided into four situations: First, if SEC correctly predicts the original text sentence M, but SEC incorrectly predicts the revised sentence N, this situation is considered to be over-correction; second, when both the original text sentence M and the revised sentence N are correctly predicted by SEC, further analyzing the CEC results, when the characters of the original text sentence are predicted to be correct, and the characters of the modified updated sentence are predicted to be incorrect, this situation is also considered to be over-correction; third, when all results are predicted to be correct, it means that the sentence can be expressed in multiple ways. In this case, it is best not to modify the original text sentence, otherwise it indicates over-correction; fourth, in other cases, it indicates correct modification.
[0114] In the embodiment of the present invention, the fusion strategy is expressed as:
[0115]
[0116] Among them, output represents the target result, y s1 represents the initial inspection result in the first inspection result, y s2 represents the modified inspection result in the first inspection result, y c1 Indicates the initial character check result in the second check result, y c2 Indicates the updated check result in the second check result, 1 indicates an error, and 0 indicates a success.
[0117] In the embodiment of the present invention, the first inspection result and the second inspection result are fused using a fusion strategy, so that the target result can be accurately obtained, thereby avoiding excessive correction of the original text sentence and improving the accuracy of text error correction.
[0118] S5. Correct the original text sentence according to the target result to obtain a corrected text sentence, and integrate multiple corrected text sentences to obtain a corrected text.
[0119] See also Figure 3 As shown, in the embodiment of the present invention, the original text sentence is corrected according to the target result to obtain a corrected text sentence, including:
[0120] S31, determining whether the target result is an over-correction or a correct modification;
[0121] When the target result is over-correction, executing S32, indicating that the original text sentence does not need to be corrected, and using the original text sentence as the corrected text sentence;
[0122] When the target result is a correct modification, executing S33, performing an initial modification on the original text sentence according to the modified inspection result in the first inspection result to obtain an initial corrected sentence;
[0123] S34. Modify the initial corrected sentence for a second time according to the updated check result in the second check result to obtain a corrected text sentence.
[0124] In an embodiment of the present invention, when the target result is over-correction, it means that there is no problem with the original text sentence and no correction is required; when the target result is correct modification, it means that there are spelling errors in the original text sentence. At this time, the original text sentence needs to be doubly modified according to the modification contents of S2 and S3 above to obtain a corrected text sentence.
[0125] In the embodiment of the present invention, the step of integrating the plurality of corrected text sentences to obtain the corrected text includes:
[0126] Extracting a text sequence of original text sentences corresponding to a plurality of the corrected text sentences in the text to be analyzed;
[0127] A plurality of the corrected text sentences are concatenated according to the text sequence to obtain a corrected text.
[0128] In an embodiment of the present invention, the original text sentences may be sorted according to the segmentation order of the original text sentences to obtain a text sequence; and the corrected text sentences corresponding to the original text sentences may be connected according to the order of the text sequence to obtain a corrected text.
[0129] In the embodiment of the present invention, the original text sentence is corrected according to the target result, so that the accuracy of the corrected text sentence can be improved; and the corrected text can be accurately obtained by integrating multiple corrected text sentences.
[0130] The embodiment of the present invention can accurately obtain the original text sentences by dividing the text to be analyzed into sentences; the sentence-level error checker and the confidence similarity decoder in the Chinese spelling correction model can accurately obtain the first inspection result by performing sentence error inspection on the original text sentences; the character-level error checker and the confidence similarity decoder can accurately obtain the second inspection result by performing character error inspection on the original text sentences; the sentence-level error checker and the character-level error checker can combine coarse-grained and fine-grained features, and can better identify the situation of over-correction, thereby improving the accuracy of Chinese spelling correction and avoiding miscorrection; the first inspection result and the second inspection result are integrated by the fusion strategy, and the target result can be accurately obtained, thereby improving the computer processing efficiency; the original text sentence is corrected by the target result, and the corrected text sentence can be accurately obtained, thereby accurately obtaining the corrected text. Therefore, the text error correction method based on the post-processing discriminator proposed by the present invention can solve the problem of low accuracy of text error correction.
[0131] like Figure 4 , is a functional module diagram of a text error correction device based on a post-processing identifier provided by an embodiment of the present invention.
[0132] The text error correction device 400 based on the post-processing discriminator of the present invention can be installed in an electronic device. According to the functions implemented, the text error correction device 400 based on the post-processing discriminator can include a sentence segmentation module 401, a sentence error checking module 402, a character error checking module 403, a result fusion module 404 and a sentence integration module 405. The module of the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0133] In this embodiment, the functions of each module / unit are as follows:
[0134] The sentence division module 401 is used to obtain the text to be analyzed, divide the text to be analyzed into sentences, and obtain original text sentences;
[0135] The sentence error checking module 402 is used to perform sentence error checking on the original text sentence using a sentence-level error checker and a confidence similarity decoder in a pre-built Chinese spelling correction model to obtain a first checking result, wherein the Chinese spelling correction model includes a sentence-level error checker, a character-level error checker, a fusion strategy, and a confidence similarity decoder;
[0136] The character error checking module 403 is used to perform character error checking on the original text sentence using the character-level error checker and the confidence similarity decoder to obtain a second checking result;
[0137] The result fusion module 404 is used to fuse the first inspection result and the second inspection result by using the fusion strategy to obtain a target result;
[0138] The sentence integration module 405 is used to correct the original text sentence according to the target result to obtain a corrected text sentence, and integrate multiple corrected text sentences to obtain a corrected text.
[0139] In detail, each module described in the text correction device 400 based on the post-processing discriminator described in the embodiment of the present invention adopts the same technical means as the text correction method based on the post-processing discriminator described in the accompanying drawings when used, and can produce the same technical effects, which will not be repeated here.
[0140] like Figure 5 , which is a schematic diagram of the structure of an electronic device for implementing a text error correction method based on a post-processing identifier provided by an embodiment of the present invention.
[0141] The electronic device 500 may include a processor 501 , a memory 502 , a communication bus 503 , and a communication interface 504 , and may also include a computer program stored in the memory 502 and executable on the processor 501 , such as a text error correction program based on a post-processing identifier.
[0142] In some embodiments, the processor 501 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 501 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 502 (for example, executing a text error correction program based on a post-processing identifier, etc.), and calls data stored in the memory 502 to execute various functions of the electronic device and process data.
[0143] The memory 502 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. The memory 502 may be an internal storage unit of an electronic device in some embodiments, such as a mobile hard disk of the electronic device. The memory 502 may also be an external storage device of an electronic device in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 502 may also include both an internal storage unit of the electronic device and an external storage device. The memory 502 may not only be used to store application software and various types of data installed in the electronic device, such as the code of a text error correction program based on a post-processing identifier, but may also be used to temporarily store data that has been output or is to be output.
[0144] The communication bus 503 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 502 and at least one processor 501, etc.
[0145] The communication interface 504 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0146] Figure 5 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 5 The structure shown does not constitute a limitation on the electronic device 500 , and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0147] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 501 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, etc. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0148] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0149] The text error correction program based on the post-processing identifier stored in the memory 502 of the electronic device 500 is a combination of multiple instructions. When running in the processor 501, it can achieve:
[0150] Obtaining a text to be analyzed, dividing the text to be analyzed into sentences, and obtaining original text sentences;
[0151] Perform sentence error checking on the original text sentence using a sentence-level error checker and a confidence similarity decoder in a pre-built Chinese spelling correction model to obtain a first checking result, wherein the Chinese spelling correction model includes a sentence-level error checker, a character-level error checker, a fusion strategy, and a confidence similarity decoder;
[0152] Performing character error checking on the original text sentence using the character-level error checker and the confidence similarity decoder to obtain a second checking result;
[0153] Using the fusion strategy to fuse the first inspection result and the second inspection result to obtain a target result;
[0154] The original text sentence is corrected according to the target result to obtain a corrected text sentence, and a plurality of the corrected text sentences are integrated to obtain a corrected text.
[0155] Specifically, the specific implementation method of the processor 501 for the above instructions can refer to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, which will not be repeated here.
[0156] Furthermore, if the module / unit integrated in the electronic device 500 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0157] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:
[0158] Obtaining a text to be analyzed, dividing the text to be analyzed into sentences, and obtaining original text sentences;
[0159] Perform sentence error checking on the original text sentence using a sentence-level error checker and a confidence similarity decoder in a pre-built Chinese spelling correction model to obtain a first checking result, wherein the Chinese spelling correction model includes a sentence-level error checker, a character-level error checker, a fusion strategy, and a confidence similarity decoder;
[0160] Performing character error checking on the original text sentence using the character-level error checker and the confidence similarity decoder to obtain a second checking result;
[0161] Using the fusion strategy to fuse the first inspection result and the second inspection result to obtain a target result;
[0162] The original text sentence is corrected according to the target result to obtain a corrected text sentence, and a plurality of the corrected text sentences are integrated to obtain a corrected text.
[0163] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0164] The modules described as separate components may or may not be physically separated, and the components shown as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0165] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0166] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0167] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0168] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0169] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0170] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A text error correction method based on a post-processing discriminator, characterized in that: The method comprises: Obtaining a text to be analyzed, dividing the text to be analyzed into sentences, and obtaining original text sentences; Perform sentence error checking on the original text sentence using a sentence-level error checker and a confidence similarity decoder in a pre-built Chinese spelling correction model to obtain a first checking result, wherein the Chinese spelling correction model includes a sentence-level error checker, a character-level error checker, a fusion strategy, and a confidence similarity decoder; Performing character error checking on the original text sentence using the character-level error checker and the confidence similarity decoder to obtain a second checking result; Using the fusion strategy to fuse the first inspection result and the second inspection result to obtain a target result; The original text sentence is corrected according to the target result to obtain a corrected text sentence, and a plurality of the corrected text sentences are integrated to obtain a corrected text.
2. The text error correction method based on the post-processing discriminator as claimed in claim 1, characterized in that: The step of dividing the text to be analyzed into sentences to obtain original text sentences includes: Extracting text symbols from the text to be analyzed, matching the text symbols with a preset symbol library to obtain target symbols; The text to be analyzed is segmented according to the target symbol to obtain original text sentences.
3. The text error correction method based on the post-processing discriminator as claimed in claim 1, characterized in that: The sentence-level error checker and the confidence similarity decoder in the pre-built Chinese spelling correction model are used to check the original text sentence for sentence errors, and a first check result is obtained, including: Performing an initial error check on the original text sentence using the sentence-level error checker to obtain an initial check result; When the initial check result is that the original text sentence has no spelling errors, decoding the original text sentence according to the confidence similarity decoder to obtain a sentence sequence and sentence confidence; Calculating the speech similarity of the sentence sequence, and assigning weights to the sentence confidence and the speech similarity to obtain a first weight and a second weight; Calculating the character similarity corresponding to the sentence sequence according to the sentence confidence, the speech similarity, the first weight, and the second weight, and reordering the sentence sequence using the character similarity to obtain an updated sentence sequence; Correcting the original text sentence according to the updated sentence sequence to obtain a corrected sentence, and performing error checking on the corrected sentence using the sentence-level error checker to obtain a corrected checking result; The initial inspection result and the revised inspection result are integrated to obtain a first inspection result.
4. The text error correction method based on the post-processing discriminator as claimed in claim 1, characterized in that: The using the character-level error checker and the confidence similarity decoder to perform character error checking on the original text sentence to obtain a second checking result includes: Using the character-level error checker to perform an initial character error check on the original text sentence to obtain an initial character check result; When the initial check result is that there are no spelling errors in the characters of the original text sentence, using the character-level error checker to extract character features from the original text sentence to obtain text character features; Decoding the text character features using the confidence similarity decoder to obtain a character sequence and character confidence; Calculating the character similarity of the character sequence, and setting a first weight ratio and a second weight ratio corresponding to the character similarity and the character confidence; Calculating the feature similarity corresponding to the text character feature according to the character similarity, the character confidence, the first weight ratio and the second weight ratio; Performing sequence updating on the character sequence based on the feature similarity to obtain an updated character sequence, and performing sentence updating on the original text sentence according to the updated character sequence to obtain an updated sentence; The character-level error checker is used to check spelling errors of characters in the updated sentence to obtain an update check result, and the initial character check result and the update check result are summarized to obtain a second check result.
5. The text error correction method based on the post-processing discriminator as claimed in claim 1, characterized in that: The using the fusion strategy to fuse the first inspection result and the second inspection result to obtain a target result includes: Determining whether the initial inspection result and the revised inspection result in the first inspection result have spelling errors based on the fusion strategy; When the initial check result does not have spelling errors but the revised check result does have spelling errors, determining that the target result is over-corrected; When the initial check result does not have spelling errors and the revised check result does not have spelling errors, determining whether the initial character check result and the updated check result in the second check result have character spelling errors; When the initial character check result does not have a character spelling error but the updated character check result does have a character spelling error, determining that the target result is over-corrected; When the initial character check result does not have a character spelling error and the updated check result does not have a spelling error, determining that the target result is over-corrected; When there are spelling errors in the initial check result in the first check result or there are no spelling errors in the initial check result in the first check result and there are no spelling errors in the revised check result but there are character spelling errors in the initial character check result in the second check result, the target result is determined to be correctly modified.
6. The text error correction method based on the post-processing discriminator as claimed in claim 1, characterized in that: The correcting the original text sentence according to the target result to obtain a corrected text sentence includes: When the target result is over-correction, it means that the original text sentence does not need to be corrected, and the original text sentence is used as the corrected text sentence; When the target result is a correct modification, performing an initial modification on the original text sentence according to the modified inspection result in the first inspection result to obtain an initial corrected sentence; The initial corrected sentence is modified for a second time according to the updated check result in the second check result to obtain a corrected text sentence.
7. The text error correction method based on a post-processing discriminator according to any one of claims 1 to 6, characterized in that: The step of integrating the plurality of corrected text sentences to obtain the corrected text comprises: Extracting a text sequence of original text sentences corresponding to a plurality of the corrected text sentences in the text to be analyzed; A plurality of the corrected text sentences are concatenated according to the text sequence to obtain a corrected text.
8. A text error correction device based on a post-processing discriminator, characterized in that: The device comprises: A sentence segmentation module is used to obtain the text to be analyzed, and to segment the text to be analyzed into sentences to obtain original text sentences; A sentence error checking module, used to perform sentence error checking on the original text sentence using a sentence-level error checker and a confidence similarity decoder in a pre-built Chinese spelling correction model to obtain a first checking result, wherein the Chinese spelling correction model includes a sentence-level error checker, a character-level error checker, a fusion strategy, and a confidence similarity decoder; A character error checking module, used for performing character error checking on the original text sentence using the character-level error checker and the confidence similarity decoder to obtain a second checking result; A result fusion module, used to fuse the first inspection result and the second inspection result by using the fusion strategy to obtain a target result; The sentence integration module is used to correct the original text sentence according to the target result to obtain a corrected text sentence, and integrate multiple corrected text sentences to obtain a corrected text.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the text error correction method based on the post-processing identifier according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the text error correction method based on a post-processing identifier as claimed in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Text error correction method and system
CN111310443A
Text error correction method and device, equipment and storage medium
CN113657098A
Text error correction method and device, electronic equipment and storage medium
CN113935317A
Chinese spelling error correction method suitable for medical context
CN117648923A
Text error correction method and device, electronic equipment, storage medium and program product
CN118798173A
Cited By
Text correction method and device and electronic equipment
CN120496529A