Text correction model training method and device, computer device, and storage medium

CN116805487BActive Publication Date: 2026-10-30PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310710599.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-15
Publication Date
2026-10-30
Estimated Expiration
2043-06-15

AI Technical Summary

Technical Problem

[0004]本发明实施例提供一种文本纠正模型训练方法、装置、计算机设备及存储介质,以解决现有技术中因采用定长修改和语音特征作为辅助特征导致纠正准确率较低的问题

Benefits of technology

[0029]本发明提供一种文本纠正模型训练方法、装置、计算机设备及存储介质,该方法通过大量的样本数据对预设训练模型进行端到端的迭代训练,实现了对文本纠正模型的确定,确保文本纠正模型有较高的准确率。通过预设训练模型中的编码模块对待纠正文本和初始拼音声调文本进行编码,实现了对待纠正向量和初始拼音声调向量的编码。通过检测模块对待纠正向量中的错误位置和错位类型进行标注,实现了对错误标注向量的确定。通过纠正模块的中文拼写纠正对错误标注向量进行错误变长纠正,实现了通过掩码预测对预测内容文本的确定。通过纠正模块的汉语发音预测对初始拼音声调向量进行错误变长纠正,实现了通过掩码预测对预测拼音声调文本的确定。通过预测内容及预测拼音声调和预设目标内容及预设目标拼音声调进行比较,实现了对预设训练模型的预测损失值的确定。进一步地,通过错误标注,实现了对待纠正向量的变长修改,实现了保险或金融等行业中文本不定长错误纠正,进而提高了保险或金融等行业中文本纠正不定长错误的准确率。通过增加汉语发音预测,提高了保险或金融等行业中文本纠正的准确率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116805487B_ABST
    Figure CN116805487B_ABST
Patent Text Reader

Abstract

The application discloses a text correction model training method, which comprises the following steps: obtaining a to-be-corrected text and an initial pinyin tone text; encoding the to-be-corrected text and the initial pinyin tone text through a preset training model to obtain a to-be-corrected vector and an initial pinyin tone vector; performing error labeling on the to-be-corrected vector through a detection module to obtain an error labeled vector; correcting the error labeled vector and the initial pinyin tone vector through Chinese spelling correction and Chinese pronunciation prediction to obtain a predicted content text and a predicted pinyin tone text; determining a predicted loss value according to the predicted content text, a target content text, a target pinyin tone text and the predicted pinyin tone text; and determining a text correction model when a preset convergence condition is reached. Through error labeling, the application realizes the correction of Chinese text indefinite length errors in the insurance or financial industry. Through Chinese pronunciation prediction, the application improves the accuracy of Chinese text correction in the insurance or financial industry.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent decision-making technology, and in particular to a text correction model training method, apparatus, computer equipment, and storage medium. Background Technology

[0002] With the rapid development of technology, speech recognition technology has been widely applied. The speech recognition process can be simply summarized as: converting input speech data into text using automatic speech recognition technology. During speech recognition, errors may occur due to pronunciation issues. For example, as business volume continues to expand in financial institutions such as banks, securities firms, and insurance companies, a large demand for speech recognition arises, but the accuracy of the recognition results is not high, necessitating correction of the recognized text.

[0003] In existing technologies, most methods for modifying or correcting text statements generated from speech recognition in industries such as insurance and finance are based on error correction models. However, existing error correction models typically use fixed-length correction methods, correcting one incorrect word to the correct one, rarely considering variable-length correction, i.e., one-to-many or many-to-one correction. Furthermore, existing error correction models only use speech features as auxiliary features to correct the recognized text, failing to effectively utilize tone features, resulting in low accuracy in industries such as insurance and finance. Summary of the Invention

[0004] This invention provides a text correction model training method, apparatus, computer device, and storage medium to solve the problem of low correction accuracy caused by the use of fixed-length modification and speech features as auxiliary features in the prior art.

[0005] A text correction model training method includes:

[0006] Obtain a sample dataset, which includes at least one text to be corrected and an initial pinyin tone text corresponding to the text to be corrected, as well as a target content text corresponding to the text to be corrected and a target pinyin tone text corresponding to the initial pinyin tone text;

[0007] The text to be corrected and the initial pinyin tone text are encoded by the encoding module in the preset training model to obtain the vector to be corrected and the initial pinyin tone vector.

[0008] The vector to be corrected is labeled with errors by the detection module in the preset training model, and an error-labeled vector is obtained.

[0009] The error-lengthening correction is performed on the error-labeled vector and the initial pinyin tone vector by the Chinese spelling correction and Chinese pronunciation prediction in the correction module of the preset training model, respectively, to obtain the predicted content text and the predicted pinyin tone text.

[0010] Based on the predicted content text, the target content text, the target pinyin tone text, and the predicted pinyin tone text, determine the prediction loss value of the preset training model;

[0011] When the predicted loss value reaches the preset convergence condition, the preset training model after convergence is determined as the text correction model.

[0012] A text correction method, comprising:

[0013] Acquire speech-recognized text, which includes content-recognized text and pinyin tone-recognized text;

[0014] Call the text correction model, which is a text correction model trained according to the above text correction model training method;

[0015] Based on the text correction model, errors are corrected in the content recognition text and pinyin tone recognition text of the speech recognition text to obtain the target corrected text.

[0016] A text correction model training device, comprising:

