Text processing method and device, storage medium and electronic equipment

Through dynamic adjustment of text normalization rules and the use of text analysis models, the problem of poor text normalization effect in the prior art is solved, and more efficient and accurate text processing is achieved.

CN119918501APending Publication Date: 2025-05-02CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411999386.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

The prior art has poor text normalization effect and lacks effective solutions when dealing with complex language and context ambiguity.

Method used

By obtaining the pending text, converting it into candidate text according to the text normalization rule information, calling the text analysis model trained based on the candidate text sample for context analysis, and adjusting the text normalization rule information to determine the target text.

Benefits of technology

It improves text processing effect, enhances the ability to process complex language and context ambiguity, and significantly improves the accuracy and efficiency of text standardization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119918501A_ABST
    Figure CN119918501A_ABST
Patent Text Reader

Abstract

The invention discloses a text processing method and device, a storage medium and electronic equipment, and relates to the technical field of artificial intelligence and speech synthesis. The method comprises the steps of obtaining a to-be-processed text; according to text standardization rule information, the to-be-processed text is converted into at least one candidate text, and the text standardization rule information is used for representing a rule for converting the to-be-processed text into the candidate text; a text analysis model is called to carry out context analysis on the candidate text to obtain an analysis result, and the text analysis model is obtained based on candidate text sample training; and adjusting the text normalization rule information based on the analysis result, and determining a target text from the at least one candidate text based on the adjusted text normalization rule information. The technical problem that the text processing effect is poor is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of artificial intelligence and speech synthesis technology, and more specifically, to a text processing method, device, storage medium and electronic device. Background Art

[0002] Currently, text normalization can transform non-standard or ambiguous text elements into a consistent, standard form, making it easier for speech synthesis systems to process text.

[0003] In related technologies, when a rule-based system implements text normalization, language-specific rules must be used, which are usually defined through regular expressions. This method is easy to expand, debug, and reason, but lacks corresponding rules to deal with complex language situations and performs poorly when dealing with context ambiguity, resulting in a technical problem of poor text processing results.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present application provide a text processing method, device, storage medium and electronic device to at least solve the technical problem of poor text processing effect.

[0006] According to one aspect of an embodiment of the present application, a text processing method is provided. The method may include: obtaining a text to be processed; converting the text to be processed into at least one candidate text according to text normalization rule information, wherein the text normalization rule information is used to represent the rule for converting the text to be processed into the candidate text; calling a text analysis model to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is obtained by training based on a sample of the candidate text; adjusting the text normalization rule information based on the analysis result, and determining a target text from at least one candidate text based on the adjusted text normalization rule information.

[0007] Optionally, the method further includes: determining text normalization rule information based on a weighted finite state machine, wherein the weighted finite state machine is used to represent a weighted conversion rule for the text to be processed.

[0008] Optionally, based on a weighted finite state machine, text normalization rule information is determined, including: based on a weighted finite state machine, initial text normalization rule information is determined; according to an adjustment strategy, the initial text normalization rule information is adjusted to obtain text normalization rule information, wherein the adjustment strategy is to first classify the initial text normalization rule information, and then convert the classified initial text normalization rule information, and / or perform non-named entity processing on the initial text normalization rule information.

[0009] Optionally, the method further includes: obtaining candidate text samples; and using the candidate text samples to train an initial text analysis model to obtain a text analysis model.

[0010] Optionally, based on the candidate text samples, the initial text analysis model is trained to obtain the text analysis model, including: batch sampling the candidate text samples to obtain the batch sampled candidate text samples; using the batch sampled candidate text samples to train the initial text analysis model to obtain the text analysis model.

[0011] Optionally, based on the candidate text samples, the initial text analysis model is trained to obtain the text analysis model, including: masking the candidate text samples to obtain the masked candidate text samples; using the masked candidate text samples to train the initial text analysis model to obtain the text analysis model.

[0012] Optionally, after the initial text analysis model is trained based on the candidate text samples to obtain the text analysis model, the method further includes: adjusting the text analysis model based at least on the redundant layers and model parameters of the text analysis model to obtain an adjusted text analysis model.

[0013] According to another aspect of the embodiment of the present application, a text processing device is also provided. The device may include: an acquisition unit, used to acquire a text to be processed; a conversion unit, used to convert the text to be processed into at least one candidate text according to text normalization rule information, wherein the text normalization rule information is used to represent the rule for converting the text to be processed into the candidate text; an analysis unit, used to call a text analysis model to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is obtained by training based on a sample of the candidate text; a determination unit, used to adjust the text normalization rule information based on the analysis result, and determine a target text from at least one candidate text based on the adjusted text normalization rule information.

