Text analysis method and apparatus, electronic device, and computer-readable storage medium

By converting texts in different languages ​​into the same type of identifier sequence for feature extraction and target task processing, the problem of excessive front-end resource consumption in multilingual speech synthesis is solved, and efficient multilingual text analysis and speech synthesis are achieved.

CN115455912BActive Publication Date: 2026-04-17BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING YOUZHUJU NETWORK TECH CO LTD
Filing Date
2022-09-19
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

The deployment of multilingual speech synthesis front-ends consumes a large amount of online resources, resulting in resource waste and inefficiency.

Method used

By converting texts in different languages ​​into the same type of identifier sequence and using the same text analysis method for feature extraction and target task processing, language differences are eliminated, and multilingual text processing is achieved.

Benefits of technology

It saves online resources, improves text analysis efficiency, and simplifies the implementation process of multilingual speech synthesis without requiring separate deployment for each language.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115455912B_ABST
    Figure CN115455912B_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of computer processing technology, specifically to text analysis methods, apparatus, electronic devices, and computer-readable storage media. The method includes acquiring text to be analyzed; converting the words in the text to be analyzed into identifier sequences, wherein the identifiers in the identifier sequences corresponding to texts in different languages ​​belong to the same type; extracting features from the identifier sequences; processing a target task based on the extracted features; and determining the analysis result of the text. For texts in different languages, converting them into identifier sequences of the same type eliminates language differences before feature extraction. When deploying this text analysis method online, it eliminates the need for separate deployments for each language; a single text analysis method can be used to process texts in different languages, saving online resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer processing technology, and more specifically to text analysis methods, apparatus, electronic devices, and computer-readable storage media. Background Technology

[0002] For speech synthesis, the text must first be analyzed, and then the analysis results are used for speech synthesis. The process of analyzing the text is called the speech synthesis front-end. For multilingual systems, if speech synthesis needs to be deployed online, a separate speech synthesis front-end needs to be built for each language, thus consuming significant online resources. Summary of the Invention

[0003] In view of this, embodiments of the present disclosure provide a text analysis method, apparatus, electronic device, and computer-readable storage medium to solve the problem of excessive online resource consumption caused by the deployment of multilingual speech synthesis front-ends.

[0004] According to a first aspect, embodiments of this disclosure provide a text analysis method, including:

[0005] Obtain the text to be analyzed;

[0006] The words in the text to be analyzed are converted into identifiers to obtain a sequence of identifiers to be analyzed. The identifiers in the sequence of identifiers to be analyzed for texts in different languages ​​belong to the same type.

[0007] Feature extraction is performed on the identifier sequence to be analyzed, and the target task is processed based on the extracted features to determine the analysis result of the text to be analyzed.

[0008] According to a second aspect, embodiments of this disclosure provide a text analysis apparatus, comprising:

[0009] The acquisition module is used to acquire the text to be analyzed.

[0010] The conversion module is used to convert the words in the text to be analyzed to obtain a sequence of identifiers to be analyzed, wherein the identifiers in the sequence of identifiers to be analyzed corresponding to texts in different languages ​​belong to the same type;

[0011] The analysis module is used to extract features from the identifier sequence to be analyzed, process the target task based on the extracted features, and determine the analysis result of the text to be analyzed.

[0012] According to a third aspect, this disclosure provides an electronic device, including: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the text analysis method described in the first aspect or any embodiment of the first aspect.

[0013] According to a fourth aspect, embodiments of this disclosure provide a computer-readable storage medium storing computer instructions for causing the computer to perform the text analysis method described in the first aspect or any embodiment of the first aspect.

[0014] The text analysis method provided in this disclosure converts texts in different languages ​​into a sequence of identifiers of the same type, thereby eliminating language differences before feature extraction. As a result, both feature extraction and target task processing are language-indiscriminate. When this text analysis method is subsequently deployed online, there is no need to deploy it separately for each language. The same text analysis method can be used to process texts in different languages, saving online resources. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0016] Figure 1 This is a flowchart of a text analysis method according to an embodiment of the present disclosure;

[0017] Figure 2 This is a flowchart of a text analysis method according to an embodiment of the present disclosure;

[0018] Figure 3 This is a flowchart of a text analysis method according to an embodiment of the present disclosure;

[0019] Figure 4 This is a schematic diagram of the structure of the target analysis model according to an embodiment of the present disclosure;

[0020] Figure 5 This is a structural block diagram of a text analysis apparatus according to an embodiment of the present disclosure;

[0021] Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this disclosure. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0023] In the field of speech synthesis, the analysis results obtained from text analysis include, but are not limited to, the parts of speech and prosody of words in the text. Parts of speech include nouns, pronouns, verbs, adjectives, adverbs, prepositions, conjunctions, and conjunctions, etc.; prosody includes continuity, word boundaries, prosodic word boundaries, prosodic phrase boundaries, intonation phrase boundaries, etc. After obtaining the analysis results, electronic devices combine them with the phonemes corresponding to the words in the text to synthesize speech output, thereby realizing the conversion of text into speech.

