Method and device for obtaining training samples, computer equipment, and storage medium

By extracting text sentences from user confirmation text based on n-member grammar model and performing speech recognition, the problems of high cost and long cycle of training samples in the prior art are solved, and training samples related to business scenarios are automatically and quickly obtained.

CN114495940BActive Publication Date: 2025-08-08IFLYTEK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111630256.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-28
Publication Date
2025-08-08
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

In the prior art, the process of obtaining training samples has high labor costs and long cycles.

Method used

Based on the n-metagram model, text sentences are extracted from user confirmation text, and voice fragments matching the target text sentence are obtained through speech recognition, as training samples, replacing the manual speech recording and labeling process.

Benefits of technology

The labor cost and exhaustion cycle of training samples are reduced, and the training samples related to business scenarios are automatically obtained and quickly obtain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114495940B_ABST
    Figure CN114495940B_ABST
Patent Text Reader

Abstract

The present application provides a method and apparatus for acquiring training samples, a computer device, and a storage medium, which solve the problems of high labor costs and long cycles in the prior art in the acquisition process of training samples. The acquisition method includes: determining a first text sentence in a user confirmation text based on an n-gram grammar model, wherein the n-gram grammar model is obtained based on training of a preset text, the n-gram grammar model includes multiple n-gram data units, and the first text sentence includes at least one n-gram data unit; determining a target text sentence based on the first text sentence; performing speech recognition on a speech segment corresponding to the target text sentence to obtain a recognized text; and determining the speech segment annotated with the recognized text as a training sample when the matching degree between the recognized text and the target text sentence meets a first preset condition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of speech recognition technology, and in particular to a method and apparatus for acquiring training samples, a computer device, and a storage medium. Background Art

[0002] With breakthroughs in artificial intelligence (AI) technology, the demand for speech recognition is growing. However, speech recognition for new business scenarios often lacks appropriate training samples. Conventional methods involve preparing pre-set text corresponding to the scenario, manually recording the pre-set text, and manually annotating the recorded speech data to generate training samples. This method is labor-intensive and time-consuming. Summary of the Invention

[0003] In view of this, the embodiments of the present application provide a method and apparatus for obtaining training samples, a computer device, and a storage medium, which solve the problems of high labor costs and long cycles in the process of obtaining training samples in the prior art.

[0004] The first aspect of the present application provides a method for obtaining training samples, including: determining a first text sentence in a user confirmation text based on an n-gram grammar model, the n-gram grammar model is obtained based on preset text training, the n-gram grammar model includes multiple n-gram data units, and the first text sentence includes at least one n-gram data unit; determining a target text sentence based on the first text sentence; performing speech recognition on a speech segment corresponding to the target text sentence to obtain a recognized text; when the matching degree between the recognized text and the target text sentence meets a first preset condition, determining the speech segment marked with the recognized text as a training sample.

[0005] In one embodiment, n metadata units include n consecutive triphone units; the user confirmation text includes at least one text sentence; determining the first text sentence in the user confirmation text based on the n-gram grammar model includes: determining the triphone sentences of at least one text sentence; determining the first triphone sentence in the triphone sentence including at least one n metadata unit; and determining that the text sentence corresponding to the first triphone sentence is the first text sentence.

[0006] In one embodiment, determining a triphone sentence of each of the at least one text sentences includes: determining a monophone sentence of each of the at least one text sentences; and determining a triphone sentence of the monophone sentence.

[0007] In one embodiment, determining the monophone sentence of the at least one text sentence comprises determining the monophone sentence of the at least one text sentence based on a phoneme dictionary, the phoneme dictionary comprising a mapping of characters or words to monophones.

[0008] In one embodiment, determining a triphone sentence of a monophone sentence includes: extracting triphone units in the monophone sentence with three monophones as units and one monophone as a step size; and arranging the triphone units in sequence to obtain a triphone sentence.

[0009] In one embodiment, determining a first triphone sentence including at least one n metadata unit in a triphone sentence includes: sliding matching multiple n metadata units with the triphone sentences respectively; when the matching results are consistent, determining the current triphone sentence as the first triphone sentence.

[0010] In one embodiment, the acquisition method further includes: when the matching results are consistent, determining that the current n metadata units are covering n metadata units, and counting the number of times the matching results corresponding to the covering n metadata units are consistent.

[0011] In one embodiment, after sliding matching is performed on multiple n metadata units with triphone sentences respectively, it also includes: when the matching results of the same n metadata unit in the sliding matching process are inconsistent, determining that the current n metadata unit is an uncovered n metadata unit.

[0012] In one embodiment, determining a target text sentence based on a first text sentence includes: determining the first text sentence as a target text sentence when the coverage of n metadata units in the first text sentence on n metadata units in an n-gram grammar model is greater than or equal to a first threshold.

[0013] In one embodiment, determining the target text sentence based on the first text sentence also includes: when the coverage is less than a first threshold and greater than a second threshold, determining uncovered n metadata units, where the uncovered n metadata units refer to n metadata units not included in the first text sentence; determining n-1 metadata units included in the uncovered n metadata units based on an n-1 grammatical model as target n-1 metadata units, where the n-1 grammatical model is obtained based on preset text training, and the n-1 grammatical model includes multiple n-1 metadata units; determining a second text sentence in the user confirmation text based on the target n-1 metadata unit, where the second text sentence includes at least one target n-1 metadata unit; and determining the first text sentence and the second text sentence together as target text sentences.

[0014] In one embodiment, determining the n-1 metadata unit contained in the uncovered n metadata unit as the target n-1 metadata unit based on the n-1 grammatical model includes: sliding matching the multiple n-1 metadata units with the uncovered n metadata unit respectively; when the matching results are consistent, determining the current n-1 metadata unit as the target n-1 metadata unit.

[0015] In one embodiment, the user confirmation text includes at least one text sentence; determining the second text sentence in the user confirmation text based on the target n-1 metadata unit includes: determining a triphone sentence of each of the at least one text sentence; determining a second triphone sentence in the triphone sentence that includes at least one target n-1 metadata unit; and determining that the text sentence corresponding to the second triphone sentence is the second text sentence.

[0016] In one embodiment, the n-gram grammar model also includes a first probability corresponding to each of the multiple n metadata units, and the n-1-gram grammar model also includes a third probability corresponding to each of the multiple n-1 metadata units; when the matching degree between the recognized text and the target text sentence meets the first preset condition, before determining that the speech segment annotated with the recognized text is a training sample, it also includes: determining that the second probability of the same n metadata unit in the first text sentence and the first probability in the n-gram grammar model meet the second preset condition; determining that the fourth probability of the same n-1 metadata unit in the second text sentence and the third probability in the n-1-gram grammar model meet the third preset condition.