[0017] The data acquisition module is used to acquire a sample dataset, which includes at least one text to be corrected and an initial pinyin tone text corresponding to the text to be corrected, as well as a target content text corresponding to the text to be corrected and a target pinyin tone text corresponding to the initial pinyin tone text.

[0018] The text encoding module is used to encode the text to be corrected and the initial pinyin tone text through the encoding module in the preset training model to obtain the vector to be corrected and the initial pinyin tone vector.

[0019] The error labeling module is used to label the vector to be corrected with errors through the detection module in the preset training model, so as to obtain the error-labeled vector.

[0020] The error correction module is used to perform error variable length correction on the error annotation vector and the initial pinyin tone vector respectively through the Chinese spelling correction and Chinese pronunciation prediction of the correction module in the preset training model, so as to obtain the predicted content text and the predicted pinyin tone text.

[0021] The loss prediction module is used to determine the prediction loss value of the preset training model based on the predicted content text, the target content text, the target pinyin tone text, and the predicted pinyin tone text.

[0022] The model convergence module is used to determine the converged preset training model as the text correction model when the predicted loss value reaches the preset convergence condition.

[0023] A text correction device, comprising:

[0024] The acquisition module is used to acquire speech recognition text, which includes content recognition text and pinyin tone recognition text;

[0025] The calling module is used to call the text correction model, which is a text correction model trained according to the above-mentioned text correction model training method.

[0026] The correction module is used to correct errors in the content recognition text and pinyin tone recognition text in the speech recognition text based on the text correction model, so as to obtain the target corrected text.

[0027] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described text correction model training method, or the processor executes the computer program to implement the above-described text correction method.

[0028] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described text correction model training method, or when executed by the processor, implements the above-described text correction method.

[0029] This invention provides a text correction model training method, apparatus, computer equipment, and storage medium. The method uses a large amount of sample data to perform end-to-end iterative training on a pre-set training model, thereby determining the text correction model and ensuring its high accuracy. The encoding module in the pre-set training model encodes the text to be corrected and the initial pinyin tone text, thus encoding the vector to be corrected and the initial pinyin tone vector. The detection module labels the error positions and misalignment types in the vector to be corrected, thus determining the error-labeled vector. The correction module performs error length correction on the error-labeled vector through Chinese spelling correction, thus determining the predicted content text through mask prediction. The correction module performs error length correction on the initial pinyin tone vector through Chinese pronunciation prediction, thus determining the predicted pinyin tone text through mask prediction. By comparing the predicted content and predicted pinyin tone with the pre-set target content and pre-set target pinyin tone, the prediction loss value of the pre-set training model is determined. Furthermore, through error annotation, variable-length modification of the vector to be corrected was achieved, enabling the correction of variable-length errors in Chinese text used in industries such as insurance and finance, thereby improving the accuracy of variable-length error correction in these industries. Adding Chinese pronunciation prediction further improved the accuracy of Chinese text correction in industries such as insurance and finance. Attached Figure Description

[0030] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0031] Figure 1 This is a schematic diagram of the application environment of the text correction model training method in one embodiment of the present invention;

[0032] Figure 2 This is a flowchart of a text correction model training method in one embodiment of the present invention;

[0033] Figure 3 This is a flowchart of a text correction method in one embodiment of the present invention;

[0034] Figure 4 This is a schematic diagram of a text correction model training device in one embodiment of the present invention;

[0035] Figure 5 This is a schematic block diagram of a text correction device in one embodiment of the present invention;

[0036] Figure 6 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation

[0037] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0038] The text correction model training method provided in this embodiment of the invention can be applied to, for example... Figure 1 The application environment is shown. Specifically, this text correction model training method is applied in a text correction model training device, which includes, as shown in the example, a text correction model training device. Figure 1 The client and server shown communicate over a network to address the low accuracy issues in existing technologies caused by the use of fixed-length modification and speech features as auxiliary features. The server can be a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The client, also known as the user terminal, refers to the program that provides classification services to customers, corresponding to the server. The client can be installed on, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices.

[0039] In one embodiment, such as Figure 2 As shown, a text correction model training method is provided, which is then applied to... Figure 1 Taking the server in the example, the following steps are included:

[0040] S10: Obtain a sample dataset, which includes at least one text to be corrected and an initial pinyin tone text corresponding to the text to be corrected, as well as a target content text corresponding to the text to be corrected and a target pinyin tone text corresponding to the initial pinyin tone text.

[0041] It can be understood that the to-be-corrected text is content obtained by recognizing speech data through Automatic Speech Recognition (ASR) technology. The initial pinyin and tone text is obtained by recognizing the pinyin and tone of the to-be-corrected text, that is, the initial pinyin and tone text includes the pinyin and tone of each character in the to-be-corrected text, for example, the character "表" corresponds to "biao3", where "biao" represents the pinyin, and "3" represents the tone, specifically, 1 represents the first tone, 2 represents the second tone, 3 represents the third tone, and 4 represents the fourth tone. Exemplarily, in an insurance scenario, the to-be-corrected text is "您向要的保险价格为3000元". The initial pinyin and tone text is nin3, xiang4, yao4, de1, bao3, xian3, jia4, ge2, wei2, 3000, yuan2. The target content text is the correct content obtained manually or by other means. The target pinyin and tone text is the correct pinyin and correct tone obtained manually or by other means. Exemplarily, in the insurance scenario, the target content text is "您想要的保险价格为3000元". The target pinyin and tone text is nin3, xiang3, yao4, de1, bao3, xian3, jia4, ge2, wei2, 3000, yuan2. The to-be-corrected text and the initial pinyin and tone text can be collected from different databases, or sent from the client to the database. Further, a to-be-corrected dataset is constructed based on all the acquired to-be-corrected text, target content text, target pinyin and tone text, and initial pinyin and tone text. For example, in a manual customer service scenario, it is necessary to convert the voices of customer service staff and users into text, and then perform quality inspection on the text. Therefore, the more accurate the recognized text content is, the higher the quality inspection accuracy rate will be.