[0014] According to another aspect of an embodiment of the present application, a non-volatile storage medium is also provided, including: the storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute any text processing method.

[0015] According to another aspect of an embodiment of the present application, there is also provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute instructions to implement any text processing method.

[0016] According to another aspect of an embodiment of the present invention, a processor is further provided. The processor is used to run a program, wherein the text processing method in the embodiment of the present invention is executed when the program is run.

[0017] According to another aspect of the embodiment of the present application, a computer program product is further provided. The computer program product may include a computer program, wherein the computer program is configured to execute any of the above-mentioned text processing methods when running.

[0018] According to another aspect of the embodiment of the present application, a computer program product is also provided. The computer program product may include a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and the computer program is configured to execute any of the above-mentioned text processing methods when running.

[0019] According to another aspect of the embodiment of the present application, a computer program is further provided, which is configured to execute any of the above-mentioned text processing methods when running.

[0020] In an embodiment of the present application, a text to be processed is obtained; according to text normalization rule information, the text to be processed is converted into at least one candidate text, wherein the text normalization rule information is used to represent the rule for converting the text to be processed into the candidate text; a text analysis model is called to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is trained based on candidate text samples; based on the analysis result, the text normalization rule information is adjusted, and based on the adjusted text normalization rule information, a target text is determined from at least one candidate text, thereby improving the effect of text processing and further solving the technical problem of poor effect of text processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0022] Figure 1 is a flowchart of a text processing method according to an embodiment of the present application;

[0023] Figure 2 is a schematic diagram of text normalization in a speech synthesis system according to an embodiment of the present application;

[0024] Figure 3 is a schematic diagram of an overall structure of text normalization according to an embodiment of the present application;

[0025] Figure 4 is a schematic diagram of the distribution of overall data types according to an embodiment of the present application;

[0026] Figure 5is a schematic diagram of text normalization rule optimization according to an embodiment of the present application;

[0027] Figure 6 is a structural schematic diagram of a text processing device according to an embodiment of the present application;

[0028] Figure 7 is a schematic block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings 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 should fall within the scope of protection of the present application.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] According to an embodiment of the present application, a method embodiment of a text processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0032] Figure 1 is a flowchart of a text processing method according to an embodiment of the present application, such as Figure 1 As shown, the method may include the following steps:

[0033] Step S102, obtaining the text to be processed.

[0034] In the above step S102, the text to be processed may be obtained, wherein the text to be processed may be a text to be subjected to text normalization processing.

[0035] In this embodiment, text normalization (TN for short) is a method of converting text from a standard written form to a spoken expression, and is an important preprocessing step of a speech synthesis (TTS for short) system.

[0036] Step S104: converting the text to be processed into at least one candidate text according to the text normalization rule information, wherein the text normalization rule information is used to represent the rule for converting the text to be processed into the candidate text.

[0037] In the above step S104, after obtaining the text to be processed, the text to be processed can be converted into at least one candidate text according to the text normalization rule information. The text normalization rule information can be a generalized text normalization rule pre-written based on a library (e.g., Pynini) for processing weighted finite state machines in a programming language (e.g., Python), which can be used to represent a rule for converting the text to be processed into a candidate text. The candidate text can be a normalized candidate of the text to be processed.

[0038] In this embodiment, a script is written to extract non-standard text combinations such as numbers and symbols, and a text normalization rule with generalization ability is written based on Python's Pynini package to build an efficient regularization system. After obtaining the text to be processed, the text to be processed can be converted into at least one candidate text based on the pre-written text normalization rule.

[0039] Step S106, calling a text analysis model to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is trained based on the candidate text sample.

[0040] In the above step S106, after the text to be processed is converted into at least one candidate text according to the text normalization rule information, the text analysis model can be called to perform context analysis on the candidate text to obtain an analysis result. The text analysis model can be trained based on the candidate text sample, and the text analysis model can be a Bidirectional Encoder Representations from Transformers (BERT) language model.

[0041] In this embodiment, after the text to be processed is converted into at least one candidate text according to the text normalization rule information, the BERT language model can be called to perform context analysis on the candidate text to obtain an analysis result, so as to select the best candidate from multiple candidate texts based on the analysis result.

[0042] Step S108, adjusting the text normalization rule information based on the analysis result, and determining the target text from at least one candidate text based on the adjusted text normalization rule information.

[0043] In the above step S108, after calling the text analysis model to perform context analysis on the candidate text and obtaining the analysis result, the text normalization rule information can be adjusted based on the obtained analysis result, and the target text can be determined from at least one candidate text based on the adjusted text normalization rule information.