[0017] In one embodiment, determining the target text sentence based on the first text sentence also includes: when the coverage is less than or equal to a second threshold, determining a third text sentence in the user confirmation text based on an n-1 grammatical model, the second threshold is less than the first threshold, the n-1 grammatical model is obtained based on preset text training, the n-1 grammatical model includes multiple n-1 metadata units, and the third text sentence includes at least one n-1 metadata unit; determining the third text sentence as the target text sentence.

[0018] In one embodiment, the user confirmation text includes at least one text sentence; determining the third text sentence in the user confirmation text based on the n-1 grammar model includes: determining a triphone sentence of each of the at least one text sentence; determining a third triphone sentence in the triphone sentence including at least one n-1 metadata unit; and determining that the text sentence corresponding to the third triphone sentence is the third text sentence.

[0019] In one embodiment, the n-1 grammatical model also includes a third probability corresponding to each of the multiple n-1 metadata units; when the matching degree between the recognized text and the target text sentence meets the first preset condition, before determining that the speech segment annotated with the recognized text is a training sample, it also includes: determining that the fifth probability of the same n-1 metadata unit in the third text sentence and the third probability in the n-1 grammatical model meet the fourth preset condition.

[0020] In one embodiment, the n-gram grammar model also includes a first probability of each of multiple n-gram metadata units; when the matching degree between the recognized text and the target text sentence meets the first preset condition, before determining that the speech segment annotated with the recognized text is a training sample, it also includes: determining that the second probability of the same n-gram metadata unit in the target text sentence and the first probability in the n-gram grammar model meet the second preset condition.

[0021] In one embodiment, performing speech recognition on the speech segment corresponding to the first text sentence to obtain the recognized text includes: performing speech recognition on the speech segment using a speech recognition model to obtain the recognized text, and the training sample is used to train the speech recognition model.

[0022] In one embodiment, before determining the first text sentence in the user confirmation text based on the n-gram grammar model, it also includes: obtaining the user confirmation text and voice data from the server; dividing the user confirmation text into at least one text sentence; dividing the voice data into at least one voice segment, and at least one voice segment corresponds one-to-one to at least one text sentence.

[0023] The second aspect of the present application provides a device for obtaining a training sample, including: a first determination module, which determines a first text sentence in a user confirmation text based on an n-gram grammar model, wherein the n-gram grammar model is obtained based on preset text training, the n-gram grammar model includes multiple n-gram data units, and the first text sentence includes at least one n-gram data unit; a second determination module, which determines a target text sentence based on the first text sentence; a recognition module, which performs speech recognition on a speech segment corresponding to the target text sentence to obtain a recognized text; and a third determination module, which determines that the speech segment marked with the recognized text is a training sample when the matching degree between the recognized text and the target text sentence meets a first preset condition.

[0024] In a third aspect, the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executed by the processor. When the processor executes the computer program, the steps of the method for obtaining training samples provided in any of the above embodiments are implemented.

[0025] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the computer program implements the steps of the method for obtaining training samples provided in any of the above embodiments.

[0026] According to the method and apparatus for obtaining training samples, computer equipment, and storage medium provided in the present application, the voice data and user confirmation text in the server are used as data basis, and a first text sentence is extracted from the user confirmation text based on an n-gram model. The n-gram model includes multiple n-gram units, and the first text sentence includes at least one n-gram unit. The target text sentence is determined based on the first text sentence, and the voice segment corresponding to the target text sentence is obtained. The above process can replace the process of manual voice recording. Furthermore, voice recognition is performed on the voice segment. If the recognized text is consistent with the user confirmation text, the annotation is considered successful. At this point, a voice segment annotated with the recognized text is obtained, i.e., a training sample. The entire process does not require human participation to obtain training samples related to the business scenario, reducing the labor cost and cycle time for obtaining training samples. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 A flowchart of the method for obtaining training samples provided in the first embodiment of the present application.

[0028] Figure 2 A flowchart of a method for obtaining training samples provided in the second embodiment of the present application.

[0029] Figure 3 This is a schematic diagram of the specific execution process of step S110 provided in one embodiment of the present application.

[0030] Figure 4 A flowchart of a method for obtaining training samples provided in the third embodiment of the present application.

[0031] Figure 5 A schematic diagram of the execution process of step S422 provided in an embodiment of the present application.

[0032] Figure 6 A schematic diagram of the execution process of step S423 provided in one embodiment of the present application.

[0033] Figure 7 A flowchart of a method for obtaining training samples provided in the fourth embodiment of the present application.

[0034] Figure 8 This is a structural block diagram of an acquisition device provided in one embodiment of the present application.

[0035] Figure 9 This is a structural block diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0036] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0037] Application Overview

[0038] With the rapid development of artificial intelligence (AI) technology, a wide range of intelligent terminal devices are emerging. Voice, as a crucial component of human-computer interaction, is widely used across all types of devices. Consequently, users are increasingly accustomed to expressing their needs through voice, rather than relying solely on pinyin or handwriting. For example, in current chat or search scenarios, more users prefer to voice-enter their needs. To avoid potential errors in direct voice input, they also confirm the voice recognition content before sending it. During this process, terminal devices generate a massive amount of voice data and the corresponding user confirmation text.

[0039] An n-gram model (n can be any positive integer) is a probability-based discriminative model consisting of n metadata units and their corresponding probabilities. These units are extracted from training examples during n-gram training. For example, if the training example is "I love deep learning," the bigram metadata units in the bigram model are: {I love}, {love deep}, {deep learning}, and the trigram metadata units in the trigram model are: {I love deep}, {love deep learning}.

[0040] The method and apparatus for obtaining training samples, computer equipment, and storage medium provided in the present application use the voice data and user confirmation text in the server as data basis, and extract the first text sentence from the user confirmation text based on the n-gram model. The n-gram model is obtained based on the preset text training in the business scenario. The n-gram model includes multiple n-gram data units, and the first text sentence includes at least one n-gram data unit. The target text sentence is determined based on the first text sentence, for example, the first text sentence is directly used as the target text sentence. The speech segment corresponding to the target text sentence is obtained. At this point, the speech segment related to the preset text is obtained. The above process can replace the process of manual voice recording. Further, speech recognition is performed on the speech segment. If the recognized text is consistent with the user confirmation text, the annotation is considered successful. This process can replace the process of manual annotation. At this point, a speech segment annotated with the recognized text, i.e., a training sample, is obtained. The entire process does not require manual participation to obtain training samples related to the business scenario, reducing the labor cost and cycle time of obtaining training samples.

[0041] Exemplary Methods

[0042] Figure 1 This is a flow chart of a method for obtaining training samples provided in the first embodiment of the present application. The method can be applied to electronic devices, such as servers or mobile terminals. Figure 1 As shown, the acquisition method 100 includes the following steps:

[0043] Step S110: Determine a first text sentence in the user confirmation text based on an n-gram model. The n-gram model is trained based on a preset text and includes multiple n-gram units. The first text sentence includes at least one n-gram unit.

[0044] The preset text is data related to the business scenario, that is, the basis for manually recorded audio. The process of training the n-gram grammar model based on the preset text, that is, the process of extracting n metadata units from the preset text and counting the probability of the occurrence of n metadata units, the obtained n-gram grammar model includes the correspondence between n metadata units and probabilities. The n mentioned here can be any positive integer. When the value of n is different, the amount of information contained in the n metadata unit is different. For example, the n metadata unit contains n consecutive triphone units. For another example, the n metadata unit contains n consecutive Chinese characters. For another example, the n metadata unit contains n consecutive letters.

[0045] According to step S110, a first text sentence in the user confirmation text containing at least one n metadata unit is determined. That is, the text sentence in the user confirmation text containing at least one n metadata unit is extracted as the first text sentence. The first text sentence and the preset text contain the same information, namely, the n metadata units.

[0046] Step S120: Determine a target text sentence based on the first text sentence. In one example, the first text sentence is determined as the target text sentence.

[0047] Step S130 , performing speech recognition on the speech segment corresponding to the target text sentence to obtain a recognized text.

[0048] The server stores the user confirmation text and the corresponding voice data. Before executing step S110, the user confirmation text and the corresponding voice data can be obtained from the server. Afterwards, the user confirmation text is divided into at least one text sentence, and the voice data is divided into at least one voice segment, and the at least one voice segment corresponds to the at least one text sentence. In one embodiment, the user confirmation text is divided into at least one text sentence based on punctuation marks, and the punctuation marks mentioned here are, for example, commas and periods, that is, the text between two adjacent commas, or a comma and a period is divided into one text sentence. In this case, after the first text sentence is determined, the voice segment corresponding to the first text sentence can be directly obtained, and then the voice segment can be speech recognized.

[0049] In one embodiment, a speech recognition model is used to perform speech recognition on speech data to obtain recognized text. The training samples obtained according to the acquisition method 100 can be used to train the speech recognition model to make the speech recognition model applicable to more application scenarios.

[0050] Step S140 : When the matching degree between the recognition text and the target text sentence meets a first preset condition, the speech segment marked with the recognition text is determined as a training sample.

[0051] The user confirmation text may or may not completely match the voice data corresponding to it in the server. For example, after the user inputs voice, the recognized text content is consistent with the voice content input by the user, and the user directly confirms and sends it. In this case, the user confirmation text and voice data completely match. For another example, after the user inputs voice, the recognized text content is inconsistent with the voice content input by the user, and the user modifies the recognized text content and sends it. In this case, the user confirmation text and voice data do not completely match. In order to ensure that the target text sentence and the acquired voice segment completely match, the matching degree between the recognized text and the target text sentence can be measured. When the matching degree meets the first preset condition, it is considered that the target text sentence and the acquired voice segment completely match, and can be used as a training sample.

[0052] In one embodiment, a text matching algorithm is used to perform similarity matching between the recognition text and the target text sentences. When the similarity is greater than or equal to a similarity threshold, the speech segment marked with the recognition text is determined to be a training sample.

[0053] According to the method for obtaining training samples provided in this embodiment, the voice data and user confirmation text in the server are used as data basis, and a first text sentence is extracted from the user confirmation text based on an n-gram grammar model. The n-gram grammar model is obtained based on the preset text training in the business scenario. The n-gram grammar model includes multiple n-gram metadata units, and the first text sentence includes at least one n-gram metadata unit. The target text sentence is determined based on the first text sentence, for example, the first text sentence is directly used as the target text sentence. The voice segment corresponding to the target text sentence is obtained. At this point, a voice segment related to the preset text is obtained. The above process can replace the process of manual voice recording. Further, voice recognition is performed on the voice segment. If the recognized text is consistent with the user confirmation text, the annotation is considered successful. This process can replace the process of manual annotation. At this point, a voice segment annotated with the recognized text is obtained, that is, a training sample. The entire process does not require human participation to obtain training samples related to the business scenario, reducing the labor cost and cycle time of obtaining training samples.

[0054] Figure 2 The flowchart of the method for obtaining training samples provided in the second embodiment of the present application is as follows. Figure 1 The acquisition method 100 further includes the step of training an n-gram model, specifically including:

[0055] Step S210: pre-process the preset text to obtain a triphone sentence of the preset text.

[0056] For example, the preset text includes a text sentence, and the text sentence is: Sleep On.

[0057] First, based on the phoneme dictionary, the monophone sentence corresponding to the preset text is determined to be: sil x iou1 m ian2 kai1 sil, where sil represents a silent symbol, and the numbers "1" and "2" represent tones.

[0058] A phoneme, the smallest unit or segment of speech that makes up a syllable, is the smallest linear unit of speech, defined from a sound quality perspective. A phoneme dictionary maps a character or word to a single phoneme. Silences are added by recognizing punctuation marks. This can be done before or after matching the phoneme dictionary.

[0059] Secondly, the three-phoneme sentence constructed based on the monophone sentence is: sil-x+iou1 x-iou1+m iou1-m+ian2m-ian2+k ian2-k+ai1 k-ai1+sil, where the monophone between “-” and “+” represents the current monophone; “-” represents the previous monophone adjacent to the current monophone, and “+” represents the next monophone adjacent to the current monophone.

[0060] Specifically, three monophones are used as units and one monophone is used as a step size to extract triphone units from a monophone sentence, and the triphone units are arranged in sequence to obtain a triphone sentence.

[0061] Step S220: training an n-gram model based on the triphone sentence.

[0062] Taking the tetragram model as an example, tetragram data units are extracted from a triphone sentence according to the extraction rule of four triphone units in length and one triphone unit in step length, resulting in three tetragram data units: sil-x+iou1 x-iou1+m iou1-m+ian2 m-ian2+k, x-iou1+m iou1-m+ian2 m-ian2+k ian2-k+ai1, and iou1-m+ian2 m-ian2+k ian2-k+ai1 k-ai1+sil. Each tetragram data unit includes four consecutive triphone units. Furthermore, the probability of occurrence of each of the multiple tetragram data units is calculated to obtain a tetragram model. The tetragram model includes the corresponding relationship between the tetragram data units in the preset text and their probabilities. For example, in this embodiment, the probability of each of the three tetragram data units is 1 / 3.