[0042] S20: Encoding the to-be-corrected text and the initial pinyin and tone text through an encoding module in a preset training model, to obtain a to-be-corrected vector and an initial pinyin and tone vector.

[0043] It can be understood that the preset training model includes an encoding module, a detection module, a correction module and a loss module, wherein the encoding module includes a character encoder and a pinyin and tone encoder, and both the character encoder and the pinyin and tone encoder adopt a BERT model for encoding.

[0044] Specifically, after obtaining the text to be corrected and the initial pinyin tone text, a pre-trained model is retrieved from the database. The text to be corrected and the initial pinyin tone text are then input into the pre-trained model. The two encoders in the encoding module of the pre-trained model encode the text to be corrected and the initial pinyin tone text respectively. That is, the input layer preprocesses the text to be corrected and the initial pinyin tone text to obtain the content input vector and the pinyin tone input vector. Then, the attention layer performs attention processing on the content input vector and the pinyin tone input vector to obtain the content text vector and the pinyin tone vector. Finally, the prediction layer performs probability prediction on the content text vector and the pinyin tone vector, and the above process is repeated a preset number of times (e.g., 12 or 24) to obtain the vector to be corrected and the initial pinyin tone vector.

[0045] S30, the vector to be corrected is labeled with errors by the detection module in the preset training model to obtain the error-labeled vector.

[0046] Understandingly, error annotations include deleted annotations, unchanged annotations, replaced annotations, and inserted annotations. Deleted annotations are represented by -1, unchanged annotations by 0, replaced annotations by 1, and inserted annotations by 2. The error annotation vector is a representation vector of the error location and error type in the vector to be corrected.

[0047] Specifically, the detection module in the pre-trained model performs error labeling on the vector to be corrected. This involves using a Bi-LSTM detector to perform mask prediction on the vector, specifically by using a forward LSTM and a backward LSTM to mask the characters in the vector for pinyin tones and similar-sounding characters. In other words, the location of the error content is first predicted by masking. Then, the type of error content location is determined by deleting, leaving unchanged, replacing, and inserting labels, thus obtaining the error content type corresponding to the erroneous character. Finally, based on the error content location and type, the vector to be corrected is masked and error-labeled to obtain the error-labeled vector.

[0048] S40: The error-annotated vector and the initial pinyin tone vector are respectively corrected by the Chinese spelling correction and Chinese pronunciation prediction of the correction module in the preset training model to obtain the predicted content text and the predicted pinyin tone text.

[0049] Understandably, the predicted content text is obtained through semantic and phonological features. The predicted pinyin tone text is obtained by correcting the initial pinyin tone vector through a Chinese pronunciation prediction task.

[0050] Specifically, after obtaining the error annotation vector and the annotation pinyin tone vector, the error annotation vector and the initial pinyin tone vector corresponding to the same text to be corrected are fused together with the error prediction value in the detection module as weights. That is, the error annotation vector and pinyin tone vector of the same character are fused through a linear combination expression, thus obtaining the fused vector. Then, the correct character or correct pinyin tone corresponding to the fused vector is predicted using the masking function of the BERT model. In other words, the fused vector is corrected for content through Chinese spelling correction, thus obtaining the predicted content text. And the fused vector is corrected for pinyin tone through Chinese pronunciation prediction, thus obtaining the predicted pinyin tone text. For example, in an insurance claim scenario, "You are sad, we will pay." The coded text is: ni3, biao3, nan2, guo4, wo3, men1, hui4, hui4, pei2, fu4, de1. Chinese spelling correction corrects the content of the fused vector, predicting the content text as "Don't be sad, we will pay." The Chinese pronunciation prediction corrects the pinyin tone of the fused vector. The predicted pinyin tone text is ni3,2,bu2,yao4,nan2,guo4,wo3,men1,hui4,-1,pei2,fu4,de1.

[0051] S50: Determine the prediction loss value of the preset training model based on the predicted content text, the target content text, the target pinyin tone text, and the predicted pinyin tone text.

[0052] Understandably, the prediction loss is generated during the process of predicting the predicted answer for the text to be corrected.

[0053] Specifically, after obtaining the predicted content text and the predicted pinyin tone text, loss calculations are performed on the target content text and the predicted content text corresponding to the same text to be corrected, obtaining the loss value of that text to be corrected. Then, the loss value of each text to be corrected is calculated, and the loss values ​​of all texts to be corrected are weighted and summed to obtain the first loss value. Further, loss calculations are performed on the target pinyin tone text and the predicted pinyin tone text corresponding to the same initial pinyin tone text, obtaining the loss value of that initial pinyin tone text. Then, the loss value of each initial pinyin tone text is calculated, and the loss values ​​of all initial pinyin tone texts are weighted and summed to obtain the second loss value. The prediction loss value of the preset training model is calculated based on the first and second loss values.

