Training data generation method and device, equipment, storage medium and program product
By processing the first audio data and transcribed text, the speech synthesis model is used to generate multi-language training data suitable for code switching scenarios, which solves the problem of insufficient training data and high cost, and improves the effect of speech recognition.
Patent Information
- Application Number
- CN202410981906.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-10-15
AI Technical Summary
In the existing technology, the speech recognition model training data in the code-switching scenario is insufficient and the training cost is high, making it difficult to effectively improve the recognition effect.
By processing the first audio data and transcribed text, time stamp information is obtained, the target characters are translated into second language type characters, and input into the speech synthesis model to generate model data for code switching scenarios for training, using The audio data and timestamp information output by the speech synthesis model construct training data to realize the generation of multi-language data.
It reduces the cost of obtaining training data, enables the generation of multi-language training data suitable for code switching scenarios while ensuring sufficient data, and improves the recognition effect of speech recognition.
Smart Images

Figure CN118782015A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, device, equipment, storage medium and program product for generating training data. Background Art
[0002] In the prior art, in order to improve the recognition effect of speech recognition in code-switch scenarios, the language model is mainly adjusted based on specific code-switch data, which requires extensive collection of code-switch data; or, the automatic speech recognition system (Automatic Speech Recognition, ASR) is trained using multi-language training, which requires the collection of training data in multiple languages. However, the above training methods still have the problems of insufficient training data and high training costs. Summary of the invention
[0003] The embodiments of the present application provide a method, apparatus, device, storage medium and program product for generating training data, which solve the problems of insufficient training data and high training cost in existing model training in code switching scenarios.
[0004] In a first aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a method for generating training data, comprising:
[0005] Processing a first transcribed text and an audio feature sequence corresponding to the first audio data to obtain timestamp information of each character in the first transcribed text; wherein the first transcribed text includes characters of a first language type;
[0006] translating the target characters in the first transcription text into characters of a second language type to obtain a second transcription text;
[0007] Inputting the second language type characters into a speech synthesis model to obtain second audio data output by the speech synthesis model;
[0008] The first audio data and the second audio data are processed according to the timestamp information to construct training data for training a model of a code switching scenario, wherein the training data corresponds to the second transcription text.
[0009] Optionally, the aligning the first transcribed text corresponding to the first audio data and the audio feature sequence to obtain timestamp information of each character in the first transcribed text includes:
[0010] Processing the audio feature sequence and the first transcribed text to obtain a correlation matrix between the audio feature sequence and the first transcribed text;
[0011] For a character in the first transcription text, determine the start frame index and the end frame index corresponding to the character in the audio feature sequence according to the target relevance element in the relevance matrix; wherein the target relevance element is related to the character, and the relevance value is greater than the relevance threshold;
[0012] The timestamp information of the one character is calculated according to the start frame index, the end frame index, the preset frame length and the frame shift, and the timestamp information includes a start time and an end time.
[0013] Optionally, the aligning the audio feature sequence and the first transcribed text to obtain a correlation matrix between the audio feature sequence and the first transcribed text includes:
[0014] Inputting the audio feature sequence and the first transcribed text into an automatic speech recognition model of an attention mechanism to obtain a multi-head attention matrix;
[0015] The correlation matrix is calculated based on the multiple multi-head attention matrices.
[0016] Optionally, calculating the timestamp information of the one character according to the start frame index, the end frame index, a preset frame length and a frame shift includes:
[0017] Determine the start time as the product of the frame shift and a first difference, where the first difference is the difference between the start frame index and a first value;
[0018] The termination time is determined to be a sum of the preset frame length and a first product, where the first product is a product of the termination frame index and the frame shift.
[0019] Optionally, translating the target characters in the first transcription text into characters of a second language type to obtain a second transcription text includes:
[0020] randomly selecting the target character in the first transcription text, the target character comprising one or more characters;
[0021] Inputting the target character into a translation model of a second language type to obtain the second language type character output by the translation model;
[0022] The target characters in the first transcription text are replaced with characters of the second language type to obtain the second transcription text.
[0023] Optionally, the processing the first audio data and the second audio data according to the timestamp information to construct training data for a code switching scenario includes:
[0024] According to the timestamp information, the first audio data is segmented to obtain a plurality of sub-audio data;
[0025] Among the plurality of sub-audio data, the sub-audio data corresponding to the target character is updated to the second audio data;
[0026] The updated multiple sub-audio data are concatenated to generate the training data.
[0027] In a second aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a training data generation device, comprising:
[0028] A first processing module, configured to process a first transcribed text and an audio feature sequence corresponding to the first audio data to obtain timestamp information of each character in the first transcribed text; wherein the first transcribed text includes characters of a first language type;
[0029] A translation module, used for translating target characters in the first transcription text into characters of a second language type to obtain a second transcription text;
[0030] An acquisition module, used for inputting the second language type characters into a speech synthesis model to obtain second audio data output by the speech synthesis model;
[0031] The second processing module is used to process the first audio data and the second audio data according to the timestamp information to construct training data for training a model of a code switching scenario, wherein the training data corresponds to the second transcription text.
[0032] In a third aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides an electronic device, including a transceiver, a processor, a memory, and a program stored in the memory and executable on the processor; when the processor executes the program, the method for generating training data as described in the first aspect is implemented.
[0033] In a fourth aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a readable storage medium on which a program or instruction is stored, and when the program or instruction is executed by a processor, the method for generating training data as described in the first aspect is implemented.
[0034] In a fifth aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a computer program product, including computer instructions, which, when executed by a processor, implement the method for generating training data as described in the first aspect.
[0035] The beneficial effects of the above technical solution of the present application are as follows:
[0036] In the method for generating training data in the embodiment of the present application, first, a first transcribed text and an audio feature sequence corresponding to the first audio data are processed to obtain timestamp information of each character in the first transcribed text; wherein the first transcribed text includes characters of a first language type; secondly, the target characters in the first transcribed text are translated into characters of a second language type to obtain a second transcribed text; thirdly, the characters of the second language type are input into a speech synthesis model to obtain second audio data output by the speech synthesis model; finally, according to the timestamp information, the first audio data and the second audio data are processed to construct training data for a model for training code switching scenarios, wherein the training data corresponds to the second transcribed text. In this way, audio data containing only one language type is used to construct audio data containing multiple language types, without the need to collect a large amount of audio data containing multiple language types. While ensuring sufficient training data, the cost of obtaining training data is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is one of the flowcharts of the method for generating training data according to an embodiment of the present application;
[0038] Figure 2 This is a second flow chart of the method for generating training data according to an embodiment of the present application;
[0039] Figure 3 This is a schematic diagram of synthetic training data in an embodiment of the present application;
[0040] Figure 4 A schematic diagram of the structure of a device for generating training data according to an embodiment of the present application;
[0041] Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0042] In order to make the technical problems, technical solutions and advantages to be solved by the present application clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0043] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0044] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0045] Additionally, the terms "system" and "network" are often used interchangeably herein.
[0046] In the embodiments provided in the present application, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.
[0047] Before describing the embodiments of the present application, the technical points of the attention mechanism involved in the embodiments of the present application are first described:
[0048] The basic principle of the attention mechanism can be expressed as follows:
[0049]
[0050] Among them, Q, K, and V are all high-dimensional vector representations in the neural network, representing the query, key value, and output value respectively. The calculation process of the attention mechanism is to calculate the attention matrix based on the correlation between Q and V, and then weight V according to the weight in the attention matrix to complete the high-dimensional vector representation calculation with the attention mechanism. Among them, in order to learn the representation information of different subspaces, multiple basic units of attention can be spliced after linear transformation to form a multi-head attention mechanism, as follows:
[0051] Multihead(Q,K,V)=Concat(head1,...,head n )W O ;
[0052] head i =Attention(QW Q ,KW K ,VW V );
[0053] The embodiments of the present application provide a method, device, equipment, storage medium and program product for generating training data. The method is used to solve the problem that the existing method for obtaining training data in the code-switch scenario is high in cost and the amount of obtained training data is small. Among them, the method, device and equipment are based on the same application concept. Since the principles of solving the problems by the method, device and equipment are similar, the implementation of the method, device and equipment can refer to each other, and the repeated parts will not be repeated.
[0054] The method for generating training data provided in the embodiment of the present application is as follows: Figure 1 As shown, the following steps are included:
[0055] Step 101, processing a first transcribed text and an audio feature sequence corresponding to first audio data to obtain timestamp information of each character in the first transcribed text; wherein the first transcribed text includes characters of a first language type; specifically, in this step, the audio feature sequence and the first transcribed text are results obtained after feature extraction of the first audio data;
[0056] Step 102, translating the target characters in the first transcription text into characters of the second language type to obtain a second transcription text; in this step, the target characters may be one or more characters, and the target characters may be randomly selected characters or characters selected according to a certain rule, that is, this step is to translate some characters in the first transcription text to obtain corresponding characters of the second language type, wherein the characters of the first language type are different from the characters of the second language type, for example, the characters of the first language type are Chinese, and the characters of the second language type are English, etc.;
[0057] Step 103: input the second language type characters into a speech synthesis model to obtain second audio data output by the speech synthesis model; in this step, the speech synthesis model is a speech synthesis model for the second language type, for example, when the second language type is English, the speech synthesis model synthesizes English text into English audio. Compared with the code-switch speech synthesis model, the speech synthesis model in this step has higher synthesis accuracy;
[0058] Step 104: Process the first audio data and the second audio data according to the timestamp information to construct training data for training a model of a code-switching scenario, wherein the training data corresponds to the second transcription text.
[0059] In the method for generating training data in the embodiment of the present application, first, the first transcription text and the audio feature sequence corresponding to the first audio data are processed to obtain the timestamp information of each character in the first transcription text; wherein the first transcription text includes characters of the first language type; secondly, the target characters in the first transcription text are translated into characters of the second language type to obtain the second transcription text; thirdly, the characters of the second language type are input into the speech synthesis model to obtain the second audio data output by the speech synthesis model; finally, according to the timestamp information, the first audio data and the second audio data are processed to construct the training data of the model for training the code switching scene, wherein the training data corresponds to the second transcription text. In this way, the first audio data of the first language type is constructed as audio data containing the first language type and at least one other language type (i.e., audio data suitable for code-switch), without the need to collect a large amount of original audio data containing multiple language types, thus reducing the cost of obtaining training data and being able to synthesize sufficient training data according to demand.
[0060] As an optional implementation, step 101 includes:
[0061] Processing the audio feature sequence and the first transcribed text to obtain a correlation matrix between the audio feature sequence and the first transcribed text; for example, this step may process the audio feature sequence and the first transcribed text based on the aforementioned multi-head attention mechanism, and obtain the correlation matrix according to the processing result; of course, this step is not limited to processing the audio feature sequence and the first transcribed text based on the multi-head attention mechanism, for example, the audio feature sequence and the first transcribed text may also be processed based on a Gaussian Mixture Model (GMM)-Hidden Markov Model (HMM) architecture, etc.;
[0062] For a character in the first transcription text, determine the start frame index and the end frame index corresponding to the character in the audio feature sequence according to the target association element in the association matrix; wherein the target association element is related to the character, and the association value is greater than the association threshold; that is, this step is: for each character in the first transcription text, determine the element in the association matrix related to the character, the element whose element value is greater than the preset association threshold as the target association element, and then further determine the start frame index and the end frame index of the character according to the target association element (including one or more elements); for example, the start frame index is the smallest ordinate of each element in the target association element in the association matrix, and the end frame index is the largest ordinate of each element in the target association element in the association matrix;
[0063] The timestamp information of the one character is calculated according to the start frame index, the end frame index, the preset frame length and the frame shift, and the timestamp information includes a start time and an end time.
[0064] In this optional implementation, the audio feature sequence and the first transcribed text are processed to obtain the association matrix, and the start frame index and the end frame index corresponding to each character in the first transcribed text are further determined based on the elements in the association matrix. Finally, based on information such as the start frame index and the end frame index, the timestamp information of each character is calculated, thereby aligning the first transcribed text with the audio feature sequence to provide a basis for subsequent audio synthesis.
[0065] As a specific implementation manner, the aligning the audio feature sequence and the first transcribed text to obtain a correlation matrix between the audio feature sequence and the first transcribed text includes:
[0066] Input the audio feature sequence and the first transcribed text into an automatic speech recognition model of an attention mechanism to obtain a multi-head attention matrix; it should be noted that this step can be performed with reference to the aforementioned multi-head attention mechanism and will not be described in detail here;
[0067] According to the multiple multi-head attention matrices, the correlation matrix is calculated; a specific example of this step is: averaging the multiple multi-head attention matrices to determine the alignment relationship between the audio feature sequence and the first transcription text (corresponding to the aforementioned correlation matrix). Of course, this step is not limited to the above specific example, and other calculation methods can be selected as needed; specifically, this step can be expressed by the following formula:
[0068]
[0069] In the above specific implementation method, the correlation matrix is calculated based on the multi-head attention matrix, so as to facilitate the subsequent accurate acquisition of the timestamp information of each character in the first transcribed text based on the elements in the correlation matrix, providing a basis for the subsequent synthesis of training data.
[0070] As another specific implementation, the calculating the timestamp information of the one character according to the start frame index, the end frame index, the preset frame length and the frame shift includes:
[0071] Determine the starting time as the product of the frame shift and a first difference, where the first difference is the difference between the starting frame index and a first value; where the first value is, for example, 1, and the frame shift is an overlapping portion between adjacent frames, the length of which is usually less than a complete frame length, and may be half or one third of a frame length; wherein the frame shift is a parameter required when extracting features from the first audio data;
[0072] The termination time is determined to be a sum of the preset frame length and a first product, where the first product is a product of the termination frame index and the frame shift.
[0073] It should be noted that in the above specific implementation, the start time can be expressed by the formula t start =(j min -1)b, the termination time can be expressed by the formula t end =j max b+a represents; wherein a represents the preset frame length, b represents the frame shift, j min represents the starting frame index, j max represents the end frame index, t start represents the starting time, t end Indicates the end time.
[0074] As another optional implementation, step 102 includes:
[0075] randomly selecting the target character in the first transcription text, the target character comprising one or more characters;
[0076] The target character is input into a translation model of a second language type to obtain the second language type character output by the translation model; here, the translation model is a pre-trained translation model for the second language type. Specifically, the translation model can be trained using text data of a first language type and corresponding text data of a second language type. In this way, this step uses the translation model to translate the target character of the first language type into a character of the second language type, which can improve the accuracy of the translation; in addition, this step translates the characters of the first language type based on a translation model of a specific language type, thereby realizing the synthesis and splicing of text to speech (TTS) models of multiple languages without the need for a TTS model that supports code-switch, which can at least reduce the dependence of TTS on the performance of code-switch scenarios;
[0077] The target characters in the first transcription are replaced with the characters of the second language type to obtain the second transcription. In short, this step is to update the first transcription with the characters of the second language type obtained by translation to obtain the second transcription. In this way, the transcription corresponding to the first audio type and containing two languages can be obtained, so as to facilitate the subsequent construction of training data corresponding to the second transcription suitable for the code-switch scenario, thereby reducing the cost of obtaining training data.
[0078] In the above optional implementations, firstly, the target characters are randomly selected so that the number and proportion of the code-switch text construction fragments are not limited, so that rich code-switch text can be constructed, and then the corresponding code-switch audio can be obtained by combining the TTS technology; secondly, the target characters are translated into characters of different languages, and any number of various languages can be combined at will, which further improves the richness of the constructed code-switch text and ultimately increases the data volume of the training data.
[0079] As another optional implementation, step 104 includes:
[0080] According to the timestamp information, the first audio data is segmented to obtain a plurality of sub-audio data; the purpose of this step is to segment the audio data corresponding to the target character in the first audio data;
[0081] Among the plurality of sub-audio data, the sub-audio data corresponding to the target character is updated to the second audio data. Specifically, this step is to replace the sub-audio data corresponding to the target character with the second audio data;
[0082] The updated multiple sub-audio data are concatenated to generate the training data.
[0083] The implementation process of the above optional implementation method can refer to Figure 3 , the first audio data is segmented according to the timestamp information obtained by forced alignment, and then spliced with the synthesized second audio data to obtain audio data corresponding to the transcribed text applied to the code-switch scenario.
[0084] Further, as an optional implementation, after step 104, the method further includes:
[0085] The ASR is trained using the training data and first audio data corresponding to the training data.
[0086] The following is an example of a method for generating training data according to an embodiment of the present application.
[0087] In view of the aforementioned problem that the acquisition method of training data for code-switch scenarios is costly and the data volume is small, the present application embodiment provides a method for generating training data, which can be specifically implemented as a speech recognition training method for code-switch scenarios based on speech synthesis and text translation technology, such as Figure 2 As shown, the specific steps include:
[0088] Step 201, based on the text data of two languages S and T involved in the code-switch scenario, train a text translation model MT from S to T; here, it should be noted that through this step, a given source language word (token / character) sequence S = {s1, s2, s3, ..., s m} to the target language word sequence T = {t1, t2, t3, ..., t n} translation task. Where m is the length of the word sequence in the source language, and n is the length of the word sequence in the target language. Language S corresponds to the first language type mentioned above, and language T corresponds to the second language type mentioned above; MT is machine translation (MachineTranslation);
[0089] Step 202, based on the speech data of the S language, the basic speech recognition system ASR0 is trained, and ASR0 is used for forced alignment to obtain the timestamp information of each word in the transcribed text; it should be noted that the implementation process of this step includes: first, given a piece of speech data (corresponding to the aforementioned first audio data), the extraction frame length is set to a, the frame shift is b, and the audio feature sequence F = {f1, f2, f3, ..., f p}, and the corresponding transcription text S = {s1,s2,s3,...,s q} (corresponding to the first transcription text mentioned above), generally p>>q. Second, taking the end-to-end ASR model architecture based on the attention mechanism as an example, how to obtain the alignment relationship between F and S is specifically explained. Among them, the basic principle formula of the attention mechanism is as mentioned above. After the end-to-end ASR model based on the attention mechanism is trained, the alignment relationship between F and S (corresponding to the aforementioned correlation matrix) can be determined by averaging N multi-head attention matrices; third, for the i-th character s in S i The corresponding timestamp information acquisition process is: in the association matrix, extract the elements related to the i-th character and whose element value is greater than the association threshold; combine the extracted elements into a set A = {j|W ij >δ,1≤j≤p}; According to the elements in set A, determine the index of the start and end frames corresponding to the i-th character in the feature sequence F, where j min =min(A),j max = max(A); Finally, according to the index of the start and end frames, the start and end time corresponding to the ith character is calculated to form the timestamp information of the ith character, where t start =(j min -1)b;t end =j max b+a; where δ is the set correlation threshold, j min and j max They are s i The index of the corresponding start and end frames in the feature sequence F, t start and t end are the converted start and end times respectively;
[0090] Step 203, randomly select words from the transcribed text in language S, and use MT to translate them into language T, so as to obtain the transcribed text of code-switch; it should be noted that the transcribed text in language S is: S = {s1, s2, s3, ..., s q}, the code-switch transcript is similar to In addition, after getting the code-switch transcription text, you can also record the translation results
[0091] Step 204: train the TTS model of the T language speech synthesis based on the T language speech data, use TTS to synthesize the corresponding audio according to the text translated into the T voice in the transcribed text, and segment the original audio according to the timestamp information obtained by forced alignment and then splice it with the synthesized audio, so as to obtain the audio data corresponding to the code-switch transcribed text; it should be noted here that the implementation process of this step can refer to Figure 3 ;
[0092] Step 205 , training a speech recognition system ASR1 with optimized performance based on the constructed code-switch audio data and the speech data of the S language.
[0093] The method for generating training data in the embodiment of the present application obtains the audio timestamp information corresponding to each word in the transcribed text by forced alignment of speech and text, and then performs text translation on the words in the random transcribed text and combines the audio synthesis technology of the target language to construct the audio and transcribed text data pairs of code switching. Based on the above method, the proposed scheme can obtain the training data pairs required for speech recognition in massive code-switch scenarios at a low cost. In this way, firstly, it solves the problem that the diversity of data is limited by the text data of the code-switch scenario. Secondly, it can reduce the dependence of TTS on the performance of the code-switch scenario. Thirdly, it can significantly improve the speech recognition ability and acoustic modeling ability of code switching. Fourthly, the method in the embodiment of the present application does not require additional language labels, which reduces the complexity of the system and the decoding time.
[0094] In addition, it should be noted that online video conferencing is a common audio and video application at present, among which intelligent video conferencing is a landing direction with a broad market in the field of speech processing. Most intelligent video conferencing involves the recognition needs of multiple languages, namely the recognition scenarios of code switching. Current products mainly consider the recognition performance of Mandarin, and do not make special recognition optimization for mixed Chinese and English code switching scenarios; or only consider the recognition optimization of code switching from the perspective of language modeling capabilities; and this optimization is lagging and limited. Based on this, the embodiment of the present application combines speech synthesis and text translation technology to propose a speech recognition training method for code switching scenarios. Based on this method, the proposed scheme can obtain the training data pairs required for speech recognition in massive code switching scenarios at a low cost. Since the model can be trained in advance through these massive freely combined code switching data pairs, the speech recognition ability of the model in the conference code switching scenario can be significantly improved.
[0095] The embodiment of the present application also provides a device for generating training data, such as Figure 4 As shown, including:
[0096] A first processing module 401 is used to process a first transcribed text and an audio feature sequence corresponding to the first audio data to obtain timestamp information of each character in the first transcribed text; wherein the first transcribed text includes characters of a first language type;
[0097] A translation module 402, configured to translate target characters in the first transcription text into characters of a second language type to obtain a second transcription text;
[0098] An acquisition module 403 is used to input the second language type characters into a speech synthesis model to obtain second audio data output by the speech synthesis model;
[0099] The second processing module 404 is used to process the first audio data and the second audio data according to the timestamp information to construct training data for training a model of a code switching scenario, wherein the training data corresponds to the second transcription text.
[0100] Optionally, the first processing module 401 includes:
[0101] A first acquisition submodule, used for processing the audio feature sequence and the first transcription text to obtain a correlation matrix between the audio feature sequence and the first transcription text;
[0102] A determination submodule, configured to determine, for a character in the first transcription text, a start frame index and an end frame index corresponding to the character in the audio feature sequence according to a target relevance element in the relevance matrix; wherein the target relevance element is related to the character, and the relevance value is greater than a relevance threshold;
[0103] The calculation submodule is used to calculate the timestamp information of the character according to the start frame index, the end frame index, the preset frame length and the frame shift, and the timestamp information includes the start time and the end time.
[0104] Optionally, the first acquisition submodule includes:
[0105] An acquisition unit, configured to input the audio feature sequence and the first transcribed text into an automatic speech recognition model of an attention mechanism to obtain a multi-head attention matrix;
[0106] A calculation unit is used to calculate the relevance matrix based on the multiple multi-head attention matrices.
[0107] Optionally, the calculation submodule includes:
[0108] A first determining unit, configured to determine the start time as a product of the frame shift and a first difference, where the first difference is a difference between the start frame index and a first value;
[0109] The second determining unit is used to determine the termination time as the sum of the preset frame length and a first product, where the first product is the product of the termination frame index and the frame shift.
[0110] Optionally, the translation module 402 includes:
[0111] A selection submodule, configured to randomly select the target character in the first transcribed text, wherein the target character includes one or more characters;
[0112] A second acquisition submodule, configured to input the target character into a translation model of a second language type, and obtain the second language type character output by the translation model;
[0113] A replacement submodule is used to replace the target characters in the first transcription text with characters of the second language type to obtain the second transcription text.
[0114] Optionally, the second processing module 404 includes:
[0115] a segmentation submodule, configured to segment the first audio data according to the timestamp information to obtain a plurality of sub-audio data;
[0116] An updating submodule, used for updating the sub audio data corresponding to the target character to the second audio data among the plurality of sub audio data;
[0117] A generating submodule is used to splice the updated multiple sub-audio data to generate the training data.
[0118] It should be noted here that the above-mentioned training data generation device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned training data generation method embodiment, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as those in the method embodiment will not be described in detail here.
[0119] The embodiment of the present application also provides an electronic device, such as Figure 5 As shown, it includes a transceiver 510, a processor 500, a memory 520, and a program or instruction stored in the memory 520 and executable on the processor 500; when the processor 500 executes the program or instruction, the above-mentioned method for generating training data is implemented.
[0120] The transceiver 510 is used to receive and send data under the control of the processor 500.
[0121] Among them, Figure 5 In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically one or more processors represented by processor 500 and various circuits of memory represented by memory 520 are linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 510 may be a plurality of components, namely, a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium. For different devices, the user interface 530 may also be an interface capable of externally connecting or internally connecting required devices, and the connected devices include but are not limited to a keypad, a display, a speaker, a microphone, a joystick, and the like.
[0122] The processor 500 is responsible for managing the bus architecture and general processing, and the memory 520 can store data used by the processor 500 when performing operations.
[0123] It should be noted that the above-mentioned electronic device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned training data generation method embodiment, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.
[0124] A readable storage medium in an embodiment of the present application stores a program or instruction thereon. When the program or instruction is executed by a processor, the steps in the method for generating training data as described above are implemented and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0125] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0126] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for an electronic device to execute the methods described in each embodiment of the present application.
[0127] Therefore, an embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps in the method for generating training data as described above and can achieve the same technical effect. To avoid repetition, they will not be described here.
[0128] In addition, in the embodiment of the present application, module can be implemented with software so that it can be executed by various types of processors. For example, an executable code module of an identification can include one or more physical or logical blocks of computer instructions, for example, it can be constructed as an object, process or function. Nevertheless, the executable code of the identified module does not need to be physically located together, but can include different instructions stored in different positions, and when these instructions are logically combined together, it constitutes a module and realizes the specified purpose of the module.
[0129] In fact, executable code module can be a single instruction or many instructions, and can even be distributed on a plurality of different code segments, distributed among different programs, and distributed across a plurality of memory devices. Similarly, operating data can be identified in the module, and can be implemented and organized in the data structure of any appropriate type according to any appropriate form. The operating data can be collected as a single data set, or can be distributed in different locations (including on different storage devices), and can only be present on a system or network as an electronic signal at least in part.
[0130] When a module can be implemented by software, considering the level of existing hardware technology, a person skilled in the art can build a corresponding hardware circuit to implement the corresponding function of the module that can be implemented by software without considering the cost. The hardware circuit includes a conventional very large scale integration (VLSI) circuit or gate array and existing semiconductors such as logic chips, transistors, or other discrete components. The module can also be implemented by a programmable hardware device, such as a field programmable gate array, a programmable array logic, a programmable logic device, etc.
[0131] The above exemplary embodiments are described with reference to the accompanying drawings, and many different forms and embodiments are feasible without departing from the spirit and teachings of the present application. Therefore, the present application should not be constructed as a limitation of the exemplary embodiments proposed herein. More specifically, these exemplary embodiments are provided so that the present application will be perfect and complete, and the scope of the present application will be conveyed to those who are familiar with the technology. In these figures, the component sizes and relative sizes may be exaggerated for clarity. The terms used here are only based on the purpose of describing specific exemplary embodiments and are not intended to be limiting. As used herein, unless the text clearly indicates otherwise, the singular forms "one", "an" and "the" are intended to include these multiple forms. It will be further understood that the terms "comprising" and / or "including" when used in this specification indicate the presence of the features, integers, steps, operations, components and / or components, but do not exclude the presence or increase of one or more other features, integers, steps, operations, components, components and / or their groups. Unless otherwise indicated, when stated, a range of values includes the upper and lower limits of that range and any subranges therebetween.
[0132] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for generating training data, characterized in that: include: Processing a first transcribed text and an audio feature sequence corresponding to the first audio data to obtain timestamp information of each character in the first transcribed text; wherein the first transcribed text includes characters of a first language type; translating the target characters in the first transcription text into characters of a second language type to obtain a second transcription text; Inputting the second language type characters into a speech synthesis model to obtain second audio data output by the speech synthesis model; The first audio data and the second audio data are processed according to the timestamp information to construct training data for training a model of a code switching scenario, wherein the training data corresponds to the second transcription text.
2. The method according to claim 1, characterized in that The aligning process of the first transcribed text corresponding to the first audio data and the audio feature sequence to obtain the timestamp information of each character in the first transcribed text includes: Processing the audio feature sequence and the first transcribed text to obtain a correlation matrix between the audio feature sequence and the first transcribed text; For a character in the first transcription text, determine the start frame index and the end frame index corresponding to the character in the audio feature sequence according to the target relevance element in the relevance matrix; wherein the target relevance element is related to the character, and the relevance value is greater than a relevance threshold; The timestamp information of the one character is calculated according to the start frame index, the end frame index, the preset frame length and the frame shift, and the timestamp information includes a start time and an end time.
3. The method according to claim 2, characterized in that The aligning process of the audio feature sequence and the first transcribed text to obtain a correlation matrix between the audio feature sequence and the first transcribed text includes: Inputting the audio feature sequence and the first transcribed text into an automatic speech recognition model of an attention mechanism to obtain a multi-head attention matrix; The correlation matrix is calculated based on the multiple multi-head attention matrices.
4. The method according to claim 2, characterized in that: The calculating the timestamp information of the one character according to the start frame index, the end frame index, the preset frame length and the frame shift comprises: Determine the start time as the product of the frame shift and a first difference, where the first difference is the difference between the start frame index and a first value; The termination time is determined to be a sum of the preset frame length and a first product, where the first product is a product of the termination frame index and the frame shift.
5. The method according to claim 1, characterized in that The step of translating the target characters in the first transcription text into characters of a second language type to obtain a second transcription text includes: randomly selecting the target character in the first transcription text, the target character comprising one or more characters; Inputting the target character into a translation model of a second language type to obtain the second language type character output by the translation model; The target characters in the first transcription text are replaced with characters of the second language type to obtain the second transcription text.
6. The method according to claim 1, characterized in that The processing of the first audio data and the second audio data according to the timestamp information to construct training data for a code switching scenario includes: According to the timestamp information, the first audio data is segmented to obtain a plurality of sub-audio data; Among the plurality of sub-audio data, the sub-audio data corresponding to the target character is updated to the second audio data; The updated multiple sub-audio data are concatenated to generate the training data.
7. A training data generating device, characterized in that: include: A first processing module, configured to process a first transcribed text and an audio feature sequence corresponding to the first audio data to obtain timestamp information of each character in the first transcribed text; wherein the first transcribed text includes characters of a first language type; A translation module, used for translating target characters in the first transcription text into characters of a second language type to obtain a second transcription text; An acquisition module, used for inputting the second language type characters into a speech synthesis model to obtain second audio data output by the speech synthesis model; The second processing module is used to process the first audio data and the second audio data according to the timestamp information to construct training data for training a model of a code switching scenario, wherein the training data corresponds to the second transcription text.
8. An electronic device comprising a transceiver, a processor, a memory, and a program stored in the memory and executable on the processor; characterized in that: When the processor executes the program, the method for generating training data according to any one of claims 1 to 6 is implemented.
9. A readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by a processor, the method for generating training data according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the method for generating training data according to any one of claims 1 to 6.
