Text conversion method and related device
By setting word labels and using predictive models combined with contextual information to process OOV words and polyphonic words, the problem of words and homophones not included in the dictionary during text conversion is solved, and the quality and accuracy of speech synthesis are improved.
Patent Information
- Application Number
- CN202210122711.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-09
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-02-09
AI Technical Summary
When the existing technology automatically converts text into speech, it fails to effectively handle OOV words not included in the dictionary and polysyllabic words with homographs, resulting in mispronunciation and affecting the quality of speech synthesis.
By setting word labels, for polysyllabic words and non-dictionary words in the dictionary, the prediction model is combined with contextual information to construct compound words, obtain phoneme sequence and stress information, and solve the pronunciation problem of OOV words and polysyllabic words.
It improves the effect of converting text into speech, unifies the processing of OOV words and polysyllabic words, and improves the accuracy of speech synthesis and user experience.
Smart Images

Figure CN114492418B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of text-to-speech conversion, and in particular to a text conversion method and related devices. Background Art
[0002] At present, text is generally automatically converted into speech with reference to a pre-built dictionary. With the continuous development of vocabulary and language, it is found in the actual application process that there are many words not included in the dictionary, that is, OOV (Out of Vocabulary) words, or words beyond the vocabulary. And in many languages, there is the phenomenon of homophony, that is, Polyphone, or polyphonic characters; however, the dictionary usually includes more commonly used pronunciations. Although the number of OOV words and polyphonic words is small, their pronunciation has a very important impact on the expression of the meaning of the whole sentence. If the polyphonic words or OOV words in the synthesized audio are pronounced incorrectly, it will make the user feel confused, resulting in a significant reduction in the effect of the synthesized audio. Summary of the invention
[0003] The present application provides a text conversion method and related devices to solve the problems of OOV words and polyphonic words in a unified manner.
[0004] To solve the above technical problems, a technical solution adopted in the present application is: to provide a text conversion method, comprising: obtaining words in a text to be converted, and setting labels for the words without punctuation marks; wherein the labels include polyphonetic words in a dictionary, non-polyphonetic words in a dictionary, or words not in a dictionary; for the words without punctuation marks, in response to the word being a non-polyphonetic word in a dictionary, obtaining the phoneme sequence and stress information of the word from the dictionary by matching; in response to the word being a polyphonetic word in a dictionary and a word not in a dictionary, constructing a corresponding compound word based on the word, and obtaining the phoneme sequence and stress information of the word based on the compound word and a prediction model; wherein, when the word is a polyphonetic word in a dictionary, the compound word is related to the context information of the word; when the word is not in a dictionary, the compound word is irrelevant to the context information of the word.
[0005] To solve the above technical problems, another technical solution adopted by the present application is: to provide a text conversion device, including: an acquisition module, used to obtain words in the text to be converted, and set labels for the words other than punctuation marks; wherein the labels include polyphones in a dictionary, non-polyphones in a dictionary, or words not in a dictionary; a first processing module, connected to the acquisition module, used to match and obtain the phoneme sequence and stress information of the word from the dictionary in response to the word being a non-polyphone word in the dictionary; a second processing module, connected to the acquisition module, used to construct corresponding compound words based on the words in response to the words being polyphones in the dictionary and words not in the dictionary, and obtain the phoneme sequence and stress information of the word based on the compound words and a prediction model; wherein, when the word is a polyphone in the dictionary, the compound words are related to the context information of the word; when the word is not in the dictionary, the compound words are irrelevant to the context information of the word.
[0006] To solve the above technical problems, another technical solution adopted in the present application is: to provide an electronic device, comprising a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the text conversion method described in any of the above embodiments.
[0007] In order to solve the above technical problems, another technical solution adopted by the present application is: providing a storage device storing program instructions that can be executed by a processor, wherein the program instructions are used to implement the text conversion method described in any of the above embodiments.
[0008] Different from the prior art, the beneficial effect of the present application is that: the text conversion method provided by the present application will first set corresponding labels for the words of non-punctuation marks in the text to be converted, and the labels include polyphones in the dictionary, non-polyphones in the dictionary, or non-dictionary words; then for the non-polyphones in the dictionary, the corresponding phoneme sequence and stress information can be directly obtained through dictionary matching; for the polyphones in the dictionary and the non-dictionary words, the corresponding phoneme sequence and stress information will be obtained using the prediction model, the difference is that when it is a polyphone, the context information of the polyphone will be considered, and when it is a non-dictionary word, the context information of the non-dictionary word is not considered. The present application uses a prediction model and a series of conversion methods to solve the main problems of OOV words (i.e., non-dictionary words) and the disambiguation problem of polyphones in the process of converting text to speech in a unified way, so as to improve the effect of converting text to speech. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work, among which:
[0010] Figure 1 This is a flowchart of an implementation method of the text conversion method of the present application;
[0011] Figure 2 for Figure 1 A corresponding schematic diagram of a framework of an implementation method;
[0012] Figure 3 for Figure 1 A flowchart of an implementation method of obtaining a phoneme sequence and stress information of a word based on a combination of words and a prediction model;
[0013] Figure 4 for Figure 1 A schematic diagram of the structure of an implementation method of a prediction model;
[0014] Figure 5 This is a schematic diagram of a framework of an implementation method of a text conversion device of the present application;
[0015] Figure 6 This is a schematic diagram of the structure of an embodiment of an electronic device of the present application;
[0016] Figure 7 This is a schematic structural diagram of an implementation of a storage device of the present application. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0018] See also Figure 1 and Figure 2 , Figure 1 This is a flowchart of an implementation method of the text conversion method of this application. Figure 2 for Figure 1 A corresponding framework diagram of an implementation method. The text conversion method specifically includes:
[0019] S101: Obtain words in a text to be converted, and set labels for words other than punctuation marks; wherein the labels include polyphonic words in a dictionary, non-polyphonic words in a dictionary, or non-dictionary words.
[0020] Specifically, in this embodiment, before the above step S101, a process of obtaining a dictionary of the language to which the text to be converted belongs and constructing a polyphonic word table of the language to which the text to be converted belongs is included. The dictionary includes multiple words, and a phoneme sequence and stress information corresponding to each word. The phoneme sequence and stress information can be combined in the form of syllables, and multiple syllables together constitute the pronunciation sequence of the word. The process of constructing the polyphonic word table can be: first collect and obtain a large amount of text data of the language to which it belongs; then obtain polyphonic words from the collected text data to construct a polyphonic word table. And generally speaking, the polyphonic words can be included in the dictionary.
[0021] The implementation process of the above step S101 can be: the text to be converted is processed by word segmentation to obtain all the words in the text to be converted, and all the words obtained at this time can include punctuation marks (for example, commas, periods, etc.) and non-punctuation marks. Further, for each non-punctuation mark word, the word can be matched with a polyphonic word table first, if the polyphonic word table contains the word, the label of the word is set to a polyphonic word in the dictionary; if the polyphonic word table does not contain the word, the word is matched with a dictionary; if the dictionary contains the word, the label of the word is set to a non-polyphonic word in the dictionary; if the dictionary does not contain the word, the label of the word is set to a non-dictionary word. Of course, in other embodiments, the text to be converted can also be processed by word segmentation to obtain some words in the text to be converted, and the part of the words can be non-stop words; wherein, non-stop words are some words other than stop words, and stop words generally refer to some meaningless words, such as "the", "of", and some punctuation marks, etc.; then set a corresponding label for each word. Alternatively, the text to be converted may be segmented to obtain all words, and then labels may be set for non-punctuation marks and non-stop words in all words.
[0022] S102: For words other than punctuation marks, in response to the word being a non-polyphonetic word in the dictionary, obtaining the phoneme sequence and stress information of the word from the dictionary by matching; in response to the word being a polyphonetic word in the dictionary and a word not in the dictionary, constructing a corresponding compound word based on the word, and obtaining the phoneme sequence and stress information of the word based on the compound word and a prediction model; wherein, when the word is a polyphonetic word in the dictionary, the compound word is related to the context information of the word; and when the word is not in the dictionary, the compound word is unrelated to the context information of the word.
[0023] Specifically, each non-punctuation word can be obtained according to the forward order of each word in the text to be converted (i.e. the order of normal reading and spelling), and further corresponding processing is selected according to the label of the non-punctuation word to obtain the corresponding phoneme sequence and stress information.
[0024] For example, when the word is a non-polyphonetic word in the dictionary, the phoneme sequence and stress information of the word can be directly obtained from the dictionary.
[0025] For another example, when the word is a polyphone in the dictionary, since analyzing the polyphone alone cannot determine which pronunciation it should belong to, only by combining it with the context in the sentence can we know its corresponding pronunciation. Therefore, we combine the contextual information of the polyphone as auxiliary information to predict the phoneme sequence and stress information of the polyphone.
[0026] The process of constructing a compound word can be: in response to the current word being a polyphone in the dictionary, the current word and other words adjacent to the current word are combined to obtain a corresponding compound word. Specifically, the preceding word and the following word adjacent to the current word can be obtained; in response to the preceding word or the following word being a punctuation mark (e.g., a comma, a period, etc.), the preceding word or the following word that is a punctuation mark is regarded as an empty word; some characters adjacent to the current word are obtained from the preceding word and the following word, and some characters and the current word are arranged in the forward order in the text to be converted to obtain a compound word. At this time, the compound word can be in the form of A_Word_B, where A represents the preceding word character, Word represents the current word, and B represents the following word character, and "_" can be regarded as a mark that distinguishes the preceding word information, the current word information, and the following word information. When the preceding word or the following word is a punctuation mark and is regarded as an empty word, the corresponding A or B can be understood as empty. In addition, since each word is of different lengths, we set the number of ending characters of the previous and next words to 1, 3, and 5 characters respectively for experiments. After experiments on Russian, German, and Italian, this case combines the last three characters of the previous word and the first three characters of the next word, and the effect is better. Of course, in other application scenarios, the number of characters in the selected previous and next words can also be set according to actual needs. In addition, in some cases, assuming that the number of partial characters to be selected from the previous word and the next word is P, but the number of all characters in the previous word (or next word) adjacent to the current word is less than P, then all the characters in the previous word (or next word) are directly added to the combined word, and the characters in the word before the previous word (or the word after the next word) are not added to the combined word.
[0027] In an application scenario, taking the sentence "чтогде-товгазетенапечатанхорошийрецепттворожника" as an example, the following multiple compound words can be formed: "_что_где", "что _где-то_в", "-то_в_газ", "в_газете_нап", "ете_напечатан_хор", "ший_рецепт_тво" and "епт_творожника_".
[0028] Further, after obtaining the combined words, see Figure 3 , Figure 3 for Figure 1A flowchart of an implementation method of obtaining a phoneme sequence and stress information of a word based on a combination of words and a prediction model, comprising:
[0029] S201: Obtain a first matrix representation of the combined word; wherein each character in the combined word is mapped to a row of elements in the first matrix representation.
[0030] Specifically, step S201 corresponds to Figure 2 The first matrix represents a preprocessing process including M rows and N columns; wherein M is the maximum character length of the preset combination word, and M can be preset manually. N is the number of all characters of the language to which the text to be converted belongs; for example, when the text to be converted is English, English has a total of 28 characters, and N is 28 at this time; for another example, when the text to be converted is Russian, Russian has a total of 33 characters, and N is 33 at this time.
[0031] The specific implementation process of the above step S201 includes: A. Obtain a character in the combined word in reverse order; wherein the reverse order is opposite to the forward order mentioned above; for example, when the normal order is from left to right, the reverse order is from right to left. B. Obtain the sorting position of the current character in the character sequence of the language to which it belongs, and set the element corresponding to the sorting position in the row element corresponding to the current character in the first matrix representation to 1, and set the elements of the remaining sorting positions to 0; for example, taking the character "B" in English as an example, its sorting position in the character sequence in English is the second position, then the element of the second position from left to right in the row element corresponding to the character in the first matrix representation is set to 1, and the elements of the remaining positions in the current row element are set to 0. C. In response to the row elements corresponding to all characters in the combined word being set, and the length of the combined word is less than M, the remaining row elements in the first matrix representation are set to 0.
[0032] In an application scenario, take the Russian word "в_газете_нап" as an example. The last character of the word combination obtained in reverse order is "п", which is mapped to the first row element in the first matrix representation. The first row element can be understood as a 1*N matrix. The character "п" corresponds to the character sequence position 13 in Russian. Then, in the 1*N matrix, the 13th element position from left to right is represented as True (or 1), and the other positions are represented as False (or 0). Similarly, the remaining L-1 characters are mapped in turn to obtain L*N two-dimensional matrix information. Among them, L represents the length of the current word combination (that is, the number of characters contained); when L is less than M, the remaining (ML)*N content belongs to the blank area, which is filled with False (or 0), and then the M*N first matrix representation is obtained.
[0033] S202: Input the first matrix representation into the prediction model to obtain a second matrix representation of the compound word; wherein a row of elements in the second matrix representation indicates whether the character of the corresponding row element in the first matrix representation is a vowel or a consonant, and whether the character has an accent when it is a vowel.
[0034] Specifically, the second matrix representation output by the prediction model is a new representation obtained by combining and merging the phoneme sequence and the stress information. Generally speaking, there are only three possible pronunciations of the phonemes corresponding to a word, namely, one-to-one correspondence between letters and phonemes, one letter corresponding to two phonemes, and two letters corresponding to one phoneme. Since there are cases where one letter corresponds to two phonemes and two letters correspond to one phoneme, the phoneme of each letter is represented by a two-bit binary 01 string. Taking Russian as an example, for the vowel letter "а", the possible phonemes of the letter are aa and ax. If aa indicates that the letter is in the stress position, ax indicates that it is unstressed. Therefore, we convert the stress information into a binary 01 string representation, using "10" to represent the phoneme aa and "01" to represent the phoneme ax. For the consonant letter "в", there is only one phoneme vv, which is represented by the binary string "00". Finally, the 01 string representation of the target phoneme corresponding to each letter is also combined into a second matrix representation of M*2 in reverse order. Wherein, M is the maximum character length of the preset combination word, that is, the number of rows of the input data (i.e., the first matrix representation) and the output data (i.e., the second matrix representation) is the same, and the same row in the first matrix representation and the second matrix representation corresponds to the same character in the word. The row element [0 0] in the second matrix representation indicates that the character corresponding to the current row element is a consonant, the row element [1 0] in the second matrix representation indicates that the character corresponding to the current row element is a vowel with an accent, and the row element [0 1] in the second matrix representation indicates that the character corresponding to the current row element is a vowel without an accent. Of course, in other embodiments, other 01 strings can also be used to distinguish consonants, vowels with accents, and vowels without accents, and this application does not limit this.
[0035] See also Figure 4 , Figure 4 for Figure 1A structural diagram of an implementation method of the prediction model in the figure. The prediction model includes a convolutional layer 10, a bidirectional long short-term memory network 12, a soft attention layer 14 and a shared coding layer 16 connected in sequence. That is, the prediction model used in this case integrates multiple deep learning models and proposes a multi-task learning network structure based on convolutional neural networks (CNN) + bidirectional long short-term memory networks (LSTM) + soft attention mechanisms (Soft Attention). The model proposed in this case can be called a CBLAM prediction model, the input of the CBLAM prediction model is a first matrix representation in the above data form, and the output of the CBLAM prediction model is a second matrix representation that combines and merges the phoneme sequence and the stress information. At this time, the phoneme information equivalent to each character is a binary classification task, and the target value of each word is combined into multiple classification tasks. The first matrix represents that after the CNN extracts information, it can learn the context information better by combining the characteristics of Bi-LSTM with soft-attention mechanism. After that, it passes through the shared coding layer, and the hidden layer of the network with correlation sharing between each task. The prediction result is output through the hard sharing of hidden layer parameters through the fully connected layer (located in the shared coding layer). The above CBLAM prediction model can be experimentally verified on Russian, German and Italian, with a sample size of 200,000 rows of data, trained based on the Pytorch framework, and obtains relatively stable model parameters.
[0036] S203: Restore the second matrix representation in the form of dictionary mapping to obtain the phoneme sequence and stress information of the word.
[0037] Specifically, the second matrix representation is equivalent to a binary string of 01, which can be restored in the form of dictionary mapping. In addition, since the second matrix representation also contains information corresponding to characters in the preceding and succeeding words other than the current word, the corresponding row elements can be obtained from the second matrix representation only according to the position information of the current word in the combined word, and then the corresponding row elements are restored by dictionary mapping to obtain the phoneme sequence and stress information of the current word. Alternatively, the second matrix representation can be restored in the form of dictionary mapping to obtain the phoneme information and stress information of the combined word; and then the phoneme information and stress information of the current word can be obtained according to the position information of the current word in the combined word.
[0038] In an application scenario, assume that the second matrix is expressed as The word for which the phoneme information and stress information are to be obtained is газа; since the second matrix representation is arranged in reverse order, it can be considered that the first row element [1 0] in the second matrix representation represents the fourth character а from left to right in the word, and the character has an accent, the second row element [0 1] represents the third character з from left to right in the word, and the character does not have an accent, the third row element [0 1] represents the second character а from left to right in the word, and the character does not have an accent, and the fourth row element [0 0] represents the first character г from left to right in the word, and the character is a consonant. The phoneme sequence of the current word obtained by dictionary mapping is [gg ax zzaa], and the phoneme sequence and stress information can finally be combined in the form of syllables, for example, ((gg ax)0)((zzaa)1), where 1 indicates that the syllable is a stressed syllable, and 0 indicates that the syllable is not a stressed syllable. Since there is only one vowel character in each syllable, the stress on the syllable essentially only acts on the vowel character.
[0039] For another example, when the word is not in the dictionary, the phoneme sequence and stress information can be obtained in a similar way to the polyphonic words in the dictionary. The difference is that the context information does not need to be considered for the words not in the dictionary. The process of constructing the compound word can be: in response to the current word being not in the dictionary, other words adjacent to the current word are regarded as empty words, and the current word and the adjacent empty words are combined to obtain the corresponding compound word. At this time, the form of the compound word can be _Word_. The subsequent process of obtaining the phoneme sequence and stress information of the current word based on the compound word and the prediction model can be seen in Figure 3 and Figure 4 The relevant description will not be repeated here.
[0040] In addition, in other embodiments, in response to the word being a polyphonetic word in the dictionary or a non-dictionary word, after the step of obtaining the phoneme sequence and stress information of the word, it also includes using a post-processing fine-tuning process to reduce the error rate of the prediction model prediction.
[0041] Specifically, for each word, the classification results predicted by the CBLAM model may result in a situation where the phoneme sequence obtained by combining the predicted results of each character is a non-stressed form, so post-processing is required to solve this situation. According to linguistic knowledge, stress always occurs on vowels.
[0042] Case 1: In response to the fact that all characters of the current word are unaccented, and when the word contains only one vowel, the vowel is treated as an accented character, and the phoneme sequence and stress information of the current word are updated.
[0043] Case 2: In response to the fact that all characters of the current word are not accented characters, and when the word contains multiple vowels, for each vowel, the average value of the sum of the classification probabilities of each phoneme form obtained by the prediction model for the vowel is obtained, and the absolute value of the difference between the classification probability of the phoneme form corresponding to the vowel as the accent and the average value is obtained; the vowel with the smallest absolute value is used as the accented character in the word, and the phoneme sequence and accent information of the current word are updated.
[0044] For example, suppose the current word contains two vowels, and both vowels are a; each vowel a has two possible phoneme forms, aa and ax, and aa is a phoneme form with stress, and ax is a phoneme form without stress. For each vowel a, the classification probabilities of the two phoneme forms aa and ax obtained by the prediction model are P1 and P2 respectively; the absolute value of P1-(P1+P2) / 2 is obtained; and the vowel with the smallest absolute value is used as the character with stress in the current word.
[0045] In a word, the application divides the processing of each word into three categories, and the non-polyphonic words in the dictionary can be directly mapped through the dictionary. For the words in the non-dictionary (i.e., OOV words) and the polyphonic words in the dictionary, the front and back word information and the current word are combined into a new word representation (the difference is that the front and back word information of the words in the non-dictionary is considered to be empty), and then the input information is converted into a two-dimensional matrix representation, and the output data is converted into a multi-task classification problem. In addition, the application also uses the similarity method to solve the problem of lacking stress in the prediction result. The application uses a model and a series of conversion methods to convert text into the problem of OOV words mainly existing in speech and the disambiguation problem of polyphonic words to be solved in a unified way. This is an experiment and exploration not carried out in the current research, which is more convenient for the front-end processing of speech synthesis, and the practical application of speech synthesis.
[0046] See also Figure 5 , Figure 5 This is a schematic diagram of a framework of an implementation of a text conversion device of the present application. The text conversion device includes an acquisition module 20, a first processing module 22 and a second processing module 24.
[0047] The acquisition module 20 is used to obtain words in the text to be converted and set labels for non-punctuation words; wherein the labels include polyphonic words in the dictionary, non-polyphonic words in the dictionary, or words not in the dictionary. The first processing module 22 is connected to the acquisition module 20, and is used to match and obtain the phoneme sequence and stress information of the word from the dictionary in response to the word being a non-polyphonic word in the dictionary. The second processing module 24 is connected to the acquisition module 20, and is used to construct corresponding composite words based on the words in response to the words being polyphonic words in the dictionary and non-words in the dictionary, and obtain the phoneme sequence and stress information of the word based on the composite words and the prediction model; wherein, when the word is a polyphonic word in the dictionary, the composite word is related to the context information of the word; when the word is not in the dictionary, the composite word is irrelevant to the context information of the word.
[0048] In one embodiment, in response to the word being a polyphonetic word in the dictionary and a word not in the dictionary, the second processing module 24 constructs a corresponding compound word based on the word, including: in response to the word being a polyphonetic word in the dictionary, combining the word with other words adjacent to the word to obtain a corresponding compound word; in response to the word being a word not in the dictionary, treating other words adjacent to the word as empty words, and combining the word with the adjacent empty words to obtain a corresponding compound word.
[0049] Among them, in response to a word being a polyphone in a dictionary, the step of combining the word with other words adjacent to the word to obtain a corresponding combined word includes: obtaining a preceding word and a following word adjacent to the word; in response to the preceding word or the following word being a punctuation mark, treating the preceding word or the following word that is a punctuation mark as an empty word; obtaining partial characters adjacent to the word from the preceding word and the following word, and arranging the partial characters and the words in forward order in the text to be converted to obtain a combined word.
[0050] In another embodiment, the step of obtaining the phoneme sequence and stress information of a word based on the combined word and the prediction model in the second processing module 24 includes: obtaining a first matrix representation of the combined word; wherein each character in the combined word is mapped to a row of elements in the first matrix representation; inputting the first matrix representation into the prediction model to obtain a second matrix representation of the combined word; wherein a row of elements in the second matrix representation indicates whether the character of the corresponding row element in the first matrix representation is a vowel or a consonant, and whether the character has an accent when it is a vowel; restoring the second matrix representation in the form of dictionary mapping to obtain the phoneme sequence and stress information of the word.
[0051] Among them, the first matrix representation contains M rows and N columns of elements; wherein M is the maximum character length of a preset combination word, and N is the number of all characters of the language to which the text to be converted belongs; the step of obtaining the first matrix representation of the combination word includes: obtaining a character in the combination word in reverse order; obtaining the sorting position of the current character in the character sequence of the language to which it belongs, setting the element corresponding to the sorting position in the row element corresponding to the current character in the first matrix representation to 1, and setting the elements of the remaining sorting positions to 0; in response to the row elements corresponding to all characters in the combination word being set, and the length of the combination word being less than M, setting the remaining row elements in the first matrix representation to 0.
[0052] Among them, the second matrix representation contains M rows and 2 columns of elements; wherein M is the maximum character length of the preset combination word; the row element [0 0] in the second matrix representation indicates that the character corresponding to the current row element is a consonant, the row element [1 0] in the second matrix representation indicates that the character corresponding to the current row element is a vowel with an accent, and the row element [0 1] in the second matrix representation indicates that the character corresponding to the current row element is a vowel without an accent.
[0053] Among them, the prediction model includes sequentially connected convolutional layers, bidirectional long short-term memory networks, soft attention layers and shared coding layers.
[0054] See also Figure 5 The text conversion device provided in the present application also includes an adjustment module 26, which is connected to the second acquisition module 24, and is used for, after the step of obtaining the phoneme sequence and stress information of the word in response to the word being a polyphone word in the dictionary or a non-dictionary word, taking the vowel as a character with stress and updating the phoneme sequence and stress information of the current word in response to all characters of the word being without stress and when the word contains only one vowel; in response to all characters of the word being without stress and when the word contains multiple vowels, obtaining, for each vowel, the average value of the sum of the classification probabilities of each phoneme form obtained by the prediction model for each vowel, and obtaining the absolute value of the difference between the classification probability of the phoneme form corresponding to the vowel with stress and the average value; taking the vowel with the smallest absolute value as the character with stress in the word, and updating the phoneme sequence and stress information of the current word.
[0055] See also Figure 6 , Figure 6The structural diagram of an embodiment of an electronic device of the present application, the electronic device comprises: a memory 32 and a processor 30 coupled to each other, the memory 32 stores program instructions, and the processor 30 is used to execute the program instructions to implement any of the above-mentioned text conversion methods. Specifically, the electronic device includes but is not limited to: a desktop computer, a laptop computer, a tablet computer, a server, etc., which are not limited here. In addition, the processor 30 can also be called a CPU (Center Processing Unit). The processor 30 may be an integrated circuit chip with signal processing capabilities. The processor 30 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 30 can be implemented by an integrated circuit chip.
[0056] See also Figure 7 , Figure 7 This is a schematic diagram of the structure of an implementation of a storage device of the present application. The storage device 40 stores program instructions 400 that can be executed by a processor. The program instructions 400 are used to implement any of the above-mentioned text conversion methods.
[0057] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0058] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0059] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0060] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0061] The above description is only an embodiment of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A text conversion method, characterized in that: include: Obtain words in the text to be converted, and set labels for the words without punctuation marks; wherein the labels include polyphonic words in the dictionary, non-polyphonic words in the dictionary, or non-dictionary words; For a word that is not a punctuation mark, in response to the word being a non-polyphonetic word in a dictionary, the phoneme sequence and stress information of the word are obtained by matching from the dictionary; in response to the word being a polyphonetic word in a dictionary and a word not in a dictionary, a corresponding compound word is constructed based on the word, and the phoneme sequence and stress information of the word are obtained based on the compound word and a prediction model; wherein, when the word is a polyphonetic word in a dictionary, the compound word is related to the context information of the word; when the word is not in a dictionary, the compound word is irrelevant to the context information of the word; Among them, the step of obtaining the phoneme sequence and stress information of the word based on the combined word and the prediction model includes: obtaining a first matrix representation of the combined word; wherein each character in the combined word is mapped to a row of elements in the first matrix representation; inputting the first matrix representation into the prediction model to obtain a second matrix representation of the combined word; wherein a row of elements in the second matrix representation indicates whether the character of the corresponding row element in the first matrix representation is a vowel or a consonant, and whether the character is stressed when it is a vowel; and restoring the second matrix representation in the form of dictionary mapping to obtain the phoneme sequence and stress information of the word.
2. The text conversion method according to claim 1, characterized in that: In response to the word being a polyphonic word in a dictionary and a word not in a dictionary, the step of constructing a corresponding compound word based on the word comprises: In response to the word being a polyphonic word in the dictionary, combining the word with other words that are immediately adjacent to the word to obtain a corresponding combined word; In response to the word being a non-dictionary word, other words adjacent to the word are regarded as empty words, and the word and the adjacent empty words are combined to obtain a corresponding combined word.
3. The text conversion method according to claim 2, characterized in that: In response to the word being a polyphonic word in the dictionary, the step of combining the word with other words adjacent to the word to obtain a corresponding combined word comprises: Obtain the preceding word and the succeeding word immediately adjacent to the word; In response to the preceding word or the succeeding word being a punctuation mark, treating the preceding word or the succeeding word being a punctuation mark as a null word; Part of the characters adjacent to the word are obtained from the preceding word and the succeeding word, and the partial characters and the word are arranged in a forward order in the text to be converted to obtain a combined word.
4. The text conversion method according to claim 1, characterized in that: The first matrix representation includes M rows and N columns of elements; wherein M is the maximum character length of the combination word preset, and N is the number of all characters of the language to which the text to be converted belongs; the step of obtaining the first matrix representation of the combination word includes: Obtain a character in the combined word in reverse order; Obtaining the sorting position of the current character in the character sequence of the language to which it belongs, setting the element corresponding to the sorting position in the row element corresponding to the current character in the first matrix representation to 1, and setting the elements of the other sorting positions to 0; In response to the row elements corresponding to all characters in the combined word being set, and the length of the combined word being less than M, the remaining row elements in the first matrix representation are set to 0.
5. The text conversion method according to claim 1, characterized in that: The second matrix representation contains M rows and 2 columns of elements; wherein M is the maximum character length of the preset combination word; the row element [0 0] in the second matrix representation indicates that the character corresponding to the current row element is a consonant, the row element [1 0] in the second matrix representation indicates that the character corresponding to the current row element is a vowel with an accent, and the row element [0 1] in the second matrix representation indicates that the character corresponding to the current row element is a vowel without an accent.
6. The text conversion method according to claim 1, characterized in that: In response to the word being a polyphonic word in a dictionary or a non-dictionary word, after the step of obtaining the phoneme sequence and stress information of the word, the method further includes: In response to all characters of the word being without accents, and when the word contains only one vowel, treating the vowel as an accented character, and updating the phoneme sequence and the accent information of the current word; In response to the fact that all characters of the word are unaccented, and when the word contains multiple vowels, for each vowel, the average value of the sum of the classification probabilities of each phoneme form of the vowel obtained by the prediction model is obtained, and the absolute value of the difference between the classification probability of the phoneme form corresponding to the vowel as an accent and the average value is obtained; the vowel with the smallest absolute value is taken as the accented character in the word, and the phoneme sequence and the accent information of the current word are updated.
7. The text conversion method according to claim 1, characterized in that: The prediction model includes a convolutional layer, a bidirectional long short-term memory network, a soft attention layer and a shared coding layer connected in sequence.
8. A text conversion device, characterized in that: include: An acquisition module, used for acquiring words in the text to be converted, and setting labels for the words without punctuation marks; wherein the labels include polyphonic words in the dictionary, non-polyphonic words in the dictionary, or words not in the dictionary; A first processing module, connected to the acquisition module, for obtaining the phoneme sequence and stress information of the word from the dictionary in response to the word without punctuation marks being a non-polyphonetic word in the dictionary; a second processing module connected to the acquisition module, for responding to the non-punctuation word being a polyphonic word in a dictionary and a non-dictionary word, constructing a corresponding compound word based on the word, and obtaining the phoneme sequence and stress information of the word based on the compound word and a prediction model; wherein, when the word is a polyphonic word in a dictionary, the compound word is related to the context information of the word; and when the word is a non-dictionary word, the compound word is irrelevant to the context information of the word; Wherein, obtaining the phoneme sequence and stress information of the word based on the combined word and the prediction model includes: obtaining a first matrix representation of the combined word; wherein each character in the combined word is mapped to a row of elements in the first matrix representation; inputting the first matrix representation into the prediction model to obtain a second matrix representation of the combined word; wherein a row of elements in the second matrix representation indicates whether the character of the corresponding row element in the first matrix representation is a vowel or a consonant, and whether the character is stressed when it is a vowel; restoring the second matrix representation in the form of dictionary mapping to obtain the phoneme sequence and stress information of the word.
9. An electronic device, characterized in that: The method comprises a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the text conversion method according to any one of claims 1 to 7.
10. A storage device, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the text conversion method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Accent evaluation method and device and electronic equipment
CN111583961A
Polyphone pronunciation prediction method, device and equipment and storage medium
CN112528648A
Pronunciation dictionary construction method, speech recognition method and related device
CN113936642A