[0054] S60: When the predicted loss value reaches the preset convergence condition, the preset training model after convergence is determined as the text correction model.

[0055] Understandably, the convergence condition can be either the predicted loss value being less than a set threshold, or the predicted loss value being very small after 500 calculations and no longer decreasing, at which point training can stop.

[0056] Specifically, when the predicted loss value fails to meet the preset convergence condition, the initial parameters of the preset training model are adjusted based on the predicted loss value. All text to be corrected and all initial pinyin tone texts are then re-input into the preset training model with adjusted initial parameters. The detection and correction modules in the preset training model are optimized to obtain the predicted loss value corresponding to the preset training model with adjusted initial parameters. Then, when the predicted loss value fails to meet the preset convergence condition, the initial parameters of the preset training model are adjusted again based on the predicted loss value, until the predicted loss value of the preset training model with adjusted initial parameters meets the convergence condition. In this way, the output of the preset training model can continuously approach the accurate result, increasing the prediction accuracy, until the predicted loss values ​​of all text to be corrected and all predicted content texts meet the preset convergence condition. At this point, the converged preset training model is recorded as the text correction model.

[0057] This invention discloses a text correction model training method. This method uses a large amount of sample data to perform end-to-end iterative training on a pre-set training model, thereby determining the text correction model and ensuring its high accuracy. The method encodes the text to be corrected and the initial pinyin tone text through the encoding module in the pre-set training model, thus encoding the vector to be corrected and the initial pinyin tone vector. The detection module labels the error positions and misalignment types in the vector to be corrected, thus determining the error-labeled vector. The correction module performs error-variable length correction on the error-labeled vector through Chinese spelling correction, thus determining the predicted content text through mask prediction. The correction module performs error-variable length correction on the initial pinyin tone vector through Chinese pronunciation prediction, thus determining the predicted pinyin tone text through mask prediction. By comparing the predicted content and predicted pinyin tone with the pre-set target content and pre-set target pinyin tone, the prediction loss value of the pre-set training model is determined. Furthermore, through error annotation, variable-length modification of the vector to be corrected was achieved, enabling the correction of variable-length errors in Chinese text used in industries such as insurance and finance, thereby improving the accuracy of variable-length error correction in these industries. Adding Chinese pronunciation prediction further improved the accuracy of Chinese text correction in industries such as insurance and finance.

[0058] In one embodiment, step S20, namely, encoding the text to be corrected using the encoding module in a preset training model to obtain a correction vector corresponding to the text to be corrected, includes:

[0059] In S201, the text to be corrected is preprocessed through the input layer of the encoding module to obtain a content input vector.

[0060] It can be understood that the content input vector is obtained by performing vector embedding on the content text to be corrected.

[0061] Specifically, the text to be corrected is input into a preset training model, and the text to be corrected is preprocessed through the input layer of the encoding module in the preset training model. That is, the word vector of the text to be corrected is first determined, that is, two special flag bits, CLS and SEP, are added to the beginning and end of the text to be corrected. Then, weighted fusion is performed on the word vectors, that is, the semantic vector of one sentence is added to each word vector, so that the sentence vector can be obtained. Finally, the position vectors of the word vector and the sentence vector are determined by the position function learned by the encoding module in the preset training model. Then the word vector, sentence vector and position vector corresponding to the same text to be corrected are added together, so that the content input vector can be obtained. For example, in the insurance field, "How much is this insurance? About 3000 yuan." The word vectors are ECLS, E这, E份, E保, E险, E多, E少, E钱, ESEP, E大, E概, E3000, E元, ESEP; the sentence vectors are EA, EA, EA, EA, EA, EA, EA, EA, EA, EB, EB, EB, EB, EB; the position vectors are E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10; the three vectors are added together to obtain the content input vector.

[0062] In S202, attention processing is performed on the content input vector through the attention layer of the encoding module to obtain a content text vector.

[0063] It can be understood that the attention vector is obtained by performing attention processing on the important content in the content input vector.

[0064] Specifically, attention processing is performed on all content input vectors through the attention mechanism of the attention layer in the prediction model, that is, multiple sets of attention mechanisms are used to calculate the Q vector, K vector and V vector in the content input vector, that is, the dot product method is used to calculate the correlation score between the Q vector and the K vector in the content input vector, that is, the dot product of each input vector in Q and each input vector in K is calculated, and the correlation score between the Q vector and the K vector is normalized. Then, through the softmax function, the score vectors between the input vectors are converted into a probability distribution between [0, 1], and according to the probability distribution between the input vectors, multiplied by the corresponding Values vector, the attention result can be obtained. Multiple sets of attention results are spliced, followed by residual summation and normalization processing, so that the content text vector can be obtained.

[0065] S203, the content text vector is predicted by the prediction layer of the encoding module to obtain the vector to be corrected.

[0066] Understandably, the vector to be corrected is the representation vector obtained by encoding the text to be corrected.

[0067] Furthermore, the attention vector is predicted by the prediction layer of the encoding module in the preset training model. That is, the attention vector is predicted by the feedforward neural network in the prediction layer. In other words, the attention vector is predicted by multiple hidden units with different weights. The prediction result can be obtained, and the residuals are summed and normalized to obtain the vector to be corrected.

[0068] This invention preprocesses the text to be corrected through an encoding module, thereby encoding the content input vector. An attention mechanism is used to apply attention to important content within the content input vector, enabling the calculation of the content text vector. Finally, a prediction layer performs vector calculations on the content text vector, thus determining the vector to be corrected.