[0044] In this embodiment, based on the obtained analysis results, in actual business needs, the text normalization rules can be dynamically adjusted according to user feedback information and changes in application scenarios, so as to promptly respond to changes in needs in actual applications and optimize processing effects.

[0045] For example, for texts in specific industries or fields, relevant rules can be adjusted to improve the accuracy and efficiency of standardization. In addition, through a continuous feedback mechanism, new non-standard text forms can be continuously learned and adapted to ensure their applicability and accuracy in complex language environments, thereby improving user experience.

[0046] In an embodiment of the present application, a text to be processed is obtained; according to text normalization rule information, the text to be processed is converted into at least one candidate text, wherein the text normalization rule information is used to represent the rule for converting the text to be processed into the candidate text; a text analysis model is called to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is trained based on candidate text samples; based on the analysis result, the text normalization rule information is adjusted, and based on the adjusted text normalization rule information, a target text is determined from at least one candidate text, thereby improving the effect of text processing and further solving the technical problem of poor effect of text processing.

[0047] In some embodiments of the present application, the method further includes: determining text normalization rule information based on a weighted finite state machine, wherein the weighted finite state machine is used to represent weighted conversion rules for the text to be processed.

[0048] In this embodiment, text normalization rule information is determined based on a weighted finite state machine, wherein a weighted finite state machine (WFST) is an extended finite state machine that combines state transfer and output functions and can be widely used in speech recognition, natural language processing, image processing and other fields.

[0049] In some embodiments of the present application, text normalization rule information is determined based on a weighted finite state machine, including: determining initial text normalization rule information based on a weighted finite state machine; adjusting the initial text normalization rule information according to an adjustment strategy to obtain text normalization rule information, wherein the adjustment strategy is to first classify the initial text normalization rule information, and then convert the classified initial text normalization rule information, and / or perform non-named entity processing on the initial text normalization rule information.

[0050] In this embodiment, based on the weighted finite state machine, the initial text normalization rule information can be determined. Further, according to the adjustment strategy, the initial text normalization rule information can be adjusted to obtain the text normalization rule information. Among them, the adjustment strategy can be to first classify the initial text normalization rule information, and then convert the classified initial text normalization rule information, that is, rule splitting, and / or, non-named entity (NE) processing is performed on the initial text normalization rule information, that is, non-named entity NE processing optimization.

[0051] In an optional example, in the writing of text regularization rules based on Pynini, a finite state machine (FST) model is used. As the number of rules increases, the scale of the state diagram expands, the conversion time is significantly prolonged, and the efficiency is reduced.

[0052] However, this application optimizes the code logic and splits the text normalization rules, breaking down the TN rules that were originally executed in one step into a logic of first classification and then conversion, reducing the complexity of the graph and the time-consuming operation, thereby effectively reducing the conversion time. Furthermore, the processing of non-named entities NE is optimized to avoid TN conversion of non-NE parts of the text, directly output the parts that do not need to be converted, reduce unnecessary calculations, and further shorten the processing time.

[0053] After two optimizations, the overall system performance of this embodiment is improved by about 59%, and the time consumed to process 100 words is shortened from 113 milliseconds (ms) to 46ms, which significantly improves the efficiency and meets the requirements of a real-time TTS system.

[0054] In some embodiments of the present application, the method further includes: obtaining candidate text samples; and using the candidate text samples to train an initial text analysis model to obtain a text analysis model.

[0055] In this embodiment, a candidate text sample may be obtained. After the candidate text sample is obtained, an initial text analysis model may be trained based on the obtained candidate text sample to obtain a text analysis model.

[0056] Optionally, collect 10 Gigabytes of text information from multiple fields, such as news, novels, conversations, and the Internet, and clean and organize the text information. Write scripts to extract non-standard text combinations such as numbers and symbols, write generalized text normalization rules based on Python's Pynini package, and build an efficient regularization system.

[0057] Optionally, after collecting text information and writing text normalization rules, the text information can be normalized based on the text normalization rules to obtain candidate text samples. Further, based on the obtained candidate text samples, an initial text analysis model can be trained to obtain a text analysis model.

[0058] In some embodiments of the present application, an initial text analysis model is trained based on candidate text samples to obtain a text analysis model, including: batch sampling the candidate text samples to obtain candidate text samples after batch sampling; and using the candidate text samples after batch sampling to train the initial text analysis model to obtain a text analysis model.

[0059] In this embodiment, after obtaining the candidate text samples, batch sampling (Batch Sampler) can be performed on the obtained candidate text samples to obtain the candidate text samples after batch sampling. Further based on the candidate text samples after batch sampling, the initial text analysis model can be trained to obtain the text analysis model.