[0063] When the preset text is "Sleep On," the training process for the above grammar model yields a tri-gram model consisting of four tri-gram data units: sil-x+iou1 x-iou1+m iou1-m+ian2, x-iou1+m iou1-m+ian2 m-ian2+k, iou1-m+ian2 m-ian2+k ian2-k+ai1, and m-ian2+k ian2-k+ai1 k-ai1+sil. The bigram model consists of five bigram data units: sil-x+iou1 x-iou1+m, x-iou1+m iou1-m+ian2, iou1-m+ian2 m-ian2+k, m-ian2+k ian2-k+ai1, and ian2-k+ai1 k-ai1+sil. The data units for the unigram model and quintuple model can be obtained similarly and are not detailed here.

[0064] Figure 3This is a schematic diagram of the specific execution process of step S110 provided in an embodiment of the present application. Figure 3 As shown, step S110 includes:

[0065] Step S311 : determining whether at least one text sentence in the user confirmation text is a triphone sentence.

[0066] For example, the user confirmation text includes a text sentence: "Sleep Mode." Based on the phoneme dictionary, the monophone sentence of the text sentence is determined to be: sil x iou1 m ian2 m o2 sh iii4 sil. The triphone sentence of the monophone sentence is determined to be: sil-x+iou1 x-iou1+m iou1-m+ian2 m-ian2+m ian2-m+o2 m-o2+sh o2-sh+iii4 sh-iii4+sil.

[0067] Step S312: determining a first triphone sentence including at least one n metadata unit in the triphone sentence.

[0068] First, the n-gram units in the n-gram model are matched with the triphone sentences respectively.

[0069] For example, the n-gram model is Figure 2 In the trigram model in the illustrated embodiment, the trigram data units include: sil-x+iou1 x-iou1+m iou1-m+ian2, x-iou1+m iou1-m+ian2 m-ian2+k, iou1-m+ian2 m-ian2+k ian2-k+ai1, and m-ian2+k ian2-k+ai1 k-ai1+sil. Each trigram data unit in the trigram model is slidingly matched with a triphone sentence, i.e., sil-x+iou1 x-iou1+m iou1-m+ian2 m-ian2+m ian2-m+o2 m-o2+sh o2-sh+iii4 sh-iii4+sil, with a step size of one triphone unit.

[0070] Secondly, when the matching results are consistent, the current triphone sentence is determined to be the first triphone sentence.

[0071] After sliding matching, the matching results of the triple data unit sil-x+iou1 x-iou1+m iou1-m+ian2 and the triphone sentence are consistent, so the current triphone sentence, that is, sil-x+iou1 x-iou1+m iou1-m+ian2 m-ian2+m ian2-m+o2 m-o2+sh o2-sh+iii4 sh-iii4+sil, is determined to be the first triphone sentence.

[0072] Step S313: Determine that the text sentence corresponding to the first triphone sentence is the first text sentence.

[0073] The text sentence corresponding to the first three-phoneme sentence, ie, the sleep mode, is the first text sentence.

[0074] In this case, the first text sentence includes one triple metadata unit, namely, sil-x+iou1 x-iou1+miou1-m+ian2, and the tri-gram model includes four triple metadata units. Therefore, the coverage of the triple metadata unit in the first text sentence over the triple metadata units in the tri-gram model is equal to 1 / 4. Depending on the coverage of the n metadata units in the first text sentence over the n metadata units in the n-gram model, step S120 can be performed according to different strategies.

[0075] Figure 4 This is a flow chart of the method for obtaining training samples provided in the third embodiment of the present application. Figure 4 As shown, the acquisition method 400 and Figure 1 The difference of the acquisition method 100 is that, in this embodiment, step S120 is specifically performed as follows:

[0076] Step S421 : When the coverage of n metadata units included in the first text sentence on n metadata units in the n-gram grammar model is greater than or equal to a first threshold, the first text sentence is determined to be a target text sentence.

[0077] When the coverage is greater than or equal to the first threshold, that is, the user confirms that the text substantially contains all the data units in the n-gram model, indicating that the currently selected n-gram model is appropriate, in this case, the first text sentence is determined to be the target text sentence.

[0078] For example, the first threshold is 20%. Figure 3 In the illustrated embodiment, the n-gram model is a tri-gram model, the coverage is equal to 1 / 4, and the coverage is greater than the first threshold value. It is considered that the user confirmation text basically contains all the data units in the tri-gram model, and the first text sentence is determined to be the target text sentence.

[0079] Step S422: When the coverage is less than the first threshold and greater than the second threshold, determine the second text sentence in the user confirmation text based on n metadata units not included in the first text sentence; and determine the first text sentence and the second text sentence as target text sentences.

[0080] The coverage of the n metadata units contained in the first text sentence is less than the first threshold and greater than the second threshold, indicating that the first text sentence contains most of the data units in the preset text. In this case, the user confirmation text is secondary extracted using the n-1 metadata units contained in the n metadata units not covered by the first text sentence (i.e., the uncovered n metadata units, the same below), to obtain a second text sentence. The second text sentence and the first text sentence are used together as the target text sentence, so that the target text sentence is closer to the preset text.

[0081] Step S423: When the coverage is less than or equal to the second threshold, determine a third text sentence in the user confirmation text based on the n-1 grammar model, where the third text sentence includes at least one n-1 metadata unit; and determine the third text sentence as the target text sentence.

[0082] When the coverage is less than or equal to the second threshold, it indicates that it is difficult to find a sentence containing n metadata units in the user confirmation text. In this case, text sentences containing n-1 metadata units are extracted from the user confirmation text.

[0083] It should be noted that, in a specific implementation, step S120 may only include at least one execution process of step S421, step S422 and step S423.

[0084] Figure 5 This is a schematic diagram of the execution process of step S422 provided in one embodiment of the present application. Figure 5 As shown, step S422 includes:

[0085] Step S5221: When the coverage is less than the first threshold and greater than the second threshold, it is determined that n metadata units are not covered, and the uncovered n metadata units refer to n metadata units not included in the first text sentence.

[0086] In one embodiment, when the coverage is less than the first threshold and greater than the second threshold, the uncovered n metadata unit is directly obtained. The uncovered n metadata unit may be obtained during the execution of step S312. Specifically, as described above, the execution of step S312 includes: matching the n metadata units in the n-gram grammar model with the triphone sentences respectively; when the matching results are consistent, determining that the current triphone sentence is the first triphone sentence. In this embodiment, the execution of step S312 also includes: when the matching results of the same n metadata unit in the matching process are inconsistent, determining that the current n metadata unit is an uncovered n metadata unit.

[0087] Step S5222: Determine n-1 metadata units that are not covered by n metadata units based on the n-1 gram model as target n-1 metadata units. The n-1 gram model is trained based on a preset text and includes multiple n-1 metadata units.

