A Chinese ASR output text repair method and system based on BERT

Through the Chinese ASR output text repair system based on BERT, the Chinese punctuation mark prediction model and error correction model are used to integrate phonetic and glyph features to solve the problem of typos and punctuation marks in the Chinese ASR output text and improve the readability and accuracy of the text. accuracy, forming an efficient end-to-end text repair system.

CN115034208BActive Publication Date: 2024-10-22SHANGHAI UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210434469.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2024-10-22
Estimated Expiration
2042-04-24

AI Technical Summary

Technical Problem

The text output by Chinese automatic speech recognition (ASR) often suffers from typos and omissions caused by noise, and the lack of punctuation marks makes the text less readable. In particular, the task of predicting Chinese punctuation marks is difficult, and existing technology cannot effectively solve it.

Method used

The BERT-based Chinese ASR output text repair system is used, combined with the Chinese punctuation prediction model and the Chinese error correction model, using the BERT Chinese word segmenter, RoBERTa-wwm, ChineseBERT pre-training model and Transformer network to integrate phonetic and glyph features, and through self-attention Force mechanism and gated recurrent neural network for punctuation prediction and error correction.

Benefits of technology

It achieves effective punctuation prediction and error correction of Chinese ASR output text, improves the readability and accuracy of the text, reduces training time and cost compared with traditional methods, and forms an end-to-end Chinese text repair system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115034208B_ABST
    Figure CN115034208B_ABST
Patent Text Reader

Abstract

The present invention proposes a Chinese ASR text repair method and system based on BERT, and the system includes: a Chinese punctuation prediction model and a Chinese error correction model. The Chinese punctuation prediction model is improved in two aspects based on BERT: the basic BERT model is replaced by the RoBERTa model, and the efficiency of the model is improved by changing the mask strategy in the pre-training task; more Chinese additional information is provided to the model by extracting two embeddings, namely, pronunciation and glyph. Through these two changes, a relatively complete Chinese punctuation prediction model is proposed. The Chinese error correction model uses the PLOME pre-training model, and the feature of this model is also to combine Chinese additional features to improve the model's ability to understand Chinese. Through a simple combination, the present invention obtains an end-to-end Chinese ASR text repair system, which combines the two tasks of Chinese punctuation prediction and Chinese error correction for the first time, and corrects erroneous texts from two angles, which can significantly improve the efficiency of text use.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a Chinese automatic speech recognition (ASR) output text repair method based on a pre-training model BERT (Bidirectional Encoder Representations from Transformers, hereinafter referred to as BERT) proposed by Transformer and a system using the method, belonging to the field of neural networks and natural language processing. Background Art

[0002] ASR plays an increasingly important role in industrial systems. However, when transcribing audio, the inevitable noise will cause the generated text to differ from the real content. Therefore, text repair after ASR transcription is a very important step. In the process of ASR text repair, there are two issues that deserve attention: First, during the transcription process, noise or other factors will affect the quality of the speech, resulting in typos and omissions in the transcription; second, the transcribed text does not contain punctuation marks, which greatly reduces the readability of the transcribed text and increases the difficulty of processing the text.

[0003] Whether applied at the word level or sentence level, Chinese error correction is a very important task, which aims to solve the problem of wrong characters in text. Chinese error correction can be used in many natural language processing tasks, such as optical character recognition and article scoring tasks. Chinese error correction is a very challenging problem. In order to better solve the problem of Chinese error correction, it is necessary to have human-like language understanding ability. Common Chinese errors are divided into two types: the first is the error of similar characters, that is, the difference between the wrong character and the correct character is the shape of the character, which often occurs in the field of optical character recognition. The other is the error of similar characters, that is, the difference between the wrong character and the correct character is the pinyin, which often occurs in the field of speech recognition ASR.

[0004] Punctuation prediction or punctuation repair refers to using computers to predict punctuation repair for punctuation-free text, so that the predicted text is more readable and consistent with its own semantics than the previous text. The current public dataset for punctuation prediction is the IWSLT dataset, which is for English speech transcription. Chinese punctuation prediction or Chinese punctuation repair is more difficult than English. First of all, there is a natural difference between Chinese and English. Each word in English is separated by spaces, and each character in Chinese has multiple meanings, that is, the ambiguity of Chinese characters. Secondly, Chinese punctuation is richer and more varied than English punctuation, which also increases the difficulty of the Chinese punctuation prediction task. So far, there has been no good progress in Chinese punctuation prediction. Therefore, whether in terms of datasets or language models, there is a lot of room for research in Chinese punctuation prediction.