[0060] Optionally, after obtaining the candidate text samples, since the training data (candidate text samples) come from a wide range of sources and the text lengths vary greatly, this embodiment adopts a batch sampling strategy to classify data of different lengths to improve the model training efficiency and avoid unnecessary computational overhead. This strategy can more effectively utilize graphics processing unit (GPU) resources, making the training process more efficient.

[0061] In some embodiments of the present application, an initial text analysis model is trained based on candidate text samples to obtain a text analysis model, including: masking the candidate text samples to obtain masked candidate text samples; and using the masked candidate text samples to train the initial text analysis model to obtain a text analysis model.

[0062] In this embodiment, after obtaining the candidate text sample, the obtained candidate text sample can be subjected to masking (Masked Language Model, MLM for short) processing to obtain the candidate text sample after masking processing. Further based on the candidate text sample after masking processing, the initial text analysis model can be trained to obtain the text analysis model.

[0063] Optionally, after obtaining the candidate text samples, a masking mechanism can be used to enhance the generalization ability of the model in low-resource scenarios. For example, 30% of the input (candidate text samples) can be masked, where 80% of the phonemes are masked, 10% are replaced with other phonemes, and the remaining 10% remain unchanged.

[0064] In some embodiments of the present application, after the initial text analysis model is trained based on the candidate text samples to obtain the text analysis model, the method further includes: adjusting the text analysis model based at least on the redundant layer and model parameters of the text analysis model to obtain an adjusted text analysis model.

[0065] In this embodiment, after the initial text analysis model is trained based on the candidate text samples to obtain the text analysis model, the text analysis model can be adjusted based on the redundant layers and model parameters of the text analysis model to obtain an adjusted text analysis model.

[0066] Optionally, in order to adapt to streaming application scenarios, the BERT model structure is streamlined and lightweight to reduce computing resource usage. By removing redundant layers and adjusting parameters, the efficiency and scalability of the model in real-time applications can be ensured, making the BERT model suitable for streaming TTS scenarios.

[0067] In an embodiment of the present application, a text to be processed is obtained; according to text normalization rule information, the text to be processed is converted into at least one candidate text, wherein the text normalization rule information is used to represent the rule for converting the text to be processed into the candidate text; a text analysis model is called to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is trained based on candidate text samples; based on the analysis result, the text normalization rule information is adjusted, and based on the adjusted text normalization rule information, a target text is determined from at least one candidate text, thereby improving the effect of text processing and further solving the technical problem of poor effect of text processing.

[0068] In order to help those skilled in the art better understand the technical solution of the present application, an example is now provided in conjunction with a specific embodiment.

[0069] At present, speech synthesis TTS is a technology that converts text into speech, which is widely used in voice assistants, audiobooks, navigation systems and other fields. Since converting written text into natural and accurate speech output is a complex process. The TTS system needs to go through multiple steps when processing text, and each part is responsible for different tasks to ensure that the system can correctly understand and generate fluent speech. These steps can be divided into two main stages: language analysis and speech synthesis. Among them, a key processing step in language analysis is text normalization. The main task of text normalization is to convert non-standard or ambiguous text elements into a consistent and standard form, so that the TTS system can process these texts more easily. Standardized content includes expanding abbreviations, converting numbers into their verbal equivalents, formatting dates, etc.

[0070] The importance of text normalization lies in the fact that it can eliminate ambiguity in written forms and make unified representations. For example, when the TTS system encounters numerical expressions such as $123 and 50%, TN will correctly read $123 as one hundred and twenty-three dollars, rather than one two three dollars, and correctly read 50% as fifty percent, rather than five zero percent. In this way, TN not only improves the accuracy of the TTS system, but also makes the generated speech more natural and clear, making it more practical in real applications.

[0071] There are three main types of systems for text normalization: rule-based systems, neural network-based systems, and hybrid systems. Rule-based systems use language-specific rules, usually defined through regular expressions or weighted finite state machines (WFSTs). This approach is easy to scale, debug, and reason, but lacks corresponding rules to deal with complex language situations and performs poorly when dealing with contextual ambiguity. Neural network-based systems treat text normalization as a machine translation task, usually using sequence-to-sequence models, which are suitable for solving context-level problems, but rely on large amounts of data for training and may generate incorrect outputs in some cases. Once these errors occur, the system is usually difficult to correct through internal mechanisms, resulting in unrecoverable errors. Hybrid systems use weak covering grammars to filter and correct incorrect pronunciations. Compared with rule-based systems, they do not require complex grammars and rely more on neural models.

