A method and device for obtaining training text for speech synthesis
By dynamically selecting the training text in the text library and optimizing the training text group according to the loss value, the problem of insufficient rare pronunciation training in TTS technology is solved, and the accuracy of speech synthesis is improved.
Patent Information
- Application Number
- CN202210678581.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-15
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2042-06-15
AI Technical Summary
The existing TTS technology has high data cost when entering data, resulting in limited training texts, affecting the accuracy of speech synthesis, especially insufficient training for rare pronunciations, resulting in inaccurate speech synthesis.
By randomly selecting text sample groups and initial training text groups from the text library, dynamically selecting training texts based on the loss value of each text, increasing the proportion of rare pronunciations, and optimizing speech synthesis training.
Improve the proportion of rare pronunciations in training texts to ensure that speech synthesis is more complete and accurate.
Smart Images

Figure CN115101045B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data processing, and in particular to a method and device for acquiring training text for speech synthesis. Background Art
[0002] TTS (Text to Speech) technology is a speech synthesis technology that converts text into speech that is as close to real human speech as possible according to the pronunciation standards of a specific language. It is widely used in scenarios such as voice assistants, smart homes, and map navigation. TTS technology has the advantages of not only helping people with visual impairments read information on computers, but also increasing the readability of text documents. The data cost of TTS technology is relatively high during data entry, compared to large amounts of raw data, which limits the number of training texts that can be used for training. Only a very small amount of data text needs to be selected for training. The screening of valid texts for training texts is a key factor that seriously affects the accuracy of TTS technology in speech synthesis conversion.
[0003] Different pronunciations usually require similar numbers of training. If a pronunciation appears too few times, if a random method is used for text screening, the probability of this pronunciation being screened into the training text is very low. In this case, this pronunciation will not be trained or the number of training times will be insufficient, resulting in inaccurate speech synthesis. Summary of the invention
[0004] The object of the present invention is to provide a method and device for obtaining training text for speech synthesis, thereby solving the above-mentioned problems existing in the prior art.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0006] In a first aspect, at least one embodiment of the present application provides a method for obtaining training text for speech synthesis, comprising: randomly selecting text from a text library to form a text sample group and an initial training text group, wherein the text library includes multiple texts, the text sample group includes multiple first texts, and the initial training text group includes N training texts, where N is a positive integer less than or equal to a preset threshold; according to the loss value of each first text in the text sample group, selecting M first texts from the text sample group as training texts to add to the training text group and removing the selected first texts from the text sample group, wherein M is a positive integer and M+N is a preset number of training texts, the loss value represents the rarity of pronunciation in a single first text and the loss value changes with the increase in the number of training texts in the training text group; wherein selecting M first texts as training texts includes selecting one first text as a training text each time until the number of selected training texts reaches M.
[0007] For example, in a method provided according to at least one embodiment of the first aspect of the present invention, M first texts are selected from a text sample group as training texts and added to the training text group according to the loss value of each first text, including looping the following operations on the text sample group until the number of training texts in the training text group reaches M+N: calculating the loss value of each first text in the text sample group; selecting a first text with the smallest loss value as the training text and adding it to the training text group; and removing the selected first text from the text sample group.
[0008] For example, in the method provided by at least one embodiment of the first aspect of the present invention, the loss value of each first text in the text sample group is calculated, including: obtaining the number of occurrences now of each different pronunciation in each pronunciation category of all current training texts in the training text group and the average number of occurrences avg of each different pronunciation; calculating the difference dif between the number of occurrences now of each different pronunciation and the corresponding average number of occurrences avg, where dif = now-avg; obtaining the number of occurrences count of different pronunciations in each pronunciation category in each first text; and calculating the loss value of each pronunciation category in each first text according to the difference dif corresponding to each different pronunciation in each pronunciation category and the number of occurrences count of each different pronunciation: loss type =dif·count; weighted sum of the loss values of each pronunciation category is performed to obtain the loss value of each first text.
[0009] For example, in the method provided by at least one embodiment of the first aspect of the present invention, the loss value loss of each pronunciation category in each first text is calculated. type , including: obtaining the length len(sentence) of each first text; calculating the loss value of each pronunciation category according to the difference dif corresponding to each different pronunciation in each pronunciation category, the number of occurrences count of each different pronunciation and the length len(sentence) of each first text Among them, β is used to adjust the influence of the length of the first text on the loss value.
[0010] For example, in the method provided by at least one embodiment of the first aspect of the present invention, the loss value loss of each pronunciation category in each first text is calculated. type , further comprising: calculating the loss value loss of each pronunciation category according to the difference dif corresponding to each different pronunciation in each pronunciation category, the number of occurrences count of each different pronunciation, and the rarity weight weight of each different pronunciation. type=weight·(count*dif), the rarity weight weight is obtained in advance from the text sample group or stored in advance.
[0011] For example, in the method provided by at least one embodiment of the first aspect of the present invention, the rarity weight weight is a function of the frequency of occurrence of each different pronunciation in the text sample group in the pronunciation category to which it belongs.
[0012] For example, in the method provided according to at least one embodiment of the first aspect of the present invention, the pronunciation categories of pronunciation include at least one of initials, finals, tones and overall pronunciations, and each pronunciation category has multiple different pronunciations and the number of each different pronunciation is greater than or equal to 1.
[0013] For example, in a method provided according to at least one embodiment of the first aspect of the present invention, randomly selecting a text sample group and an initial training text group from a text library includes: dividing the text library into multiple text groups, randomly selecting the same number of first texts from each of the multiple text groups to form a text sample group, and randomly selecting the same number of initial training texts from each text group to form an initial training text group; or, randomly shuffling the order of all texts in the text library, selecting a preset number of texts that are ranked first to form a text sample group, and continuing to select N texts in order to form an initial training text group.
[0014] In a second aspect, at least one embodiment of the present application provides a device for obtaining training text for speech synthesis, including a processor and a memory, wherein the memory stores instructions executable by the processor, and when the instructions are executed by the processor, the processor executes a method as described in any one of the above-mentioned first aspects.
[0015] The beneficial effects of the present invention are as follows: the present invention discloses a method and device for obtaining training text for speech synthesis. Compared with randomly extracted training text, the present invention sets a text sample group and a training text group, and dynamically selects the training text according to the loss value of the first text, thereby increasing the occurrence ratio of rare pronunciations in the training text, so that subsequent speech synthesis can be more completely trained, thereby optimizing the accuracy of speech synthesis. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a flowchart of a method for obtaining speech synthesis according to at least one embodiment of the present invention;
[0017] Figure 2 The device for acquiring training text for speech synthesis provided by at least one embodiment of the present invention is a schematic diagram. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] Unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0020] The present invention discloses a method and device for obtaining training text for speech synthesis. Compared with randomly extracted training text, the present invention sets a text sample group and a training text group, and dynamically selects the training text according to the loss value of the first text, thereby increasing the occurrence ratio of rare pronunciations in the training text, so that subsequent speech synthesis can be trained more completely, and the accuracy of speech synthesis is optimized.
[0021] Figure 1 The present invention is a flowchart of a method for obtaining speech synthesis according to at least one embodiment of the present invention.
[0022] exist Figure 1 In the method for obtaining training text for speech synthesis, the method includes steps S110 to S120.
[0023] Step S110 is executed to randomly select text from the text library to form a text sample group and an initial training text group.
[0024] In the present invention, the text library includes multiple texts, for example, the text library includes 10,000 texts, 100,000 texts, 1 million texts, 10 million texts, etc. The number of texts in the text library may also be less than 10,000, and the specific number is not limited here. Each text can be a sentence or a paragraph. The sample group and the initial training text group in this paper are randomly selected from the text library, for example, the random selection can be realized by adopting an existing random algorithm. The initial training text group includes N training texts, N is a positive integer less than or equal to a preset threshold, for example, the preset threshold is 110, and N is 100. The preset threshold is used to limit the number of training texts in the initial training text group, because the training texts in the initial training text group are randomly selected, so there is a situation where the number of different pronunciations is unbalanced, so the preset threshold needs to be set relatively less, for example, the final desired training text group has a total of 1,000 texts, and the number of training texts in the initial training text group is limited to 100.
[0025] In an embodiment of the present invention, the pronunciation (phone) of a text can be divided into multiple categories, such as the categories of initials, finals, tones, and overall pronunciation. For example, the finals include "a", "e", "i", and "o", etc. Different languages may have different pronunciation categories, and the specific pronunciation category can be set according to the pronunciation habits of the language. Further, each pronunciation category includes at least one pronunciation, usually including a plurality of different pronunciations. Following the previous example, in the pronunciation category of the finals, "a", "e", "i", and "o" are four different pronunciations. In the present invention, the number of each pronunciation in a text refers to the number of a specific pronunciation (e.g., "a") in the text.
[0026] Optionally, when the text library has a massive amount of text, the text library can be first divided into multiple text groups, and the same number of first texts are randomly selected from each of the multiple text groups to form a text sample group, and the same number of initial training texts are randomly selected from each text group to form an initial training text group; or, all texts in the text library are randomly shuffled, a preset number of texts in the front order are selected to form a text sample group, and N texts are continuously selected in order to form an initial training text group.
[0027] For example, if the text library has 100,000 texts, the 100,000 texts can be divided into 20 text groups, each text group has 5,000 texts, and the text sample group requires 1,000 texts, then 50 texts are randomly selected from each of the 20 text groups to form the text sample group. As for the initial training text group, a similar method can be used. For example, if the initial training text group requires 100 texts, 5 texts are randomly selected from each of the above 20 text groups to form the initial training text group.
[0028] For another example, when the text library has millions or tens of millions of texts, the computing resources and processing time required to group the text library are relatively large, so the text library can be shuffled as a whole, and then the top 100,000 texts are selected, and then the 100,000 texts are grouped, and the same number of texts are randomly selected from each group to form the initial training text group of the text sample combination. For details, please refer to the previous example, which will not be repeated here. It can be understood that the number of texts in the text library is not necessarily exactly one hundred or one thousand. For example, if the text library has 53,209 texts, in this case, 9 texts can be randomly discarded and then grouped, that is, the texts in the text library are subjected to an operation similar to rounding, so that the number of texts to be randomly selected is an integer that can be grouped. It should be noted that this operation does not change the number of texts in the text library.
[0029] Optionally, before executing step S110, the text library can also be preliminarily screened, for example, according to preset rules, deleting the text in the text library that does not conform to the preset rules, such as deleting sentences with three (or more) consecutive identical words, such as "ahhhhhhhhh".
[0030] Step S120 is executed to select M first texts from the text sample group as training texts and add them to the training text group according to the loss value of each first text in the text sample group, and remove the selected first texts from the text sample group.
[0031] After obtaining the text sample group and the initial training text group, M first texts can be selected from the text sample group as training texts and added to the training text group according to the loss value of each first text in the text sample group. It should be noted that after the first text is selected as the training text, it is removed from the text sample group to ensure that the same first text is not selected as the training text.
[0032] In this embodiment, the loss value represents the rarity of a certain pronunciation or a certain category in a single first text. For example, in one first text, there are three different finals "a", "e" and "i", the number of "a" is 2, the number of "e" is 1 and the number of "i" is 5, then in the first text, "e" is the most rare. The rarity in the present invention can be measured by the ratio of the number of each pronunciation to the total number of all pronunciations. The smaller the value, the higher the rarity. Accordingly, as the number of training texts in the training text group increases, or as the number of first texts in the text sample group decreases, the loss value changes.
[0033] When executing step S120 , selecting M first texts as training texts means selecting one first text each time until a total of M texts are selected.
[0034] In some optional embodiments, M first texts are selected as training texts and the following operations may be performed on the text sample group in a loop until the number of training texts in the training text group reaches M+N, and the operations of the loop include: calculating the loss value of each first text in the text sample group; selecting a first text with the smallest loss value as the training text and adding it to the training text group; and removing the selected first text from the text sample group.
[0035] In this embodiment, before selecting a training text each time, it is necessary to calculate the loss value of all the current first texts in the text sample group, and select the first text with the smallest loss value among all the current first texts as the training text. For example, the text sample group initially has 10,000 first texts, the initial training text group has 100 training texts, and the training text group ultimately needs to have 1,000 training texts, then 900 need to be selected from the text sample group, then it is necessary to perform the above-mentioned loop operation 900 times, wherein the loss value of 10,000 first texts is calculated for the first time, the loss value of 9,999 first texts is calculated for the second time, the loss value of 9,998 first texts is calculated three times, ..., and the loss value of 9,101 first texts is calculated for the 900th time.
[0036] In some optional embodiments, calculating the loss value of each first text in the text sample group includes: obtaining the number of occurrences now of each different pronunciation in each pronunciation category of all current training texts in the training text group and the average number of occurrences avg of each different pronunciation; calculating the difference dif between the number of occurrences now of each different pronunciation and the corresponding average number of occurrences avg, where dif = now-avg; obtaining the number of occurrences count of different pronunciations in each pronunciation category in each first text; and calculating the loss value loss of each pronunciation category in each first text according to the difference dif corresponding to each different pronunciation in each pronunciation category and the number of occurrences count of each different pronunciation. type , where loss type =dif*count; perform weighted summation on the loss value of each pronunciation category to obtain the loss value of each first text.
[0037] In this embodiment, count, dif and now can all be expressed in the form of vectors. When the number of occurrences of a pronunciation is smaller, the value of dif is smaller, and the value can be a negative value. For example, a text has the finals "a", "e", "i" and "o", then the corresponding now = [1, 3, 5, 7] of the text means that the text has 1 "a", 3 "e", 5 "i" and 7 "o". It can be understood that in actual applications, the corresponding finals and their order of each element in the vector may be different from those in this example, and are not limited here. Count, dif and now are expressed in vector form so that a single vector can express how many different pronunciations a pronunciation category has and the number corresponding to each different pronunciation. The "*" in dif*count represents the Hadamard product. For example, now = [1, 3, 5, 7], avg = (1+3+5+7) / 4 = 4, dif = now-avg = [-3, -1, 1, 3], count = [2, 3, 3, 1], then the loss value loss of the pronunciation of this category is type =dif*count=[-6,-3,3,3].
[0038] Optionally, the loss value of a first text is the sum of the loss values of all pronunciation categories in the first text. For example, a first text includes pronunciations of four pronunciation categories, and the loss values of the four pronunciation categories are loss type1 、loss type2 、loss type3 and loss type4 , the loss value of the first text can be expressed as loss sum , then loss sum =α1loss type1 +α2loss type2 +α3loss type3 +α4loss type4 , where α1 to α4 are the weights of the loss value of each pronunciation category, usually constants, which are used to unify the order of magnitude of the loss values of different pronunciation categories, such as loss type1 The calculated value is 5.5, and the loss type2 If the calculated value is 0.5, α1 can be set to 0.1 and α2 can be set to 0.8. The specific values of α1 to α4 can be set according to actual conditions and are not limited here.
[0039] The method in the above embodiment can effectively increase the number of rare pronunciations in the training text group, so that the number of occurrences of each pronunciation is relatively balanced. When the final training text group is used for training, each pronunciation can be trained evenly.
[0040] However, the above method may result in the selected training texts being long texts. This is because the sum of the loss values of the second-best pronunciations in many long texts may be smaller than the loss value of the best pronunciation in the shorter texts. For one or some pronunciations, it is necessary to select a shorter text, but it is not desirable that the text length is too short. Therefore, in some optional embodiments, the loss value loss of each pronunciation category in each first text is calculated. type , including: obtaining the length len(sentence) of each first text; calculating the loss task of each pronunciation category according to the difference dif corresponding to each different pronunciation in each pronunciation category, the number of occurrences count of each different pronunciation and the length len(sentence) of each first text Among them, β is used to adjust the influence of the length of the first text on the loss value.
[0041] It is understandable that the length of the text can be expressed in words or characters, and the length of the text can be set according to actual needs, for example, a text with more than 50 words is a long text, and vice versa. The value of β can also be set according to actual needs, for example, set to 0.5.
[0042] When the number of training texts in the training text group is small (for example, when the initial training text group is obtained, such as only 100 training texts), the number of times different pronunciations appear in the training texts at this time is generally small, and some pronunciations may not appear yet, so the rarity of the pronunciation at this time is inaccurate. The above scheme can improve the average occurrence of each pronunciation after cyclically selecting the first text, but more cycles are required and some of the training texts initially selected are not comprehensive enough. Therefore, in some optional embodiments, the loss value loss of each pronunciation category in each first text is calculated. type , further comprising: calculating the loss value loss of each pronunciation category according to the difference dif corresponding to each different pronunciation in each pronunciation category, the number of occurrences count of each different pronunciation, and the rarity weight weight of each different pronunciation. type =weight·(count*dif), the rarity weight weight is obtained in advance from the text sample group or stored in advance.
[0043] For example, the number of occurrences of each pronunciation is counted in advance from the text sample group, and a rarity weight is assigned to each pronunciation according to the number of occurrences of each pronunciation, or the rarity weight is pre-stored historical data.
[0044] Optionally, the rarity weight is a function of the frequency of occurrence of each different pronunciation in the text sample group in the pronunciation category to which it belongs. For example, the rarity weight is the inverse of the frequency of occurrence of each pronunciation in the pronunciation category. For example, if the number of occurrences of all pronunciations in a pronunciation category is [1, 2, 4, 3], then the frequency of occurrence is [1 / (1+2+4+3), 3 / (1+2+4+3), 5 / (1+2+4+3), 7 / (1+2+4+3)], and the corresponding rarity weight is weight=[10, 5, 2.5, 3.333]. In addition to the inverse, the rarity weight can also be characterized as other functions.
[0045] Figure 2 A schematic diagram of an apparatus for acquiring training text for speech synthesis according to at least one embodiment of the present invention.
[0046] exist Figure 2 In the embodiment, the device 200 for obtaining training text for speech synthesis includes a processor 210 and a memory 220, in which instructions executable by the processor 210 are stored, and when the instructions are executed by the processor 210, the processor 210 executes a method as in any one of the above embodiments.
[0047] By adopting the above technical solution disclosed in the present invention, the following beneficial effects are obtained:
[0048] The present invention discloses a method and device for obtaining training text for speech synthesis. Compared with randomly extracted training text, the present invention sets a text sample group and a training text group, and dynamically selects the training text according to the loss value of the first text, thereby increasing the occurrence ratio of rare pronunciations in the training text, so that subsequent speech synthesis can be trained more completely, and the accuracy of speech synthesis is optimized.
[0049] The various illustrative logic blocks, modules, circuits, and algorithmic operations described in conjunction with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and operations have been described above generally in terms of their functions. Whether such functions are implemented as hardware or software depends on the specific application and the design constraints imposed on the entire system. A skilled person may implement the described functions in different ways for each specific application, but such implementation decisions should not be interpreted as causing a deviation from the scope of the claims.
[0050] The hardware for implementing the various illustrative logics, logic blocks, modules, and circuits described in conjunction with the embodiments disclosed herein may be implemented or executed with a general-purpose processor, a digital signal processor (DSP), a dedicated application integrated circuit (TCUASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination designed to perform the functions described herein. A general-purpose processor may be a microprocessor, but in an alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in combination with a DSP core, or any other such configuration. Alternatively, some operations or methods may be performed by circuits specific to a given function.
[0051] In one or more embodiments, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored as one or more instructions or codes on a non-transitory computer-readable medium or a non-transitory processor-readable medium. The operation of the method or algorithm disclosed herein may be embodied in a processor-executable software module, which may reside on a non-transitory computer-readable or processor-readable storage medium. A non-transitory computer-readable or processor-readable storage medium may be any storage medium accessible by a computer or processor. As an example and not limitation, such non-transitory computer-readable or processor-readable media may include RAM, ROM, EEPROM, flash memory, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the required program code in the form of instructions or data structures and can be accessed by a computer. As used herein, disks and discs include compact discs (CDs), laser discs, optical discs, digital versatile discs (DVDs), floppy disks, and Blu-ray discs, where the discs typically reproduce data magnetically, and the discs reproduce data optically by lasers. The above combinations are also included within the scope of non-transitory computer-readable and processor-readable media. Furthermore, the operations of a method or algorithm may reside as one or any combination or set of codes and / or instructions on a non-transitory processor-readable medium and / or computer-readable medium, which may be incorporated into a computer program product.
[0052] The foregoing description of the disclosed embodiments is provided to enable any person skilled in the art to formulate or use the claims. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be applied to other embodiments without departing from the scope of the claims. Therefore, the present invention is not intended to be limited to the embodiments shown herein, but is to be consistent with the widest scope consistent with the claims and the principles and novel features disclosed herein.
Claims
1. A method for obtaining training text for speech synthesis, comprising: Randomly selecting text from a text library to form a text sample group and an initial training text group, wherein the text library includes a plurality of texts, the text sample group includes a plurality of first texts, and the initial training text group includes N training texts, where N is a positive integer less than or equal to a preset threshold; According to the loss value of each first text in the text sample group, select M first texts from the text sample group as training texts to add to the training text group and remove the selected first texts from the text sample group, wherein M is a positive integer and M+N is a preset number of training texts, the loss value represents the rarity of pronunciation in a single first text and the loss value changes as the number of training texts in the training text group increases; The selecting M first texts as training texts includes selecting one first text as a training text each time until the number of selected training texts reaches M.
2. The method according to claim 1, wherein: The step of selecting M first texts from the text sample group as training texts and adding them to the training text group according to the loss value of each first text comprises loopingly performing the following operations on the text sample group until the number of training texts in the training text group reaches M+N: Calculating the loss value of each first text in the text sample group; Select a first text with the smallest loss value as a training text and add it to the training text group; The selected first text is removed from the text sample group.
3. The method according to claim 2, wherein: The calculating the loss value of each first text in the text sample group includes: Obtain the number of occurrences now of each different pronunciation in each pronunciation category of all current training texts in the training text group and the average number of occurrences avg of each different pronunciation; Calculate the difference dif between the number of occurrences now of each different pronunciation and the corresponding average number of occurrences avg, where dif = now - avg; Get the count of the number of occurrences of different pronunciations in each pronunciation category in each first text; According to the difference dif corresponding to each different pronunciation in each pronunciation category and the number of occurrences count of each different pronunciation, the loss value of each pronunciation category in each first text is calculated: loss type =dif·count; The loss value of each pronunciation category is weightedly summed to obtain the loss value of each first text.
4. The method according to claim 3, wherein: The loss value loss of each pronunciation category in each first text is calculated type ,include: Get the length of each first text len(sentence); Calculate the loss value of each pronunciation category based on the difference dif corresponding to each different pronunciation in each pronunciation category, the number of occurrences of each different pronunciation count, and the length len(sentence) of each first text Among them, β is used to adjust the influence of the length of the first text on the loss value.
5. The method according to claim 3, wherein: The loss value loss of each pronunciation category in each first text is calculated type , also includes: According to the difference dif corresponding to each different pronunciation in each pronunciation category, the number of occurrences of each different pronunciation count, and the rarity weight of each different pronunciation weight, the loss value loss of each pronunciation category is calculated. type =weight·(count*dif), wherein the rarity weight weight is obtained in advance from the text sample group or stored in advance.
6. The method according to claim 5, wherein: The rarity weight is a function of the frequency of occurrence of each different pronunciation in the text sample group in the pronunciation category to which it belongs.
7. The method according to claim 1, wherein: The pronunciation categories of the pronunciation include at least one of initial consonants, final consonants, tones and overall pronunciations, and each pronunciation category has a plurality of different pronunciations and the number of each different pronunciation is greater than or equal to one.
8. The method according to claim 1, wherein: The randomly selecting a text sample group and an initial training text group from a text library includes: Dividing the text library into a plurality of text groups, randomly selecting the same number of first texts from each of the plurality of text groups to form the text sample group, and randomly selecting the same number of initial training texts from each text group to form the initial training text group; or, All the texts in the text library are randomly shuffled, the preset number of texts in the front order are selected to form the text sample group, and N texts are continuously selected in order to form the initial training text group.
9. A device for acquiring training text for speech synthesis, comprising a processor and a memory, wherein the memory stores instructions executable by the processor, and when the instructions are executed by the processor, the processor executes the method as described in any one of claims 1 to 8.