[0005] Using the Wikipedia dataset, Google combined BERT, aiming to pre-train a deep bidirectional representation of text from unlabeled text by combining the left and right context information of all layers. The model refreshed the best performance of most natural language processing tasks and made good use of the idea of ​​pre-training-fine-tuning. The two pre-training tasks of BERT are: masked language model and context prediction. The masked language model task aims to randomly select 15% of the input for label masking before pre-training the model, and then learn the text context content based on Transformers to predict the masked tags. The context prediction task is a binary classification task that determines whether two samples are contextual in the original text. Positive samples are created by taking consecutive sentences from the text corpus, and negative samples are created by extracting fragments from different documents. Positive and negative samples are sampled with equal probability. This task aims to improve the performance of downstream tasks, such as natural language inference.

[0006] In order to better adapt to different task scenarios, the team also proposed a technology called Whole Word Masking (WWM), which masks all tags corresponding to the entire word at once to optimize the original masked language model pre-training task. The technology has been proven to have a positive effect in experiments on Chinese NLP tasks. Based on the whole word masking technology, the team proposed the BERT-wwm model, which uses the Chinese word segmentation tool to replace the WordPiece word segmenter, splits the text into multiple words, and then performs whole word masking on the split words.

[0007] PLOME (Pre-training with Misspelled Knowledge for Chinese Spelling Correction) is a pre-trained language model with misspelling knowledge. Different from BERT's random selection of marker masks for prediction, PLOME adopts a masking strategy based on confusion sets in pre-training tasks, which includes four masking methods: pronunciation-confused word replacement, glyph-confused word replacement, random replacement, and original word unchanged. In addition, PLOME extracts two additional Chinese features of pronunciation and glyph to add to the model, and combines the initial character and position information as the input of the entire model, so that the model can better learn the correlation between characters. The above improvements allow PLOME to surpass the previously proposed methods in the Chinese error correction task. It can be seen that adding additional Chinese features is helpful to help the model learn more information between characters. Summary of the invention

[0008] The purpose of the present invention is to perform Chinese repair on the text output by Chinese ASR in two aspects.

[0009] In order to achieve the above object, a technical solution of the present invention is to provide a Chinese ASR output text repair system based on BERT, characterized in that it includes a Chinese punctuation prediction model and a Chinese error correction model, wherein:

[0010] The Chinese punctuation prediction model includes the BERT Chinese word segmenter, the RoBERTa pre-trained model, the ChineseBERT pre-trained model, the Transformer network, and the classification module, among which:

[0011] The BERT Chinese word segmenter encodes each Chinese word in the input Chinese text to obtain a word vector;

[0012] The RoBERTa-wwm pre-trained model encodes word vectors into word encoding vectors obtained through pre-training tasks, that is, word encoding embeddings are obtained;

[0013] The ChineseBERT pre-trained model extracts the phonetic and glyph features of word vectors to obtain pinyin embedding and glyph embedding;

[0014] The Transformer network learns the self-attention mechanism for the character encoding embedding, pinyin embedding, and glyph embedding, integrating the information of the character encoding embedding layer, pinyin embedding layer, and glyph embedding layer while stretching the dimension of the embedding layer to the dimension of the classification module input;

[0015] The classification module is composed of two linear layers and two dropout layers. The classification model predicts the probability of each character encoding for four categories and outputs the category of the punctuation mark with the highest probability for each character. The labels of the four categories are space, comma, period, and question mark.

[0016] The sentences with punctuation output by the Chinese punctuation prediction model are input into the Chinese error correction model, and the Chinese error correction model adopts the PLOME model.

[0017] Preferably, the text punctuation prediction model and the Chinese error correction model are encapsulated into an end-to-end Chinese text repair model.

[0018] Preferably, the masking strategies adopted by the RoBERTa pre-training model include 0% masking, 15% masking and 30% masking.

[0019] Preferably, the ChineseBERT pre-trained model uses the following method to obtain pinyin embedding:

[0020] The pinyin of each character is obtained through open source tools, and the pinyin of each character is convolved through a CNN network with a width of two, and then the pinyin embedding is obtained through a maximum pooling layer;

[0021] The ChineseBERT pre-trained model uses the following method to obtain glyph embeddings:

[0022] Use glyph images of three Chinese fonts, each with a size of 24*24. The three Chinese fonts of each character are combined into a 24*24*3 tensor, and then use a fully convolutional neural network to stretch the tensor to form a glyph embedding.