[0024] Speech synthesis inevitably involves multilingual speech synthesis. To achieve multilingual speech synthesis, a speech synthesis front-end corresponding to each language is typically deployed during the text analysis phase. In this approach, if a product needs to synthesize speech in N languages, then N language-specific speech synthesis front-ends need to be deployed within the product, which inevitably increases the resources consumed by speech synthesis.

[0025] Based on this, the text analysis method provided in this embodiment first performs identifier conversion on the text to be analyzed to obtain an identifier sequence to be analyzed. Then, the identifier sequence to be analyzed is analyzed to obtain the analysis result. This method can first eliminate the influence of language by using identifier conversion, converting texts to be analyzed in different languages ​​into identifier sequences to be analyzed represented by the same type of identifier. Since the identifier sequence to be analyzed is represented by the same type of identifier, the specific method for processing the identifier sequence does not need to distinguish between different languages, and only needs to use the same processing logic. Based on this, when this text analysis method is deployed to a product, it is not necessary to deploy text analysis methods corresponding to each language; the text analysis method in this embodiment can be used to realize a speech synthesis front-end for different languages.

[0026] Furthermore, text analysis typically requires obtaining multiple analytical results. For example, parts of speech and prosody are needed. A common approach is a pipelined workflow, where a separate task analysis module is deployed for each analysis task in each language. This approach has a lengthy workflow and requires multiple sets of task analysis modules to be deployed online.

[0027] Based on this, the text analysis method provided in this embodiment improves text analysis efficiency by setting at least one target task processing unit in parallel within the same target analysis model.

[0028] In some implementations, the aforementioned target analysis model is obtained based on a pre-trained feature extraction unit and at least one preset task processing unit. The pre-trained feature extraction unit is obtained through unsupervised text pre-training, enabling it to learn linguistic information shared by different languages. When using the target analysis model for analysis, it can predict text in different languages. Based on this, the target analysis model has zero-learning capability, enabling text analysis and prediction for new languages ​​without labeled data. Here, the new language refers to a language other than the preset language used to train the target analysis model; that is, the new language was not used for training the target analysis model.

[0029] According to an embodiment of this disclosure, a text analysis method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0030] This embodiment provides a text analysis method that can be used in electronic devices, such as computers, tablets, and voice devices. Figure 1 This is a flowchart of a text analysis method according to an embodiment of the present disclosure, such as... Figure 1 As shown, the process includes the following steps:

[0031] S11, Obtain the text to be analyzed.

[0032] The text to be analyzed can be input into the electronic device through user interaction, stored on the electronic device, or obtained by the electronic device from other devices via communication connections. There are no restrictions on how the electronic device obtains the text; the specific method is determined based on actual needs. There are also no restrictions on the language representation of the text to be analyzed; for example, it can be Chinese, English, Spanish, German, etc.

[0033] S12, perform identifier transformation on the words in the text to be analyzed to obtain the identifier sequence to be analyzed.

[0034] Among them, the identifiers in the identifier sequences corresponding to the texts to be analyzed in different languages ​​belong to the same type.

[0035] After obtaining the text to be analyzed, the electronic device first determines the words in the text to be analyzed, then performs identification mapping on the words to obtain the corresponding identifications of the words, and then splices the obtained identifications according to the order of the words in the text to be analyzed to obtain the identification sequence to be analyzed. It should be noted that the words in the text to be analyzed refer to the smallest independent characters in the text to be analyzed. For example, a single character in Chinese, or a single word in English, etc. The electronic device can divide the words in the text to be analyzed according to the form of the language of the text to be analyzed. For example, in the English language family, the spaces between words can be used for division.

[0036] If the text to be analyzed is "今日天气晴朗", the words in the text to be analyzed are: 今, 日, 天, 气, 晴, 朗; if the text to be analyzed is "It is sunny today", the words in the text to be analyzed are: it, is, sunny, today.

[0037] For the text to be analyzed described in different languages, the identifications in the identification sequence to be analyzed obtained after identification conversion are all represented by the same type of identification. For example, the identification can be a number, and different combinations of numbers are used to obtain the identification sequence to be analyzed, etc.

[0038] The electronic device can be a terminal device provided for users to use, or a server. When the electronic device is a terminal device, a mapping relationship between words and identifications needs to be maintained in the terminal device. After the terminal device obtains the words in the text to be analyzed, it can obtain the corresponding identifications of each word by querying this mapping relationship, so as to obtain the identification sequence to be analyzed. When the electronic device is a server, the server is used to connect to the terminal device. When the server obtains the text to be analyzed uploaded by the terminal device, it performs identification conversion on it using the mapping relationship between words and identifications to obtain the identification sequence to be analyzed.

[0039] As described above, after the text to be analyzed in different languages undergoes identification conversion, an identification sequence to be analyzed represented by the same type of identification is obtained. Based on this, the electronic device is equivalent to converting the text to be analyzed in different languages into the same type of identification representation, thus eliminating the limitations of different languages. For the subsequent processing steps, only the processing of the identification sequence to be analyzed represented by the same type of identification needs to be focused on, without the need to distinguish different languages.