[0088] The n-1 metadata units in the n-1 gram model are filtered using the uncovered n metadata units, and the n-1 metadata units contained in the uncovered n metadata units are retained as the target n-1 metadata units. Specifically, the n-1 metadata units in the n-1 gram model are slidingly matched with the uncovered n metadata units respectively; when the matching results are consistent, the current n-1 metadata unit is determined to be the target n-1 metadata unit.

[0089] Step S5223: Determine a second text sentence in the user confirmation text based on the target n-1 metadata unit, where the second text sentence includes at least one target n-1 metadata unit.

[0090] Specifically, a triphone sentence of at least one text sentence in the user confirmation text is determined; a second triphone sentence including at least one target n-1 metadata unit is determined in the triphone sentence; and the text sentence corresponding to the second triphone sentence is determined to be the second text sentence.

[0091] Step S5224: Take the first text sentence and the second text sentence together as the target text sentence.

[0092] The following is a specific example Figure 5 The execution process of step S422 is shown.

[0093] For example, the n-gram model is Figure 3The trigram model shown in FIG. 4 includes the following trigram units: sil-x+iou1 x-iou1+m iou1-m+ian2, x-iou1+m iou1-m+ian2 m-ian2+k, iou1-m+ian2 m-ian2+k ian2-k+ai1, m-ian2+k ian2-k+ai1 k-ai1+sil. The user confirmation text is: Sleep on. The triphone sentence corresponding to the user confirmation text is: sil-x+iou1 x-iou1+m iou1-m+ian2 m-ian2+kian2-k+ai1 k-ai1+q ai1-q+i3 q-i3+sil". After sliding matching, it can be seen that the user confirmation text contains: sil-x+iou1 x-iou1+m iou1-m+ian2, x-iou1+m iou1-m+ian2 m-ian2+k, iou1-m+ian2 m-ian2+k ian2-k+ai1. In this case, the first text sentence is, and the uncovered four-phonetic units include: sil-x+iou1x-iou1+m iou1-m+ian2 m-ian2+k, x-iou1+m iou1-m+ian2 m-ian2+k ian2-k+ai1, iou1-m+ian2 m-ian2+k ian2-k+ai1 k-ai1+sil.

[0094] The three-tuple data units in the trigram model include: sil-x+iou1 x-iou1+m iou1-m+ian2, x-iou1+m iou1-m+ian2 m-ian2+k, iou1-m+ian2 m-ian2+k ian2-k+ai1, m-ian2+k ian2-k+ai1 k-ai1+sil. These three-tuple data units are sliding matched with the uncovered four-tuple data units, and the target three-tuple data units are determined to include: sil-x+iou1 x-iou1+m iou1-m+ian2, x-iou1+m iou1-m+ian2 m-ian2+k, iou1-m+ian2 m-ian2+k ian2-k+ai1, m-ian2+k ian2-k+ai1 k-ai1+sil.

[0095] The above target three-phoneme data unit is matched with the three-phoneme sentences corresponding to the user confirmation text. It can be seen that sil-x+iou1 x-iou1+m iou1-m+ian2 appears in both the target three-phoneme data unit and the three-phoneme sentence, then "sleep mode" is determined to be the second text sentence.

[0096] At this point, it can be determined that the target text sentence is: sleep mode.

[0097] Figure 6 This is a schematic diagram of the execution process of step S423 provided in one embodiment of the present application. Figure 6 As shown, step S423 includes:

[0098] Step S6231: When the coverage is less than or equal to the second threshold, determine a third text sentence in the user confirmation text based on the n-1 grammatical model, where the third text sentence includes at least one n-1 metadata unit, and the second threshold is less than the first threshold.

[0099] Step S6232: Determine the third text sentence as the target text sentence.

[0100] The following is a specific example Figure 6 The execution process of step S423 is shown.

[0101] For example, the second threshold is 20%. The n-gram model is Figure 3 The four-gram grammar model shown in the figure includes four-gram data units: sil-x+iou1 x-iou1+m iou1-m+ian2 m-ian2+k, x-iou1+m iou1-m+ian2 m-ian2+k ian2-k+ai1, iou1-m+ian2 m-ian2+k ian2-k+ai1 k-ai1+sil. The user confirmation text is: sleep mode, and its corresponding three-phoneme sentence is: sil-x+iou1 x-iou1+m iou1-m+ian2 m-ian2+mian2-m+o2 m-o2+sh o2-sh+iii4 sh-iii4+sil. After sliding matching, it can be seen that the user confirmation text does not contain any four-gram data units. In this case, the first text sentence does not exist in the user confirmation text, and the coverage is zero, which is less than the second threshold.

[0102] The uncovered quadruple data units are determined to include: sil-x+iou1 x-iou1+m iou1-m+ian2 m-ian2+k, x-iou1+m iou1-m+ian2 m-ian2+k ian2-k+ai1, iou1-m+ian2 m-ian2+k ian2-k+ai1 k-ai1+sil.

[0103] A trigram model is used to perform secondary extraction on the user confirmation text. The trigram data units in the trigram model include: sil-x+iou1 x-iou1+m iou1-m+ian2, x-iou1+m iou1-m+ian2 m-ian2+k, iou1-m+ian2 m-ian2+k ian2-k+ai1, and m-ian2+k ian2-k+ai1 k-ai1+sil. These trigram data units are matched with the triphone sentences corresponding to the user confirmation text. It is found that sil-x+iou1 x-iou1+m iou1-m+ian2 appears in both the trigram model and the triphone sentence, indicating that "sleep mode" is the third text sentence.

[0104] At this point, it can be determined that the target text sentence is: sleep mode.

[0105] Figure 7 This is a flow chart of the method for obtaining training samples provided in the fourth embodiment of the present application. Figure 7 As shown, the acquisition method 700, based on the acquisition method provided in any of the above embodiments, further includes: when the matching degree between the recognition text and the target text sentence meets the first preset condition, determining whether the probability distribution of the data unit in the target text sentence is similar to the probability distribution of the data unit in the grammatical model. Figure 4 Taking the acquisition method shown as an example, the n-gram grammar model includes a first probability corresponding to n metadata units, and the n-1-gram grammar model includes a third probability corresponding to n-1 metadata units.

[0106] When step S120 is executed as step S421, Figure 7 As shown, the acquisition method 700 further includes:

[0107] Step S710 : When the matching degree between the recognized text and the target text sentence satisfies the first preset condition, determining that the second probability of the same n-gram unit in the target text sentence and the first probability in the n-gram grammar model satisfy the second preset condition.