[0069] In one embodiment, such as Figure 3 As shown, in step S30, that is, by using the detection module in the preset training model to perform error labeling on the vector to be corrected, an error-labeled vector is obtained, including:

[0070] S301, the error prediction of the vector to be corrected is performed by the mask unit of the detection module to obtain the location of the error content.

[0071] Understandably, the error content location is the position of the erroneous character in the vector to be corrected. For example, in the expression "you are sad", the second character is incorrect.

[0072] Specifically, after obtaining the vector to be corrected, the detection module of the pre-trained model performs error prediction on the vector. That is, a Bi-LSTM model is used to perform masked error prediction on the vector. First, a bidirectional LSTM is used to perform prediction processing using contextual information. Then, mask prediction is performed based on the pinyin tone and similar-sounding confused characters to determine the positions of all erroneous characters in the vector to be corrected. In this way, at least one erroneous content position corresponding to the vector to be corrected can be obtained. For example, in an insurance scenario, a forward LSTM... L Inputting "Peace", "Insurance", and "Just Good" in sequence yields three vectors {h} L0 h L1 h L2 Backward LSTM R Inputting "It's good", "Insurance", and "Peace of Mind" in sequence yields three vectors {h} R0 h R1 h R2Finally, the implicit vectors of the forward and backward directions are concatenated to obtain {[h L0 h R2 ],[h L1 h R1 ],[h L2 h R2 ]}, that is, {h0, h1, h2}. Understanding this statement from left to right, we can obtain h at each time step. Li Hidden layer output, understood from right to left, allows us to obtain h at each time step. Ri Hidden layer output, while Bi-LSTM concatenates the forward and backward hidden layer outputs at each time step [h Li h Ri ] is used to represent the hidden layer output of the features at the current time.

[0073] S302, the error type of the vector to be corrected is predicted by the deletion annotation, the unchanged annotation, the replacement annotation and the insertion annotation to obtain the error content type.

[0074] S303, determine the error annotation vector based on the error content type and the error content location.

[0075] Understandably, error content types are categorized into four types: deleted annotations, unchanged annotations, replaced annotations, and inserted annotations. An error annotation vector is a representation vector encoding the error location and type. For example, in an insurance scenario, if you express sadness, we will provide compensation. (0200, 000-1000)

[0076] Specifically, error type prediction is performed on the vector to be corrected based on four preset character error types. This involves using a bidirectional LSTM and deleting, invariant, replacing, and inserting annotations to predict the error type, and identifying the error type with the highest predicted probability as the error content type. The error content location and error content type are determined simultaneously; the error type is determined for each location, thus obtaining the error content type corresponding to each error content location. Further, based on all error content types and locations, a masked error annotation is applied to the vector to be corrected, yielding the error annotation vector corresponding to the vector to be corrected.

[0077] This invention utilizes the mask prediction function of the detection module to annotate errors in the text to be corrected, thereby identifying the location and type of errors. By annotating all error locations and types in the vector to be corrected, the error annotation vector is determined, thus enabling variable-length annotation of the erroneous text.

[0078] In one embodiment, such as Figure 4As shown, in step S40, that is, by using the Chinese spelling correction and Chinese pronunciation prediction of the correction module in the preset training model to perform error variable length correction on the error annotation vector and the initial pinyin tone vector respectively, the predicted content text and the predicted pinyin tone text are obtained, including:

[0079] S401, the error annotation vector and the initial pinyin tone vector corresponding to the same text to be corrected are fused to obtain a fused vector.

[0080] S402, the content of the fusion vector is corrected by the Chinese spelling correction in the correction module to obtain the predicted content text.

[0081] Understandably, the fusion vector is weighted by the error prediction values ​​of the detection module. The predicted content text is the content after correcting erroneous characters according to the error content type. The fusion vector expression is e. m =(1-p err )e w +p err e p , Where, p err For incorrect predictions, θ d For the parameters of the detection module, x w It is a character vector.

[0082] Specifically, after obtaining the error-labeled vector, the correction module of the pre-trained model fuses the error-labeled vector and the initial pinyin tone vector corresponding to the same text to be corrected. That is, the error-labeled vector and the initial pinyin tone vector are fused using the error prediction value of the detection module as weights, resulting in a fused vector corresponding to the text to be corrected. Further, the fused vector is corrected for content through a Chinese spelling correction task in the correction module. This involves using the masking function of the BERT model to predict the correct content of the fused vector's error labels. Specifically, a portion (15%) of the characters is masked, and the fused vector is then subjected to Chinese spelling correction. The predicted words with the highest probability values ​​are then deleted, left unchanged, replaced, or inserted according to their error type, thus obtaining the predicted content text. For example, in an insurance claim scenario, the text "You are sad, we will pay." The Chinese spelling correction corrects the content of the fused vector, predicting the text "Don't be sad, we will pay."

[0083] S403, the fusion vector is corrected for pinyin tone by the Chinese pronunciation prediction in the correction module to obtain the predicted pinyin tone text.

[0084] Understandably, the predicted pinyin tone text is the pinyin tone after correcting the incorrect pinyin tone according to the type of incorrect content.