[0040] The specific details of this step will be described in detail below.

[0041] S13. Extract features from the identification sequence to be analyzed, process the target task based on the extracted features, and determine the analysis result of the text to be analyzed.

[0042] Electronic devices can utilize feature extraction models to extract features from the token sequences to be analyzed. Examples include the ELECTRA model and the BERT model. ELECTRA stands for "Efficiently Learning an Encoder That Classifies Token Replacements Accurately," while BERT stands for "Bidirectional Encoder Representations from Transformer." No specific model is restricted here; it should be configured according to actual needs, as long as the input to the feature extraction model is the token sequence and the output is the features of that token sequence.

[0043] After extracting the features of the identifier sequence to be analyzed, the electronic device performs target task processing based on the extracted features. The target task can be one, two, or more; there is no specific limit to the number. When there are two or more target tasks, the processing of the target tasks can be parallel, sequential, or other methods. For example, the electronic device uses the extracted features to perform part-of-speech tagging to obtain the part-of-speech tag for each word.

[0044] The specifics of this step will be described in detail below.

[0045] The text analysis method provided in this embodiment converts texts in different languages ​​into sequences of identifiers of the same type, thus eliminating language differences before feature extraction. Therefore, both feature extraction and target task processing are language-indiscriminate processes. When this text analysis method is subsequently deployed online, there is no need to deploy it separately for each language. The same text analysis method can be used to process texts in different languages, saving online resources.

[0046] This embodiment provides a text analysis method that can be used in electronic devices, such as computers, tablets, and voice devices. Figure 2 This is a flowchart of a text analysis method according to an embodiment of the present disclosure, such as... Figure 2 As shown, the process includes the following steps:

[0047] S21, Obtain the text to be analyzed.

[0048] Please see details Figure 1 S11 of the illustrated embodiment will not be described again here.

[0049] S22, perform identifier transformation on the words in the text to be analyzed to obtain the identifier sequence to be analyzed.

[0050] Among them, the identifiers in the identifier sequences corresponding to the texts to be analyzed in different languages ​​belong to the same type.

[0051] Specifically, S22 includes:

[0052] S221, Obtain the multilingual vocabulary.

[0053] The multilingual vocabulary is used to represent the mapping relationship between words and identifiers in multiple languages.

[0054] A multilingual vocabulary includes words from N languages. For all languages, the vocabulary only lists, rather than exhaustively enumerates, words from all N languages. For example, when constructing a multilingual vocabulary, we can assign indices 1 to N1 to represent language 1; indices N1+1 to N2 to represent language 2; and so on, obtaining the indices for each language. The indices within each range serve as identifiers, representing the word at that position.

[0055] S222, query the identifiers corresponding to the words in the text to be analyzed in the multilingual lexicon to determine the sequence of identifiers to be analyzed.

[0056] For each word in the text to be analyzed, the electronic device searches for that word in a multilingual vocabulary to determine its corresponding identifier. The electronic device then iterates through the words in the text to determine the identifier for each word, and concatenates these identifiers according to the order of the words in the text to obtain the sequence of identifiers to be analyzed.

[0057] Since the number of words included in a multilingual dictionary is limited, a corresponding identifier may not be found in the dictionary, resulting in an empty query result. Therefore, the electronic device performs sub-word segmentation on the word. Specifically, in some implementations, S222 includes:

[0058] (1) Search for the identifiers corresponding to the words in the text to be analyzed in the multilingual vocabulary.

[0059] (2) When the query result is empty, the word is divided into sub-words, and the corresponding identifiers of the sub-words are queried in the multilingual vocabulary to determine the identifier sequence to be analyzed.

[0060] The multilingual dictionary includes not only identifiers for commonly used words but also identifiers for commonly used sub-words. For example, if a query for "bedroom" in the multilingual dictionary returns an empty result, the electronic device will divide it into the sub-words "bed" and "room," and then query the multilingual dictionary for the identifiers corresponding to "bed" and "room."

[0061] For example, if a query for "sunny" in a multilingual dictionary returns no results, the electronic device will divide it into the subwords "sun" and "ny," and then search for the corresponding identifiers for "sun" and "ny" in the multilingual dictionary. Based on this, the subwords included in the multilingual dictionary can also include commonly used prefixes, suffixes, etc.

[0062] When a word cannot be found in a multilingual vocabulary, the word is divided into sub-words to obtain the sequence of identifiers to be analyzed.

[0063] S23, extract features from the identifier sequence to be analyzed, process the target task based on the extracted features, and determine the analysis result of the text to be analyzed.

[0064] Please see details Figure 1 S13 of the illustrated embodiment will not be described again here.

[0065] The text analysis method provided in this embodiment improves the efficiency of identifier conversion by deploying a multilingual vocabulary and directly querying the vocabulary to determine the identifier sequence to be analyzed during identifier conversion.

[0066] This embodiment provides a text analysis method that can be used in electronic devices, such as computers, tablets, and voice devices. Figure 3 This is a flowchart of a text analysis method according to an embodiment of the present disclosure, such as... Figure 3 As shown, the process includes the following steps:

[0067] S31, Obtain the text to be analyzed.

[0068] Please see details Figure 1 S12 of the illustrated embodiment will not be described again here.

[0069] S32, perform identifier transformation on the words in the text to be analyzed to obtain the identifier sequence to be analyzed.

[0070] Among them, the identifiers in the identifier sequences corresponding to the texts to be analyzed in different languages ​​belong to the same type.

[0071] Please see details Figure 2 S22 of the illustrated embodiment will not be described again here.

[0072] S33, extract features from the identifier sequence to be analyzed, process the target task based on the extracted features, and determine the analysis result of the text to be analyzed.

[0073] Specifically, S33 includes:

[0074] S331, Obtain the target analysis model.

[0075] The target analysis model is obtained based on the analysis of sample identifier sequences in at least one preset language, and the target analysis model includes a feature extraction unit and at least one target task processing unit.

[0076] Figure 4 The structure of the target analysis model is shown, which includes a feature extraction unit and a target task processing unit. Figure 4 The diagram shows m target task processing units, namely, target task processing unit 1 to target task processing unit m. Of course, Figure 4 This is merely an example and does not limit the specific structure of the target analysis model in this embodiment. The number of 'm' is set according to actual needs. Each target task processing unit has a corresponding processing result. That is, the output of the target analysis model is the processing result of target task 1 to the processing result of target task m.

[0077] The feature extraction unit is used to extract features from the input identifier sequence; the target task processing unit is used to process the extracted features for the corresponding target task, such as part-of-speech prediction, prosodic boundary prediction, etc.

[0078] The target analysis model can be pre-trained and deployed on electronic devices, or it can be trained by the electronic devices when text analysis is required; its source is not limited here. The preset language is within the range of languages ​​included in the multilingual vocabulary, and the sample identifier sequence is obtained by converting text in at least one preset language through the multilingual vocabulary.

[0079] In some embodiments, S331 includes:

[0080] (1) Obtain a preset analysis model, which includes a pre-trained feature extraction unit and at least one preset task processing unit.

[0081] The pre-trained feature extraction units are trained using a large number of unsupervised text sequences corresponding to various languages, without the need for labels during training; alternatively, publicly available pre-trained feature extraction units can be used directly. The number and type of preset task processing units are set according to actual needs; the model structure of these preset task processing units can be based on a classification model; the initial parameters in the preset task processing units can be set based on empirical values ​​or randomly.

[0082] (2) Obtain at least one sample identifier sequence in a preset language and the task label corresponding to the sample identifier sequence.

[0083] As mentioned above, the preset language is one of the languages ​​included in the multilingual vocabulary. For example, by collecting texts in 10 preset languages ​​and using the multilingual vocabulary to identify and convert the words in the preset language texts, a sample identifier sequence for the preset language is obtained. The content included in the task labels corresponding to the sample identifier sequence is set according to the target task. If the target task includes parts of speech and prosody, then the task labels include part-of-speech tags and prosody tags. The part-of-speech tags include the part-of-speech tags of each word in the text, and the prosody tags include the prosody type tags in the text.

[0084] For example, part-of-speech tags include: noun, pronoun, verb, adjective, adverb, preposition, conjunction, interjection, etc.; prosodic break tags include: 0 (connected speech), 1 (word boundary), 2 (prosodic word boundary), 3 (prosodic phrase boundary), 4 (intonation phrase boundary).

[0085] For task labels, they can be manually annotated. For example, annotators combine auditory perception, waveform diagrams, spectrum, and semantic information obtained from the text to annotate prosodic discontinuity features on minority language audio databases, ultimately forming parallel data of <text-prosodic labels-audio>. Part-of-speech related data is downloaded from open-source data on the Internet, and finally, task labels are formed.

[0086] (3) Input the sample identification sequence into the preset analysis model to determine the prediction results corresponding to each preset task processing unit.

[0087] The electronic device inputs the obtained sample identification sequence into the preset analysis model, uses the preset analysis model to perform feature extraction and target task processing, and obtains the prediction results corresponding to each preset task processing unit.

[0088] (4) Calculate the loss function based on the prediction results and task labels to update the parameters of the pre-trained feature extraction unit and at least one preset task processing unit, and determine the target analysis model.

[0089] For each pre-defined task processing unit, the category with the highest probability is used as the prediction result for that unit. Simultaneously, each category has a corresponding probability for each pre-defined task processing unit. The electronic device calculates a loss function between the prediction result and the corresponding task label to determine the difference between the prediction result and the corresponding task label. Based on this, the parameters of the pre-trained feature extraction unit and at least one pre-defined task processing unit are updated. After multiple iterations, the target analysis model is determined.

[0090] By pre-training on unsupervised multilingual texts, shared linguistic information can be learned, enabling a single model to perform inference and prediction on texts in different languages ​​during the inference phase. The pre-trained feature extraction unit is used in the pre-defined analysis model because different languages ​​share certain similarities in prosodic structures. Through unsupervised pre-training, this pre-trained feature extraction unit learns the cross-linguistic capabilities of the multilingual pre-trained model. This is because: firstly, there is overlap in words between different languages; secondly, a unified and similar grammatical structure can be learned; and thirdly, deep semantic features at the sentence level can be captured, making the representations of synonyms spatially similar.