[0023] Preferably, the core formula of the attention mechanism of the Transformer network is as follows:

[0024]

[0025] Where: Q is the query matrix; K is the information that the attention mechanism focuses on; V is the matrix after the original input value is linearly transformed, which is used to save the input features, and Q and K are transposed T Perform dot multiplication to calculate the attention weight of Q on V; d k It is the moving head size in the multi-head attention mechanism algorithm.

[0026] Preferably, in the Chinese error correction model, the input of the PLOME model consists of a character embedding layer, a position embedding layer, a pronunciation embedding layer and a glyph embedding layer; the PLOME model uses a word segmentation module to construct character embedding and position embedding based on sentences with punctuation marks, and the PLOME model uses a gated recurrent neural network encoder to construct pronunciation embedding and glyph embedding; the PLOME model integrates the character embedding layer, the position encoding embedding layer, the pronunciation embedding layer and the glyph embedding layer in a mixed manner, and inputs the integrated vector into a Chinese error correction network based on a Transformer network to obtain the corrected text.

[0027] Another technical solution of the present invention is to provide a Chinese ASR output text repair method based on BERT, characterized in that it is implemented based on the aforementioned Chinese ASR output text repair system, comprising the following steps:

[0028] Inputting the Chinese results output by the Chinese automatic language recognition into the Chinese punctuation mark prediction model, and the Chinese punctuation mark prediction model outputs the sentence with punctuation marks;

[0029] The sentence with punctuation marks is input into the Chinese error correction model, and the Chinese error correction model outputs a repaired Chinese text result.

[0030] Preferably, the training of the Chinese punctuation prediction model and the Chinese error correction model comprises the following steps:

[0031] Step 1: Build a sample dataset

[0032] The LC Chinese news dataset and the Json version of the community question-answering dataset are used to build a sample dataset for training the Chinese punctuation prediction model, and the sample dataset is further defined as the Chinese punctuation dataset;

[0033] Select SIGHAN 2015CSC Datasets as the sample dataset for training the Chinese error correction model;

[0034] Step 2: Preprocess the Chinese punctuation dataset

[0035] Clean the text in the Chinese punctuation dataset, then remove the characters that cannot be recognized by the BERT pre-trained model encoder in the Chinese punctuation dataset, and then use the BERT pre-trained model to encode the text in the Chinese punctuation dataset into word vectors;

[0036] Step 3: Training phase

[0037] The training of the Chinese punctuation prediction model specifically includes the following steps:

[0038] Step 3A01, input the pre-processed Chinese text into the BERT Chinese word segmenter, which encodes each Chinese word and can add markers to the start and end positions of each sentence to obtain a word vector with a fixed length;

[0039] Step 3A02: Input the obtained word vectors into the RoBERTa-wwm pre-training model and the ChineseBERT pre-training model respectively, where:

[0040] The RoBERTa pre-trained model encodes word vectors into word encoding vectors obtained through pre-training tasks, namely word encoding embeddings;

[0041] The ChineseBERT pre-trained model extracts the phonetic and glyph features of word vectors to obtain pinyin embedding and glyph embedding;

[0042] Step 3A03, the Transformer network learns the self-attention mechanism for the character code embedding, pinyin embedding and glyph embedding, integrates the information of the three embedding layers and stretches the dimension of the embedding layer into the dimension of the subsequent classification module input;

[0043] Step 3A04: Input the integrated embedding layer into the classification model, use the classification model to predict the probability of each character code for the four categories, and output the category of the punctuation mark with the maximum probability for each word;

[0044] For the training of the Chinese error correction model, the PLOME model is used for training, which includes the following steps:

[0045] Step 3B01, input the sample dataset into the model, and use the BERT-based word segmenter to obtain the character embedding layer and the position encoding embedding layer;

[0046] Step 3B02: Input the sample data set into the gated recurrent neural network encoder to obtain the pronunciation embedding layer and the character shape embedding layer.

[0047] Step 3B03, the character embedding layer, the position code embedding layer, the pronunciation embedding layer and the glyph embedding layer are mixed and integrated, and the integrated vector contains the comprehensive information of the four embedding layers;

[0048] Step 3B04: input the integrated vector into the Chinese error correction network based on the Transformer network to obtain the corrected text.

[0049] Preferably, when training the Chinese punctuation prediction model, a negative log-likelihood function with label weights is used as a loss function, as shown in the following formula:

[0050]