[0108] Specifically, the number of occurrences of the n metadata units in the first text sentence is obtained. The number of occurrences can be obtained during the execution of step S112. Specifically, as described above, the execution of step S312 includes: matching the n metadata units in the n-gram grammar model with the triphone sentences respectively; when the matching results are consistent, determining that the current triphone sentence is the first triphone sentence. In this embodiment, the execution of step S312 also includes: when the matching results are consistent, determining that the current n metadata units are covering n metadata units, and counting the number of matching results corresponding to the covering n metadata units that are consistent. The probability of the n metadata units in the first text sentence is the ratio of the number of times corresponding to each covering n metadata unit to the sum of the number of times corresponding to all covering n metadata units.

[0109] Determine whether the second probability of the same n-gram unit in the target text sentence and the first probability in the n-gram grammar model meet a second preset condition, for example, determining whether the difference between the second probability and the first probability is less than or equal to a probability difference threshold. In this case, the speech segment annotated with the recognition text is determined as a training sample.

[0110] When step S120 is executed as step S422, as shown in FIG. Figure 7 As shown, the acquisition method 700 further includes:

[0111] Step S720: When the matching degree between the recognized text and the target text sentence satisfies the first preset condition, determining that the second probability of the same n-1 metadata unit in the first text sentence and the first probability in the n-1 grammatical model satisfy the second preset condition; determining that the fourth probability of the same n-1 metadata unit in the second text sentence and the third probability in the n-1 grammatical model satisfy the third preset condition.

[0112] Specifically, the process for determining the second probability is the same as step S710 and will not be repeated here. The steps for determining the fourth probability are similar to those for determining the second probability, for example, including obtaining the number of occurrences of the target n-1 metadata unit in the second text sentence. The n-1 metadata units contained in the second text sentence are denoted as covered n-1 metadata units. The fourth probability is equal to the ratio of the number of occurrences corresponding to each covered n-1 metadata unit to the sum of the number of occurrences corresponding to all covered n-1 metadata units.

[0113] Determine whether the second probability of the same n-1 metadata unit in the target text sentence and the first probability in the n-1 gram model satisfy a second preset condition, for example, by determining that the difference between the second probability and the first probability is less than or equal to a probability difference threshold. Determine whether the fourth probability of the same n-1 metadata unit in the target text sentence and the third probability in the n-1 gram model satisfy a third preset condition, for example, by determining that the difference between the fourth probability and the third probability is less than or equal to the probability difference threshold. In this case, the speech segment annotated with the recognition text is determined as a training sample.

[0114] When step S120 is executed as step S423, Figure 7 As shown, the acquisition method 700 further includes:

[0115] Step S730: When the matching degree between the recognized text and the target text sentence satisfies the first preset condition, determining whether the fifth probability of the same n-1 metadata unit in the third text sentence and the third probability in the n-1 grammatical model satisfy the fourth preset condition.

[0116] Specifically, the fifth probability is determined similarly to the second probability, for example, including obtaining the number of occurrences of n-1 metadata units in the third text sentence. The n-1 metadata units contained in the third text sentence are referred to as covered n-1 metadata units. The fifth probability is then equal to the ratio of the number of occurrences of each covered n-1 metadata unit to the sum of the number of occurrences of all covered n-1 metadata units.

[0117] According to the acquisition method provided by this embodiment, when the matching degree between the recognition text and the target text sentence meets the first preset condition, it is determined whether the probability distribution of the data unit in the target text sentence and the probability distribution of the data unit in the grammatical model are similar. If they are similar, the speech segment marked with the recognition text is determined to be a training sample, which can further improve the similarity between the training sample and the preset text.

[0118] Exemplary devices

[0119] This application also provides a device for acquiring training samples. Figure 8 This is a structural block diagram of an acquisition device provided in one embodiment of the present application. Figure 8As shown, the acquisition device 800 includes: a first determination module 810, a second determination module 820, a recognition module 830 and a third determination module 840. Among them, the first determination module 810 is used to determine the first text sentence in the user confirmation text based on the n-gram grammar model. The n-gram grammar model is obtained based on preset text training, the n-gram grammar model includes multiple n-gram metadata units, and the first text sentence includes at least one n-gram metadata unit. The second determination module 820 is used to determine the target text sentence based on the first text sentence. The recognition module 830 is used to perform speech recognition on the speech segment corresponding to the target text sentence to obtain a recognized text. The third determination module 840 is used to determine that the speech segment marked with the recognized text is a training sample when the matching degree between the recognized text and the target text sentence meets the first preset condition.

[0120] In one embodiment, the acquisition device 800 further includes a training module for training at least one grammar model based on a preset text. Specifically, the training module is configured to preprocess the preset text to obtain a triphone sentence of the preset text. The at least one n-gram grammar model is trained based on the triphone sentence.

[0121] In one embodiment, the first determination module 810 includes a first determination unit, a second determination unit, and a third determination unit. The first determination unit is configured to determine whether at least one text sentence in the user confirmation text is a triphone sentence. The second determination unit is configured to determine whether the triphone sentence includes at least one n-metadata unit. The third determination unit is configured to determine whether the text sentence corresponding to the first triphone sentence is the first text sentence.

[0122] In one embodiment, the second determination module 820 includes a third determination unit, a fourth determination unit, and a fifth determination unit. The third determination unit is used to determine that the first text sentence is a target text sentence when the coverage of the n metadata units contained in the first text sentence on the n metadata units in the n-gram grammar model is greater than or equal to a first threshold. The fourth determination unit is used to determine the second text sentence in the user confirmation text based on the n metadata units not contained in the first text sentence when the coverage is less than the first threshold and greater than the second threshold; and determine that the first text sentence and the second text sentence are target text sentences. The fifth determination unit is used to determine the third text sentence in the user confirmation text based on the n-1 grammar model when the coverage is less than or equal to the second threshold, the third text sentence including at least one n-1 metadata unit; and determine that the third text sentence is a target text sentence.

[0123] In one example, the fourth determination unit is specifically used to determine the uncovered n metadata units when the coverage is less than the first threshold and greater than the second threshold, where the uncovered n metadata units refer to the n metadata units not included in the first text sentence. The n-1 metadata units included in the uncovered n metadata units are determined based on the n-1 grammatical model as the target n-1 metadata units. The n-1 grammatical model is obtained based on preset text training, and the n-1 grammatical model includes multiple n-1 metadata units. The second text sentence in the user confirmation text is determined based on the target n-1 metadata unit, and the second text sentence includes at least one target n-1 metadata unit. The first text sentence and the second text sentence are collectively used as the target text sentences.

[0124] In one example, the fifth determining unit is specifically configured to, when the coverage is less than or equal to the second threshold, determine, based on the n-1-gram model, a third text sentence in the user confirmation text, where the third text sentence includes at least one n-1 metadata unit, and the second threshold is less than the first threshold, and determine the third text sentence as the target text sentence.