[0091] In some embodiments, step (4) of S331 above includes:

[0092] 4.1) Obtain the prediction category corresponding to each target task in the prediction results.

[0093] 4.2) Calculate the first loss function based on the predicted category and the target category corresponding to the preset task to determine the first loss.

[0094] 4.3) Obtain each of the optional prediction categories in the target task, wherein the prediction category is one of the optional prediction categories.

[0095] 4.4) Calculate the second loss function based on each optional prediction category to determine the second loss.

[0096] 4.5) Based on the first loss and the second loss, update the parameters of the pre-trained feature extraction unit and at least one preset task processing unit to determine the target analysis model.

[0097] As mentioned above, the electronic device determines the category with the highest probability among the predicted results of each target task as the predicted category corresponding to that target task. For example, the preset analysis model includes two preset task processing units, corresponding to two target tasks. For each target task, after processing by the corresponding preset task processing unit, the category with the highest probability is determined as the predicted category corresponding to that target task. The electronic device then uses the task label corresponding to the target task and the predicted category to calculate a first loss function to determine the first loss. The first loss is a fusion of the calculation results of the first loss functions corresponding to each target task; it can be a weighted sum, a mean, etc.

[0098] For each target task, after processing by a preset task processing unit, optional prediction categories are obtained, where the predicted category is the one with the highest probability value among the optional prediction categories. For each optional prediction category of the preset task processing unit, a second loss function is calculated separately. The calculation results of the second loss function of the same preset task processing unit are then fused, and the fused results of all preset task processing units are fused again to determine the second loss. The specific calculation methods of the first and second loss functions are set according to actual needs; for example, the cross-entropy loss function can be used for calculation.

[0099] Two types of loss are used for training: the first is to calculate the loss for the task, and the second is to calculate the loss for different categories within the same task, in order to balance the network output for different tasks.

[0100] As an optional implementation of this embodiment, step 4.4) above includes:

[0101] 4.4.1) Count the number of each optional prediction category.

[0102] 4.4.2) Determine the loss value for each optional prediction category based on the quantity, wherein the loss value is negatively correlated with the quantity.

[0103] 4.4.3) Determine the second loss based on the loss values ​​of all optional prediction categories.

[0104] For different optional prediction categories, we first count the number of each category, and then determine a negatively correlated loss value based on the count, so that the order of magnitude of the loss values ​​for each optional prediction category is at the same level. This is because the proportion of each category in the data is extremely unbalanced; therefore, calculating the loss for different optional prediction categories in the same objective task can balance the output of each category.

[0105] In some implementations, the loss function at this stage is the sum of weighted cross-entropy loss functions for the predicted and ground truth label sequences for each target task. There are two weighting processes: the first weighting applies to each target task, assigning different weights to different tasks to balance the network outputs across tasks. The second weighting applies to different categories within the task, such as categories in part-of-speech tagging or prosody tagging. For each target task, different optional prediction categories are assigned different weights, with smaller weights for more numerous categories and larger weights for fewer categories. This is because the proportion of each optional prediction category in the data is extremely unbalanced, and using a weighted cross-entropy loss function helps balance the output of each category.

[0106] S332, input the identifier sequence to be analyzed into the feature extraction unit for feature extraction, and obtain the extracted features.

[0107] S333, the extracted features are input into at least one target task processing unit to determine the analysis results of the text to be analyzed.

[0108] The feature extraction unit extracts features from the input identifier sequence to be analyzed, and then inputs the extracted features into at least one target task processing unit, and performs parallel processing of at least one target task using at least one target task processing unit to obtain the analysis result of the text to be analyzed.

[0109] In some implementations, the language of the text to be analyzed is a language other than a preset language, and the multilingual vocabulary includes the language of the text to be analyzed. The multilingual vocabulary is used to represent the mapping relationship between words and identifiers in multiple languages. The preset language is the language corresponding to the sample identifier sequence used to train the preset analysis model. For example, the multilingual vocabulary includes 100 languages, but only 20 of them are used when training the preset analysis model. The language of the text to be analyzed is not involved in the training of the preset analysis model; that is, the language of the text to be analyzed is a new language for the trained preset analysis model, but it is included in the multilingual vocabulary.

[0110] Because the target analysis model has a cross-language model, it can be used to analyze texts in new languages ​​other than the preset language without labeled data.

[0111] The text analysis method provided in this embodiment uses a target analysis model that includes at least one target task processing unit to analyze the text to be analyzed, thereby achieving parallel processing of at least one target task, improving analysis efficiency. Furthermore, it does not require the deployment of multiple analysis models during deployment; it can be achieved using only one target analysis model, further reducing the online resources required.

[0112] As an optional implementation of this embodiment, after obtaining the analysis results of the text to be analyzed, the electronic device can perform speech synthesis to synthesize the text to be analyzed into speech output. The target task includes prosodic boundary prediction; therefore, the above method further includes:

[0113] (1) Obtain the phoneme sequence corresponding to the text to be analyzed.

[0114] (2) Speech synthesis is performed based on phoneme sequences and predicted prosodic boundaries to determine the target speech.

[0115] The phoneme sequence corresponding to the text to be analyzed is determined by querying a phoneme table to obtain the phonemes of each word in the text. Based on the phoneme sequence, speech synthesis is performed by combining the predicted prosodic boundaries to obtain the target speech.

[0116] After predicting the target task, speech synthesis can be achieved using phoneme sequences and predicted prosodic boundaries. For online products, since the same type of identifier sequence to be analyzed is obtained by using identifier conversion, the language difference is eliminated, so that subsequent speech synthesis processing does not need to be deployed separately for each language.

[0117] In some implementations, the target task further includes part-of-speech prediction. Based on this, step (2) above includes: when the text to be analyzed includes polyphonic words, determining the phonemes of the polyphonic words based on their part-of-speech to determine the phoneme sequence of the text to be analyzed. Specifically, after predicting the part-of-speech of the polyphonic words, the pronunciation of the corresponding part-of-speech is selected according to the polyphonic word pronunciation table to complete the polyphonic word disambiguation task and obtain the phoneme sequence of the polyphonic words. When the phoneme sequence of the input text is combined with prosodic boundary features, the speech synthesis model can synthesize speech with a certain prosodic rhythm and prosodic naturalness, and the polyphonic words are pronounced correctly with appropriate prosodic pauses.

[0118] For polyphonic words, the phonemes of polyphonic words are first determined by using the predicted part of speech, which ensures the accuracy of the phonemes of polyphonic words and thus improves the accuracy of the phoneme sequence of the text to be analyzed.

[0119] As a specific application example of this embodiment, the electronic device is a mobile phone. The user interacts with the phone and inputs the text to be analyzed on the phone's display interface. The phone uses a multilingual vocabulary to convert the text into a sequence of identifiers to be analyzed. Then, a target analysis model processes the sequence of identifiers to be analyzed, outputting the part-of-speech sequence and prosodic boundary sequence corresponding to the sequence. If there are polyphonic words in the text, the phonemes of the polyphonic words are determined based on their part-of-speech, thus determining the phoneme sequence of the text. Finally, the phoneme sequence and the prosodic boundary sequence are used for speech synthesis, ultimately outputting the target speech corresponding to the text being analyzed.

[0120] As another specific application example of this embodiment, the electronic device is a point-and-read device. The user selects the text to be analyzed by pointing with their finger. The point-and-read device collects the text to be analyzed and uses a multilingual vocabulary to convert the text into a sequence of identifiers to be analyzed. Then, a target analysis model is used to process the sequence of identifiers to be analyzed, outputting the part-of-speech sequence and prosodic boundary sequence corresponding to the sequence of identifiers to be analyzed. If there are polyphonic words in the text to be analyzed, the phonemes of the polyphonic words are determined based on their parts of speech to determine the phoneme sequence of the text to be analyzed. Then, the phoneme sequence and the prosodic boundary sequence are used for speech synthesis, and finally, the target speech corresponding to the text to be analyzed is output.

[0121] This embodiment also provides a text analysis device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0122] This embodiment provides a text analysis device, such as... Figure 5 As shown, it includes:

[0123] Module 41 is used to acquire the text to be analyzed;

[0124] The conversion module 42 is used to convert the words in the text to be analyzed to obtain the identifier sequence to be analyzed, wherein the identifiers in the identifier sequence to be analyzed corresponding to the texts to be analyzed in different languages ​​belong to the same type;

[0125] The analysis module 43 is used to extract features from the identifier sequence to be analyzed, process the target task based on the extracted features, and determine the analysis result of the text to be analyzed.

[0126] In some implementations, the conversion module 42 includes:

[0127] The first acquisition unit is used to acquire a multilingual vocabulary, which represents the mapping relationship between words and identifiers in multiple languages;

[0128] The first determining unit is used to query the identifiers corresponding to words in the text to be analyzed in the multilingual vocabulary and determine the sequence of identifiers to be analyzed.

[0129] In some implementations, the first determining unit includes:

[0130] The query subunit is used to query the identifiers corresponding to words in the text to be analyzed from the multilingual vocabulary;

[0131] The sub-unit is used to divide the word into sub-words when the query result is empty, and to query the identifier corresponding to the sub-word in the multilingual vocabulary to determine the identifier sequence to be analyzed.

[0132] In some implementations, the analysis module 43 includes:

[0133] The second acquisition unit is used to acquire a target analysis model, which is obtained based on the analysis of sample identifier sequences in at least one preset language. The target analysis model includes a feature extraction unit and at least one target task processing unit.

[0134] The first input unit is used to input the identifier sequence to be analyzed into the feature extraction unit for feature extraction, and obtain the extracted features.

[0135] The second input unit is used to input the extracted features into at least one target task processing unit to determine the analysis result of the text to be analyzed.

