A method, device, electronic device and computer-readable storage medium for expanding corpus of speech recognition model
By automatically obtaining and analyzing the correct and wrong text in the speech recognition model, calculating the probability of wrong vocabulary replacement and adding it to the corpus, the problem of error recognition problems and high cost of corpus acquisition in the speech recognition model is solved, and automatic corpus expansion and model accuracy are achieved Improvement of sex.
Patent Information
- Application Number
- CN202111317109.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-09
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-11-09
AI Technical Summary
Under the influence of environmental noise, dialect and channel, the existing speech recognition model often contains errors in the recognition results, which affects the accuracy of the natural language processing algorithm of the dialogue management module. The increase in corpus requires manual annotation and screening, resulting in high costs and resources. waste.
By obtaining the correct text and wrong text in the speech recognition model, word segmentation obtains the correct vocabulary and wrong vocabulary, calculate the probability of each wrong vocabulary replacing the correct vocabulary, and add the wrong vocabulary to the corpus when the probability is greater than the preset threshold, avoiding Manual participation.
It realizes automatic expansion of corpus, reduces the cost of manual labeling and screening, and improves the accuracy and interactive experience of the speech recognition model.
Smart Images

Figure CN113889094B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of model training, and in particular to a method, device, electronic device and computer-readable storage medium for expanding corpus of a speech recognition model. Background Art
[0002] With the continuous development of artificial intelligence and the increasing amount of data, natural language processing technology has been widely used in all walks of life. One of its important application areas is human-computer dialogue.
[0003] The human-computer dialogue system is generally composed of a speech recognition model, a dialogue management module, and a speech synthesis module. The speech recognition model is responsible for converting sound into text, the dialogue management module is responsible for identifying the meaning and giving the corresponding reply, and the speech synthesis module is responsible for converting the reply text into speech. Usually, the dialogue management module is based on some pre-annotated corpus, trains the natural language processing technology algorithm model, and uses the model to identify the user's intention based on the speech recognition results and decide the next reply.
[0004] Due to the influence of various phonemes such as environmental noise, dialects, and channels, the results of speech recognition models often contain various errors, which will affect the accuracy of the natural language processing technology algorithm in the dialogue management module, thereby affecting the interactive experience.
[0005] Therefore, in practice, a large amount of corpus needs to be added and the entire speech recognition system needs to be retrained. Currently, the screening of corpus needs to be based on manual observation. Therefore, high cost and high resource loss have become one of the difficulties in corpus acquisition. Summary of the invention
[0006] The purpose of the present invention is to provide a method, device, electronic device and computer-readable storage medium for expanding the corpus of a speech recognition model, which can achieve the expansion of the corpus and avoid manual participation, thereby saving costs.
[0007] In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0008] In a first aspect, an embodiment of the present application provides a method for expanding corpus of a speech recognition model, the method comprising:
[0009] Get the correct text and error text in the speech recognition model;
[0010] Segmenting the correct text to obtain a plurality of correct words, and segmenting the incorrect text to obtain a plurality of incorrect words, wherein each correct word corresponds to each incorrect word;
[0011] For each of the erroneous words, determining a first number of times the speech recognition model replaces a correct word with the erroneous word and a second number of times the erroneous word appears in the erroneous text;
[0012] Determine a first probability of forming a sentence of the erroneous text corresponding to the erroneous vocabulary and a second probability of forming a sentence of the correct text corresponding to the correct vocabulary;
[0013] Determine a probability that a correct word is replaced by an incorrect word based on the first probability, the second probability, the first number of times, and the second number of times;
[0014] When the probability of a correct word being replaced by an incorrect word is greater than a preset probability threshold, the incorrect word is added to the corpus of the speech recognition model.
[0015] In an optional implementation, the step of determining, for each of the erroneous words, the first number of times the speech recognition model replaces the correct word with the erroneous word comprises:
[0016] Determine the correct word corresponding to each incorrect word, and calculate the edit distance between each incorrect word and the corresponding correct word based on the edit distance algorithm;
[0017] Based on the edit distance, a first number of times a correct word is replaced with an incorrect word by the speech recognition model is determined.
[0018] In an optional implementation, the step of determining a first probability of forming a sentence of the erroneous text corresponding to the erroneous vocabulary and a second probability of forming a sentence of the correct text corresponding to the correct vocabulary includes:
[0019] Inputting the erroneous text corresponding to the erroneous vocabulary into the language model to obtain a first probability of forming a sentence of the erroneous text corresponding to the erroneous vocabulary;
[0020] The correct text corresponding to the correct vocabulary is input into the language model to obtain a second probability of the correct text corresponding to the correct vocabulary forming a sentence.
[0021] In an optional implementation manner, the probability that the correct word is replaced by the incorrect word is determined based on the first probability, the second probability, the first number of times, and the second number of times by the following formula:
[0022] The probability of a correct word being replaced by an incorrect word = p(X|Y)*p(Y) / p(X);
[0023] Wherein, p(X|Y) is the ratio of the first number to the second number, p(Y) is the first probability, and p(X) is the second probability.
[0024] In an optional embodiment, the method further comprises:
[0025] The sum of the expanded corpus and the original corpus of the speech recognition model is used as the target corpus;
[0026] The speech recognition model is trained based on the target corpus.
[0027] In an optional implementation, the step of training the speech recognition model based on the target corpus includes:
[0028] Determining a first weight of the original corpus;
[0029] Determining a second weight of the expanded corpus;
[0030] Training the speech recognition model based on the original corpus according to a first weight;
[0031] The speech recognition model is trained based on the expanded corpus according to the second weight.
[0032] In a second aspect, an embodiment of the present application provides a corpus expansion device for a speech recognition model, the device comprising: an acquisition module and a processing module;
[0033] The acquisition module is used to acquire the correct text and the incorrect text in the speech recognition model;
[0034] The processing module is used to segment the correct text to obtain a plurality of correct words, and segment the incorrect text to obtain a plurality of incorrect words, wherein each correct word corresponds to each incorrect word;
[0035] For each of the erroneous words, determining a first number of times the speech recognition model replaces a correct word with the erroneous word and a second number of times the erroneous word appears in the erroneous text;
[0036] Determine a first probability of forming a sentence of the erroneous text corresponding to the erroneous vocabulary and a second probability of forming a sentence of the correct text corresponding to the correct vocabulary;
[0037] Determine a probability that a correct word is replaced by an incorrect word based on the first probability, the second probability, the first number of times, and the second number of times;
[0038] When the probability that the correct word is replaced by the wrong word is greater than a preset probability threshold, the wrong word is added to the corpus of the speech recognition model.
[0039] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the corpus expansion method of the speech recognition model when executing the computer program.
[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for expanding the corpus of the speech recognition model.
[0041] This application has the following beneficial effects:
[0042] The present application obtains the correct text and the wrong text in the speech recognition model; performs word segmentation on the correct text to obtain multiple correct words, performs word segmentation on the wrong text to obtain multiple wrong words, wherein each correct word has a corresponding relationship with each wrong word; for each wrong word, determines the first number of times that the speech recognition model replaces the correct word with the wrong word and the second number of times that the wrong word appears in the wrong text; determines the first probability of the sentence formation of the wrong text corresponding to the wrong word and the second probability of the sentence formation of the correct text corresponding to the correct word; based on the first probability, the second probability, the first number and the second number, determines the probability of the correct word replacing the wrong word; when the probability of the correct word replacing the wrong word is greater than the preset probability threshold, the wrong word is added to the corpus of the speech recognition model. The present method only needs to count the correct text and the transcribed text with errors during the training of the speech recognition model, and directly calculates the probability of the correct word replacing the wrong word based on the sentence formation probability of the wrong text and the sentence formation probability of the correct text, and expands the wrong words greater than the preset probability threshold, without the need to manually identify and expand the corpus, saving costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0044] Figure 1 A block diagram of an electronic device provided by an embodiment of the present invention;
[0045] Figure 2 One of the step flow charts of a method for expanding corpus of a speech recognition model provided by an embodiment of the present invention;
[0046] Figure 3A second flow chart of the steps of a method for expanding the corpus of a speech recognition model provided by an embodiment of the present invention;
[0047] Figure 4 A flowchart of the steps of a method for expanding the corpus of a speech recognition model provided by an embodiment of the present invention;
[0048] Figure 5 A structural block diagram of a corpus expansion device for a speech recognition model provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0050] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0052] In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. appear to indicate an orientation or position relationship, they are based on the orientation or position relationship shown in the accompanying drawings, or are the orientation or position relationship in which the product of the invention is usually placed when used. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0053] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.
[0054] In the description of this application, it should also be noted that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0055] After extensive research, the inventors found that due to the influence of various phonemes such as environmental noise, dialects, and channels, the results of speech recognition model recognition often contain various errors, which will affect the accuracy of the natural language processing technology algorithm in the dialogue management module, thereby affecting the interactive experience. In order to avoid the above situation, it is necessary to increase the training set, that is, the corpus, to further train the speech recognition model, thereby improving the accuracy of the speech recognition model. In the prior art, adding corpus often requires manual annotation and screening of the corpus. Therefore, high cost and high resource loss have become one of the difficulties in corpus acquisition.
[0056] In view of the discovery of the above problems, the present embodiment provides a corpus expansion method, device, electronic device and computer-readable storage medium for a speech recognition model, which can count the correct text and the transcribed text with errors during the speech recognition model training, and directly calculate the probability of replacing the correct vocabulary with the incorrect vocabulary based on the sentence formation probability of the incorrect text and the sentence formation probability of the correct text, and expand the incorrect vocabulary greater than the preset probability threshold, without the need for manual recognition and expansion of the corpus, thus saving costs. The solution provided by the present embodiment is described in detail below.
[0057] This embodiment provides an electronic device that can expand the corpus of a speech recognition model. In a possible implementation, the electronic device can be a user terminal, for example, the electronic device can be, but is not limited to, a server, a smart phone, a personal computer (PC), a tablet computer, a personal digital assistant (PDA), and a mobile Internet device (MID).
[0058] Please refer to Figure 1 , Figure 1 1 is a schematic diagram of the structure of the electronic device 100 provided in the embodiment of the present application. The electronic device 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown. Figure 1Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0059] The electronic device 100 includes a corpus expansion device 110 for a speech recognition model, a memory 120 and a processor 130 .
[0060] The components of the memory 120 and the processor 130 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The corpus expansion device 110 of the speech recognition model includes at least one software function module that can be stored in the memory 120 in the form of software or firmware or solidified in the operating system (OS) of the electronic device 100. The processor 130 is used to execute the executable modules stored in the memory 120, such as the software function modules and computer programs included in the corpus expansion device 110 based on the speech recognition model.
[0061] The memory 120 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory 120 is used to store a program, and the processor 130 executes the program after receiving an execution instruction.
[0062] Please refer to Figure 2 , Figure 2 For application Figure 1 A flowchart of a corpus expansion method for a speech recognition model of an electronic device 100 is provided, and the method including each step is described in detail below.
[0063] Step 201: Acquire correct text and incorrect text in the speech recognition model.
[0064] Step 202: Segment the correct text to obtain a plurality of correct words, and segment the incorrect text to obtain a plurality of incorrect words.
[0065] There is a corresponding relationship between each correct word and each incorrect word.
[0066] Step 203: For each incorrect word, determine a first number of times that the speech recognition model replaces the correct word with the incorrect word and a second number of times that the incorrect word appears in the incorrect text.
[0067] Step 204: Determine a first probability of forming a sentence of the erroneous text corresponding to the erroneous vocabulary and a second probability of forming a sentence of the correct text corresponding to the correct vocabulary.
[0068] Step 205: Based on the first probability, the second probability, the first number, and the second number, determine the probability that the correct word is replaced by the incorrect word.
[0069] Step 206: When the probability of replacing the correct word with the incorrect word is greater than a preset probability threshold, the incorrect word is added to the corpus of the speech recognition model.
[0070] It should be noted that the correct text and the incorrect text correspond to each other. When the speech recognition model is pre-trained, the speech recognition model will correctly recognize the speech and incorrectly recognize the speech during the process of recognizing the speech.
[0071] For example: a voice is "I'm hungry". This voice is input into the speech recognition model. If the recognition accuracy of the speech recognition model is high, the voice will be correctly recognized as the correct text of "I'm hungry". Of course, the recognition accuracy of the speech recognition model is not 100% accurate. Therefore, the speech recognition model will recognize the voice of "I'm hungry" as other texts, for example: recognize the voice as "I'm hungry alone", "I'm hungry alone", etc., then the text of "I'm hungry" is the correct text, and the texts such as "I'm hungry alone", "I'm hungry alone", etc. are incorrect texts.
[0072] Of course, different voices correspond to different texts. Therefore, the correct texts and incorrect texts obtained from the speech recognition model are not just a few individual ones, but a large number of correct texts and incorrect texts.
[0073] Since the error occurs during the speech recognition process of the speech recognition model, the correct text and the error text correspond to each other. Moreover, it should be noted that the error text corresponding to the correct text is not all recognition errors, but only has errors, such as individual word recognition errors.
[0074] Segment all correct texts and incorrect texts, and count the number of times all words appear. Suppose the correct text is X and the incorrect text is Y. After segmenting the correct text, all correct words are x = [x1, x2, ..., xn], and after segmenting the incorrect text Y, all incorrect words are y = [y1, y2, ..., yn].
[0075] For each incorrect word, determine the first number of times the correct word is replaced by the incorrect word. For example, if the correct text is "I am hungry" and the incorrect text is "I am hungry alone", and among a large number of correct texts and incorrect texts, the number of times the correct word "stomach" is recognized as "alone" during the recognition process is the first number of times the correct word is replaced by the incorrect word. And determine the second number of times the incorrect word appears in all incorrect texts.
[0076] For example, the error texts include 1. I am hungry alone. 2. I am holy fire alone. 3. I am fast alone. 4...5... and the like.
[0077] Determine the number of occurrences of the incorrect word "alone" in "I am hungry alone" in the incorrect text, and the second number of occurrences of the incorrect word in the incorrect text is 3 times.
[0078] Based on the language model, a first probability corresponding to the erroneous text corresponding to the erroneous word and a second probability corresponding to the correct text corresponding to the correct word associated with the erroneous word are determined.
[0079] Simply put, a language model is a model used to calculate the probability of a sentence, that is, to determine whether a sentence is human speech. The probability and conditional probability are calculated based on the corpus, and the joint probability of the sentence is calculated based on the calculated probability.
[0080] The specific steps of generating the first probability and the second probability are:
[0081] The erroneous text corresponding to the erroneous word is input into the language model, and the language model outputs the first probability of the erroneous text corresponding to the erroneous word forming a sentence based on the input erroneous text. The first probability of the erroneous text forming a sentence is the probability of identifying whether the erroneous text corresponding to the erroneous word is human speech.
[0082] The correct text corresponding to the correct vocabulary is input into the language model. Based on the input correct text, the language model outputs the second probability of the correct text corresponding to the correct vocabulary forming a sentence. The second probability of the correct text forming a sentence is the probability of identifying whether the correct text corresponding to the correct vocabulary is human speech.
[0083] Exemplarily, the wrong word is “alone”, and the wrong text “I am hungry alone” corresponding to the wrong word is input into the language model, and the probability of “I am hungry alone” being a human word is output.
[0084] The correct word "stomach" corresponding to the incorrect word "alone" is determined, and the correct text "I'm hungry" corresponding to the correct word "stomach" is determined and input into the language model, and the probability of "I'm hungry" being spoken by a person is output.
[0085] Finally, the probability of the correct word being replaced by the wrong word is determined based on the first probability, the second probability, the first number, and the second number. When the probability of the correct word being replaced by the wrong word is high, that is, the probability of the correct word being replaced by the wrong word is higher than a preset probability threshold, the wrong word is expanded into the corpus of the speech recognition model.
[0086] It should be noted that the preset probability threshold may be set to 70%, 80%, 90%, etc., and the embodiment of the present invention does not impose any specific limitation on this.
[0087] The present application obtains the correct text and the wrong text in the speech recognition model; performs word segmentation on the correct text to obtain multiple correct words, performs word segmentation on the wrong text to obtain multiple wrong words, wherein each correct word has a corresponding relationship with each wrong word; for each wrong word, determines the first number of times that the speech recognition model replaces the correct word with the wrong word and the second number of times that the wrong word appears in the wrong text; determines the first probability of the sentence formation of the wrong text corresponding to the wrong word and the second probability of the sentence formation of the correct text corresponding to the correct word; based on the first probability, the second probability, the first number and the second number, determines the probability of the correct word replacing the wrong word; when the probability of the correct word replacing the wrong word is greater than the preset probability threshold, the wrong word is added to the corpus of the speech recognition model. The present method only needs to count the correct text and the transcribed text with errors during the training of the speech recognition model, and directly calculates the probability of the correct word replacing the wrong word based on the sentence formation probability of the wrong text and the sentence formation probability of the correct text, and expands the wrong words greater than the preset probability threshold, without the need to manually identify and expand the corpus, saving costs.
[0088] For determining the first time of replacing the correct word with the wrong word, for the above step 203, as Figure 3 As shown, it is a flow chart of a method for expanding the corpus of a speech recognition model provided in an embodiment of the present application, which specifically includes the following steps:
[0089] Step 203 - 1 : Determine the correct word corresponding to each incorrect word, and calculate the edit distance between each incorrect word and the corresponding correct word based on an edit distance algorithm.
[0090] Step 203 - 2 : Based on the edit distance, determine the first number of times the speech recognition model replaces a correct word with an incorrect word.
[0091] The edit distance algorithm calculates the similarity between the transcribed text and the template text by counting the minimum number of edit operations required to convert the transcribed text into the template text. Edit operations include: replacing one character with another, inserting a character, deleting a character, etc.
[0092] Based on the edit distance, the first number of times a correct word is replaced by an incorrect word is determined.
[0093] In order to determine the probability of replacing the correct word with the wrong word, the above step 205 specifically includes:
[0094] The probability of the correct word being replaced by the wrong word is determined based on the first probability, the second probability, the first number, and the second number using the following formula:
[0095] The probability of a correct word being replaced by an incorrect word = p(X|Y)*p(Y) / p(X);
[0096] Among them, p(X|Y) is the ratio of the first number to the second number, p(Y) is the first probability, and p(X) is the second probability.
[0097] The corpus data of the speech recognition model is statistically analyzed with p(X|Y), and the conditional probability p(X|Y) of possible errors is inferred from the correct text. p(X) and p(Y) are given by the language model. It is worth noting that since the conditional probability p(X|Y) and the language model score p(Y) are often not in the same order of magnitude, p(Y) is exponentially scaled to a certain extent to make p(X|Y) closer to p(Y).
[0098] In actual use, the most likely incorrect words can be selected to expand the corpus of the speech recognition model, or a preset probability threshold can be set to only expand the incorrect words with scores exceeding the preset probability threshold to the corpus of the speech recognition model.
[0099] The sum of the expanded corpus and the original corpus in the speech recognition model is the target corpus, and the speech recognition model is trained based on the target corpus.
[0100] The expanded corpus is obtained from the training results of the speech recognition model. Therefore, the speech recognition model can be trained based on the expanded corpus and the original expectations of the speech recognition model without adding any new annotated corpus to improve the accuracy of the speech recognition model.
[0101] For training of speech recognition models, such as Figure 4 As shown, it is a flow chart of a method for expanding the corpus of a speech recognition model provided in an embodiment of the present application, which specifically includes the following steps:
[0102] Step 301: Determine the first weight of the original corpus.
[0103] Step 302: Determine a second weight of the expanded corpus.
[0104] Step 303: Train the speech recognition model based on the original corpus according to the first weight.
[0105] Step 304: Train the speech recognition model based on the expanded corpus according to the second weight.
[0106] During the training process, certain weight adjustments are made to the gradient feedback results of the expanded corpus to reduce the negative impact caused by the expanded corpus.
[0107] Different weight values are set for the original corpus and the expanded corpus. For example, a first weight set for the original corpus is higher than a second weight set for the expanded corpus, thereby avoiding the problem of inaccurate recognition of the speech recognition model due to the expanded corpus.
[0108] Please refer to Figure 5 The present application embodiment also provides a method for applying Figure 1 The corpus expansion device 110 of the speech recognition model of the electronic device 100, the corpus expansion device 110 of the speech recognition model comprises: an acquisition module 111 and a processing module 112;
[0109] The acquisition module 111 is used to acquire the correct text and the incorrect text in the speech recognition model;
[0110] The processing module 112 is used to segment the correct text to obtain a plurality of correct words, and segment the incorrect text to obtain a plurality of incorrect words, wherein each correct word corresponds to each incorrect word;
[0111] For each of the erroneous words, determining a first number of times the speech recognition model replaces a correct word with the erroneous word and a second number of times the erroneous word appears in the erroneous text;
[0112] Determine a first probability of forming a sentence of the erroneous text corresponding to the erroneous vocabulary and a second probability of forming a sentence of the correct text corresponding to the correct vocabulary;
[0113] Determine a probability that a correct word is replaced by an incorrect word based on the first probability, the second probability, the first number of times, and the second number of times;
[0114] When the probability that the correct word is replaced by the wrong word is greater than a preset probability threshold, the wrong word is added to the corpus of the speech recognition model.
[0115] In an optional implementation, the processing module 112 is further configured to:
[0116] Determine the correct word corresponding to each incorrect word, and calculate the edit distance between each incorrect word and the corresponding correct word based on the edit distance algorithm;
[0117] Based on the edit distance, a first number of times a correct word is replaced with an incorrect word by the speech recognition model is determined.
[0118] In an optional implementation, the processing module 112 is further configured to:
[0119] Inputting the erroneous text corresponding to the erroneous vocabulary into the language model to obtain a first probability of forming a sentence of the erroneous text corresponding to the erroneous vocabulary;
[0120] The correct text corresponding to the correct vocabulary is input into the language model to obtain a second probability of the correct text corresponding to the correct vocabulary forming a sentence.
[0121] Optionally, the probability that a correct word is replaced by an incorrect word is determined based on the first probability, the second probability, the first number of times, and the second number of times by the following formula:
[0122] The probability of a correct word being replaced by an incorrect word = p(X|Y)*p(Y) / p(X);
[0123] Wherein, p(X|Y) is the ratio of the first number to the second number, p(Y) is the first probability, and p(X) is the second probability.
[0124] In an optional implementation, the processing module 112 is further configured to:
[0125] The sum of the expanded corpus and the original corpus of the speech recognition model is used as the target corpus;
[0126] The speech recognition model is trained based on the target corpus.
[0127] In an optional implementation, the processing module 112 is further configured to:
[0128] Determining a first weight of the original corpus;
[0129] Determining a second weight of the expanded corpus;
[0130] Training the speech recognition model based on the original corpus according to a first weight;
[0131] The speech recognition model is trained based on the expanded corpus according to the second weight.
[0132] In summary, by obtaining the correct text and the wrong text in the speech recognition model; segmenting the correct text to obtain multiple correct words, segmenting the wrong text to obtain multiple wrong words, wherein each correct word has a corresponding relationship with each wrong word; for each wrong word, determining the first number of times the speech recognition model replaces the correct word with the wrong word and the second number of times the wrong word appears in the wrong text; determining the first probability of the sentence formation of the wrong text corresponding to the wrong word and the second probability of the sentence formation of the correct text corresponding to the correct word; based on the first probability, the second probability, the first number and the second number, determining the probability of the correct word replacing the wrong word; when the probability of the correct word replacing the wrong word is greater than the preset probability threshold, adding the wrong word to the corpus of the speech recognition model. This method only needs to count the correct text and the transcribed text with errors during the training of the speech recognition model, based on the sentence formation probability of the wrong text and the sentence formation probability of the correct text, so as to directly calculate the probability of the correct word replacing the wrong word, and expand the wrong words greater than the preset probability threshold, without the need to manually identify and expand the corpus, saving costs.
[0133] The present application also provides an electronic device 100, which includes a processor 130 and a memory 120. The memory 120 stores computer executable instructions, and when the computer executable instructions are executed by the processor 130, the corpus expansion method of the speech recognition model is implemented.
[0134] The embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by the processor 130, the corpus expansion method of the speech recognition model is implemented.
[0135] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0136] In addition, each functional module in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk.
[0137] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0138] The above are only various implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for expanding corpus of a speech recognition model, characterized in that: The method comprises: Get the correct text and error text in the speech recognition model; Segmenting the correct text to obtain a plurality of correct words, and segmenting the incorrect text to obtain a plurality of incorrect words, wherein each correct word corresponds to each incorrect word; For each of the erroneous words, determining a first number of times the speech recognition model replaces a correct word with the erroneous word and a second number of times the erroneous word appears in the erroneous text; Determine a first probability of forming a sentence of the erroneous text corresponding to the erroneous vocabulary and a second probability of forming a sentence of the correct text corresponding to the correct vocabulary; Determine a probability that a correct word is replaced by an incorrect word based on the first probability, the second probability, the first number of times, and the second number of times; When the probability of a correct word being replaced by an incorrect word is greater than a preset probability threshold, the incorrect word is added to the corpus of the speech recognition model.
2. The method according to claim 1, characterized in that The step of determining, for each of the erroneous words, the first number of times that the speech recognition model replaces the correct word with the erroneous word comprises: Determine the correct word corresponding to each incorrect word, and calculate the edit distance between each incorrect word and the corresponding correct word based on the edit distance algorithm; Based on the edit distance, a first number of times a correct word is replaced with an incorrect word by the speech recognition model is determined.
3. The method according to claim 1, characterized in that The step of determining a first probability of forming a sentence of the erroneous text corresponding to the erroneous vocabulary and a second probability of forming a sentence of the correct text corresponding to the correct vocabulary comprises: Inputting the erroneous text corresponding to the erroneous vocabulary into a language model to obtain a first probability of forming a sentence of the erroneous text corresponding to the erroneous vocabulary; The correct text corresponding to the correct vocabulary is input into the language model to obtain a second probability of the correct text corresponding to the correct vocabulary forming a sentence.
4. The method according to claim 1, characterized in that: The probability that the correct word is replaced by the incorrect word is determined based on the first probability, the second probability, the first number of times, and the second number of times by the following formula: The probability of a correct word being replaced by an incorrect word = p(X|Y)*p(Y) / p(X); Wherein, p(X|Y) is the ratio of the first number to the second number, p(Y) is the first probability, and p(X) is the second probability.
5. The method according to claim 1, characterized in that The method further comprises: The sum of the expanded corpus and the original corpus of the speech recognition model is used as the target corpus; The speech recognition model is trained based on the target corpus.
6. The method according to claim 5, characterized in that The step of training the speech recognition model based on the target corpus includes: Determining a first weight of the original corpus; Determining a second weight of the expanded corpus; Training the speech recognition model based on the original corpus according to a first weight; The speech recognition model is trained based on the expanded corpus according to the second weight.
7. A corpus expansion device for a speech recognition model, characterized in that: The device comprises: an acquisition module and a processing module; The acquisition module is used to acquire the correct text and the incorrect text in the speech recognition model; The processing module is used to segment the correct text to obtain a plurality of correct words, and segment the incorrect text to obtain a plurality of incorrect words, wherein each correct word corresponds to each incorrect word; For each of the erroneous words, determining a first number of times the speech recognition model replaces a correct word with the erroneous word and a second number of times the erroneous word appears in the erroneous text; Determine a first probability of forming a sentence of the erroneous text corresponding to the erroneous vocabulary and a second probability of forming a sentence of the correct text corresponding to the correct vocabulary; Determine a probability that a correct word is replaced by an incorrect word based on the first probability, the second probability, the first number of times, and the second number of times; When the probability that the correct word is replaced by the wrong word is greater than a preset probability threshold, the wrong word is added to the corpus of the speech recognition model.
8. The device according to claim 7, characterized in that The processing module is also used for: Determine the correct word corresponding to each incorrect word, and calculate the edit distance between each incorrect word and the corresponding correct word based on the edit distance algorithm; Based on the edit distance, a first number of times a correct word is replaced with an incorrect word by the speech recognition model is determined.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Error correction method and device for search query term
CN106708893A
Text error detection method and device
CN110929502A