[0125] In one embodiment, the acquisition device 800 also includes a fourth determination module for determining whether the probability distribution of the data unit in the target text sentence is similar to the probability distribution of the data unit in the grammatical model when the matching degree between the recognized text and the target text sentence meets the first preset condition.

[0126] In one example, the fourth determination module includes a sixth determination unit, a seventh determination unit, and an eighth determination unit. The sixth determination unit is used to determine that the second probability of the same n-1 metadata unit in the target text sentence and the first probability in the n-1 grammar model meet the second preset condition when the matching degree between the recognized text and the target text sentence meets the first preset condition. The seventh determination unit is used to determine that the second probability of the same n-1 metadata unit in the first text sentence and the first probability in the n-1 grammar model meet the second preset condition when the matching degree between the recognized text and the target text sentence meets the first preset condition; and determine that the fourth probability of the same n-1 metadata unit in the second text sentence and the third probability in the n-1 grammar model meet the third preset condition. The eighth determination unit is used to determine that the fifth probability of the same n-1 metadata unit in the third text sentence and the third probability in the n-1 grammar model meet the fourth preset condition when the matching degree between the recognized text and the target text sentence meets the first preset condition.

[0127] The training sample acquisition device provided in this embodiment and the training sample acquisition method provided in the embodiments of this application are based on the same application concept and can execute the training sample acquisition method provided in any embodiment of this application. It has the corresponding functional modules and beneficial effects of executing the training sample acquisition method. For technical details not fully described in this embodiment, please refer to the training sample acquisition method provided in the embodiments of this application and will not be repeated here.

[0128] Exemplary electronic devices

[0129] Figure 9 This is a block diagram of the structure of an electronic device provided in one embodiment of the present application. The electronic device may be a server or a mobile terminal. The mobile terminal may be a mobile phone, a computer, a palm reader, etc. Figure 9 As shown, electronic device 900 includes one or more processors 910 and memory 920 .

[0130] The processor 910 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 900 to perform desired functions.

[0131] The memory 920 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), a hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 11 may execute the program instructions to implement the training sample acquisition methods of the various embodiments of the present application described above and / or other desired functions. The computer-readable storage medium may also store various contents such as input signals, signal components, and noise components.

[0132] In one example, the electronic device 900 may further include an input device 930 and an output device 940 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0133] For example, the input device 930 may be a microphone or a microphone array for capturing input signals from a sound source. In addition, the input device 930 may also include, for example, a keyboard, a mouse, and the like.

[0134] The output device 940 can output various information to the outside, including determined distance information, direction information, etc. The output device 940 can include, for example, a display, a speaker, a printer, a communication network and its connected remote output device, etc.

[0135] Of course, to simplify, Figure 9 Only some of the components related to the present application in the electronic device 900 are shown, and components such as buses, input / output interfaces, etc. are omitted. In addition, the electronic device 900 may further include any other appropriate components according to specific application scenarios.

[0136] Exemplary computer program products and computer-readable storage media

[0137] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions. When the computer program instructions are executed by a processor, the processor executes the steps of the method for obtaining training samples according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.

[0138] The computer program product may be written in any combination of one or more programming languages to implement the program code for performing the operations of the embodiments of the present application, including object-oriented programming languages such as Java, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0139] In addition, an embodiment of the present application may also be a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by the processor, the processor 11 executes the steps of the method for obtaining training samples according to various embodiments of the present application described in the above “Exemplary Method” section of this specification.

[0140] The computer-readable storage medium may be any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0141] The basic principles of the present application have been described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, and effects mentioned in this application are merely illustrative and not restrictive, and it should not be assumed that these advantages, strengths, and effects are required of each embodiment of this application. In addition, the specific details disclosed above are merely illustrative and facilitating understanding, and are not restrictive. The above details do not limit this application to necessarily being implemented using the above specific details.

[0142] The block diagrams of the devices, devices, equipment, and systems involved in this application are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, devices, equipment, and systems can be connected, arranged, or configured in any manner. Words such as "include," "comprise," "have," and the like are open-ended words, meaning "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or" and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.

[0143] It should also be noted that in the apparatus, device, and method of the present application, each component or each step can be decomposed and / or recombined, and such decomposition and / or recombination should be regarded as equivalent solutions of the present application.

[0144] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to be accorded the widest scope consistent with the principles and novel features disclosed herein.

[0145] It should be understood that the qualifiers "first", "second", "third", "fourth", "fifth" and "sixth" used in the description of the embodiments of the present application are only used to more clearly explain the technical solutions and cannot be used to limit the scope of protection of the present application.

[0146] The above description has been provided for the purpose of illustration and description. Furthermore, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although a number of example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.

Claims

1. A method for obtaining training samples, characterized in that: include: Determining a first text sentence in the user confirmation text based on an n-gram model, wherein the n-gram model is obtained by training based on a preset text, the n-gram model includes a plurality of n-gram units, and the first text sentence includes at least one of the n-gram units; determining a target text sentence based on the first text sentence; Performing speech recognition on the speech segment corresponding to the target text sentence to obtain a recognized text; When the matching degree between the recognition text and the target text sentence satisfies a first preset condition, determining the speech segment marked with the recognition text as the training sample; The n-gram units include n consecutive triphone units; the user confirmation text includes at least one text sentence; and determining the first text sentence in the user confirmation text based on the n-gram grammar model includes: determining a triphone sentence of each of the at least one text sentence; determining a first triphone sentence in the triphone sentence that includes at least one of the n-gram units; and determining that the text sentence corresponding to the first triphone sentence is the first text sentence. Among them, determining the first triphone sentence including at least one of the n metadata units in the triphone sentence includes: sliding matching the multiple n metadata units with the triphone sentences respectively; when the matching results are consistent, determining that the current triphone sentence is the first triphone sentence.

2. The method for obtaining training samples according to claim 1, characterized in that: Determining the triphone sentence of each of the at least one text sentence comprises: determining a monophone sentence for each of the at least one text sentence; A triphone sentence of the monophone sentence is determined.

3. The acquisition method according to claim 2, characterized in that Determining the monophone sentence of each of the at least one text sentence comprises: A monophone sentence of each of the at least one text sentence is determined based on a phoneme dictionary, the phoneme dictionary including a mapping of characters or words to monophones.

4. The acquisition method according to claim 2, characterized in that Determining the triphone sentence of the monophone sentence comprises: extracting triphone units in the monophone sentence with three monophones as units and one monophone as a step size; The triphone units are arranged in sequence to obtain the triphone sentence.

5. The acquisition method according to claim 1, characterized in that Also includes: When the matching results are consistent, the current n metadata units are determined to be covering n metadata units, and the number of times the matching results corresponding to the covering n metadata units are consistent is counted.