[0136] In some implementations, the second acquisition unit includes:

[0137] The first acquisition subunit is used to acquire a preset analysis model, which includes a pre-trained feature extraction unit and at least one preset task processing unit.

[0138] The second acquisition subunit is used to acquire at least one sample identifier sequence of a preset language and the task label corresponding to the sample identifier sequence;

[0139] The prediction subunit is used to input the sample identifier sequence into the preset analysis model to determine the prediction result corresponding to each preset task processing unit.

[0140] The first computational subunit is used to calculate a loss function based on the prediction result and the task label, so as to update the parameters of the pre-trained feature extraction unit and at least one preset task processing unit, and determine the target analysis model.

[0141] In some implementations, the first computing subunit includes:

[0142] The third acquisition subunit is used to acquire the prediction category corresponding to each target task in the prediction result;

[0143] The second calculation subunit is used to calculate a first loss function based on the predicted category and the target category corresponding to the preset task, and to determine the first loss.

[0144] The fourth acquisition subunit is used to acquire each of the optional prediction categories in the target task, wherein the prediction category is one of the optional prediction categories;

[0145] The third calculation subunit is used to calculate the second loss function based on each of the optional prediction categories and determine the second loss.

[0146] An update subunit is used to update the parameters of the pre-trained feature extraction unit and at least one preset task processing unit based on the first loss and the second loss, so as to determine the target analysis model.

[0147] In some implementations, the third computing subunit includes:

[0148] The statistics subunit is used to count the number of each of the optional prediction categories;

[0149] The first determining subunit is used to determine the loss value of each optional prediction category based on the quantity, wherein the loss value is negatively correlated with the quantity;

[0150] The second determining subunit is used to determine the second loss based on the loss values ​​of all the optional prediction categories.

[0151] In some implementations, the language of the text to be analyzed is a language other than the preset language, and the multilingual vocabulary includes the language of the text to be analyzed. The multilingual vocabulary is used to represent the mapping relationship between words and identifiers in multiple languages.

[0152] In some embodiments, the target task includes prosodic boundary prediction, and the apparatus further includes:

[0153] The phoneme sequence acquisition module is used to acquire the phoneme sequence corresponding to the text to be analyzed;

[0154] The speech synthesis module is used to perform speech synthesis based on the phoneme sequence and the predicted prosodic boundaries to determine the target speech.

[0155] In some implementations, the target task further includes part-of-speech tagging, and the phoneme sequence acquisition module includes:

[0156] A phoneme determination unit is used to determine the phonemes of polyphonic words based on their parts of speech when the text to be analyzed includes polyphonic words, so as to determine the phoneme sequence of the text to be analyzed.

[0157] In this embodiment, the text analysis device is presented in the form of a functional unit. Here, a unit refers to an ASIC circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above-mentioned functions.

[0158] Further functional descriptions of the above modules are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0159] This disclosure also provides an electronic device having the above-described features. Figure 5 The text analysis device shown.

[0160] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided in an optional embodiment of this disclosure, such as... Figure 6 As shown, the electronic device may include: at least one processor 51, such as a CPU (Central Processing Unit), at least one communication interface 53, memory 54, and at least one communication bus 52. The communication bus 52 is used to enable communication between these components. The communication interface 53 may include a display screen or a keyboard; optionally, the communication interface 53 may also include a standard wired interface or a wireless interface. The memory 54 may be high-speed RAM (Random Access Memory) or non-volatile memory, such as at least one disk storage device. Optionally, the memory 54 may also be at least one storage device located remotely from the aforementioned processor 51. The processor 51 may be combined with... Figure 5 The described apparatus has an application program stored in memory 54, and the processor 51 calls the program code stored in memory 54 to perform any of the above method steps.

[0161] The communication bus 52 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus 52 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0162] The memory 54 may include volatile memory, such as random-access memory (RAM); the memory may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 54 may also include a combination of the above types of memory.

[0163] The processor 51 can be a central processing unit (CPU), a network processor (NP), or a combination of CPU and NP.

[0164] The processor 51 may further include a hardware chip. This hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0165] Optionally, memory 54 is also used to store program instructions. Processor 51 can invoke program instructions to implement the text analysis method as shown in any embodiment of this application.

[0166] This disclosure also provides a non-transitory computer storage medium storing computer-executable instructions that can execute the text analysis method in any of the above method embodiments. The storage medium may be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium may also include combinations of the above types of memory.

[0167] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0168] It is understood that in the specific embodiments of this disclosure, data such as user information and text to be analyzed are involved. When the above embodiments of this disclosure are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0169] Although embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A text analysis method, characterized in that, include: Obtain the text to be analyzed; The words in the text to be analyzed are converted into identifiers to obtain a sequence of identifiers to be analyzed. The identifiers in the sequence of identifiers to be analyzed for texts in different languages ​​belong to the same type. The words in the text to be analyzed refer to the smallest independent characters in the text to be analyzed. Feature extraction is performed on the identifier sequence to be analyzed, and the target task is processed based on the extracted features to determine the analysis result of the text to be analyzed; The step of performing word identification conversion on the text to be analyzed to obtain the identification sequence to be analyzed includes: Obtain a multilingual vocabulary, which represents the mapping relationship between words and identifiers in multiple languages; The identifiers corresponding to the words in the text to be analyzed are queried in the multilingual vocabulary to determine the sequence of identifiers to be analyzed.