[0072] Despite the advantages of rule-based systems, the main challenge they face is the problem of contextual ambiguity. Due to the limitations of rules, such systems are prone to inaccurate recognition or mishandling when dealing with contextually relevant text, which makes them more vulnerable when faced with complex language environments. Therefore, combining neural networks to assist these rules can improve the system's ability to understand context and thus enhance the processing of semantic relevance. While maintaining the flexibility of the rule system, this method uses the powerful characteristics of deep learning models to make up for the shortcomings of the rules, which can effectively improve the system's performance in complex situations.

[0073] In an optional example, a weighted finite state machine WFST and a language model can be combined to improve the performance of text normalization. Because the traditional WFST system has certain limitations when processing context-dependent fuzzy input. For example, when faced with an input such as 1 / 4, the WFST may not be able to correctly select one quarter or January fourth based on the context. To solve this problem, the non-deterministic WFST can be combined with a language model. The WFST is used to generate multiple normalization candidates, while the language model is responsible for selecting the best candidate based on the context. This method not only improves the accuracy of text normalization, but also effectively handles various semi-symbol classes. However, this method cannot adapt to business needs and has universality, so there is a problem of poor effect in processing text.

[0074] In order to solve the above problems, the present application proposes an efficient text normalization method combining a weighted finite state machine and BERT, which can effectively deal with the rule conversion error problem caused by context ambiguity while ensuring the correct conversion of basic rules. Traditional rule-based systems are prone to inaccurate recognition and incorrect processing in complex language environments, resulting in the fragility of processing results. This embodiment optimizes the text processing process by introducing the context analysis capability of neural networks, and realizes dynamic adjustment and selection of the most relevant processing rules, thereby improving processing precision and accuracy, thereby significantly improving the accuracy and effectiveness of text processing in complex language environments, and providing a more powerful solution for the field of natural language processing.

[0075] Figure 2 is a schematic diagram of text normalization in a speech synthesis system according to an embodiment of the present application, such as Figure 2As shown, the text "The correct score for this question is 12 / 11, which shows that his math level is very high" and "The competition will be held on 12 / 11, and the contestants are looking forward to getting good scores" are normalized to obtain "The correct score for this question is 11 / 12, which shows that his math level is very high" and "The competition will be held on December 11, and the contestants are looking forward to getting good scores", and then the normalized text is input into the speech synthesis system to achieve conversion from written language to spoken expression, and the conversion result is closely related to the context. This embodiment can ensure the accuracy of text conversion and ensure the consistency of the generated speech and the input text at the speech level, thereby improving the naturalness and fluency of the generated speech, and thus improving the user experience.

[0076] The text normalization TN method proposed in this embodiment can adapt to business needs and has universality. Figure 3 is a schematic diagram of an overall structure of text normalization according to an embodiment of the present application, such as Figure 3 As shown in the figure, for data collection and processing, a total of 10G of text information can be collected from multiple fields, such as news, books, novels, conversations, and the Internet, and the information can be cleaned and organized. By writing scripts to extract non-standard text combinations such as "numbers + symbols", and writing text normalization rules with generalization capabilities based on Python's Pynini package, an efficient regularization system can be built. Figure 4 is a schematic diagram of the distribution of overall data types according to an embodiment of the present application, such as Figure 4 As shown in the figure, the horizontal axis represents data, cardinal, measure, time, money, decimal, electronic, fraction, telephone, year, sport, math, labels, whitelist, business and digit, and the vertical axis represents the proportion of data distribution.

[0077] Since Pynini is based on the finite state machine FST, the degree of perfection of the rules is directly related to the scale of the state diagram. As the number of rules increases, the scale of the state diagram expands, the conversion time is significantly prolonged, and the efficiency is reduced. In order to solve this problem, this embodiment optimizes the logic to shorten the conversion time. For rule writing, through rule splitting, the TN rules that were originally executed in one step are disassembled into the logic of first classification and then conversion, reducing the complexity of the graph and the time-consuming operation, thereby effectively reducing the conversion time. Further through the non-named entity NE processing optimization, TN conversion of the non-NE part of the text is avoided, and the part that does not need to be converted is directly output, reducing unnecessary calculations and further shortening the processing time. After two optimizations, the overall performance of the system is improved by about 59%, and the time consumption for processing 100 words is shortened from 113ms to 46ms, which significantly improves efficiency and meets the needs of real-time TTS systems.

[0078] By normalizing each symbol tag, the weighted finite state transferer WFST assigns a higher weight to the path that keeps the tag unchanged. Through this design, unnecessary outputs can be effectively pruned, thereby improving the overall efficiency of the system. Figure 3 As shown, WFST outputs and removes the results whose weights are greater than the threshold. Assuming that the weights of output 3 and output 5 are greater than the threshold, output 3 and output 5 are removed.