6. The acquisition method according to claim 1 or 5, characterized in that: After sliding matching the plurality of n metadata units with the triphone sentences respectively, the method further includes: When the matching results of the same n metadata units in the sliding matching process are all inconsistent, it is determined that the current n metadata units are uncovered n metadata units.

7. The acquisition method according to any one of claims 1 to 5, wherein determining the target text sentence based on the first text sentence comprises: When the coverage of the n metadata units in the first text sentence on the n metadata units in the n-gram grammar model is greater than or equal to a first threshold, the first text sentence is determined to be the target text sentence.

8. The acquisition method according to claim 7, characterized in that: The determining of the target text sentence based on the first text sentence further includes: When the coverage is less than the first threshold and greater than a second threshold, determining that n metadata units are not covered, the uncovered n metadata units refer to the n metadata units not included in the first text sentence; Determining, based on an n-1 gram model, n-1 metadata units included in the uncovered n metadata units as target n-1 metadata units, wherein the n-1 gram model is obtained by training based on the preset text and includes a plurality of the n-1 metadata units; determining a second text sentence in the user confirmation text based on the target n-1 metadata unit, the second text sentence including at least one of the target n-1 metadata unit; The first text sentence and the second text sentence are determined to be the target text sentence.

9. The acquisition method according to claim 8, characterized in that: The determining, based on the n-1-gram grammar model, n-1 metadata units included in the uncovered n metadata units as target n-1 metadata units includes: Perform sliding matching on the plurality of n-1 metadata units and the uncovered n metadata units respectively; When the matching results are consistent, the current n-1 metadata unit is determined to be the target n-1 metadata unit.

10. The acquisition method according to claim 8, characterized in that: The user confirmation text includes at least one text sentence; and determining a second text sentence in the user confirmation text based on the target n-1 metadata unit includes: determining a triphone sentence for each of the at least one text sentence; determining a second triphone sentence in the triphone sentence including at least one of the target n-1 metadata units; Determine that the text sentence corresponding to the second triphone sentence is the second text sentence.

11. The acquisition method according to claim 8, characterized in that: The n-gram model further includes a first probability corresponding to each of the plurality of n metadata units, and the n-1-gram model further includes a third probability corresponding to each of the plurality of n-1 metadata units; when the degree of matching between the recognized text and the target text sentence satisfies a first preset condition, before determining that the speech segment annotated with the recognized text is the training sample, the method further includes: Determining that a second probability of the same n-gram unit in the first text sentence and the first probability in the n-gram grammar model satisfy a second preset condition; It is determined that the fourth probability of the same n-1 metadata unit in the second text sentence and the third probability in the n-1 grammatical model meet a third preset condition.

12. The acquisition method according to claim 7, characterized in that: The determining of the target text sentence based on the first text sentence further includes: When the coverage is less than or equal to a second threshold, determining a third text sentence in the user confirmation text based on an n-1 gram model, the second threshold is less than the first threshold, the n-1 gram model is trained based on the preset text, the n-1 gram model includes a plurality of n-1 metadata units, and the third text sentence includes at least one of the n-1 metadata units; The third text sentence is determined to be the target text sentence.

13. The acquisition method according to claim 12, characterized in that: The user confirmation text includes at least one text sentence; and determining the third text sentence in the user confirmation text based on the n-1 gram model includes: determining a triphone sentence for each of the at least one text sentence; determining a third triphone sentence in the triphone sentences that includes at least one of the n-1 metadata units; The text sentence corresponding to the third triphone sentence is determined to be the third text sentence.

14. The acquisition method according to claim 12, characterized in that: The n-1-gram grammar model further includes a third probability corresponding to each of the plurality of n-1 metadata units; when the matching degree between the recognized text and the target text sentence satisfies a first preset condition, before determining that the speech segment annotated with the recognized text is the training sample, the method further includes: It is determined that the fifth probability of the same n-1 metadata unit in the third text sentence and the third probability in the n-1 grammatical model meet a fourth preset condition.

15. The acquisition method according to any one of claims 1 to 5, characterized in that: The n-gram model further includes a first probability of each of the plurality of n-gram units; when the degree of matching between the recognized text and the target text sentence satisfies a first preset condition, before determining the speech segment annotated with the recognized text as the training sample, the method further includes: It is determined that the second probability of the same n-gram unit in the target text sentence and the first probability in the n-gram grammar model meet a second preset condition.

16. The acquisition method according to any one of claims 1 to 5, characterized in that: The performing speech recognition on the speech segment corresponding to the target text sentence to obtain the recognized text includes: The speech segment is subjected to speech recognition using a speech recognition model to obtain the recognition text, and the training sample is used to train the speech recognition model.

17. The acquisition method according to any one of claims 1 to 5, characterized in that: Before determining the first text sentence in the user confirmation text based on the n-gram model, the method further includes: Acquire the user confirmation text and voice data from the server; dividing the user confirmation text into at least one text sentence; The speech data is divided into at least one speech segment, and the at least one speech segment corresponds to the at least one text sentence.

18. A device for obtaining training samples, characterized in that: include: a first determining module, configured to determine a first text sentence in the user confirmation text based on an n-gram model, wherein the n-gram model is obtained by training based on a preset text, the n-gram model includes a plurality of n-gram units, and the first text sentence includes at least one of the n-gram units; A second determination module is configured to determine a target text sentence based on the first text sentence, wherein determining the target text sentence based on the first text sentence comprises: determining that the first text sentence is the target text sentence when coverage of the n metadata units in the first text sentence over the n metadata units in the n-gram grammar model is greater than or equal to a first threshold; A recognition module performs speech recognition on the speech segment corresponding to the target text sentence to obtain a recognized text; a third determining module, which determines that the speech segment marked with the recognition text is the training sample when the matching degree between the recognition text and the target text sentence meets a first preset condition; The n metadata units include n consecutive triphone units; the user confirmation text includes at least one text sentence; the first determination module is further configured to determine a triphone sentence for each of the at least one text sentence; determine a first triphone sentence among the triphone sentences that includes at least one of the n metadata units; and determine that the text sentence corresponding to the first triphone sentence is the first text sentence; The first determination module is further configured to perform sliding matching on the multiple n metadata units and the triphone sentences respectively; and when the matching results are consistent, determine that the current triphone sentence is the first triphone sentence.

19. A computer device comprising a memory, a processor, and a computer program stored in the memory and executed by the processor, wherein: When the processor executes the computer program, the steps of the method for obtaining training samples according to any one of claims 1 to 17 are implemented.

20. 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 for obtaining training samples according to any one of claims 1 to 17 are implemented.

Citation Information

Patent Citations

  • Method for automatically obtaining label data to optimize user-defined awakening model

    CN109637537A

  • Audio corpus screening method and device for speech recognition and computer equipment

    CN110263322A