[0051] In the formula: l(x,y)=L={l1,…,l n ,…,l N} T , is the label y of the nth sample in the sample dataset n The weight of weigh[y n ] indicates label y n The weight of y n ≠ignore index , ignore index Indicates the index value of the selected ignored tag. Represents the nth sample in the sample data set, whose label is y n , N is the size of the sample data set.

[0052] In order to perform two aspects of Chinese repair on the text output by Chinese ASR, the present invention first needs to predict Chinese punctuation marks. The present invention considers this problem as a four-category problem, and the labels of the four categories are space, comma, period and question mark. The output of the model is the probability that each Chinese character may be followed by one of the four categories. Taking into account that the frequency of use of some uncommon punctuation marks is not high, the present invention simplifies the data, such as replacing exclamation marks with periods, removing dashes and book title marks, etc. Finally, punctuation marks are filled according to the predicted category of each Chinese character. The Chinese error correction task is to use the pre-trained model to detect and modify Chinese errors for each word in the input text. After these two steps, the present invention outputs the text with the final Chinese repair completed.

[0053] Compared with the prior art, the present invention has at least the following advantages:

[0054] (1) The present invention proposes a Chinese punctuation prediction model based on the basic BERT. Compared with existing Chinese punctuation models with poor performance, such as BiLSTM, the present invention uses the most popular and more efficient BERT pre-trained model for fine-tuning, and uses Transformer to integrate feature embedding. It is currently a relatively complete and efficient method and system for Chinese punctuation prediction tasks.

[0055] (2) In the Chinese punctuation prediction model proposed in the present invention, an embedding layer of pronunciation and glyph features is added. Compared with other methods for extracting pronunciation and glyph features, this paper uses a Chinese pre-trained model to directly obtain feature embedding, which greatly reduces training time and cost while adding more Chinese text information.

[0056] (3) The model proposed in the present invention combines the two tasks of Chinese punctuation and Chinese error correction model to form an end-to-end Chinese ASR output text repair system. Different from other systems that only focus on punctuation or Chinese error correction, it can completely solve the errors in ASR output text from two perspectives. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 A flowchart of a Chinese ASR output text repair method based on BERT provided by the present invention;

[0058] Figure 2 Schematic diagram of the pinyin embedding model in the Chinese punctuation prediction model of the present invention;

[0059] Figure 3 Schematic diagram of a glyph embedding model in a Chinese punctuation mark prediction model of the present invention;

[0060] Figure 4 Schematic diagram of the Chinese punctuation mark prediction model of the present invention;

[0061] Figure 5 Schematic diagram of the Chinese text error correction model of the present invention; DETAILED DESCRIPTION

[0062] The present invention is further described below in conjunction with specific examples. It should be understood that these examples are only to help those of ordinary skill in the art understand the principles and knowledge of the present invention, and are not intended to limit the scope of the present invention, and cannot be considered to limit the application scenarios of the present invention. In addition, it should be understood that after reading the content taught by the present invention, those skilled in the art may make various changes or modifications to the present invention, but the deformation, changes and conversions made to the embodiments based on the principles and purposes of the present invention also fall within the scope defined by the claims attached to this application. And it is obvious that this specification is only exemplified by preferred embodiments, and there is no need to exhaust all embodiments.

[0063] like Figure 1 As shown, this embodiment discloses a BERT-based Chinese ASR output text repair solution, which mainly consists of two parts: a Chinese punctuation prediction model and a Chinese error correction model.

[0064] First, the Chinese result output by ASR is input into the Chinese punctuation prediction model, which is a model fine-tuned for the Chinese punctuation prediction task based on the BERT pre-trained model. The Chinese punctuation prediction model outputs sentences with punctuation. After that, the sentences with punctuation are input into the Chinese error correction model, and finally the repaired Chinese text result is obtained. In this embodiment, the Chinese punctuation prediction model and the Chinese error correction model are encapsulated into an end-to-end Chinese text repair model.

[0065] The main structures of the two models are introduced below:

[0066] First) Chinese punctuation prediction model

[0067] At present, there is no very systematic method for predicting Chinese punctuation marks, and the effect of using only BERT for prediction is not good. Therefore, the present invention proposes a Chinese punctuation mark prediction model based on BERT. Compared with the native BERT, the Chinese punctuation mark prediction model has three main improvements:

[0068] 1) Use the RoBERTa model to replace the BERT model. The RoBERTa model is characterized by using dynamic masks to replace the static masks in the original BERT model and canceling the context prediction task in the BERT model. That is, in the RoBERTa model, the data set is first copied multiple times, and different random masking strategies are applied to the same data, so that the mask positions of the same data in different training rounds are different. In this embodiment, there are three main masking strategies used: 0% mask, 15% mask, and 30% mask.