[0079] Figure 5 is a schematic diagram of text normalization rule optimization according to an embodiment of the present application, such as Figure 5 As shown, for the process of traditional text normalization rules of tagging, parsing, generating recordings, and verbalizing, the TN rule that was originally executed in one step is broken down into the logic of first classifying (classify) and then converting (convert), and the text normalization rule optimization is achieved through non-named entity NE processing optimization.

[0080] For example, to normalize the text "I spent ¥123 on the 12th of that month", the traditional processing flow is: segment and mark the text to get "tokens{name: that}tokens{name: month}tokens{date{day: the 12th}}tokens{name: me}tokens{name: spend}tokens{name: fee}tokens{name: got}tokens{measure{currency: yuan, integer_part: one hundred and twenty-three}}", where tokens represents tags, name represents name, date represents date, day represents day, measure represents measure, currency represents currency, and integer_part represents integer part. Further parsing the above content, we get [{name: that}{name: month}{date{day: the 12th}}{name: me}{name: spend}{name: fee}{name: got}{measure{currency: yuan, integer_part: one hundred and twenty-three}}]. The record is further generated as "tokens{name: that}tokens{name: month}tokens{date{day: the 12th}}tokens{name: me}tokens{name: spend}tokens{name: fee}tokens{name: got}tokens{measure{integer_part: one hundred and twenty-three, currency: yuan}}". The final verbal expression is "I spent one hundred and twenty-three yuan on the 12th of that month".

[0081] For another example, the above text normalization process is optimized. First, the text is classified to obtain "tokens{name: this}tokens{name: month}tokens{date{day: 12th}}tokens{name: I}tokens{name: spend}tokens{name: cost}tokens{name: of}tokens{measure{currency: yuan, integer_part: 123}}". Further parsing the above content gives [{name: this}{name: month}{date{day: 12th}}{name: I}{name: spend}{name: cost}{name: of}{measure{currency: yuan, integer_part: 123}}]. Further generating a record as "tokens{name: this}tokens{name: month}tokens{date{day: 12th}}tokens{name: I}tokens{name: spend}tokens{name: cost}tokens{name: of}tokens{measure{integer_part: 123, currency: yuan}}". Converting this content gives "this month tokens{date{day: 12th}} I spent tokens{measure{integer_part: one hundred and twenty-three, currency: yuan}}", and finally the verbal expression obtained is "I spent one hundred and twenty-three yuan on the 12th of this month."

[0082] In addition, this embodiment trains the BERT model based on the collected text, customizes the model parameters and training strategies to improve the model efficiency. Finally, based on the actual business output, the rules can also be dynamically adjusted to achieve higher text processing accuracy and flexibility.

[0083] For the training of the BERT language model, since the training data sources are extensive and the text lengths vary greatly, this embodiment adopts a batch sampling strategy to classify data of different lengths to improve the model training efficiency and avoid unnecessary computational overhead. This strategy can make more effective use of GPU resources and make the training process more efficient. In addition, a masking mechanism is adopted to enhance the generalization ability of the model in low-resource scenarios. The specific strategy is that 30% of the input will be masked, among which 80% of the phonemes will be masked, 10% will be replaced by other phonemes, and the remaining 10% remains unchanged. As Figure 3As shown in the figure, the final output is obtained by MLM re-scoring and pruning (i.e., output 2 and output 4 are pruned, and output 1 is obtained). In order to adapt to streaming application scenarios, the BERT model structure is streamlined and lightweight to reduce computing resource usage. By removing redundant layers and adjusting parameters, the model is ensured to be efficient and scalable in real-time applications, making it suitable for streaming TTS scenarios.