[0085] Specifically, the fusion vector is corrected for pinyin tones through Chinese pronunciation prediction in the correction module. This means that characters with incorrect pronunciations share a certain similarity to correct characters. Based on the initials and finals of the incorrectly pronounced characters, other pinyin tone characters are continuously replaced until the pinyin tone with the highest probability value is predicted through a fully connected layer. This yields the predicted pinyin tone corresponding to the predicted content text. Thus, after predicting the pinyin tone and tone for all error positions and types in the vector to be corrected, the predicted pinyin tone text is obtained. For example, in an insurance claim scenario, ni3, biao3, nan2, guo4, wo3, men1, hui4, hui4, pei2, fu4, de1. After correcting the fusion vector for pinyin tones through Chinese pronunciation prediction, the predicted pinyin tone text is ni3, 2, bu2, yao4, nan2, guo4, wo3, men1, hui4, -1, pei2, fu4, de1.

[0086] This invention, through its embodiments, determines the fused vector by weighting the error-annotated vector and the annotated pinyin tone vector with the error prediction value in the detection module. By adding tone to tone for finer-grained and more precise correction, it predicts not only the characters of the target word but also its pinyin tone, thus improving the accuracy of ASR error correction, which addresses the issue of the BERT model neglecting tone features.

[0087] In one embodiment, step S50, namely determining the prediction loss value of the preset training model based on the predicted content text, the target content text, the target pinyin tone text, and the predicted pinyin tone text, includes:

[0088] S501, determine a first loss value based on the target content text and the predicted content text.

[0089] Understandably, the first loss value is generated during the content correction process of the text to be corrected. The target content text is obtained by correcting the identified content text manually or through other means.

[0090] Specifically, after obtaining the predicted content text, all predicted content texts corresponding to the same text to be corrected are arranged according to the order of the texts to be corrected in the set of texts to be corrected. Then, the target content text is compared with the predicted content texts in the same sequence; that is, according to the order of the texts to be corrected, the target content text that is first is compared with the predicted content text corresponding to the first text to be corrected, and the loss value between the target content text and the predicted content text is determined by a loss function. Then, the target content text that is second is compared with the predicted content text corresponding to the second text to be corrected, until all target content texts and all predicted content texts have been compared, and the first loss value of all texts to be corrected is obtained. For example, in an insurance claim scenario, the predicted content text is "I'm sorry, we will pay you." The target content text is "Don't be sad, we will pay you." The first loss value is determined by calculating the difference between the two texts.

[0091] S502, determine a second loss value based on the predicted pinyin tone text and the target pinyin tone text.

[0092] Understandably, the second loss value is generated during the process of correcting the initial pinyin tone text for pinyin tones. The target pinyin tone text is obtained by correcting the identified pinyin tone text manually or through other methods.

[0093] Specifically, after obtaining the predicted pinyin tone text, all predicted pinyin tone texts corresponding to the same text to be corrected are arranged according to the order of the texts to be corrected in the text set. Then, the target pinyin tone text is compared with the predicted pinyin tone texts in the same sequence; that is, according to the texts to be corrected, the first target pinyin tone text is compared with the predicted pinyin tone text corresponding to the first text to be corrected, and the loss value between the target pinyin tone text and the predicted pinyin tone text is determined by a loss function. Then, the second target pinyin tone text is compared with the predicted pinyin tone text corresponding to the second text to be corrected, until all target pinyin tone texts and all predicted pinyin tone texts have been compared, and the second loss value of all initial pinyin tone texts is obtained. For example, in an insurance claim scenario, the target pinyin tone text is ni3,bu2,yao4,nan2,guo4,wo3,men1,hui4,pei2,fu4,de1. Predict the pinyin tones of the texts ni3, biao3, nan2, guo4, wo3, men1, hui4, hui4, pei2, fu4, de1. Determine the second loss value by calculating the difference between the two texts.

[0094] S503, determine the predicted loss value of the preset training model based on the first loss value and the second loss value.

[0095] Specifically, the overall loss value of the model is calculated using the preset weight values ​​for each branch. This involves multiplying the weight value of each branch by its corresponding loss value; for example, multiplying the first loss value of the Chinese spelling correction branch by the weight value of the content correction branch, and multiplying the second loss value of the Chinese pronunciation prediction branch by the weight value of the pinyin tone correction branch. The results of these multiplications are then summed to obtain the predicted loss value of the preset training model. In this embodiment, the weight value of the Chinese pronunciation prediction branch uses the error probability value predicted by the detection module, and the weight value of the Chinese spelling correction branch uses the result of subtracting the error probability value from the prediction value of the detection module. The loss function expression is L = (1 - p err )L w +p err L p , where L w L represents the loss value for Chinese spelling correction. p The loss value for predicting Chinese pronunciation.

[0096] This invention calculates the loss value of each branch by using the real and predicted labels corresponding to the same text to be corrected and the initial pinyin tone text, thus determining the loss value of each branch. By calculating the overall loss value of the preset training model using different weight values ​​for each branch, the predicted loss value is determined, thereby improving the accuracy of the text correction model.

[0097] In one embodiment, such as Figure 3 As shown, a text correction method is provided, including the following steps:

[0098] S11, Obtain speech recognition text, which includes content recognition text and pinyin tone recognition text.

[0099] S12, invoke the text correction model, wherein the text correction model is the text correction model trained by the text correction model training method according to any one of claims 1-5.