[0069] 2) In order to improve the machine's ability to understand language, two additional Chinese features, pronunciation and glyph, are extracted. The embedding of pronunciation is represented by pinyin embedding, and the embedding of glyph is represented by glyph embedding. The following is the method to obtain pinyin embedding and glyph embedding:

[0070] Pinyin embedding: Get the pinyin of each character through open source tools, convolve the pinyin of each character through a CNN network with a width of two, and then get the pinyin embedding through the maximum pooling layer, such as Figure 2 shown.

[0071] Glyph embedding: Use glyph images of three Chinese fonts (Lishu, Xingkai, and Fangsong). The size of each glyph image is 24*24. The three Chinese fonts of each character are combined into a 24*24*3 tensor. Then use a fully convolutional neural network to stretch the tensor to form a glyph embedding, such as Figure 3 shown.

[0072] 3) After the RoBERTa model obtains the embedding of the phonetic features and the glyph features in the data, it inputs the generated embedding layer into a Transformer network with one encoder and one decoder layer, and uses the Transformer network's self-attention mechanism to integrate the input information. In this embodiment, the core formula of the attention mechanism is as follows:

[0073]

[0074] Where: Q is the query matrix; K is the information that the attention mechanism focuses on; V is the matrix after the original input value is linearly transformed, which is used to save the input features, and Q and K are transposed T Perform dot multiplication to calculate the attention weight of Q on V; d k is the head size in the multi-head attention mechanism algorithm, using The purpose of scaling is to avoid the T The dot product is too large, because once the dot product is too large, the gradient through the SoftMax function will be very small.

[0075] The advantage of using the SoftMax function in the present invention is that it is convenient for back-propagation gradient calculation and smoothes the result to the interval of 0-1. The initial Q, K, and V are interlinked and are the result of adding the character embedding layer and the position embedding layer. Q, K, and V are also the parameters that the model needs to train and optimize.

[0076] The output of the Transformer network is input to the classification module. In this embodiment, the classification module is composed of two linear layers and two Dropout layers, where the nonlinear function uses the relu function. Finally, the classification module uses the SoftMax function to output the result. The structure of the Chinese punctuation prediction model disclosed in this embodiment is as follows: Figure 4 shown.

[0077] Second) Chinese error correction model:

[0078] In this embodiment, the Chinese error correction model is implemented based on the PLOME model, and the PLOME model is used to perform the Chinese error correction task. The PLOME model strengthens the relationship between the model recognition characters by combining the relevant information of the pronunciation and the glyph, so that errors in Chinese can be better judged. The input of the PLOME model is mainly composed of four embedding layers, namely the character embedding layer, the position embedding layer, the pronunciation embedding layer and the glyph embedding layer. The PLOME model uses a word segmentation module to construct character embedding and position embedding. The word segmentation module uses a pre-trained model model word segmenter to quickly obtain two basic embedding layers of character embedding and position embedding. Next, the PLOME model uses a gated recurrent neural network encoder to construct pronunciation and glyph embedding. Since the gated recurrent neural network has good memory capacity, while solving the long-range dependency problem, it can better utilize the relevant information contained in the context of the pronunciation and glyph embedding. Then, the PLOME model uses a twelve-layer Transformer network as an encoder to perform Chinese error correction. The structure of the encoder is similar to the BERT-base model, such as Figure 5 shown.

[0079] The training of the above-mentioned Chinese punctuation prediction model and Chinese error correction model specifically includes the following steps:

[0080] Step 1: Select a dataset. This paper selects three suitable datasets: LC Chinese News Dataset, Json Version Community Question Answering Dataset, and SIGHAN 2015 CSC Datasets.

[0081] LC Chinese News Dataset: Each piece of data in this dataset consists of two parts. The first part is the introduction or title of the news, which is used to summarize the news. Generally, the sentence length is less than 20 words. The second part is the complete content of the news, and each sentence is more than 100 words. The dataset is divided into training set, validation set and test set. The size of the training set is more than 100,000, and the number of validation set and test set is more than 10,000. Because the content of the dataset covers a wide range and the amount of data is relatively sufficient, it is often used as a dataset for Chinese natural language processing tasks;