[0084] According to the final results, in actual business needs, according to user feedback and changes in application scenarios, dynamically adjust text normalization rules (such as Figure 3 This flexibility enables the system to respond to changes in demand in actual applications and optimize processing results. For example, for texts in specific industries or fields, relevant rules can be adjusted to improve the accuracy and efficiency of standardization. In addition, through a continuous feedback mechanism, the system can continuously learn and adapt to emerging non-standard text forms to ensure its applicability and accuracy in complex language environments, thereby improving user experience.

[0085] This embodiment collects and processes data from multiple fields, collects 10G text data from multiple fields such as news, novels, conversations, and the Internet, extracts non-standard text combinations such as "numbers + symbols", and uses the Pynini package to build text normalization rules with generalization capabilities to improve the adaptability and efficiency of the system. The complexity of the state diagram is reduced through rule splitting and non-named entity processing optimization, effectively shortening the conversion time. The system performance is improved by about 59%, and the processing time is significantly reduced to meet the requirements of the real-time TTS system. For the training and optimization of the BERT language model, the batch sampling strategy is used to improve the model training efficiency and avoid computational overhead; the mask mechanism MLM is used to enhance the generalization ability of the model in low-resource scenarios and improve the text comprehension ability; the model structure is lightweight to ensure the efficiency and scalability of the model in streaming applications, which is suitable for real-time text processing.

[0086] In this embodiment, according to user feedback and changes in actual application scenarios, the text normalization rules are flexibly adjusted to ensure the applicability and accuracy of the system in complex language environments. By introducing the context analysis capability of BERT, the rule conversion errors caused by context ambiguity are effectively resolved to ensure the consistency of the generated speech with the input text. The performance of the optimized system is significantly improved, and the processing time is greatly shortened, which can meet the needs of the real-time TTS system and improve the user experience. Based on text data in multiple fields, the constructed normalization rules have strong generalization capabilities, can handle various non-standard text combinations, and improve the applicability of the system. The dynamic adjustment mechanism enables the system to respond to changes in demand in actual applications in a timely manner, optimize the processing effect, and improve the accuracy and efficiency of normalization. By improving the naturalness and fluency of the generated speech, the user's satisfaction with the speech synthesis system is ultimately improved.

[0087] In an embodiment of the present application, a text to be processed is obtained; according to text normalization rule information, the text to be processed is converted into at least one candidate text, wherein the text normalization rule information is used to represent the rule for converting the text to be processed into the candidate text; a text analysis model is called to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is trained based on candidate text samples; based on the analysis result, the text normalization rule information is adjusted, and based on the adjusted text normalization rule information, a target text is determined from at least one candidate text, thereby improving the effect of text processing and further solving the technical problem of poor effect of text processing.

[0088] Figure 6 is a structural diagram of a text processing device according to an embodiment of the present application, such as Figure 6 As shown, the text processing device 600 may include: an acquisition unit 602 , a conversion unit 604 , an analysis unit 606 and a determination unit 608 .

[0089] The acquisition unit 602 is used to acquire the text to be processed.

[0090] The conversion unit 604 is used to convert the text to be processed into at least one candidate text according to the text normalization rule information, wherein the text normalization rule information is used to represent the rule for converting the text to be processed into the candidate text.

[0091] The analysis unit 606 is used to call a text analysis model to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is trained based on the candidate text sample.

[0092] The determination unit 608 is configured to adjust the text normalization rule information based on the analysis result, and determine the target text from at least one candidate text based on the adjusted text normalization rule information.

[0093] Optionally, the device further includes: a first determining unit, configured to determine text normalization rule information based on a weighted finite state machine, wherein the weighted finite state machine is used to represent a weighted conversion rule for the text to be processed.

[0094] Optionally, the first determination unit includes: a determination module, used to determine the initial text normalization rule information based on a weighted finite state machine; an adjustment module, used to adjust the initial text normalization rule information according to an adjustment strategy to obtain text normalization rule information, wherein the adjustment strategy is to first classify the initial text normalization rule information, and then convert the classified initial text normalization rule information, and / or perform non-named entity processing on the initial text normalization rule information.

[0095] Optionally, the device further includes: a first acquisition unit, used to acquire candidate text samples; and a training unit, used to train an initial text analysis model using the candidate text samples to obtain a text analysis model.

[0096] Optionally, the training unit includes: a sampling module for batch sampling candidate text samples to obtain candidate text samples after batch sampling; a first training module for training an initial text analysis model using the candidate text samples after batch sampling to obtain a text analysis model.

[0097] Optionally, the training unit includes: a masking module, used to perform masking on candidate text samples to obtain masked candidate text samples; and a second training module, used to train an initial text analysis model using the masked candidate text samples to obtain a text analysis model.

[0098] Optionally, after the initial text analysis model is trained based on the candidate text samples to obtain the text analysis model, the device also includes: an adjustment unit, used to adjust the text analysis model based on at least the redundant layer and model parameters of the text analysis model to obtain an adjusted text analysis model.

[0099] In the device, the text to be processed is obtained by the acquisition unit 602. The text to be processed is converted into at least one candidate text by the conversion unit 604 according to the text normalization rule information, wherein the text normalization rule information is used to represent the rule for converting the text to be processed into the candidate text. The text analysis model is called by the analysis unit 606 to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is obtained by training based on the candidate text sample. The text normalization rule information is adjusted based on the analysis result by the determination unit 608, and the target text is determined from at least one candidate text based on the adjusted text normalization rule information, thereby improving the effect of text processing and solving the technical problem of poor effect of text processing.

[0100] According to another aspect of an embodiment of the present application, a non-volatile storage medium is further provided, the non-volatile storage medium including a stored program, wherein when the program is running, a device where the non-volatile storage medium is located is controlled to execute any text processing method.

[0101] Specifically, the above storage medium is used to store program instructions for the following functions to implement the following functions:

[0102] Acquire a text to be processed; convert the text to be processed into at least one candidate text according to text normalization rule information, wherein the text normalization rule information is used to represent the rule for converting the text to be processed into the candidate text; call a text analysis model to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is trained based on candidate text samples; adjust the text normalization rule information based on the analysis result, and determine a target text from at least one candidate text based on the adjusted text normalization rule information.

[0103] Optionally, in this embodiment, the above-mentioned storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the above-mentioned contents. More specific examples of the above-mentioned storage medium may include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above-mentioned contents.

[0104] In an exemplary embodiment of the present application, a computer program product is further provided, including a computer program, and when the computer program is executed by a processor, the computer program implements any of the above-mentioned text processing methods.

[0105] Optionally, the computer program may implement the following steps when executed by a processor:

[0106] Acquire a text to be processed; convert the text to be processed into at least one candidate text according to text normalization rule information, wherein the text normalization rule information is used to represent the rule for converting the text to be processed into the candidate text; call a text analysis model to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is trained based on candidate text samples; adjust the text normalization rule information based on the analysis result, and determine a target text from at least one candidate text based on the adjusted text normalization rule information.

[0107] According to an embodiment of the present application, an electronic device is provided, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any of the above-mentioned text processing methods.

[0108] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0109] Figure 7 is a schematic block diagram of an electronic device according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0110] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0111] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0112] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as the processing method of the text. For example, in some embodiments, the processing method of the text may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the processing method of the text described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to execute the processing method of the text in any other appropriate manner (e.g., by means of firmware).