2. The method according to claim 1, characterized in that, The step of querying the identifiers corresponding to words in the text to be analyzed in the multilingual lexicon to determine the sequence of identifiers to be analyzed includes: Search the multilingual vocabulary for the identifiers corresponding to the words in the text to be analyzed. When the query result is empty, the word is divided into sub-words, and the corresponding identifier of the sub-word is queried in the multilingual vocabulary to determine the identifier sequence to be analyzed.

3. The method according to claim 1, characterized in that, The step of extracting features from the identifier sequence to be analyzed, processing the target task based on the extracted features, and determining the analysis result of the text to be analyzed includes: A target analysis model is obtained, which is based on the analysis of sample identifier sequences in at least one preset language. The target analysis model includes a feature extraction unit and at least one target task processing unit. The identifier sequence to be analyzed is input into the feature extraction unit for feature extraction to obtain the extracted features; The extracted features are input into at least one target task processing unit to determine the analysis result of the text to be analyzed.

4. The method according to claim 3, characterized in that, The target acquisition analysis model includes: Obtain a preset analysis model, which includes a pre-trained feature extraction unit and at least one preset task processing unit; Obtain sample identifier sequences in at least one preset language and the task labels corresponding to the sample identifier sequences; The sample identifier sequence is input into the preset analysis model to determine the prediction result corresponding to each preset task processing unit; Based on the prediction results and the task labels, a loss function is calculated to update the parameters of the pre-trained feature extraction unit and at least one preset task processing unit, thereby determining the target analysis model.

5. The method according to claim 4, characterized in that, The step of calculating a loss function based on the prediction results and the task labels to update the parameters of the pre-trained feature extraction unit and at least one preset task processing unit, and determining the target analysis model, includes: Obtain the prediction category corresponding to each target task in the prediction results; A first loss function is calculated based on the predicted category and the target category corresponding to the preset task to determine the first loss; Obtain each of the optional prediction categories in the target task, wherein the prediction category is one of the optional prediction categories; A second loss function is calculated based on each of the optional prediction categories to determine the second loss; Based on the first loss and the second loss, the parameters of the pre-trained feature extraction unit and at least one preset task processing unit are updated to determine the target analysis model.

6. The method according to claim 5, characterized in that, The step of calculating the second loss function based on each of the optional prediction categories to determine the second loss includes: Count the number of each of the optional prediction categories; The loss value for each of the optional prediction categories is determined based on the quantity, and the loss value is negatively correlated with the quantity; The second loss is determined based on the loss values ​​of all the optional prediction categories.

7. The method according to claim 3, characterized in that, The language of the text to be analyzed is a language other than the preset language, and the multilingual vocabulary includes the language of the text to be analyzed. The multilingual vocabulary is used to represent the mapping relationship between words and identifiers in multiple languages.

8. The method according to claim 1, characterized in that, The target task includes prosodic boundary prediction, and the method further includes: Obtain the phoneme sequence corresponding to the text to be analyzed; Speech synthesis is performed based on the phoneme sequence and the predicted prosodic boundaries to determine the target speech.

9. The method according to claim 8, characterized in that, The target task also includes part-of-speech tagging, and obtaining the phoneme sequence corresponding to the text to be analyzed includes: When the text to be analyzed includes polyphonic words, the phonemes of the polyphonic words are determined based on their parts of speech, so as to determine the phoneme sequence of the text to be analyzed.

10. A text analysis device, characterized in that, include: The acquisition module is used to acquire the text to be analyzed. The conversion module is used to convert the identifiers of words in the text to be analyzed to obtain a sequence of identifiers to be analyzed. The identifiers in the sequence of identifiers to be analyzed for texts in different languages ​​belong to the same type. The words in the text to be analyzed refer to the smallest independent characters in the text to be analyzed. The analysis module is used to extract features from the identifier sequence to be analyzed, process the target task based on the extracted features, and determine the analysis result of the text to be analyzed. The step of performing word identification conversion on the text to be analyzed to obtain the identification sequence to be analyzed includes: Obtain a multilingual vocabulary, which represents the mapping relationship between words and identifiers in multiple languages; The identifiers corresponding to the words in the text to be analyzed are queried in the multilingual vocabulary to determine the sequence of identifiers to be analyzed.

11. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the text analysis method of any one of claims 1-9 by executing the computer instructions.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the text analysis method according to any one of claims 1-9.

Citation Information

Patent Citations

  • Speech synthesis method and device, storage medium and electronic equipment

    CN112309367A

  • Text analysis method and device for speech synthesis, server and medium

    CN112364653A

  • Speech synthesis method, device and equipment and computer readable storage medium

    CN112365878A

  • Rhythm prediction method and device, readable medium and electronic equipment

    CN114613351A