[0082] Json version of the community question and answer dataset: contains more than 4.1 million pre-filtered, high-quality questions and replies. Each question belongs to a topic, totaling 28,000 topics. From the 14 million original questions and answers, the answers that received at least 3 likes were screened out to obtain a high-quality dataset. In addition to each question corresponding to a topic, a description of the question, and one or more replies, each reply also carries a label with the number of likes, reply ID, and respondent. The data is deduplicated and divided into three parts: the training set size is 4.12 million, and the validation set and test set are 68,000. Compared with the LC Chinese news dataset, this dataset contains more Chinese punctuation marks, which can improve the accuracy of the present invention in the Chinese punctuation mark prediction task.

[0083] The LC Chinese news dataset and the Json version of the community question-answering dataset are used as Chinese punctuation datasets for training the Chinese punctuation prediction model.

[0084] SIGHAN 2015 CSC Datasets: The format of this dataset is similar to the Json version of the community question-and-answer dataset, that is, the format of key-value pairs. Therefore, after converting it to a Json format file, the efficiency of subsequent processing can be improved. The training set size of this dataset is 150,000, and the test set and validation set are 140,000 respectively. Each piece of data includes three parts: original_text, wrong_ids, and correct_text. original_text represents a sentence with errors, wrong_ids represents the index of the wrong word in original_text, and correct_text represents the correct sentence. SIGHAN 2015 CSC Datasets is a commonly used dataset for Chinese error correction. In this embodiment, this dataset is used to train the Chinese error correction model.

[0085] Step 2: Preprocess the sample data set. The Chinese punctuation data set used is not a well-organized data set. In the prediction of Chinese punctuation, it is necessary to ensure that the data set is clean and tidy. For example, there cannot be multiple punctuation marks connected, and the sentence cannot start with a punctuation mark. Therefore, the text in the Chinese punctuation data set needs to be cleaned. Secondly, it is necessary to remove characters that the BERT pre-trained model encoder in the Chinese punctuation data set cannot recognize, such as foreign languages ​​such as Korean, uncommon characters, and special symbols. After the Chinese punctuation data set is cleaned, the BERT pre-trained model is used to encode the text in the Chinese punctuation data set into word vectors as input for fine-tuning the pre-trained model.

[0086] Step 3: The training phase is divided into the training of the Chinese punctuation prediction model and the training of the Chinese error correction model.

[0087] For the training of the Chinese punctuation prediction model, the present invention uses two pre-trained models, RoBERTa-wwm and ChineseBERT, and fine-tunes them for the Chinese punctuation task, specifically including the following steps:

[0088] Step 3A01: ​​Input the preprocessed Chinese text into the BERT Chinese word segmenter, which can encode each Chinese character and add a marker to the beginning and end of each sentence, so that the length of the encoding input each time is fixed. The word vector length selected in this embodiment is 512.

[0089] Step 3A02, input the obtained word vectors into the RoBERTa-wwm pre-training model and the ChineseBERT pre-training model respectively. The RoBERTa-wwm pre-training model encodes the word vector into a character encoding vector obtained through the pre-training task, that is, a character encoding embedding. Compared with the previous word vector, the character encoding vector contains more relationships between characters for subsequent downstream tasks. The ChineseBERT pre-training model extracts the Chinese features of the word vector - the phonetic features and the glyph features, and obtains the pinyin embedding and the glyph embedding. Through the RoBERTa-wwm pre-training model and the ChineseBERT pre-training model, three embedding layers are obtained - character encoding embedding, pinyin embedding and glyph embedding.

[0090] Step 3A03, the Transformer network learns the self-attention mechanism for the three embedding layers, integrates the information of the three embedding layers and stretches the dimensions of the embedding layers into the dimensions of the subsequent classification module input.

[0091] Step 3A04: Input the integrated embedding layer into the classification model, which can predict the probability of each character code for the four categories and output the category of the punctuation mark with the highest probability for each word. At this point, the Chinese punctuation mark prediction task is completed.

[0092] During the training process, the hyperparameters are set as follows: batch_size is set to 16, epochs is set to 12, learning_rate is set to 3e-5, the optimizer uses the adamw optimizer, and the training indicators select accuracy, recall rate, F1-score and auc value for evaluation.

[0093] For the training of the Chinese error correction model, this embodiment uses the PLOME model for training. The training process of the model is as follows:

[0094] Step 3B01, input the sample data set into the model, and use the BERT-based word segmenter to obtain the character embedding layer and the position encoding embedding layer. Both embedding layers contain information contained in the characters themselves, and are also relatively easy to obtain information.

[0095] Step 3B02: input the sample data set into the gated recurrent neural network encoder. The function of the gated recurrent neural network encoder is similar to that of the ChineseBERT pre-trained model, and it can also obtain the pronunciation embedding layer and the character shape embedding layer.