[0100] Understandably, the speech-recognized text can be obtained by crawling from different databases or by sending it to the server via a client. That is, at least one speech-recognized text is obtained, which includes content-recognized text and pinyin tone-recognized text. For example, in the insurance field, this could be the recognized text of a conversation between a salesperson and a customer, or in the financial field, the recognized text of a user's inquiry to a staff member. The content-recognized text is the character text identified from the audio data, and the pinyin tone-recognized text is the text containing the pinyin tones and intonations corresponding to the character text. Further, the text correction model trained according to the aforementioned text correction model training method is retrieved from the database.

[0101] S13, Based on the text correction model, perform error correction on the content recognition text and pinyin tone recognition text in the speech recognition text to obtain the target corrected text.

[0102] Understandably, the target corrected text is the text after error correction for both content-recognized text and pinyin tone-recognized text.

[0103] Specifically, after retrieving the text correction model, the speech recognition text is input into it. The text correction model encodes the content recognition text and the pinyin tone recognition text within the speech recognition text; that is, it encodes the content recognition text and the pinyin tone recognition text using a character encoder and a pinyin tone encoder, respectively, to obtain character encoding vectors and pinyin tone encoding vectors. Then, the error sequence labeling model of the detection module labels the character encoding vectors with errors, that is, it represents the error type at the error location using numbers from the training process, thus obtaining the text labeling vector. Finally, the correction module performs text correction on the text labeling vector and the pinyin tone encoding vector, that is, it uses the masking function of the BERT model to predict and correct the text labeling vector and the pinyin tone encoding vector, thus obtaining the target corrected text. The specific process is the same as the training process described above, and will not be repeated here.

[0104] This invention encodes speech recognition text using a trained text correction model, thus determining the encoding vector. Error labeling of the encoding vector enables error location and type prediction. A masking function corrects all error types by character and pinyin tone, thereby correcting speech recognition text and, consequently, errors of variable length.

[0105] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0106] In one embodiment, a text correction device is provided, which corresponds one-to-one with the text correction methods described in the above embodiments. For example... Figure 5 As shown, the text correction device includes an acquisition module 11, a recall module 12, and a correction module 13. Detailed descriptions of each functional module are as follows:

[0107] The acquisition module 11 is used to acquire speech recognition text, which includes content recognition text and pinyin tone recognition text;

[0108] Module 12 is used to call the text correction model, wherein the text correction model is a text correction model trained by the text correction model training method according to any one of claims 1-5;

[0109] The recognition module 13 is used to correct errors in the content recognition text and pinyin tone recognition text in the speech recognition text based on the text correction model, so as to obtain the target corrected text.

[0110] In one embodiment, a text correction model training device is provided, which corresponds one-to-one with the text correction model training method described in the above embodiments. For example... Figure 4 As shown, the text correction model training device includes a data acquisition module 10, a text encoding module 20, an error annotation module 30, an error correction module 40, a loss prediction module 50, and a model convergence module 60. Detailed descriptions of each functional module are as follows:

[0111] Data acquisition module 10 is used to acquire a sample dataset, the sample dataset including at least one text to be corrected and an initial pinyin tone text corresponding to the text to be corrected, as well as a target content text corresponding to the text to be corrected and a target pinyin tone text corresponding to the initial pinyin tone text;

[0112] The text encoding module 20 is used to encode the text to be corrected and the initial pinyin tone text through the encoding module in the preset training model to obtain the vector to be corrected and the initial pinyin tone vector.

[0113] Error labeling module 30 is used to label the vector to be corrected with errors through the detection module in the preset training model, so as to obtain an error-labeled vector;

[0114] Error correction module 40 is used to perform error variable length correction on the error annotation vector and the initial pinyin tone vector by Chinese spelling correction and Chinese pronunciation prediction of the correction module in the preset training model, respectively, to obtain the predicted content text and the predicted pinyin tone text;

[0115] The loss prediction module 50 is used to determine the prediction loss value of the preset training model based on the predicted content text, the target content text, the target pinyin tone text, and the predicted pinyin tone text.

[0116] The model convergence module 60 is used to determine the converged preset training model as the text correction model when the predicted loss value reaches the preset convergence condition.

[0117] Specific limitations regarding the text correction model training device can be found in the limitations of the text correction model training method described above, and will not be repeated here. Each module in the aforementioned text correction model training device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0118] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores data used in the text correction model training method described in the above embodiments. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a text correction model training method; or, when the processor executes the computer program, it implements the aforementioned text correction method.

[0119] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described text correction model training method, or the processor executes the computer program to implement the above-described text correction method.

[0120] In one embodiment, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described text correction model training method, or when the processor executes the computer program, implements the above-described text correction method.