[0113] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0114] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0115] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0116] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0117] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0118] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0119] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0120] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0121] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, 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, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0122] 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 units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0123] 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.

[0124] 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, in essence, 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, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0125] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A text processing method, characterized in that: include: Get the text to be processed; According to the text normalization rule information, converting the to-be-processed text into at least one candidate text, wherein the text normalization rule information is used to represent the rule for converting the to-be-processed text into the candidate text; Calling a text analysis model to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is trained based on a sample of the candidate text; Based on the analysis result, the text normalization rule information is adjusted, and based on the adjusted text normalization rule information, a target text is determined from at least one of the candidate texts.

2. The method according to claim 1, characterized in that: The method further comprises: The text normalization rule information is determined based on a weighted finite state machine, wherein the weighted finite state machine is used to represent a weighted conversion rule for the text to be processed.

3. The method according to claim 2, characterized in that Based on the weighted finite state machine, determining the text normalization rule information includes: Based on the weighted finite state machine, determining initial text normalization rule information; According to the adjustment strategy, the initial text normalization rule information is adjusted to obtain the text normalization rule information, wherein the adjustment strategy is to first classify the initial text normalization rule information, and then convert the classified initial text normalization rule information, and / or perform non-named entity processing on the initial text normalization rule information.

4. The method according to claim 1, characterized in that The method further comprises: Obtaining the candidate text sample; The candidate text samples are used to train an initial text analysis model to obtain the text analysis model.

5. The method according to claim 4, characterized in that Based on the candidate text samples, an initial text analysis model is trained to obtain the text analysis model, including: Performing batch sampling on the candidate text samples to obtain candidate text samples after batch sampling; The initial text analysis model is trained using the candidate text samples after the batch sampling to obtain the text analysis model.

6. The method according to claim 4, characterized in that Based on the candidate text samples, an initial text analysis model is trained to obtain the text analysis model, including: Performing mask processing on the candidate text sample to obtain a masked candidate text sample; The initial text analysis model is trained using the candidate text samples after the masking process to obtain the text analysis model.

7. The method according to claim 4, characterized in that After the initial text analysis model is trained based on the candidate text sample to obtain the text analysis model, the method further includes: The text analysis model is adjusted based at least on the redundant layers and model parameters of the text analysis model to obtain an adjusted text analysis model.

8. A text processing device, characterized in that: include: An acquisition unit, used for acquiring the text to be processed; A conversion unit, used for converting the to-be-processed text into at least one candidate text according to text normalization rule information, wherein the text normalization rule information is used for indicating a rule for converting the to-be-processed text into the candidate text; An analysis unit, configured to call a text analysis model to perform context analysis on the candidate text to obtain an analysis result, wherein the text analysis model is trained based on a sample of the candidate text; A determination unit is used to adjust the text normalization rule information based on the analysis result, and determine a target text from at least one of the candidate texts based on the adjusted text normalization rule information.

9. A non-volatile storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 7.