Text fixed-length error correction method, device, equipment and storage medium
By performing error detection and error correction processing of data enhancement and deep error correction model on text, combined with soft mask connection and multiple rounds of error correction mechanism, the problem of low accuracy in the error correction process in the existing technology is solved, and high efficiency is achieved Parallel error correction and accurate error correction.
Patent Information
- Application Number
- CN202111149204.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-29
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2041-09-29
AI Technical Summary
The existing text error correction methods are difficult to correct errors in one-time and in parallel during the error correction process, resulting in low error correction accuracy.
By performing data enhancement processing on the original text, a training text set is generated, and the error detection network and error correction network of the deep error correction model are used for spelling error detection and error correction, combining soft mask connection processing and multiple rounds of error correction mechanisms, improving Error correction efficiency and accuracy.
It realizes efficient parallel error correction for text containing typos, significantly improves error correction accuracy and efficiency, and solves the problem of low text fixed-length error correction accuracy.
Smart Images

Figure CN113887201B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a text fixed-length error correction method, device, electronic device and computer-readable storage medium. Background Art
[0002] In the different business activities of banks, there are many business scenarios involving text records: for example, human agents will record customer consultation, customer service process overview, customer complaint summary, etc. in the form of text entry, and these recorded texts may contain typos due to human negligence. In this case, text error correction technology is needed to find typos in the entered text and correct them according to the context.
[0003] Existing text correction methods usually use a fixed-length text correction method based on a pre-trained language model, using a masking and then prediction method to correct each word in the text. This correction method needs to be performed sequentially and it is difficult to perform corrections in parallel at one time, which will cause correction errors and lead to low accuracy of text correction. Summary of the invention
[0004] The present invention provides a text fixed-length error correction method, device and computer-readable storage medium, the main purpose of which is to solve the problem of low accuracy of text fixed-length error correction.
[0005] To achieve the above object, the present invention provides a text fixed-length error correction method, comprising:
[0006] Acquire an original text set, and perform data enhancement processing on the original text set to obtain a training text set;
[0007] Performing vectorization processing on the training text set to obtain training text vectors;
[0008] Inputting the training text vector into the error detection network of a preset deep error correction model for error detection, and obtaining an output result of whether the spelling is correct;
[0009] According to the output result of whether the spelling is correct, performing soft mask connection processing on the training text vector to obtain embedded data;
[0010] Performing error correction processing on the embedded data using the error correction network of the deep error correction model to obtain an error correction result;
[0011] Calculating a cross entropy loss value of the deep error correction model according to the error correction result, adjusting a model parameter of the deep error correction model according to the cross entropy loss value, and outputting a standard deep error correction model;
[0012] The pre-acquired text to be corrected is input into the standard deep error correction model, and the correct text after error correction is obtained based on a preset multi-round error correction mechanism.
[0013] Optionally, performing data enhancement processing on the original text set to obtain a training text set includes:
[0014] Obtaining a preset corpus and word frequencies corresponding to the corpora in the corpus;
[0015] Randomly select a plurality of replaced characters from the original text set;
[0016] According to the word frequency, a confusion probability value between the confusion word in a preset confusion dictionary and the replaced word is calculated using a preset confusion probability calculation formula;
[0017] The obfuscated characters are sorted according to the obfuscation probability values, and the obfuscated character with the largest obfuscation probability value is selected to replace the replaced character, so as to obtain a training text set.
[0018] Optionally, the vectorizing the training text set to obtain the training text vector includes:
[0019] Obtaining a word embedding vector, a position embedding vector and a segment embedding vector for each character of the training text in the training text set;
[0020] The word embedding vector, the position embedding vector and the segment embedding vector are summed to obtain a training text vector.
[0021] Optionally, the step of inputting the training text vector into an error detection network of a preset deep error correction model to perform error detection and obtaining an output result of whether the spelling is correct includes:
[0022] Performing forward encoding and reverse encoding on the training text vector respectively to obtain a forward encoding vector and a reverse encoding vector;
[0023] Merging the forward coding vector and the reverse coding vector horizontally to obtain a coding hidden vector;
[0024] The encoded hidden vector is input into the fully connected layer for binary classification to obtain an output result of whether the spelling is correct.
[0025] Optionally, the step of inputting the encoded hidden vector into a fully connected layer for binary classification to obtain an output result of whether the spelling is correct includes:
[0026] Inputting the encoded hidden vector into the fully connected layer to obtain a classification probability;
[0027] When the classification probability is greater than or equal to a preset classification threshold, the output result is determined to be a spelling error;
[0028] When the classification probability is less than a preset classification threshold, the output result is determined to be correctly spelled.
[0029] Optionally, performing soft mask connection processing on the training text vector to obtain embedded data includes:
[0030] The mask coefficient is calculated using a preset mask coefficient formula and the encoded hidden vector;
[0031] The vector of spelling errors in the training text vector is calculated according to the mask coefficient and a preset soft mask connection formula to obtain embedded data.
[0032] Optionally, the using the error correction network of the deep error correction model to perform error correction processing on the embedded data to obtain an error correction result includes:
[0033] Encoding the embedded data using multiple coding layers in the error correction network, and taking the hidden state of the last coding layer in the multiple coding layers;
[0034] Performing a residual connection on the hidden state and the training text vector to obtain a connection value;
[0035] The connection value is input into the fully connected layer of the error correction network to obtain an error correction result.
[0036] In order to solve the above problem, the present invention also provides a text fixed-length error correction device, the device comprising:
[0037] A data processing module is used to obtain an original text set, perform data enhancement processing on the original text set to obtain a training text set, and perform vectorization processing on the training text set to obtain a training text vector;
[0038] An error detection module, used for inputting the training text vector into an error detection network of a preset deep error correction model to perform error detection and obtain an output result of whether the spelling is correct;
[0039] An error correction processing module is used to perform soft mask connection processing on the training text vector according to the output result of whether the spelling is correct to obtain embedded data, and use the error correction network of the deep error correction model to perform error correction processing on the embedded data to obtain an error correction result;
[0040] A model training module, used to calculate the cross entropy loss value of the deep error correction model according to the error correction result, and adjust the model parameters of the deep error correction model according to the cross entropy loss value, and output a standard deep error correction model;
[0041] The multi-round error correction module is used to input the pre-acquired text to be corrected into the standard deep error correction model, and obtain the correct text after error correction based on the preset multi-round error correction mechanism.
[0042] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0043] at least one processor; and,
[0044] a memory communicatively connected to the at least one processor; wherein,
[0045] The memory stores a computer program that can be executed 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 execute the text fixed-length error correction method described above.
[0046] In order to solve the above problem, 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 fixed-length error correction method.
[0047] The embodiment of the present invention obtains a training text set by performing data enhancement processing on the original text set. The data enhancement processing can construct a large number of training samples that can be used for training models at low cost and quickly. The vectorized training text set is input into the error detection network of the preset deep error correction model to obtain an output result of whether the spelling is correct. According to the output result of whether the spelling is correct, the training text vector is subjected to soft mask connection processing to obtain embedded data. The soft mask connection processing integrates the output result of whether the spelling is correct as the input of the error correction network. The error correction network of the deep error correction model is used to perform error correction processing on the embedded data. The error correction network has a strong text fixed-length error correction capability, and can perform parallel error correction on business texts containing typos at one time, and its error correction efficiency and timeliness can be greatly improved. Based on the preset multi-round error correction mechanism, the pre-acquired text to be corrected is input into the standard deep error correction model to obtain the correct text after correction. The multi-round error correction mechanism can further improve the error correction effect of the deep error correction model. Therefore, the text fixed-length error correction method, device, electronic device and computer-readable storage medium proposed in the present invention can solve the problem of low accuracy of text fixed-length error correction. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A flowchart of a text fixed-length error correction method provided by an embodiment of the present invention;
[0049] Figure 2A functional module diagram of a text fixed-length error correction device provided by an embodiment of the present invention;
[0050] Figure 3 A schematic diagram of the structure of an electronic device for implementing the text fixed-length error correction method provided by one embodiment of the present invention.
[0051] 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
[0052] 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.
[0053] The embodiment of the present application provides a method for correcting text fixed length errors. The execution subject of the method for correcting text fixed length errors 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 method for correcting text fixed length errors 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 basic cloud computing services such as 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 big data and artificial intelligence platforms.
[0054] Reference Figure 1 FIG. 1 is a flow chart of a text fixed-length error correction method provided by an embodiment of the present invention. In this embodiment, the text fixed-length error correction method includes:
[0055] S1. Obtain an original text set, and perform data enhancement processing on the original text set to obtain a training text set.
[0056] In the embodiment of the present invention, the original text set may be text records involved in different business activities of the bank, for example, texts related to customer consultation recorded by human agents, customer service process overviews, and customer complaint summaries.
[0057] Specifically, performing data enhancement processing on the original text set to obtain a training text set includes:
[0058] Get the preset obfuscation dictionary and preset enhancement number;
[0059] Select the homophonic characters in the confusion dictionary that match the number of the enhancement numbers, and use the homophonic characters to perform random replacement on the characters in the original text set to obtain the training text set.
[0060] Among them, the enhancement number refers to the number of characters that need to be replaced with data.
[0061] Specifically, the confusion dictionary contains 5,401 commonly used Chinese characters and their corresponding five types of homophonic characters: homophonic and same-tone characters, homophonic and different-tone characters, near-homophonic and same-tone characters, near-homophonic and different-tone characters, and characters with the same radical and the same number of strokes.
[0062] For example, the original text in the original text set is "Apply for a credit card". Using the homophonic and same-tone characters in the confusion dictionary to replace the original text can obtain "Shenqing credit card". Using the characters with the same radical and the same number of strokes in the confusion dictionary to replace the original text can obtain "Apply for an encroachment card" or "Apply for a convenience card".
[0063] In another embodiment of the present invention, the data enhancement process for the original text set to obtain the training text set may also include:
[0064] Obtain a preset corpus and the word frequency corresponding to the corpus in the corpus;
[0065] Randomly select multiple characters to be replaced from the original text set;
[0066] According to the word frequency, use a preset confusion probability calculation formula to calculate the confusion probability value between the homophonic characters in the preset confusion dictionary and the characters to be replaced;
[0067] Sort the homophonic characters according to the confusion probability value, and select the homophonic character with the largest confusion probability value to replace the characters to be replaced to obtain the training text set.
[0068] Specifically, the preset confusion probability calculation formula is:
[0069]
[0070] Among them, is the confusion probability value, represents the number of homophonic characters corresponding to the characters to be replaced in the original text in the confusion dictionary, represents the sum of the word frequencies of the homophonic characters in the corpus, represents the homophonic character The word frequency in the corpus.
[0071] For example, the original text in the original text set is "The customer inquires about applying for the Flower Card product of the bank". Multiple replacement words are randomly selected from the original text set. Among them, the replacement words can be "inquires", "applies", "flower", "credit card", and "product". Find all five confusing words corresponding to the replacement words in the confusion dictionary and look up the word frequencies corresponding to all five confusing words in the corpus. According to the calculated confusion probability value, replace the replacement word with the confusing word with the highest confusion probability value. Replace "inquires" with "seeks", "applies" with "applies deeply", "flower" with "pattern", "credit card" with "heart", and "product" with "shovel". Therefore, the sample in the obtained training sample set is "The customer seeks deep application for the bank's pattern heart credit card shovel product".
[0072] In the embodiment of the present invention, data augmentation processing is performed on the original text set to obtain a large number of training samples with typos and their corresponding correct word labels (the words before replacement can be considered as the corresponding correct word labels). Then, these labeled training samples are input into the deep error correction model for training and model effect optimization. Finally, a deep error correction model for business texts applicable to this business scenario can be obtained.
[0073] S2. Perform vectorization processing on the training text set to obtain training text vectors.
[0074] In the embodiment of the present invention, by obtaining the word embedding vector, position embedding vector, and segment embedding vector of each character in the training text in the training text set, and performing summation processing on the word embedding vector, the position embedding vector, and the segment embedding vector, a training text vector is obtained.
[0075] Therefore, in the embodiment of the present invention, the training text vector is obtained by performing summation processing on the word embedding vector (word embedding), position embedding vector (position embedding), and segment embedding vector of each character in the training text:
[0076]
[0077] Among them, represents the i-th character in the training text, represents the training text vector, wordembedding is the word embedding vector, position embedding is the position embedding vector, and segmentembedding is the segment embedding vector.
[0078] S3. Input the training text vector into the error detection network of a preset deep error correction model to perform error detection, and obtain an output result of whether the spelling is correct.
[0079] In an embodiment of the present invention, the deep error correction model is a detection-correction-combined model, which includes two network models: an error detection network and an error correction network. The error detection network is essentially a bidirectional GRU model (Bi-GRU). The GRU model (Gated Recurrent Unit), also known as a gated recurrent unit structure, is constructed by an update gate and a reset gate, and can effectively capture the semantic association between long sequences and alleviate the gradient disappearance or explosion phenomenon.
[0080] Specifically, the training text vector is input into an error detection network of a preset deep error correction model for error detection to obtain an output result, including:
[0081] Performing forward encoding and reverse encoding on the training text vector respectively to obtain a forward encoding vector and a reverse encoding vector;
[0082] Merging the forward coding vector and the reverse coding vector horizontally to obtain a coding hidden vector;
[0083] The encoded hidden vector is input into the fully connected layer for binary classification to obtain an output result of whether the spelling is correct.
[0084] Furthermore, the embodiment of the present invention uses the following calculation formula to calculate the forward encoding vector and the reverse encoding vector:
[0085]
[0086]
[0087] in, is the forward encoding vector, is the reverse encoding vector, is the hidden state of the previous character, is the hidden state of the next character, Represents the training text vector corresponding to the i-th character.
[0088] Furthermore, the embodiment of the present invention horizontally merges the forward encoding vector and the reverse encoding vector to obtain an encoding hidden vector:
[0089]
[0090] in, is the encoded hidden vector, is the forward encoding vector, is the reverse encoding vector.
[0091] Specifically, the encoding hidden vector is input into the fully connected layer for binary classification processing to obtain an output result of whether the spelling is correct, including:
[0092] Inputting the encoded hidden vector into the fully connected layer to obtain a classification probability;
[0093] When the classification probability is greater than or equal to a preset classification threshold, the output result is determined to be a spelling error;
[0094] When the classification probability is less than a preset classification threshold, the output result is determined to be correctly spelled.
[0095] The present invention uses the following formula to calculate the classification probability:
[0096]
[0097] in, is the classification probability, is the encoded hidden vector, is the bias term of the fully connected layer, is the weight matrix of the fully connected layer, is the activation function, and is a fixed parameter, is the output result corresponding to the i-th character, For The integer portion of the value.
[0098] S4. According to the output result of whether the spelling is correct, the training text vector is subjected to soft mask connection processing to obtain embedded data.
[0099] In the embodiment of the present invention, the output result of whether the spelling is correct of the error detection network is integrated into the input of the error correction network by means of a soft masking connection.
[0100] In detail, the soft mask connection process mainly processes the misspelled part in the output result of whether the spelling is correct to obtain embedded data.
[0101] Specifically, the step of performing soft mask connection processing on the training text vector according to the output result of whether the spelling is correct to obtain embedded data includes:
[0102] The mask coefficient is calculated using a preset mask coefficient formula and the encoded hidden vector;
[0103] The vector of spelling errors in the training text vector is calculated according to the mask coefficient and a preset soft mask connection formula to obtain embedded data.
[0104] Furthermore, the preset mask coefficient formula is:
[0105]
[0106] in, is the bias term in the fully connected layer, is the weight matrix in the fully connected layer, is the mask coefficient, is the encoded hidden vector, is a fixed parameter, It refers to the variance.
[0107] Specifically, the embodiment of the present invention uses the following calculation formula to calculate the embedded data:
[0108]
[0109] in, For the embedded data, is the mask coefficient, is the vector of spelling errors in the training vector, It is the embedded "mask special character".
[0110] S5. Perform error correction processing on the embedded data using the error correction network of the deep error correction model to obtain an error correction result.
[0111] In an embodiment of the present invention, the correction network (Correction Network) of the deep error correction model is a MacBert pre-trained language model, which includes 12 encoding layers (Encoder layers). Among them, the MacBert pre-trained language model improves the RoBERTa model in many aspects, especially using MLM as a masked strategy for correction (Mac). The structure of the MacBert pre-trained language model is consistent with the Bert model, but the masking method has been changed.
[0112] Specifically, the using the error correction network of the deep error correction model to perform error correction processing on the embedded data to obtain an error correction result includes:
[0113] Encoding the embedded data using multiple coding layers in the error correction network, and taking the hidden state of the last coding layer in the multiple coding layers;
[0114] Performing a residual connection on the hidden state and the training text vector to obtain a connection value;
[0115] The connection value is input into the fully connected layer of the error correction network to obtain an error correction result.
[0116] In detail, the connection value is input into the fully connected layer, the conditional probability corresponding to the connection value is calculated using the activation function in the fully connected layer, and the error correction result is obtained by comparing the conditional probability with a preset error correction threshold.
[0117] The embodiment of the present invention selects the last coding layer in the error correction network All hidden states of .
[0118] Furthermore, the embodiment of the present invention uses the following calculation formula to perform a residual connection on the hidden state and the training text vector to obtain a connection value:
[0119]
[0120] in, is the connection value, is the hidden state, is the training text vector.
[0121] In the embodiment of the present invention, the value obtained after residual connection is Input into a fully connected layer, this fully connected layer will The hidden states are mapped to a space with the same number of dimensions as the number of words in the candidate vocabulary, and the result of this fully connected layer mapping is input into the softmax function to calculate the number of characters in the text sequence. Corrected to characters in the candidate vocabulary (vocab) The conditional probability of . This calculation process is shown in the following formula:
[0122]
[0123] in, For characters Corrected to characters in the candidate vocabulary (vocab) The conditional probability of is the bias term of the fully connected layer, is the weight matrix of the fully connected layer, is the connection value and j is a fixed parameter.
[0124] In detail, the error correction result is obtained by comparing the conditional probability with a preset error correction threshold. When the conditional probability is greater than or equal to the error correction threshold, the error correction result is determined to be a correct error correction; when the conditional probability is less than the error correction threshold, the error correction result is determined to be an incorrect error correction.
[0125] S6. Calculate the cross entropy loss value of the deep error correction model according to the error correction result, adjust the model parameters of the deep error correction model according to the cross entropy loss value, and output a standard deep error correction model.
[0126] In the embodiment of the present invention, the cross entropy loss value of the deep error correction model is calculated using the following formula:
[0127]
[0128]
[0129]
[0130] in, is the cross entropy loss value of the deep error correction model, is the cross entropy loss value of the error detection network, is the cross entropy loss value of the error correction network, and is the preset fixed weight, n is the total amount of data, For the output result, To correct the result, is the preset prediction result. The default test result.
[0131] In detail, the prediction result is a corresponding standard result preset in the error detection network, and the detection result is a corresponding standard result preset in the error correction network. The error correction result includes the error correction status when the error correction network is used to perform error correction processing on the embedded data, which may be correct or wrong.
[0132] In the model training stage, the embodiment of the present invention uses the cross entropy loss value to perform gradient descent back propagation to adjust the model parameters, so that the cross entropy loss value is continuously reduced. While the cross entropy loss value is reduced, some metrics are used to measure the effect of the current model training: such as obtaining a verification data set in advance to verify the deep error correction model, and using the accuracy value, recall value, precision value, f1 value and other indicators of the model on the verification data set to verify the effect of the model training. When the effect of metrics such as accuracy value or f1 value on the verification data set is improved to a higher level (for example, about 95% to 98%), it can be considered that the model has been trained to a good degree. At this time, the training can be stopped and it can be output as a standard deep error correction model.
[0133] S7. Input the pre-acquired text to be corrected into the standard deep error correction model, and obtain the correct text after error correction based on a preset multi-round error correction mechanism.
[0134] In an embodiment of the present invention, after a large number of training samples enhanced by the "data enhancement method based on combining confusion dictionary and text word replacement" are used to train a deep error correction model in a certain business scenario, when performing fixed-length error correction on a business text with typos, a multi-round error correction mechanism can be used to further improve the error correction effect.
[0135] In detail, when a business text with typos is input into the deep error correction model and goes through a round of correction, most of the typos are corrected, but a small number of typos may not be corrected in this round of correction. At this time, after a second or even third round of correction based on the results of the first round of correction, the typos in the business text will basically all be corrected to correct words.
[0136] The embodiment of the present invention obtains a training text set by performing data enhancement processing on the original text set. The data enhancement processing can construct a large number of training samples that can be used for training models at low cost and quickly. The vectorized training text set is input into the error detection network of the preset deep error correction model to obtain an output result of whether the spelling is correct. According to the output result of whether the spelling is correct, the training text vector is subjected to soft mask connection processing to obtain embedded data. The soft mask connection processing integrates the output result of whether the spelling is correct as the input of the error correction network. The error correction network of the deep error correction model is used to perform error correction processing on the embedded data. The error correction network has a strong text fixed-length error correction capability, and can perform parallel error correction on business texts containing typos at one time, and its error correction efficiency and timeliness can be greatly improved. Based on the preset multi-round error correction mechanism, the pre-acquired text to be corrected is input into the standard deep error correction model to obtain the correct text after correction. The multi-round error correction mechanism can further improve the error correction effect of the deep error correction model. Therefore, the text fixed-length error correction method proposed in the present invention can solve the problem of low accuracy of text fixed-length error correction.
[0137] like Figure 2 The figure shows a functional module diagram of a text fixed-length error correction device provided by one embodiment of the present invention.
[0138] The fixed-length text error correction device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the fixed-length text error correction device 100 can include a data processing module 101, an error detection module 102, an error correction processing module 103, a model training module 104 and a multi-round error correction module 105. 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.
[0139] In this embodiment, the functions of each module / unit are as follows:
[0140] The data processing module 101 is used to obtain an original text set, perform data enhancement processing on the original text set to obtain a training text set, and perform vectorization processing on the training text set to obtain a training text vector;
[0141] The error detection module 102 is used to input the training text vector into the error detection network of the preset deep error correction model to perform error detection and obtain an output result of whether the spelling is correct;
[0142] The error correction processing module 103 is configured to perform a soft mask connection process on the training text vector according to the output result of whether the spelling is correct, obtain embedded data, and perform error correction processing on the embedded data by using the error correction network of the deep error correction model to obtain an error correction result;
[0143] The model training module 104 is configured to calculate the cross-entropy loss value of the deep error correction model according to the error correction result, adjust the model parameters of the deep error correction model according to the cross-entropy loss value, and output a standard deep error correction model;
[0144] The multi-round error correction module 105 is configured to input a pre-obtained text to be error-corrected into the standard deep error correction model, and obtain a correct text after error correction based on a preset multi-round error correction mechanism.
[0145] Specifically, the specific implementation manners of the modules of the text fixed-length error correction device 100 are as follows:
[0146] Step 1: Obtain an original text set, and perform data augmentation processing on the original text set to obtain a training text set.
[0147] In the embodiment of the present invention, the original text set may be text records involved in different business activities of a bank. For example, relevant texts of customer problem consultations recorded by an artificial agent, an overview of a customer's service process, and a summary of a customer's complaint, etc.
[0148] Specifically, the performing data augmentation processing on the original text set to obtain a training text set includes:
[0149] Obtain a preset confusion dictionary and a preset augmentation number;
[0150] Screen out confusion characters in the confusion dictionary that are consistent with the number of the augmentation number, and perform random replacement on the characters in the original text set by using the confusion characters to obtain a training text set.
[0151] Wherein, the augmentation number refers to the number of characters that need to be replaced with data.
[0152] Specifically, the confusion dictionary contains 5,401 common Chinese characters and their corresponding five types of confusion characters: homophonic and same-tone characters, homophonic and different-tone characters, near-homophonic and same-tone characters, near-homophonic and different-tone characters, and characters with the same radical and the same number of strokes.
[0153] For example, if the original text in the original text set is "Apply for a credit card", replacing the original text with the homophonic and same-tone characters in the confusion dictionary can obtain "Shenqing credit card". Replacing the original text with the characters with the same radical and the same number of strokes in the confusion dictionary can obtain "Apply for an infringement card" or "Apply for a convenience card".
[0154] In another embodiment of the present invention, the data augmentation processing of the original text set to obtain a training text set may also include:
[0155] Obtain a preset corpus and the word frequencies corresponding to the corpora in the corpus;
[0156] Randomly select multiple words to be replaced from the original text set;
[0157] According to the word frequencies, use a preset confusion probability calculation formula to calculate the confusion probability value between the confusing words in the preset confusion dictionary and the words to be replaced;
[0158] Sort the confusing words according to the confusion probability value, and select the confusing word with the largest confusion probability value to replace the word to be replaced to obtain a training text set.
[0159] Specifically, the preset confusion probability calculation formula is:
[0160]
[0161] Wherein, is the confusion probability value, represents the number of confusing words corresponding to the word to be replaced in the original text in the confusion dictionary, represents the sum of the word frequencies of the confusing words in the corpus, represents the confusing word The word frequency in the corpus.
[0162] For example, the original text in the original text set is "The customer inquires about applying for the Huayang credit card product of the bank". Randomly select multiple words to be replaced from the original text set. Among them, the words to be replaced can be "inquire", "apply", "yang", "credit", and "product". Find all five confusing words corresponding to the words to be replaced in the confusion dictionary and find the word frequencies corresponding to all five confusing words in the corpus. According to the calculation of the confusion probability value, replace the word to be replaced with the confusing word with the largest confusion probability value. "Search" replaces "inquire", "deep" replaces "apply", "sample" replaces "yang", "heart" replaces "credit", and "shovel" replaces "product". Therefore, the sample in the obtained training sample set is "The customer searches deeply for the flower pattern heart credit card shovel product".
[0163] The embodiment of the present invention performs data enhancement processing on the original text set to obtain a large number of training samples with typos and their corresponding correct word labels (the typos are used to replace the words in the original text, and the words before replacement can be considered as the corresponding correct word labels). These labeled training samples are then input into the deep error correction model for training and model effect optimization, and finally a business text deep error correction model suitable for this business scenario can be obtained.
[0164] Step 2: vectorize the training text set to obtain training text vectors.
[0165] In an embodiment of the present invention, a training text vector is obtained by obtaining a word embedding vector, a position embedding vector and a segment embedding vector of each character of the training text in the training text set, and summing the word embedding vector, the position embedding vector and the segment embedding vector.
[0166] Therefore, the training text vector in the embodiment of the present invention is obtained by summing up the word embedding vector, position embedding vector and segment embedding vector of each character in the training text to obtain the training text vector:
[0167]
[0168] in, represents the i-th character in the training text, Represents the training text vector, wordembedding is the word embedding vector, position embedding is the position embedding vector, and segmentembedding is the segment embedding vector.
[0169] Step three: input the training text vector into the error detection network of a preset deep error correction model for error detection to obtain an output result of whether the spelling is correct.
[0170] In an embodiment of the present invention, the deep error correction model is a detection-correction-combined model, which includes two network models: an error detection network and an error correction network. The error detection network is essentially a bidirectional GRU model (Bi-GRU). The GRU model (Gated Recurrent Unit), also known as a gated recurrent unit structure, is constructed by an update gate and a reset gate, and can effectively capture the semantic association between long sequences and alleviate the gradient disappearance or explosion phenomenon.
[0171] Specifically, the training text vector is input into an error detection network of a preset deep error correction model for error detection to obtain an output result, including:
[0172] Performing forward encoding and reverse encoding on the training text vector respectively to obtain a forward encoding vector and a reverse encoding vector;
[0173] Merging the forward coding vector and the reverse coding vector horizontally to obtain a coding hidden vector;
[0174] The encoded hidden vector is input into the fully connected layer for binary classification to obtain an output result of whether the spelling is correct.
[0175] Furthermore, the embodiment of the present invention uses the following calculation formula to calculate the forward encoding vector and the reverse encoding vector:
[0176]
[0177]
[0178] in, is the forward encoding vector, is the reverse encoding vector, is the hidden state of the previous character, is the hidden state of the next character, Represents the training text vector corresponding to the i-th character.
[0179] Furthermore, the embodiment of the present invention horizontally merges the forward encoding vector and the reverse encoding vector to obtain an encoding hidden vector:
[0180]
[0181] in, is the encoded hidden vector, is the forward encoding vector, is the reverse encoding vector.
[0182] Specifically, the encoding hidden vector is input into the fully connected layer for binary classification processing to obtain an output result of whether the spelling is correct, including:
[0183] Inputting the encoded hidden vector into the fully connected layer to obtain a classification probability;
[0184] When the classification probability is greater than or equal to a preset classification threshold, the output result is determined to be a spelling error;
[0185] When the classification probability is less than a preset classification threshold, the output result is determined to be correctly spelled.
[0186] The present invention uses the following formula to calculate the classification probability:
[0187]
[0188] in, is the classification probability, is the encoded hidden vector, is the bias term of the fully connected layer, is the weight matrix of the fully connected layer, is the activation function, and is a fixed parameter, is the output result corresponding to the i-th character, For The integer portion of the value.
[0189] Step 4: According to the output result of whether the spelling is correct, the training text vector is subjected to soft mask connection processing to obtain embedded data.
[0190] In the embodiment of the present invention, the output result of whether the spelling is correct of the error detection network is integrated into the input of the error correction network by means of a soft masking connection.
[0191] In detail, the soft mask connection process mainly processes the misspelled part in the output result of whether the spelling is correct to obtain embedded data.
[0192] Specifically, the step of performing soft mask connection processing on the training text vector according to the output result of whether the spelling is correct to obtain embedded data includes:
[0193] The mask coefficient is calculated using a preset mask coefficient formula and the encoded hidden vector;
[0194] The vector of spelling errors in the training text vector is calculated according to the mask coefficient and a preset soft mask connection formula to obtain embedded data.
[0195] Furthermore, the preset mask coefficient formula is:
[0196]
[0197] in, is the bias term in the fully connected layer, is the weight matrix in the fully connected layer, is the mask coefficient, is the encoded hidden vector, is a fixed parameter, It refers to the variance.
[0198] Specifically, the embodiment of the present invention uses the following calculation formula to calculate the embedded data:
[0199]
[0200] in, For the embedded data, is the mask coefficient, is the vector of spelling errors in the training vector, It is the embedded "mask special character".
[0201] Step 5: Use the error correction network of the deep error correction model to perform error correction processing on the embedded data to obtain an error correction result.
[0202] In an embodiment of the present invention, the correction network (Correction Network) of the deep error correction model is a MacBert pre-trained language model, which includes 12 encoding layers (Encoder layers). Among them, the MacBert pre-trained language model improves the RoBERTa model in many aspects, especially using MLM as a masked strategy for correction (Mac). The structure of the MacBert pre-trained language model is consistent with the Bert model, but the masking method has been changed.
[0203] Specifically, the using the error correction network of the deep error correction model to perform error correction processing on the embedded data to obtain an error correction result includes:
[0204] Encoding the embedded data using multiple coding layers in the error correction network, and taking the hidden state of the last coding layer in the multiple coding layers;
[0205] Performing a residual connection on the hidden state and the training text vector to obtain a connection value;
[0206] The connection value is input into the fully connected layer of the error correction network to obtain an error correction result.
[0207] In detail, the connection value is input into the fully connected layer, the conditional probability corresponding to the connection value is calculated using the activation function in the fully connected layer, and the error correction result is obtained by comparing the conditional probability with a preset error correction threshold.
[0208] The embodiment of the present invention selects the last coding layer in the error correction network All hidden states of .
[0209] Furthermore, the embodiment of the present invention uses the following calculation formula to perform a residual connection on the hidden state and the training text vector to obtain a connection value:
[0210]
[0211] in, is the connection value, is the hidden state, is the training text vector.
[0212] In the embodiment of the present invention, the value obtained after residual connection is Input into a fully connected layer, this fully connected layer will The hidden states are mapped to a space with the same number of dimensions as the number of words in the candidate vocabulary, and the result of this fully connected layer mapping is input into the softmax function to calculate the number of characters in the text sequence. Corrected to characters in the candidate vocabulary (vocab) The conditional probability of . This calculation process is shown in the following formula:
[0213]
[0214] in, For characters Corrected to characters in the candidate vocabulary (vocab) The conditional probability of is the bias term of the fully connected layer, is the weight matrix of the fully connected layer, is the connection value and j is a fixed parameter.
[0215] In detail, the error correction result is obtained by comparing the conditional probability with a preset error correction threshold. When the conditional probability is greater than or equal to the error correction threshold, the error correction result is determined to be a correct error correction; when the conditional probability is less than the error correction threshold, the error correction result is determined to be an incorrect error correction.
[0216] Step six: calculate the cross entropy loss value of the deep error correction model according to the error correction result, adjust the model parameters of the deep error correction model according to the cross entropy loss value, and output a standard deep error correction model.
[0217] In the embodiment of the present invention, the cross entropy loss value of the deep error correction model is calculated using the following formula:
[0218]
[0219]
[0220]
[0221] in, is the cross entropy loss value of the deep error correction model, is the cross entropy loss value of the error detection network, is the cross entropy loss value of the error correction network, and is the preset fixed weight, n is the total amount of data, For the output result, To correct the result, is the preset prediction result. The default test result.
[0222] In detail, the prediction result is a corresponding standard result preset in the error detection network, and the detection result is a corresponding standard result preset in the error correction network. The error correction result includes the error correction status when the error correction network is used to perform error correction processing on the embedded data, which may be correct or wrong.
[0223] In the model training stage, the embodiment of the present invention uses the cross entropy loss value to perform gradient descent back propagation to adjust the model parameters, so that the cross entropy loss value is continuously reduced. While the cross entropy loss value is reduced, some metrics are used to measure the effect of the current model training: such as obtaining a verification data set in advance to verify the deep error correction model, and using the accuracy value, recall value, precision value, f1 value and other indicators of the model on the verification data set to verify the effect of the model training. When the effect of metrics such as accuracy value or f1 value on the verification data set is improved to a higher level (for example, about 95% to 98%), it can be considered that the model has been trained to a good degree. At this time, the training can be stopped and it can be output as a standard deep error correction model.
[0224] Step seven: input the pre-acquired text to be corrected into the standard deep error correction model, and obtain the correct text after error correction based on a preset multi-round error correction mechanism.
[0225] In an embodiment of the present invention, after a large number of training samples enhanced by the "data enhancement method based on combining confusion dictionary and text word replacement" are used to train a deep error correction model in a certain business scenario, when performing fixed-length error correction on a business text with typos, a multi-round error correction mechanism can be used to further improve the error correction effect.
[0226] In detail, when a business text with typos is input into the deep error correction model and goes through a round of correction, most of the typos are corrected, but a small number of typos may not be corrected in this round of correction. At this time, after a second or even third round of correction based on the results of the first round of correction, the typos in the business text will basically all be corrected to correct words.
[0227] The embodiment of the present invention obtains a training text set by performing data enhancement processing on the original text set. The data enhancement processing can construct a large number of training samples that can be used for training models at low cost and quickly. The vectorized training text set is input into the error detection network of the preset deep error correction model to obtain an output result of whether the spelling is correct. According to the output result of whether the spelling is correct, the training text vector is subjected to soft mask connection processing to obtain embedded data. The soft mask connection processing integrates the output result of whether the spelling is correct as the input of the error correction network. The error correction network of the deep error correction model is used to perform error correction processing on the embedded data. The error correction network has a strong text fixed-length error correction capability, and can perform parallel error correction on business texts containing typos at one time, and its error correction efficiency and timeliness can be greatly improved. Based on the preset multi-round error correction mechanism, the pre-acquired text to be corrected is input into the standard deep error correction model to obtain the correct text after correction. The multi-round error correction mechanism can further improve the error correction effect of the deep error correction model. Therefore, the text fixed-length error correction device proposed by the present invention can solve the problem of low accuracy of text fixed-length error correction.
[0228] like Figure 3 1 is a schematic diagram of the structure of an electronic device for implementing a text fixed-length error correction method provided by an embodiment of the present invention.
[0229] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a text fixed-length error correction program.
[0230] In some embodiments, the processor 10 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 10 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 various functions of the electronic device and processes data by running or executing programs or modules stored in the memory 11 (for example, executing a fixed-length text error correction program, etc.), and calling data stored in the memory 11.
[0231] The memory 11 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 (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, 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 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can 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 fixed-length error correction program, etc., but can also be used to temporarily store data that has been output or is to be output.
[0232] The communication bus 12 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 11 and at least one processor 10, etc.
[0233] The communication interface 13 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.
[0234] Figure 3 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 3The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0235] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 10 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 one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0236] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0237] The text fixed-length error correction program stored in the memory 11 in the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:
[0238] Acquire an original text set, and perform data enhancement processing on the original text set to obtain a training text set;
[0239] Performing vectorization processing on the training text set to obtain training text vectors;
[0240] Inputting the training text vector into the error detection network of a preset deep error correction model for error detection, and obtaining an output result of whether the spelling is correct;
[0241] According to the output result of whether the spelling is correct, performing soft mask connection processing on the training text vector to obtain embedded data;
[0242] Performing error correction processing on the embedded data using the error correction network of the deep error correction model to obtain an error correction result;
[0243] Calculating a cross entropy loss value of the deep error correction model according to the error correction result, adjusting a model parameter of the deep error correction model according to the cross entropy loss value, and outputting a standard deep error correction model;
[0244] The pre-acquired text to be corrected is input into the standard deep error correction model, and the correct text after error correction is obtained based on a preset multi-round error correction mechanism.
[0245] Specifically, the specific implementation method of the processor 10 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.
[0246] Furthermore, if the module / unit integrated in the electronic device 1 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 can 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).
[0247] 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:
[0248] Acquire an original text set, and perform data enhancement processing on the original text set to obtain a training text set;
[0249] Performing vectorization processing on the training text set to obtain training text vectors;
[0250] Inputting the training text vector into the error detection network of a preset deep error correction model for error detection, and obtaining an output result of whether the spelling is correct;
[0251] According to the output result of whether the spelling is correct, performing soft mask connection processing on the training text vector to obtain embedded data;
[0252] Performing error correction processing on the embedded data using the error correction network of the deep error correction model to obtain an error correction result;
[0253] Calculating a cross entropy loss value of the deep error correction model according to the error correction result, adjusting a model parameter of the deep error correction model according to the cross entropy loss value, and outputting a standard deep error correction model;
[0254] The pre-acquired text to be corrected is input into the standard deep error correction model, and the correct text after error correction is obtained based on a preset multi-round error correction mechanism.
[0255] 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.
[0256] 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.
[0257] 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.
[0258] 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.
[0259] 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.
[0260] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0261] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. 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.
[0262] 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.
[0263] 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 fixed-length text error correction method, characterized in that: The method comprises: Obtaining an original text set, performing data enhancement processing on the original text set to obtain a training text set; Performing vectorization processing on the training text set to obtain training text vectors; Inputting the training text vector into an error detection network of a preset deep error correction model for error detection to obtain an output result of whether the spelling is correct, including: forward encoding and reverse encoding the training text vector respectively to obtain a forward encoding vector and a reverse encoding vector, horizontally merging the forward encoding vector and the reverse encoding vector to obtain an encoding hidden vector, inputting the encoding hidden vector into a fully connected layer for binary classification processing, and obtaining an output result of whether the spelling is correct; According to the output result of whether the spelling is correct, a mask coefficient is calculated using a preset mask coefficient formula and the encoded hidden vector, and the vector of spelling errors in the training text vector is calculated according to the mask coefficient and a preset soft mask connection formula to obtain embedded data; The embedded data is encoded using multiple encoding layers in the error correction network of the deep error correction model, and the hidden state of the last encoding layer in the multiple encoding layers is obtained, and the hidden state is residually connected with the training text vector to obtain a connection value, and the connection value is input into the fully connected layer of the error correction network to obtain an error correction result; Calculating a cross entropy loss value of the deep error correction model according to the error correction result, adjusting a model parameter of the deep error correction model according to the cross entropy loss value, and outputting a standard deep error correction model; The pre-acquired text to be corrected is input into the standard deep error correction model, and the correct text after error correction is obtained based on a preset multi-round error correction mechanism.
2. The text fixed-length error correction method according to claim 1, characterized in that: The data enhancement process is performed on the original text set to obtain a training text set, including: Obtaining a preset corpus and word frequencies corresponding to the corpora in the corpus; Randomly select a plurality of replaced characters from the original text set; According to the word frequency, a confusion probability value between the confusion word in a preset confusion dictionary and the replaced word is calculated using a preset confusion probability calculation formula; The obfuscated characters are sorted according to the obfuscation probability values, and the obfuscated character with the largest obfuscation probability value is selected to replace the replaced character, so as to obtain a training text set.
3. The text fixed-length error correction method according to claim 1, characterized in that: The vectorization process of the training text set to obtain the training text vector includes: Obtaining a word embedding vector, a position embedding vector and a segment embedding vector for each character of the training text in the training text set; The word embedding vector, the position embedding vector and the segment embedding vector are summed to obtain a training text vector.
4. The text fixed-length error correction method according to claim 1, characterized in that: The encoding hidden vector is input into the fully connected layer for binary classification to obtain an output result of whether the spelling is correct, including: Inputting the encoded hidden vector into the fully connected layer to obtain a classification probability; When the classification probability is greater than or equal to a preset classification threshold, the output result is determined to be a spelling error; When the classification probability is less than a preset classification threshold, the output result is determined to be correctly spelled.
5. A text fixed-length error correction device, used to implement the text fixed-length error correction method as described in any one of claims 1 to 4, characterized in that: The device comprises: A data processing module is used to obtain an original text set, perform data enhancement processing on the original text set to obtain a training text set, and perform vectorization processing on the training text set to obtain a training text vector; An error detection module, used for inputting the training text vector into an error detection network of a preset deep error correction model to perform error detection and obtain an output result of whether the spelling is correct; An error correction processing module is used to perform soft mask connection processing on the training text vector according to the output result of whether the spelling is correct to obtain embedded data, and use the error correction network of the deep error correction model to perform error correction processing on the embedded data to obtain an error correction result; A model training module, used to calculate the cross entropy loss value of the deep error correction model according to the error correction result, and adjust the model parameters of the deep error correction model according to the cross entropy loss value, and output a standard deep error correction model; The multi-round error correction module is used to input the pre-acquired text to be corrected into the standard deep error correction model, and obtain the correct text after error correction based on the preset multi-round error correction mechanism.
6. 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 that can be executed 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 execute the text fixed-length error correction method as described in any one of claims 1 to 4.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the text fixed-length error correction method as described in any one of claims 1 to 4 is implemented.