[0121] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0122] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0123] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A method for training a text correction model, characterized in that, include: Obtain a sample dataset, which includes at least one text to be corrected and an initial pinyin tone text corresponding to the text to be corrected, as well as a target content text corresponding to the text to be corrected and a target pinyin tone text corresponding to the initial pinyin tone text; The text to be corrected and the initial pinyin tone text are encoded by the encoding module in the preset training model to obtain the vector to be corrected and the initial pinyin tone vector. The vector to be corrected is labeled with errors by the detection module in the preset training model to obtain an error-labeled vector; wherein, the error labels include deleted labels, unchanged labels, replaced labels and inserted labels; The error-lengthening correction is performed on the error-labeled vector and the initial pinyin tone vector by the Chinese spelling correction and Chinese pronunciation prediction in the correction module of the preset training model, respectively, to obtain the predicted content text and the predicted pinyin tone text. Based on the predicted content text, the target content text, the target pinyin tone text, and the predicted pinyin tone text, the prediction loss value of the preset training model is determined; wherein, the weight value of the Chinese pronunciation prediction branch is the error probability value predicted by the detection module, and the weight value of the Chinese spelling correction branch is the result of the detection module's prediction minus the error probability value. When the predicted loss value reaches the preset convergence condition, the preset training model after convergence is determined as the text correction model. The process involves using the Chinese spelling correction and Chinese pronunciation prediction modules in a pre-trained model to perform error length correction on the error-annotated vector and the initial pinyin tone vector, respectively, to obtain the predicted content text and the predicted pinyin tone text, including: The error annotation vector and the initial pinyin tone vector corresponding to the same text to be corrected are fused to obtain a fused vector; The fusion vector is corrected by Chinese spelling correction in the correction module to obtain the predicted content text. The fusion vector is corrected for pinyin tone by the Chinese pronunciation prediction in the correction module to obtain the predicted pinyin tone text.

2. The text correction model training method as described in claim 1, characterized in that, The step of encoding the text to be corrected through the encoding module in the preset training model to obtain the vector to be corrected includes: The text to be corrected is preprocessed through the input layer of the encoding module to obtain a content input vector; The content input vector is processed by the attention layer of the encoding module to obtain the content text vector; The prediction layer of the encoding module predicts the content text vector to obtain the vector to be corrected.

3. The text correction model training method as described in claim 1, characterized in that, The erroneous annotations include four types: deleted annotations, unchanged annotations, replaced annotations, and inserted annotations. The step of using the detection module in the preset training model to perform error labeling on the vector to be corrected, and obtaining the error-labeled vector, includes: The error location is obtained by predicting the error in the vector to be corrected through the masking unit of the detection module. The error type is predicted by deleting the annotation, keeping the annotation unchanged, replacing the annotation, and inserting the annotation to obtain the error content type; Based on the error content type and the error content location, an error annotation vector is determined.

4. The text correction model training method as described in claim 1, characterized in that, The step of determining the prediction loss value of the preset training model based on the predicted content text, the target content text, the target pinyin tone text, and the predicted pinyin tone text includes: Based on the target content text and the predicted content text, a first loss value is determined; A second loss value is determined based on the predicted pinyin tone text and the target pinyin tone text; The predicted loss value of the preset training model is determined based on the first loss value and the second loss value.

5. A text correction method, characterized in that, include: Acquire speech-recognized text, which includes content-recognized text and pinyin tone-recognized text; Call the text correction model, wherein the text correction model is a text correction model trained by the text correction model training method according to any one of claims 1-4; Based on the text correction model, errors are corrected in the content recognition text and pinyin tone recognition text of the speech recognition text to obtain the target corrected text.

6. A text correction model training device, characterized in that, include: The data acquisition module is used to acquire a sample dataset, which includes at least one text to be corrected and an initial pinyin tone text corresponding to the text to be corrected, as well as a target content text corresponding to the text to be corrected and a target pinyin tone text corresponding to the initial pinyin tone text. The text encoding module is used to encode the text to be corrected and the initial pinyin tone text through the encoding module in the preset training model to obtain the vector to be corrected and the initial pinyin tone vector. The error labeling module is used to label the vector to be corrected with errors through the detection module in the preset training model, so as to obtain an error-labeled vector; wherein, error labeling includes deletion labeling, unchanged labeling, replacement labeling and insertion labeling; The error correction module is used to perform error variable length correction on the error annotation vector and the initial pinyin tone vector respectively through the Chinese spelling correction and Chinese pronunciation prediction of the correction module in the preset training model, so as to obtain the predicted content text and the predicted pinyin tone text. The loss prediction module is used to determine the prediction loss value of the preset training model based on the predicted content text, the target content text, the target pinyin tone text, and the predicted pinyin tone text; wherein, the weight value of the Chinese pronunciation prediction branch is the error probability value predicted by the detection module, and the weight value of the Chinese spelling correction branch is the result of the detection module's prediction minus the error probability value. The model convergence module is used to determine the converged preset training model as the text correction model when the predicted loss value reaches the preset convergence condition. The error correction module is also used for: The error annotation vector and the initial pinyin tone vector corresponding to the same text to be corrected are fused to obtain a fused vector; The fusion vector is corrected by Chinese spelling correction in the correction module to obtain the predicted content text. The fusion vector is corrected for pinyin tone by the Chinese pronunciation prediction in the correction module to obtain the predicted pinyin tone text.

7. A text correction device, characterized in that, include: The acquisition module is used to acquire speech recognition text, which includes content recognition text and pinyin tone recognition text; The calling module is used to call the text correction model, wherein the text correction model is a text correction model trained by the text correction model training method according to any one of claims 1-4; The correction module is used to correct errors in the content recognition text and pinyin tone recognition text in the speech recognition text based on the text correction model, so as to obtain the target corrected text.

8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the text correction model training method as described in any one of claims 1 to 4, or when the processor executes the computer program, it implements the text correction method as described in claim 5.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the text correction model training method as described in any one of claims 1 to 4, or when the processor executes the computer program, it implements the text correction method as described in claim 5.

Citation Information

Patent Citations

  • Text error correction model training and text error correction method and device

    CN115965009A

  • Method and apparatus for text error correction, electronic device and storage medium

    US20210248309A1