Method and apparatus for constructing text colloquialization conversion model, and electronic device
By identifying and removing colloquial words to generate pseudo-parallel corpus, and training the text colloquial conversion model, it solves the high cost and model training limitations of converting written text into colloquial text, and improves the quality of conversion.
Patent Information
- Application Number
- PCT/CN2024/085492
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-18
- Filing Date
- 2024-04-02
- Publication Date
- 2024-10-24
AI Technical Summary
In the existing technology, converting written text into spoken text requires a large amount of manual annotation, resulting in high labor costs, time costs, and economic costs. At the same time, the amount of parallel corpus is insufficient, which limits the model training effect.
By obtaining text samples containing colloquial vocabulary, use the pre-trained colloquial recognition model to identify and remove colloquial vocabulary, generate pseudo-parallel corpus, and input it into the text colloquial conversion model for training to generate high-quality text spoken language. transformation model.
It reduces the cost and time of manual annotation, overcomes the problem of insufficient number of parallel corpora, and improves the conversion quality and generation effect of the text spoken language conversion model.
Smart Images

Figure CN2024085492_24102024_PF_FP_ABST
Abstract
Description
Text-to-oral conversion model construction method, device and electronic device
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application is based on and claims priority to a Chinese application with application number 202310421130.1, filing date April 18, 2023, entitled “Text-to-Spoken Conversion Model Construction Method, Device and Electronic Device”. The disclosed content of the Chinese application is hereby introduced as a whole into this application. Technical Field
[0003] The embodiments of the present disclosure relate to the field of computer technology, and in particular to a method, device, and electronic device for constructing a text-to-spoken conversion model. Background Art
[0004] In intelligent human-machine dialogue scenarios, synthesizing text into vivid, lifelike speech output is a key factor influencing the interactive experience. When this interaction expands to digital human scenarios, even higher demands are placed on the virtual anchor's expressiveness. In addition to optimizing TTS (text-to-speech) technology, using speech delivery techniques that emulate the style of a real anchor can effectively enhance the naturalness of speech synthesis, thereby capturing user attention.
[0005] Summary of the Invention
[0006] The present disclosure provides a method, device, and electronic device for constructing a text-to-spoken conversion model to solve some or all of the technical problems in related technologies.
[0007] In a first aspect, the present disclosure provides a method for constructing a text-to-spoken conversion model, comprising:
[0008] Obtaining a first text sample, wherein the first text sample includes colloquial vocabulary;
[0009] Inputting the first text sample into a pre-trained colloquialism recognition model to recognize colloquialism words in the first text sample;
[0010] After removing colloquial words from the first text sample, a second text sample is obtained;
[0011] After the first text sample and the second text sample are formed into a pseudo-parallel corpus, the pseudo-parallel corpus is input into a pre-built text-to-spoken conversion model, the text-to-spoken conversion model is trained, and a final text-to-spoken conversion model is obtained.
[0012] In a second aspect, the present disclosure provides a device for constructing a text-to-spoken conversion model, the device comprising:
[0013] An acquisition module, configured to acquire a first text sample, wherein the first text sample includes colloquial vocabulary;
[0014] a recognition module, configured to input the first text sample into a pre-trained colloquialism recognition model to recognize colloquialism words in the first text sample;
[0015] The processing module is used to remove colloquial vocabulary from the first text sample and obtain a second text sample; after the first text sample and the second text sample form a pseudo-parallel corpus, they are input into a pre-built text-to-colloquial conversion model, the text-to-colloquial conversion model is trained, and a final text-to-colloquial conversion model is obtained.
[0016] In a third aspect, an electronic device is provided, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0017] Memory for storing computer programs;
[0018] The processor is configured to implement the steps of the method for constructing a text-to-spoken conversion model of any embodiment of the first aspect when executing the program stored in the memory.
[0019] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by an electronic device, the steps of the text-to-spoken conversion model construction method, device and electronic device as described in any embodiment of the first aspect are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] FIG1 is a flow chart of a method for constructing a text-to-spoken conversion model according to an embodiment of the present disclosure;
[0021] FIG2 is a schematic diagram of the structure of a device for constructing a text-to-spoken conversion model provided by an embodiment of the present disclosure;
[0022] FIG3 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] Limited by deep-rooted writing habits, most pre-synthesized texts are not natural enough, or require a lot of effort and constant adjustment, which is time-consuming and laborious.
[0024] The method for constructing a text-to-spoken conversion model provided by the embodiment of the present disclosure obtains a first text sample, which includes spoken vocabulary. Then, the spoken vocabulary in the first text sample is identified by a pre-trained spoken vocabulary recognition model. After removing the spoken vocabulary in the first text sample, a second text sample is obtained. At this time, a spoken text sample and a non-spoken text sample are obtained. After the first text sample and the second text sample are formed into a pseudo-parallel corpus, they are input into a pre-built text-to-spoken conversion model, and the text-to-spoken conversion model is trained to obtain a final text-to-spoken conversion model. This allows the text-to-spoken conversion model to be used to convert written text to obtain spoken text. In the above scheme, spoken vocabulary is identified by the spoken vocabulary recognition model, and after removing the spoken vocabulary, a written text sample is obtained, which is then combined with the spoken text to form a high-quality pseudo-parallel corpus. This method can obtain a large amount of pseudo-parallel corpus, avoid the cost of manual annotation, and also overcome the problem of the limitation of too few parallel corpora on model training in related technologies. Furthermore, it can also indirectly improve the conversion degree of the text-to-spoken conversion model and the generation quality of spoken text.
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0026] To facilitate understanding of the embodiments of the present disclosure, further explanation will be given below with reference to specific embodiments in conjunction with the accompanying drawings. The embodiments do not constitute a limitation on the embodiments of the present disclosure.
[0027] In response to the technical problems mentioned above, the embodiments of the present disclosure provide a method, device, and electronic device for constructing a text-to-spoken conversion model.
[0028] In this embodiment, the lack of parallel corpora in the relevant technology is mainly taken into consideration. If manual annotation is performed, not only will a large amount of manpower and time cost be wasted, but the ability requirements for the annotation personnel are also relatively high. For example, we can usually explain something in the form of written text, but if the written text is converted into a spoken text, the ability to edit the text needs to be tested. For example, people with experience as anchors may find it easier to express the written text in a spoken form, but for ordinary people, it is difficult. Even if a spoken text can be written for the written text, the spoken text may not be fluent or smooth enough. It is precisely because it is difficult to convert written text into spoken text that a method for constructing a text-to-spoken conversion model is provided in this application to construct a text-to-spoken conversion model to convert written text into spoken text, so as to greatly reduce the labor cost, time cost, and economic cost caused by manual annotation.
[0029] For parallel corpus, please refer to the following examples:
[0030] For example, the colloquial parallel corpus is: Come in and place your five orders. Five, four, three, two, one, refresh the car purchase link number one, refresh the car purchase link number one. Um, clear out five orders, refresh the car purchase link number one, two hundred and ninety-nine. This design will increase in price in spring. Look, it's very elegant even when opened. Buying in advance is a good thing, buy in advance.
[0031] The corresponding written text corpus is: To place five orders, refresh the car purchase link. To clear five orders, refresh the car purchase link, two hundred and ninety-nine. Designer styles will increase in price in spring, so open and wear them with style. Buying in advance is a good idea.
[0032] In this application document, it is hoped to convert written text corpus into spoken corpus as listed above. The specific implementation method can be seen below.
[0033] The following will describe in detail the steps involved in constructing a text-to-spoken conversion model. Please refer to FIG1 provided in the embodiment of the present disclosure, which is a flow chart of a method for constructing a text-to-spoken conversion model provided in the embodiment of the present disclosure. The steps of the method include:
[0034] Step 110: Obtain a first text sample, where the first text sample includes spoken vocabulary.
[0035] Specifically, the first text sample is a text sample of a spoken style, and spoken words can be marked in the text sample.
[0036] The first text sample may be a text sample with colloquial vocabulary obtained by crawling or other legal means. The first text sample may be a small number of samples, and then the colloquial vocabulary is annotated manually.
[0037] Assume that there is a manually labeled spoken language dataset D. For each data D in the dataset D i , suppose it contains m words, which can be expressed as D i =(d1,d2,…,d m ), where d i ,d i+1 ,…,d j The words were manually annotated as colloquial vocabulary.
[0038] Step 120: Input the first text sample into a pre-trained colloquialism recognition model to recognize colloquialism words in the first text sample.
[0039] In an optional example, the pre-trained spoken language recognition model may be a spoken language recognition model trained using a large amount of different types of unilateral corpora.
[0040] Unilateral corpus, for example, can be spoken text corpus or written text corpus. There is no parallel corpus relationship between spoken text corpus and written text corpus as mentioned above.
[0041] For example, the colloquial text corpus is: This product is really whitening, I recommend everyone to stock up on one. The merchant is having a promotion this time, if you don’t buy it now, you’ll have to wait a long time~ I suggest girls to stock up quickly, the date is also very new, come on, three, two, one, go to the link.
[0042] The written text material is: Using high vacuum technology to achieve long-lasting heat preservation effect, so that every sip is the warmest, suitable for both the elderly and children. Bring your own boiled water and drink it healthily. This is the secret to staying beautiful at all times!
[0043] The colloquialism recognition model is trained using different types of unilateral corpora to identify colloquialism words in the colloquial text corpus. When the pre-trained colloquialism recognition model meets a certain preset condition, it is determined that the colloquialism recognition model can be applied, and then the trained colloquialism recognition model is used to identify colloquialism words in the first text sample. For example, the data D i d in i ,d i+1 ,…,d j And other words.
[0044] Step 130 : After removing the colloquial words from the first text sample, a second text sample is obtained.
[0045] For example, the data D mentioned above i d in i ,d i+1 ,…,d j When the data D i Remove d i ,d i+1 ,…,d j After the vocabulary is obtained, a new data is obtained, and all the new data constitute the second text sample.
[0046] Step 140 : After the first text sample and the second text sample are formed into a pseudo-parallel corpus, the pseudo-parallel corpus is input into a pre-built text-to-spoken conversion model, and the text-to-spoken conversion model is trained to obtain a final text-to-spoken conversion model.
[0047] Specifically, after removing the colloquialism from the first text sample, a written text corpus, i.e., the second text sample, can be obtained. The second text sample and the first text sample form a pseudo-parallel corpus and are input together into a pre-built text-to-colloquialism conversion model. The text-to-colloquialism conversion model is trained until the final text-to-colloquialism conversion model is obtained. The specific training process can be referenced by existing neural network training methods and will not be further explained here.
[0048] Finally, the final text-to-spoken conversion model can be used to convert written text into a spoken text style, thereby solving the problem of converting written text into a spoken text style requiring a large amount of manual annotation, which wastes manpower, time, and economic costs.
[0049] The method for constructing a text-to-colloquial conversion model provided by the embodiments of the present disclosure includes colloquial vocabulary in a first text sample. Then, a pre-trained colloquial recognition model is used to identify the colloquial vocabulary in the first text sample. After removing the colloquial vocabulary from the first text sample, a second text sample is obtained. At this point, a colloquial text sample and a non-colloquial text sample are obtained. After the first and second text samples are formed into a pseudo-parallel corpus, the pseudo-parallel corpus is input into a pre-constructed text-to-colloquial conversion model, and the text-to-colloquial conversion model is trained to obtain a final text-to-colloquial conversion model. This allows the text-to-colloquial conversion model to be used to subsequently convert written text to obtain colloquial text. In the above scheme, colloquial vocabulary is identified by the colloquial recognition model, and after removing the colloquial vocabulary, a written text sample is obtained, which is then combined with the colloquial text to form a high-quality pseudo-parallel corpus. This method can obtain a large amount of pseudo-parallel corpus, significantly reducing the labor, time, and economic costs associated with manual annotation. Furthermore, it can also overcome the limitation of model training caused by the small amount of parallel corpus in related technologies. Furthermore, it can also indirectly improve the conversion degree of the text-to-spoken conversion model and the generation quality of spoken text.
[0050] In an optional example, the colloquialism recognition model includes one or more of a sequence labeling sub-model, a binary classification sub-model, and a mask mechanism sub-model. Inputting a first text sample into the pre-trained colloquialism recognition model, recognizing colloquialism words in the first text sample includes:
[0051] One or more sub-models in the spoken language recognition model are used to recognize spoken language vocabulary in the first text sample.
[0052] Specifically, the sequence labeling sub-model may be, for example, a Bert (Bidirectional Encoder Representation from Transformers) + Conditional Random Field (CRF) sequence labeling model.
[0053] Take the colloquial text input above as an example: Come in and place your five orders. Five, four, three, two, one, refresh the car purchase link, refresh the car purchase link. Um, clear out five orders, refresh the car purchase link, two hundred and ninety-nine. This design will increase in price in spring, but look at it; it's very stylish even when opened. Buying in advance is a good idea, buy in advance.
[0054] After the sequence labeling sub-model, the output results include, for example: {come}_interjection, {refresh car purchase number one link}_repeat, {um}_interjection, etc.
[0055] That is, the sequence tagging sub-model can not only tag spoken words, but also assign parts of speech to the spoken words. Since this application does not involve processing the parts of speech of words, it will not be discussed here.
[0056] For example, if a binary classification sub-model is used, it can also identify colloquial words in the text. This is mainly based on the self-attention mechanism in the binary classification model to identify colloquial words.
[0057] For example, in the above-mentioned spoken text, words such as {five}_spoken speech attribute {four}_spoken speech attribute {three}_spoken speech attribute {two}_spoken speech attribute {one}_spoken speech attribute are identified.
[0058] Furthermore, for example, when using the mask mechanism sub-model to identify the colloquial vocabulary in the above-mentioned colloquial text, it is necessary to combine the final output of the binary classification model. That is, after the binary classification model identifies the above-mentioned text as colloquial text, it outputs the colloquial score score_1; the mask mechanism is used to perform mask operations on the vocabulary in the colloquial text one by one.
[0059] For example, the first entry is: [Mask] Enter five orders. Five, four, three, two, one. Refresh the purchase link for car number one. Um, clear out five orders. Refresh the purchase link for car number one. Two hundred and ninety-nine. This design will increase in price in spring. Look at it, it's very elegant even when opened and worn. Buying in advance is a good idea. Buy in advance.
[0060] Then, using a binary classification model, we obtain the colloquial style score (score_2) of the masked text. We calculate the difference between score_1 and score_2. If the difference is greater than a preset threshold, we determine that the masked word is a colloquial word. This same operation can be used to identify the colloquial words in the input colloquial text.
[0061] All three methods can identify colloquial vocabulary in text. Of course, the emphasis on identifying colloquial vocabulary may vary, and the recognition results may contain duplicate or completely different vocabulary. Therefore, in order to achieve more comprehensive and accurate recognition of colloquial vocabulary in text, you can combine multiple methods of identifying colloquial vocabulary in the above three methods.
[0062] For example, first, the sequence labeling sub-model is used to identify colloquial words in the first text sample.
[0063] Prior to this, it was necessary to train the BERT+CRF sequence annotation model based on a small amount of manually annotated corpus, and then use the model to identify colloquial vocabulary in the first text sample.
[0064] Then, the style discrimination model is used to identify colloquial words in the first text sample.
[0065] The binary classification model is also a pre-trained model that can be used. The intermediate parameters in the binary classification model can be used to automatically discover colloquial style vocabulary. The principle is to use the self-attention mechanism to identify colloquial vocabulary in the text.
[0066] As described above, for each piece of data D in the first text sample i , assuming it contains m words (hereinafter referred to as tokens, where a word represents the smallest unit of a sentence after word segmentation. Since word segmentation technology is relatively mature, it will not be elaborated here), the data after word segmentation can be expressed as D i =(d0,d1,d2,…,d m ), D i In the input binary classification model, the binary classification model will return a vector result at the position corresponding to each word, where the result at position d0 is the model discrimination output position, that is, the judgment data D i Whether it is a colloquial text, and the score for determining it as a colloquial text.
[0067] The binary classification model relies on the self-attention mechanism for type discrimination. The self-attention mechanism here means that each token will be converted into a vector during the forward calculation process of the model, and the vectors corresponding to each token in the sentence and other tokens (including the current token) will be summed up by vector inner products to obtain m values, which are multiplied with the corresponding vectors and summed to obtain the output of the position. i Construct a self-attention matrix between the classification output feature position and all tokens in the text. Since larger eigenvalues in the matrix have a greater influence on the text type, they can be identified as segments with stronger stylistic attributes. The self-attention matrix has a dimension of 1*m, with the value at each position equal to the l2-normalized inner product of the vector at the style determination position and the output vector at that position. Positions in the matrix with a value greater than a threshold are marked as colloquial segments.
[0068] Therefore, the self-attention mechanism in the two-classification model can identify D i Colloquial vocabulary in .
[0069] Furthermore, as mentioned above, the binary classification model can also obtain the score of each piece of data belonging to the spoken style text.
[0070] In getting D i After scoring the colloquial category score on the discriminant model, you can i On the basis of d1, d2, ..., dm Perform a replacement operation and replace it with the special character [MASK] in the vocabulary. Run the discriminant model again to get the corresponding score score_j. Calculate the difference between score_j and score. The difference is the contribution of the token to the score. If the difference is greater than the set threshold, the word d is considered j is a word with a colloquial style and marks the position as a colloquial segment.
[0071] This method is the process of the Mask mechanism sub-model mentioned above to perform spoken language recognition on the first text sample.
[0072] After the colloquial words in the first text sample are identified by the above three methods, the colloquial words in the first text sample can be identified more comprehensively. Then, the colloquial words in the first text sample are eliminated based on the recognition results.
[0073] Further optionally, in another specific example, it is considered that the second text sample after removing the colloquial vocabulary may not conform to our normal reading habits, or even be incoherent.
[0074] For example, the result of identifying and removing colloquial words in the first text sample using the three methods above may be:
[0075] Enter five orders. Refresh the car purchase link. Clear five orders, refresh the car purchase link, two hundred and ninety-nine. Designer styles will increase in price in spring, open and wear stylishly, it is a good idea to buy in advance.
[0076] Although the colloquial words have been removed from the colloquial text and converted into written text, the reading is not very consistent with our usual reading habits. Therefore, the method can also include the following steps:
[0077] The second text sample is corrected using the text generation model to obtain a third text sample, so that the first and third text samples can be subsequently input into a pre-built text-to-spoken conversion model to train the text-to-spoken conversion model and obtain a final text-to-spoken conversion model.
[0078] Specifically, a text generation model can be pre-trained using a large amount of written style corpus to predict and generate missing vocabulary in the second text sample, ensuring that the second text sample reads more smoothly. In a specific example, the text generation model can be a generative unsupervised pre-trained model. This model is used to repair the written style fragment into a complete and coherent sentence.
[0079] Specifically, we also take the spoken language dataset D as an example. Take the manually annotated spoken language dataset D, and for each data D in the dataset Di , suppose it contains m words, which can be expressed as D i =(d1,d2,…,d m ). Let d i ,d i+1 ,…,d j After the second step, the word is marked as "spoken part", then delete i ,d i+1 ,…,d j Words, and then through the written generation model to get D i ′=(d1,d2,…,d i-1 ,d′ i , d′ i+1 ,…,d′ j , d j+1 ,…,d m ), think D i ′ is a non-spoken text, a pseudo-parallel corpus can be constructed.
[0080] Further optionally, in addition to the above-mentioned method of identifying colloquial words and obtaining the second text sample, the following method can also be used: obtaining the second text sample based on a word frequency deletion strategy.
[0081] Specifically, please refer to the following formula:
[0082] in, Expressive words The score on attribute v, D v is a set of sentences with attribute v, D v′ is the set of sentences without attribute v, count(u,d v ) represents the frequency of word u appearing in sentences with attribute v, and λ is a balancing parameter. If the value is greater than the threshold value Y, then u is considered to be an attribute word. After determining the attribute word, the attribute word in the attribute v sentence is deleted, and it is considered that the deleted sentence does not have the attribute v, thereby obtaining the second text sample.
[0083] The word frequency-based deletion strategy is an existing technology and is only briefly introduced here without further explanation. It is described as an optional embodiment of the above-mentioned acquisition of the second text sample.
[0084] In an optional example, a pre-built text-to-spoken conversion model includes a neural network BART (Bidirectional and Auto-Regressive Transformers, abbreviated as BART) model that has both contextual information and autoregressive properties and a pointer generation network.
[0085] In this application document, the reason for considering combining the BART model and the pointer generation network to form a text-to-spoken conversion model is that the simple BART model has the following defects:
[0086] 1. It cannot process Out of Vocabulary (OOV) words, which are not in the BART fixed vocabulary, and cannot accurately reproduce details.
[0087] 2. Tends to repeat words from the BART fixed vocabulary.
[0088] Therefore, a Pointer-Generator-Network (PGN) was introduced to alleviate these two issues. During the BART decoding phase, pointers are used to copy words from the source text, helping to accurately replicate information while retaining the ability to generate new words through BART's generator. Optionally, a coverage mechanism is also needed to track generated content when performing loss calculations on the entire BART+PGN neural network to avoid generating duplicate text.
[0089] In the context of spoken language stylization, information loss is unacceptable; the core meaning of the original text must be preserved as much as possible. Therefore, the Copy mechanism has been optimized to increase the probability of selecting characters from the original text for generation. The Copy mechanism refers to the native BART model, which can only generate words from a fixed vocabulary. Specifically, this optimization involves using a pointer generation network to optimize the existing vocabulary generation probabilities in the BART model to obtain a new vocabulary generation probability model. This new vocabulary generation probability model indicates the ability to extract words from the first text sample.
[0090] The specific expression of the new vocabulary generation probability model can be found in the following formula:
[0091] In the BART+PGN structure, the generation probability of word w is:
[0092] Among them, P(w) is the generation probability of the new word w, p gen ∈[0,1], indicating the probability of generating a word from a fixed vocabulary; P vocab (w) is the generation probability of the vocabulary generated by the BART model; represents the attention weight distribution corresponding to the i-th word w.
[0093] Among them, PGN can be Specifically, if the word w is OOV, it will not be generated by the BART model, so the generation probability P of the generated word in the BART model is vocab (w) is zero; at the same time, if w does not appear in the source text, the attention weight distribution is zero. Then, P(w) is 0, which means that the generation probability P(w) of the new word w is zero.
[0094] On the contrary, if w appears in the original text, the attention weight distribution is greater than zero. Therefore, P(w) must be greater than zero. This indicates a certain probability of generating word w. Therefore, when word w appears in the original text, even if w is not in the BART fixed vocabulary, because P(w) is greater than zero, there is a certain probability that word w will appear in the final generated text. This guarantees, to a certain extent, the reproduction of the original text's details, thus resolving the problem mentioned above that the simple BART model cannot handle unregistered words.
[0095] Furthermore, as previously mentioned, by adding a coverage mechanism to track generated content and avoid generating duplicate text when performing loss calculations throughout the BART+PGN neural network, we can address the second issue mentioned above, namely the tendency to repeat words in the BART fixed vocabulary.
[0096] In the above structure, considering that in the original BART model, p gen and These two parameters slow down the convergence of the model.
[0097] For example, if the word A is expected to be generated, it is equivalent to the expected generation probability P(w) of the word A to be finally obtained to be relatively large. However, in actual practice, as shown in the above formula 2, assuming that p gen and When both are small, the final P(w) corresponding to vocabulary A will also be small. The actual P(w) obtained is very different from the expected P(w), which reflects that the calculated loss is relatively large. The conclusion is that the convergence speed of the BART+PGN model will be relatively slow. Based on this, in an optional embodiment, the method also includes: improving the generation probability P of the BART model vocab (w).
[0098] Specifically, the generative probability submodel of the original BART model, that is, P vocab (w) is calculated as:
[0099] Among them, Pvocab (w) is the generative probability submodel of the original BART model, V, V′, b and b′ are learnable parameters, s t is the decoder hidden state in the BART model, is the context vector.
[0100] After optimizing the original BART model’s generation probability sub-model using the pointer generation network, the new BART model’s generation probability sub-model is obtained. The specific formula can be seen in the following expression:
[0101] Among them, P′ vocab (w) is the generation probability of the optimized BART model.
[0102] As mentioned above, if w does not appear in the original text, p(w) does not change. However, if w is a word that appears in the original text, then, Greater than 0, P vocab (w) will increase. Consequently, p(w) in Formula 2 will also increase. A larger p(w) naturally speeds up the model's convergence. Furthermore, it increases the probability that word w in the source text will be selected, minimizing the loss of important information in the original text.
[0103] The above is an embodiment of the method corresponding to the construction of the text-to-spoken conversion model provided by the present disclosure. The following describes other embodiments corresponding to the construction of the text-to-spoken conversion model provided by the present disclosure. Please refer to the following for details.
[0104] FIG2 is a schematic diagram of the structure of a device for constructing a text-to-spoken conversion model provided by an embodiment of the present disclosure. The device includes: an acquisition module 201 , a recognition module 202 , and a processing module 203 .
[0105] An acquisition module 201 is configured to acquire a first text sample, wherein the first text sample includes colloquial vocabulary;
[0106] Recognition module 202, configured to input the first text sample into a pre-trained colloquialism recognition model to recognize colloquialism words in the first text sample;
[0107] The processing module 203 is used to remove the colloquial vocabulary in the first text sample and obtain a second text sample; after the first text sample and the second text sample are formed into a pseudo-parallel corpus, they are input into a pre-built text-to-colloquial conversion model, the text-to-colloquial conversion model is trained, and a final text-to-colloquial conversion model is obtained.
[0108] Optionally, the spoken language recognition model is obtained by training different types of unilateral corpora, where the different types of unilateral corpora include spoken text samples and written text samples.
[0109] Optionally, the spoken language recognition model includes one or more of a sequence labeling sub-model, a binary classification sub-model, and a mask mechanism sub-model; the recognition module 202 is specifically configured to:
[0110] One or more sub-models in the spoken language recognition model are used to recognize spoken language vocabulary in the first text sample.
[0111] Optionally, the processing module 203 is also used to use the text generation model to correct the second text sample and obtain a third text sample, so that the first text sample and the third text sample can be subsequently input into a pre-built text-to-spoken conversion model to train the text-to-spoken conversion model and obtain the final text-to-spoken conversion model.
[0112] Optional, pre-built text-to-spoken conversion models, including the BART model and the Pointer Generation Network.
[0113] Optionally, the processing module is further used to optimize the original vocabulary generation probability in the BART model using a pointer generation network to obtain a new vocabulary generation probability model, where the new vocabulary generation probability model is used to indicate the ability to acquire words in the first text sample.
[0114] Optionally, the new vocabulary generation probability model includes an optimized generation probability sub-model of the BART model. The optimized generation probability sub-model of the BART model is a sub-model generated by optimizing the generation probability sub-model of the original BART model using a pointer generation network. The generation probability sub-model of the optimized BART model is represented by the following formula:
[0115] Among them, P′ vocab (w) is the generation probability of the optimized BART model, V, V′, b and b′ are learnable parameters, s t is the decoder hidden state in the BART model, is the context vector, is the attention weight distribution corresponding to the i-th word w.
[0116] The functions performed by the various components in the text-to-spoken conversion model construction device provided by the embodiments of the present disclosure have been described in detail in the above embodiments, and therefore will not be repeated here.
[0117] The present disclosure provides a device for constructing a text-to-spoken conversion model. A first text sample includes spoken vocabulary. A pre-trained spoken vocabulary recognition model is then used to identify the spoken vocabulary in the first text sample. After removing the spoken vocabulary from the first text sample, a second text sample is obtained. At this point, a spoken text sample and a non-spoken text sample are obtained. The first and second text samples are combined to form a pseudo-parallel corpus, which is then input into a pre-constructed text-to-spoken conversion model. The text-to-spoken conversion model is then trained to obtain a final text-to-spoken conversion model. This allows the text-to-spoken conversion model to be used to subsequently convert written text to obtain spoken text. In the above scheme, spoken vocabulary is identified by the spoken vocabulary recognition model, and after removing the spoken vocabulary, a written text sample is obtained. This is then combined with the spoken text to form a high-quality pseudo-parallel corpus. This approach can obtain a large amount of pseudo-parallel corpus, significantly reducing the labor, time, and economic costs associated with manual annotation. Furthermore, it can overcome the limitation of model training caused by the small amount of parallel corpora in related technologies. Furthermore, it can also indirectly improve the conversion degree of the text-to-spoken conversion model and the generation quality of spoken text.
[0118] As shown in FIG3 , an embodiment of the present disclosure provides an electronic device, including a processor 111 , a communication interface 112 , a memory 113 and a communication bus 114 , wherein the processor 111 , the communication interface 112 , and the memory 113 communicate with each other via the communication bus 114 .
[0119] Memory 113, for storing computer programs;
[0120] In one embodiment of the present disclosure, the processor 111 is configured to execute a program stored in the memory 113 to implement the method for constructing a text-to-spoken conversion model provided in any of the aforementioned method embodiments, the method comprising:
[0121] Obtaining a first text sample, wherein the first text sample includes colloquial vocabulary;
[0122] Inputting the first text sample into a pre-trained colloquialism recognition model to recognize colloquialism words in the first text sample;
[0123] After removing colloquial words from the first text sample, a second text sample is obtained;
[0124] After the first text sample and the second text sample are formed into a pseudo-parallel corpus, the pseudo-parallel corpus is input into a pre-built text-to-spoken conversion model, the text-to-spoken conversion model is trained, and a final text-to-spoken conversion model is obtained.
[0125] Optionally, the spoken language recognition model is obtained by training different types of unilateral corpora, where the different types of unilateral corpora include spoken text samples and written text samples.
[0126] Optionally, the spoken language recognition model includes one or more of a sequence labeling sub-model, a binary classification sub-model, and a Mask mechanism sub-model; the first text sample is input into the pre-trained spoken language recognition model, and identifying the spoken language vocabulary in the first text sample includes using one or more sub-models in the spoken language recognition model to identify the spoken language vocabulary in the first text sample.
[0127] Optionally, after removing the colloquial vocabulary from the first text sample and obtaining the second text sample, the method further includes:
[0128] The second text sample is corrected using the text generation model to obtain a third text sample, so that the first and third text samples can be subsequently input into a pre-built text-to-spoken conversion model to train the text-to-spoken conversion model and obtain a final text-to-spoken conversion model.
[0129] Optional, pre-built text-to-spoken conversion models, including the BART model and the Pointer Generation Network.
[0130] The method also includes: optimizing the original vocabulary generation probability in the BART model using a pointer generation network to obtain a new vocabulary generation probability model, where the new vocabulary generation probability model is used to indicate the ability to obtain words in the first text sample.
[0131] Optionally, the new vocabulary generation probability model includes an optimized generation probability sub-model of the BART model. The optimized generation probability sub-model of the BART model is a sub-model generated by optimizing the generation probability sub-model of the original BART model using a pointer generation network. The generation probability sub-model of the optimized BART model is represented by the following formula:
[0132] Among them, P′ vocab (w) is the generation probability of the optimized BART model, V, V′, b and b′ are learnable parameters, s t is the decoder hidden state in the BART model, is the context vector, is the attention weight distribution corresponding to the i-th word w.
[0133] The embodiments of the present disclosure also provide a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a cloud server, the steps of the method for constructing a text-to-spoken conversion model as provided in one or more of the aforementioned method embodiments are implemented.
[0134] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device that includes the element.
[0135] The foregoing are merely specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not to be limited to the embodiments shown herein, but is to be construed in the broadest manner consistent with the principles and novel features claimed herein.
Claims
1. A method for constructing a text-to-oral conversion model, the method comprising: Acquire a first text sample, wherein the first text sample includes colloquial vocabulary; Inputting the first text sample into a pre-trained colloquialism recognition model to recognize colloquialism words in the first text sample; After removing the colloquial words in the first text sample, a second text sample is obtained; After the first text sample and the second text sample are formed into a pseudo-parallel corpus, they are input into a pre-built text-to-spoken conversion model, the text-to-spoken conversion model is trained, and a final text-to-spoken conversion model is obtained.
2. The method according to claim 1, wherein: The spoken language recognition model is obtained by training different types of unilateral corpora, and the different types of unilateral corpora include spoken text samples and written text samples.
3. The method according to claim 1, wherein: The colloquialism recognition model includes one or more of a sequence labeling sub-model, a binary classification sub-model, and a mask mechanism sub-model; the step of inputting the first text sample into the pre-trained colloquialism recognition model to recognize colloquialism words in the first text sample includes: One or more sub-models in the spoken language recognition model are used to recognize spoken language vocabulary in the first text sample.
4. The method according to claim 1, wherein: After removing the colloquial words in the first text sample and obtaining the second text sample, the method further includes: The second text sample is modified by using a text generation model to obtain a third text sample, so that the first text sample and the third text sample can be subsequently input into a pre-built text-to-spoken conversion model, the text-to-spoken conversion model can be trained, and a final text-to-spoken conversion model can be obtained.
5. The method according to any one of claims 1 to 4, wherein: The pre-built text-to-spoken conversion model includes a BART model and a pointer generation network.
6. The method according to claim 5, wherein: The method also includes: optimizing the original vocabulary generation probability in the BART model by using the pointer generation network to obtain a new vocabulary generation probability model, wherein the new vocabulary generation probability model is used to indicate the ability to obtain words in the first text sample.
7. The method according to claim 6, wherein: The new vocabulary generation probability model includes a generation probability sub-model of the optimized BART model, which is a sub-model generated by optimizing the generation probability sub-model of the original BART model using a pointer generation network; the generation probability sub-model of the optimized BART model is embodied by the following formula: Among them, P′ vocab (w) is the generation probability of the optimized BART model, V, V′, b and b′ are learnable parameters, s t is the decoder hidden state in the BART model, is the context vector, is the corresponding attention weight distribution of the i-th word w.
8. A device for constructing a text-to-oral conversion model, the device comprising: An acquisition module, configured to acquire a first text sample, wherein the first text sample includes colloquial vocabulary; A recognition module, configured to input the first text sample into a pre-trained colloquial recognition model to recognize colloquial vocabulary in the first text sample; The processing module is used to remove the colloquial vocabulary in the first text sample to obtain a second text sample; after the first text sample and the second text sample constitute a pseudo-parallel corpus, they are input into a pre-constructed text-to-colloquial conversion model, the text-to-colloquial conversion model is trained, and a final text-to-colloquial conversion model is obtained.
9. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface, and the memory communicate with each other via a communication bus; Memory, used to store computer programs; The processor is used to implement the steps of the method for constructing a text-to-spoken conversion model as described in any one of claims 1 to 7 when executing the program stored in the memory.
10. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by an electronic device, the steps of the method for constructing a text-to-spoken conversion model as described in any one of claims 1 to 7 are implemented.
11. A computer program product having a computer program stored thereon, wherein when the computer program is executed by an electronic device, the steps of the method for constructing a text-to-spoken conversion model as claimed in any one of claims 1 to 7 are implemented.
12. A computer program, which, when executed by an electronic device, implements the steps of the method for constructing a text-to-spoken conversion model as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and system for transforming written text into oral text
CN107844480A
Text processing method and device and computing equipment
CN112151019A
Text processing method, computer equipment and storage medium
CN114298031A
Model training method and device based on written language
CN115186812A
Text spoken language conversion model construction method and device and electronic equipment
CN116522924A