[0096] Step 3B03, the character embedding layer, the position code embedding layer, the pronunciation embedding layer and the glyph embedding layer are mixed and integrated, and the integrated vector contains the comprehensive information of the four embedding layers.

[0097] Step 3B04: Input the integrated vector into the Chinese error correction network based on the Transformer network to obtain the corrected text.

[0098] The Chinese error correction model disclosed in this embodiment also achieves the error correction effect of multiple error points. In the hyperparameter setting of the training process, the present invention sets batch_szie to 32, epochs to 10, and learning_rate to 5e-5. The optimizer uses the Adam weight descent optimizer, and the evaluation indicators select the minimum loss value, model accuracy, and F1-score.

[0099] In terms of loss function, the present invention focuses on the loss function in the Chinese punctuation prediction task. Since the Chinese punctuation prediction task is a multi-classification task, and there is a serious sample imbalance problem in the selected Chinese punctuation dataset, that is, the number of periods in the dataset is much larger than the number of question marks and commas, the loss function used is the negative log-likelihood function with label weights. This loss function can add the weights of each label in the dataset to the optimization to alleviate the problem of sample imbalance. The weighted loss value can be defined as:

[0100]

[0101] In the formula: l(x,y)=L={l1,…,l n ,…,l N} T , is the label y of the nth sample in the sample dataset n The weight of weigh[y n ] indicates label y n The weight of y n ≠ignore index , ignore index Indicates the index value of the selected ignored tag. Represents the nth sample in the sample data set, whose label is y n , N is the size of the sample data set.

Claims

1. A Chinese ASR output text repair system based on BERT, characterized in that: It includes Chinese punctuation prediction model and Chinese error correction model, among which: The Chinese punctuation prediction model includes the BERT Chinese word segmenter, the RoBERTa pre-trained model, the ChineseBERT pre-trained model, the Transformer network, and the classification module, among which: The BERT Chinese word segmenter encodes each Chinese word in the input Chinese text to obtain a word vector; The RoBERTa pre-trained model encodes word vectors into word encoding vectors obtained through pre-training tasks, that is, word encoding embeddings are obtained; The ChineseBERT pre-trained model extracts the phonetic and glyph features of word vectors to obtain pinyin embedding and glyph embedding; The Transformer network learns the self-attention mechanism for the character encoding embedding, pinyin embedding, and glyph embedding, integrating the information of the character encoding embedding layer, pinyin embedding layer, and glyph embedding layer while stretching the dimension of the embedding layer to the dimension of the classification module input; The classification module is composed of two linear layers and two dropout layers. The classification model predicts the probability of each character encoding for four categories and outputs the category of the punctuation mark with the highest probability for each character. The labels of the four categories are space, comma, period, and question mark. The sentences with punctuation output by the Chinese punctuation prediction model are input into the Chinese error correction model, and the Chinese error correction model adopts the PLOME model.

2. A Chinese ASR output text repair system based on BERT as claimed in claim 1, characterized in that: The text punctuation prediction model and the Chinese error correction model are encapsulated into an end-to-end Chinese text repair model.

3. A Chinese ASR output text repair system based on BERT as claimed in claim 1, characterized in that: The masking strategies adopted by the RoBERTa pre-training model include 0% mask, 15% mask and 30% mask.

4. A Chinese ASR output text repair system based on BERT as claimed in claim 1, characterized in that: The ChineseBERT pre-trained model uses the following method to obtain pinyin embedding: The pinyin of each character is obtained through open source tools, and the pinyin of each character is convolved through a CNN network with a width of two, and then the pinyin embedding is obtained through a maximum pooling layer; The ChineseBERT pre-trained model uses the following method to obtain glyph embeddings: Use glyph images of three Chinese fonts, each with a size of 24*24. The three Chinese fonts of each character are combined into a 24*24*3 tensor, and then use a fully convolutional neural network to stretch the tensor to form a glyph embedding.

5. A Chinese ASR output text repair system based on BERT as claimed in claim 1, characterized in that: The core formula of the attention mechanism of the Transformer network is as follows: Where: Q is the query matrix; K is the information that the attention mechanism focuses on; V is the matrix after the original input value is linearly transformed, which is used to save the input features, and Q and K are transposed T Perform dot multiplication to calculate the attention weight of Q on V; d k It is the head size in the multi-head attention mechanism algorithm.

6. A Chinese ASR output text repair system based on BERT as claimed in claim 1, characterized in that: In the Chinese error correction model, the input of the PLOME model consists of a character embedding layer, a position embedding layer, a pronunciation embedding layer, and a glyph embedding layer; The PLOME model uses a word segmentation module to build character embeddings and position embeddings based on sentences with punctuation marks. The PLOME model uses a gated recurrent neural network encoder to build phonetic embeddings and glyph embeddings. The PLOME model integrates the character embedding layer, positional encoding embedding layer, phonetic embedding layer and glyph embedding layer in a mixed manner, and inputs the integrated vector into the Chinese error correction network based on the Transformer network to obtain the corrected text.

7. A Chinese ASR output text repair method based on BERT, characterized in that: The Chinese ASR output text repair system according to claim 1 is implemented, comprising the following steps: Inputting the Chinese results output by the Chinese automatic language recognition into the Chinese punctuation mark prediction model, and the Chinese punctuation mark prediction model outputs the sentence with punctuation marks; The sentence with punctuation marks is input into the Chinese error correction model, and the Chinese error correction model outputs a repaired Chinese text result.

8. A BERT-based Chinese ASR output text repair method as claimed in claim 7, characterized in that: The training of the Chinese punctuation prediction model and the Chinese error correction model includes the following steps: Step 1: Build a sample dataset The LC Chinese news dataset and the Json version of the community question-answering dataset are used to build a sample dataset for training the Chinese punctuation prediction model, and the sample dataset is further defined as the Chinese punctuation dataset; Select SIGHAN 2015 CSC Datasets as the sample dataset for training the Chinese error correction model; Step 2: Preprocess the Chinese punctuation dataset Clean the text in the Chinese punctuation dataset, then remove the characters that cannot be recognized by the BERT pre-trained model encoder in the Chinese punctuation dataset, and then use the BERT pre-trained model to encode the text in the Chinese punctuation dataset into word vectors; Step 3: Training phase The training of the Chinese punctuation prediction model specifically includes the following steps: Step 3A01, input the pre-processed Chinese text into the BERT Chinese word segmenter, which encodes each Chinese character and can add markers to the start and end positions of each sentence to obtain a word vector with a fixed length; Step 3A02: Input the obtained word vectors into the RoBERTa-wwm pre-training model and the ChineseBERT pre-training model respectively, where: The RoBERTa-wwm pre-trained model encodes word vectors into word encoding vectors obtained through pre-training tasks, namely word encoding embeddings; The ChineseBERT pre-trained model extracts the phonetic and glyph features of word vectors to obtain pinyin embedding and glyph embedding; Step 3A03, the Transformer network learns the self-attention mechanism for the character code embedding, pinyin embedding and glyph embedding, integrates the information of the three embedding layers and stretches the dimension of the embedding layer into the dimension of the subsequent classification module input; Step 3A04: Input the integrated embedding layer into the classification model, predict the probability of each character encoding for the four categories through the classification model, and output the category of the punctuation mark with the maximum probability for each word; for the training of the Chinese error correction model, the PLOME model is used for training, which specifically includes the following steps: Step 3B01, input the sample dataset into the model, and use the BERT-based word segmenter to obtain the character embedding layer and the position encoding embedding layer; Step 3B02, input the sample data set into the gated recurrent neural network encoder to obtain a character pronunciation embedding layer and a character shape embedding layer; Step 3B03, the character embedding layer, the position code embedding layer, the pronunciation embedding layer and the glyph embedding layer are mixed and integrated, and the integrated vector contains the comprehensive information of the four embedding layers; Step 3B04: input the integrated vector into the Chinese error correction network based on the Transformer network to obtain the corrected text.

9. A Chinese ASR output text repair method based on BERT as claimed in claim 8, characterized in that: When training the Chinese punctuation prediction model, a negative log-likelihood function with label weights is used as the loss function, as shown in the following formula: Where: is the label y of the nth sample in the sample dataset n The weight of weigh[y n ] indicates label y n The weight of y n ≠ignore index , ignore index Indicates the index value of the selected ignored tag. Represents the nth sample in the sample data set, whose label is y n , N is the size of the sample data set.

Citation Information

Patent Citations

  • Chinese spelling error correction method and device based on multiple representations and multiple pre-training models

    CN113627158A

  • Chinese spelling error correction method based on multi-task learning

    CN114065738A

  • Error correction method and device for Chinese text in power field, storage medium and computing equipment

    CN114118065A

  • Text error correction method and apparatus, and terminal device and computer storage medium

    WO2021164310A1