A semantic processing method and device, electronic equipment and storage medium
By acquiring the recognized text during speech recognition and performing pre-classification using a semantic pre-classification model, the problem of slow semantic processing speed after speech recognition is solved, and the timely return of semantic processing results is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PATEO CONNECT (NANJING) CO LTD
- Filing Date
- 2022-01-12
- Publication Date
- 2026-05-01
AI Technical Summary
In existing natural language processing technologies, the chain of steps for semantic processing after speech recognition into text is relatively long, resulting in slow processing speed and untimely semantic processing results.
In the process of speech recognition to text, the recognized text is obtained, and a semantic pre-classification model is used for pre-classification to initiate semantic processing in advance. This includes training the semantic pre-classification model to generate semantic pre-classification and confidence scores, and initiating corresponding semantic processing based on the confidence scores.
By initiating semantic pre-classification processing in advance, the timeliness of semantic processing is improved, the problem of slow processing speed is avoided, and the results are returned in a timely manner.
Smart Images

Figure CN116467404B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of language processing technology, and in particular to a semantic processing method, a semantic processing device, an electronic device, and a readable storage medium. Background Technology
[0002] Natural Language Processing (NLP) is the technology that uses natural language to communicate with computers. Because the key to processing natural language is enabling computers to "understand" it, NLP is also called Natural Language Understanding (NLU). NLU is the collective term for all methods, models, or tasks that support machines in understanding text content. NLU plays a crucial role in text information processing systems and is an essential module for recommendation, question answering, and search systems.
[0003] In current NLU or NLP technologies, when a user inputs speech, the speech is first recognized as text. Only after recognition is complete can the corresponding semantic category be determined before proceeding to the next step of semantic processing within that category. This processing chain is quite long, with each step requiring a considerable amount of time. Therefore, semantic processing for speech suffers from slow processing speed, resulting in delayed returns of semantic processing results. Summary of the Invention
[0004] The purpose of this invention is to provide a semantic processing method, apparatus, electronic device, and storage medium to solve the problem that semantic processing for speech is slow and results are not returned in a timely manner.
[0005] To address the aforementioned problems, in a first aspect of this invention, a semantic processing method is provided, comprising:
[0006] During the process of recognizing and processing the target speech, the recognized text is obtained;
[0007] Based on the identified text, determine the corresponding semantic pre-classification;
[0008] Before the recognition and processing of the target speech is completed, the semantic processing corresponding to the semantic pre-classification is initiated.
[0009] Optionally, determining the corresponding semantic pre-classification based on the identified text includes:
[0010] The identified text is input into a semantic pre-classification model; wherein the semantic pre-classification model is trained using text samples of various lengths and corresponding labeled sample classification information;
[0011] Based on the identified text, the semantic pre-classification model generates the corresponding semantic pre-classification.
[0012] Optionally, generating a corresponding semantic pre-classification based on the identified text using the semantic pre-classification model includes:
[0013] Based on the identified text, the semantic pre-classification model generates at least one corresponding semantic pre-classification and a confidence level corresponding to the semantic pre-classification.
[0014] Optionally, the sample classification information includes semantic classification and corresponding importance data. Before inputting the identified text into the semantic pre-classification model, the method further includes:
[0015] Based on the historical text, text samples of various lengths are extracted by sequentially increasing the number of characters from beginning to end; wherein, each length of text sample includes the very first character of the historical text;
[0016] Based on the historical text and the corresponding semantic classification, determine the semantic classification of the text samples of various lengths.
[0017] For the same text samples in various historical texts, the occurrence counts of the same semantic category are accumulated to obtain the occurrence counts of various semantic categories for text samples of various lengths;
[0018] Based on the frequency of occurrence of various semantic categories of text samples of various lengths and the semantic category weights set for each semantic category, the importance data of various semantic categories of text samples of various lengths are calculated; wherein, the semantic category weights set for valid semantic categories are positive numbers, and the semantic category weights set for invalid semantic categories are negative numbers.
[0019] The semantic pre-classification model is trained based on text samples of various lengths and the corresponding labeled sample classification information.
[0020] Optionally, the sample classification information includes the number of valid semantic instances and the number of invalid semantic instances corresponding to the text samples of various lengths. Before training the semantic pre-classification model based on the text samples of various lengths and the corresponding labeled sample classification information, the method further includes:
[0021] For text samples of various lengths, the occurrence counts of valid semantic categories are summed to obtain the number of valid semantic categories, and the occurrence counts of invalid semantic categories are summed to obtain the number of invalid semantic categories.
[0022] The step of generating corresponding semantic pre-classifications from the semantic pre-classification model based on the identified text further includes:
[0023] Based on the identified text, the semantic pre-classification model generates the probability that the identified text is a valid semantic classification and the probability that it is an invalid semantic classification.
[0024] Optionally, the step of initiating the semantic processing corresponding to the semantic pre-classification before completing the recognition processing of the target speech includes:
[0025] When the confidence level corresponding to the semantic pre-classification exceeds the first preset threshold, the semantic processing corresponding to the semantic pre-classification is initiated, and the identified text is preprocessed.
[0026] Optionally, after initiating the semantic processing corresponding to the semantic pre-classification before completing the recognition processing of the target speech, the method further includes:
[0027] When the confidence level corresponding to the semantic pre-classification exceeds the second preset threshold, and the semantic pre-classification model generates only one semantic pre-classification, then the semantic processing corresponding to the semantic pre-classification begins.
[0028] Alternatively, when the confidence level corresponding to the semantic pre-classification exceeds a third preset threshold, the semantic processing corresponding to the semantic pre-classification is started.
[0029] Wherein, the first preset threshold is lower than the second preset threshold, and the second preset threshold is lower than the third preset threshold.
[0030] In a second aspect of the invention, a semantic processing apparatus is provided, comprising:
[0031] The text acquisition module is used to acquire the recognized text during the process of recognizing and processing the target speech.
[0032] The pre-classification determination module is used to determine the corresponding semantic pre-classification based on the identified text;
[0033] The semantic processing initiation module is used to initiate the semantic processing corresponding to the semantic pre-classification before the recognition processing of the target speech is completed.
[0034] Optionally, the pre-classification determination module includes:
[0035] The model input submodule is used to input the identified text into the semantic pre-classification model; wherein the semantic pre-classification model is trained by text samples of various lengths and corresponding labeled sample classification information;
[0036] The pre-classification generation submodule is used to generate corresponding semantic pre-classifications based on the identified text using the semantic pre-classification model.
[0037] Optionally, the pre-classification generation submodule includes:
[0038] The confidence generation submodule is used to generate at least one corresponding semantic pre-classification and a confidence score corresponding to the semantic pre-classification based on the identified text by the semantic pre-classification model.
[0039] Optionally, the sample classification information includes semantic classification and corresponding importance data, and the device further includes:
[0040] The sample extraction module is used to extract text samples of various lengths based on historical text before inputting the identified text into the semantic pre-classification model, in an order of increasing word count from beginning to end; wherein, each length of text sample includes the first character of the historical text.
[0041] The semantic classification determination module is used to determine the semantic classification of the corresponding text samples of various lengths based on the historical text and the corresponding semantic classification.
[0042] The occurrence count accumulation module is used to accumulate the occurrence counts of the same semantic category for the same text samples in each historical text, so as to obtain the occurrence counts of various semantic categories for text samples of various lengths;
[0043] The importance data calculation module is used to calculate the importance data of various semantic categories of text samples of various lengths based on the frequency of occurrence of various semantic categories and the semantic category weights set for each semantic category; wherein, the semantic category weights set for valid semantic categories are positive numbers, and the semantic category weights set for invalid semantic categories are negative numbers.
[0044] The model training module is used to train the semantic pre-classification model based on text samples of various lengths and the corresponding labeled sample classification information.
[0045] Optionally, the sample classification information includes the number of valid semantic instances and the number of invalid semantic instances corresponding to the text samples of various lengths, and the device further includes:
[0046] The frequency addition module is used to, before training the semantic pre-classification model based on the text samples of various lengths and the corresponding labeled sample classification information, add up the occurrence counts of effective semantic classifications for each text sample of various lengths to obtain the effective semantic counts, and add up the occurrence counts of invalid semantic classifications to obtain the invalid semantic counts.
[0047] The pre-classification generation submodule also includes:
[0048] The probability generation unit is used to generate, based on the identified text, the probability of the identified text being a valid semantic classification and the probability of an invalid semantic classification by the semantic pre-classification model.
[0049] Optionally, the semantic processing initiation module includes:
[0050] The startup submodule is used to start semantic processing corresponding to the semantic pre-classification and perform data preprocessing on the identified text when the confidence level corresponding to the semantic pre-classification exceeds a first preset threshold.
[0051] Optionally, the device further includes:
[0052] The semantic processing start module is used to start the semantic processing corresponding to the semantic pre-classification before the recognition processing of the target speech is completed. When the confidence level of the semantic pre-classification exceeds the second preset threshold and the semantic pre-classification model generates only one semantic pre-classification, the semantic processing corresponding to the semantic pre-classification is started.
[0053] Alternatively, the semantic processing start module is used to start semantic processing corresponding to the semantic pre-classification when the confidence level corresponding to the semantic pre-classification exceeds a third preset threshold.
[0054] Wherein, the first preset threshold is lower than the second preset threshold, and the second preset threshold is lower than the third preset threshold.
[0055] In a third aspect of the present invention, an electronic device is provided, characterized in that it includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus.
[0056] Memory, used to store computer programs;
[0057] When a processor executes a program stored in memory, it implements any of the steps described above.
[0058] In a fourth aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, characterized in that the program, when executed by a processor, implements any of the methods described above.
[0059] This invention provides a semantic processing method, apparatus, electronic device, and storage medium. During the recognition process of target speech, the recognized text is acquired, and a corresponding semantic pre-classification is determined based on the recognized text. Before the recognition process of the target speech is completed, the semantic processing corresponding to the semantic pre-classification is initiated. This allows for semantic pre-classification of the text while recognizing the speech as text, thus determining the semantic pre-classification when only a portion of the text is recognized. This enables the early initiation of semantic processing corresponding to the semantic pre-classification, avoiding slow processing speeds and improving the timeliness of the semantic processing results. Attached Figure Description
[0060] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0061] Figure 1 A flowchart illustrating the steps of an embodiment of the semantic processing method of the present invention is shown;
[0062] Figure 2 A flowchart illustrating the steps of an embodiment of the semantic processing method of the present invention is shown;
[0063] Figure 3 A schematic diagram illustrating the training of a semantic pre-classification model is shown.
[0064] Figure 4 A schematic diagram of semantic processing of target speech is shown;
[0065] Figure 5 A structural block diagram of an embodiment of the semantic processing apparatus of the present invention is shown;
[0066] Figure 6 A schematic diagram of an electronic device according to an embodiment of the present invention is shown. Detailed Implementation
[0067] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0068] Reference Figure 1 The diagram illustrates a flowchart of a semantic processing method according to an embodiment of the present invention, which may specifically include the following steps:
[0069] Step 101: During the process of recognizing the target speech, obtain the recognized text.
[0070] In this embodiment of the invention, the target speech is the speech to be semantically processed, such as the speech being input by a user on a voice-enabled smart terminal, or any other applicable speech; this embodiment of the invention does not limit this. Semantic processing refers to semantic-related processing, such as question-and-answer, recommendation, or search based on the target speech, which requires processing based on semantic understanding. Specifically, it can include any applicable semantic processing; this embodiment of the invention does not limit this.
[0071] In this embodiment of the invention, before semantic processing, the target speech needs to be recognized and converted into corresponding text. The conversion of the target speech into text is performed character by character; while the target speech is not completely converted into text, the recognized text can be obtained first.
[0072] In one specific implementation, an acquisition is performed for each character identified. Alternatively, in another specific implementation, an acquisition is performed for each preset number of characters identified. Or, in yet another specific implementation, the first acquisition begins after the identified text reaches a set character threshold, followed by an acquisition for each preset number of characters identified thereafter. Any applicable implementation method can be included, and this embodiment of the invention does not limit this.
[0073] Step 102: Determine the corresponding semantic pre-classification based on the identified text.
[0074] In this embodiment of the invention, the semantic classification of the text can be obtained by classifying the text according to its semantics. Since the identified text is not the complete text corresponding to the target speech, the classification determined based on the identified text is denoted as semantic pre-classification.
[0075] In this embodiment of the invention, each time recognized text is acquired, a corresponding semantic pre-classification is determined based on that acquired recognized text. As the number of characters in the recognized text increases, the proportion of the recognized text in the complete text corresponding to the target speech increases, and the semantics of the recognized text and the complete text become closer. Therefore, the probability that the semantic pre-classification is the same as the semantic classification of the complete text will be greater.
[0076] In this embodiment of the invention, there are various ways to determine the corresponding semantic pre-classification based on the identified text. For example, the identified text can be input into an existing text classification model to classify the identified text and obtain a semantic pre-classification. Another example is to input the identified text into a semantic pre-classification model; wherein the semantic pre-classification model is trained using text samples of various lengths and corresponding labeled sample classification information; based on the identified text, the semantic pre-classification model generates the corresponding semantic pre-classification. Specifically, any applicable implementation method can be included, and this embodiment of the invention does not limit this.
[0077] Step 103: Before the recognition processing of the target speech is completed, start the semantic processing corresponding to the semantic pre-classification.
[0078] In this embodiment of the invention, semantic processing refers to processing based on the semantics of text, such as question answering, searching, recommending, controlling, or any other applicable processing; this embodiment of the invention does not limit this. Because text semantics are diverse, semantic processing needs to be divided into multiple categories to achieve greater accuracy and support more types of processing. Different categories of semantic processing are implemented by different models or modules. After determining the semantic pre-classification, the semantic processing model or module corresponding to the semantic pre-classification is determined. Before the target speech recognition processing is completed, the semantic processing model or module is pre-activated.
[0079] For example, if the semantic pre-classification is navigation, the navigation model is pre-started so that the complete text of the target speech is input into the navigation model after the target speech is recognized. Similarly, if the semantic pre-classification is music, the music model is pre-started so that the complete text of the target speech is input into the music model after the target speech is recognized.
[0080] According to an embodiment of the present invention, during the process of recognizing target speech, the recognized text is obtained, and the corresponding semantic pre-classification is determined based on the recognized text. Before the recognition process of the target speech is completed, the semantic processing corresponding to the semantic pre-classification is started, so that the text is semantically pre-classified while the speech is being recognized as text. Thus, the semantic pre-classification can be determined when part of the text is recognized, thereby realizing the early start of the semantic processing corresponding to the semantic pre-classification, thereby avoiding the problem of slow processing speed and improving the timeliness of the semantic processing results.
[0081] Reference Figure 2 The diagram illustrates a flowchart of a semantic processing method according to an embodiment of the present invention, which may specifically include the following steps:
[0082] Step 201: During the process of recognizing the target speech, obtain the recognized text.
[0083] In this embodiment of the invention, the specific implementation of this step can be found in the description of the foregoing embodiments, and will not be repeated here.
[0084] Step 202: Input the identified text into the semantic pre-classification model; wherein the semantic pre-classification model is trained using text samples of various lengths and corresponding labeled sample classification information.
[0085] In this embodiment of the invention, the semantic pre-classification of the identified text can be achieved using machine learning. This involves learning the correlation between text samples of various lengths and their corresponding labeled classification information, resulting in a semantic pre-classification model capable of predicting semantic pre-classification. To train this model, sample data and corresponding label data are needed, namely, text samples of various lengths and their corresponding labeled classification information. For example, a complete text can be extracted by sequentially increasing the number of characters from beginning to end, yielding text samples of various lengths. The classification of the complete text's corresponding label is then used as the sample classification information for each length of text sample.
[0086] In this embodiment of the invention, the semantic pre-classification model can adopt Bayesian classification, K-means (k-means clustering algorithm), or any other applicable model structure. This embodiment of the invention does not limit this.
[0087] In this embodiment of the invention, each time a recognized text is obtained, the recognized text is input into the semantic pre-classification model trained.
[0088] In an optional embodiment of the present invention, the sample classification information includes semantic classification and corresponding importance data. Before inputting the identified text into the semantic pre-classification model, the method may further include: extracting text samples of various lengths from historical texts in an incremental manner from the beginning to the end; wherein each length of text sample includes the first character in the historical text; determining the semantic classification of the corresponding text samples of various lengths based on the historical texts and the corresponding semantic classifications; accumulating the occurrence counts of the same semantic classification for the same text samples in each historical text to obtain the occurrence counts of each semantic classification for each length of text samples; calculating the importance data of each semantic classification for each length of text samples based on the occurrence counts of each semantic classification for each length of text samples and the semantic classification weights set for each semantic classification; wherein the semantic classification weights set for valid semantic classifications are positive numbers, and the semantic classification weights set for invalid semantic classifications are negative numbers; and training the semantic pre-classification model based on the text samples of various lengths and the corresponding labeled sample classification information.
[0089] Historical text is a large amount of collected historical data. It is labeled to obtain corresponding semantic classifications. The historical text is then processed by extracting text samples of varying lengths, from shortest to longest, in ascending order of the number of characters from beginning to end. Each length of text sample includes the very first character of the historical text. For example, the first character of the historical text is considered one text sample, the first two characters another, the first three characters another, and so on, until the entire historical text is considered a single text sample.
[0090] For a given historical text, the semantic classification of each extracted text sample of various lengths is labeled as the semantic classification of that historical text. Then, the text samples extracted from different historical texts are compared together to obtain identical text samples. Since identical text samples come from different historical texts, the semantic classifications of different historical texts may be the same or different. Therefore, the semantic classifications of identical text samples from different historical texts may be the same or different. For identical text samples in different historical texts, the occurrence counts of the same semantic classification are accumulated. This statistical analysis is performed on all text samples extracted from historical texts to obtain the occurrence counts of various semantic classifications for text samples of various lengths. For example, if the semantic classification of historical text a is music, historical text b is navigation, historical text c is music, and historical text d is chat, and historical texts a, b, c, and d all extract the same text sample "I want," then the semantic classification "music" for the text sample "I want" occurs 2 times, the semantic classification "navigation" occurs 1 time, and the semantic classification "chat" occurs 1 time.
[0091] Semantic classification can be divided into valid and invalid. For valid semantic classifications, this embodiment of the invention provides corresponding semantic processing; for invalid semantic classifications, this embodiment of the invention does not provide corresponding semantic processing. For each semantic classification, a corresponding semantic classification weight is set. The rules for setting the weight are as follows: the semantic classification weight for valid semantic classifications is a positive number, and the semantic classification weight for invalid semantic classifications is a negative number. For example, the semantic classification weight for the music category is 1, and the semantic classification weight for the casual conversation category is -2.
[0092] The importance data for a given semantic category of a text sample is calculated by multiplying the frequency of occurrence of that category by its corresponding semantic category weight. This result is recorded as the importance data for that semantic category of the text sample. This calculation is performed for each semantic category of each text sample to obtain the importance data for each semantic category of text samples of various lengths.
[0093] Sample classification information includes semantic classification and corresponding importance data. Then, based on text samples of various lengths and their corresponding label classification information, a semantic pre-classification model is trained. For example, using Bayesian classification, K-means algorithms, etc., the semantic classification and importance data of text samples of various lengths and their corresponding labels are calculated, thus obtaining the probability of text of various lengths for various semantic classifications. After training the semantic pre-classification model with identified text input, the semantic pre-classification model can obtain the probability of the identified text for various semantic classifications, and then output the various semantic classifications of the identified text and their probabilities.
[0094] For example, such as Figure 3 The diagram illustrates the training of the semantic pre-classification model. Historical text and classification labels include: "Navigation" for "Navigate to XX University", "Music" for "I want to listen to XXX's songs", "Sunroof control" for "Open the sunroof", "Chat" for "The weather is nice today", etc. Semantic classifications are summarized, and semantic classification weights are assigned to each category: "Music" has a weight of 1, "Navigation" has a weight of 2, "Chat" has a weight of -2, and "Sunroof control" has a weight of 1.5. Statistical analysis of historical text and semantic classifications is performed. First, the historical text is split into characters, following the leftmost principle, dividing a text of length N into N sample texts of length 1 to N. Then, the frequency of each semantic category for each sample text is calculated. The importance data for a text sample's semantic category is calculated by multiplying the frequency of a semantic category's occurrence by the corresponding semantic category weight. Text samples of various lengths, along with corresponding semantic classification and importance data, are input into a semantic pre-classification model. After training, a semantic pre-classification model is generated.
[0095] Step 203: Based on the identified text, the semantic pre-classification model generates the corresponding semantic pre-classification.
[0096] In this embodiment of the invention, for the identified text obtained this time, the output of the semantic pre-classification model is obtained, and then the output of the semantic pre-classification model is used as the semantic pre-classification of the identified text.
[0097] In an optional embodiment of the present invention, a specific implementation of generating a corresponding semantic pre-classification by the semantic pre-classification model based on the identified text may include: generating at least one corresponding semantic pre-classification and a confidence level corresponding to the semantic pre-classification by the semantic pre-classification model based on the identified text.
[0098] A semantic pre-classification model can generate at least one corresponding semantic pre-classification and a confidence score for each semantic pre-classification based on the identified text. For example, the semantic pre-classification model trained on the text sample, semantic classification, and corresponding importance data can output a semantic pre-classification and its corresponding probability, which can then be used as a confidence score.
[0099] In an optional embodiment of the present invention, the sample classification information includes the number of valid semantic occurrences and the number of invalid semantic occurrences corresponding to the text samples of various lengths. Before training the semantic pre-classification model based on the text samples of various lengths and the corresponding labeled sample classification information, the method may further include: for the text samples of various lengths, summing the occurrence counts of valid semantic classifications to obtain the number of valid semantic occurrences, and summing the occurrence counts of invalid semantic classifications to obtain the number of invalid semantic occurrences. Correspondingly, in a specific implementation of generating corresponding semantic pre-classifications from the semantic pre-classification model based on the identified text, the method may further include: generating the probability of the identified text being a valid semantic classification and the probability of it being an invalid semantic classification from the semantic pre-classification model based on the identified text.
[0100] For a given text sample, the occurrence counts of each valid semantic category are summed to obtain the valid semantic count for that text sample. The same method is used to obtain the valid semantic count for each text sample. Conversely, for a given text sample, the occurrence counts of each invalid semantic category are summed to obtain the invalid semantic count for that text sample. The same method is used to obtain the invalid semantic count for each text sample.
[0101] For example, for a text sample, the semantic category "music" appears 2 times, and the semantic category "navigation" appears 2 times. Both are valid semantic categories. Therefore, the occurrence counts are added together to get the number of valid semantic counts for the text sample as 4.
[0102] Since the sample classification information used to train the semantic pre-classification model includes the number of valid and invalid semantic classifications corresponding to text samples of various lengths, the semantic pre-classification model can also be designed with a binary classification output, outputting the probability of the identified text being a valid semantic classification and the probability of it being an invalid semantic classification. For example, a Bayesian classification algorithm can be used to calculate the probability of the identified text being a valid semantic classification and the probability of it being an invalid semantic classification. For an identified text, if the probability of a valid semantic classification is greater than the probability of an invalid semantic classification, it indicates that the identified text has a valid semantic classification.
[0103] Step 204: Before the recognition processing of the target speech is completed, start the semantic processing corresponding to the semantic pre-classification.
[0104] In this embodiment of the invention, the specific implementation of this step can be found in the description of the foregoing embodiments, and will not be repeated here.
[0105] In an optional embodiment of the present invention, a specific implementation of starting the semantic processing corresponding to the semantic pre-classification before the recognition processing of the target speech is completed may include: when the confidence level corresponding to the semantic pre-classification exceeds a first preset threshold, starting the semantic processing corresponding to the semantic pre-classification and performing data preprocessing on the recognized text.
[0106] The semantic pre-classification model outputs at least one semantic pre-classification of the identified text, along with its corresponding confidence score. When the confidence score corresponding to one or more semantic pre-classifications exceeds a first preset threshold, semantic processing corresponding to those pre-classifications is initiated. Simultaneously, data preprocessing is performed on the identified text according to the needs of semantic processing, such as data cleaning, punctuation removal, and word segmentation. The first preset threshold can be set according to actual needs, and this embodiment of the invention does not impose any limitations on it.
[0107] By initiating semantic processing before the target speech recognition process is completed, and by performing data preprocessing on the already recognized text, the semantic processing can be initiated earlier. Once all the target speech has been recognized, semantic processing can proceed directly without waiting, thus avoiding the problem of slow processing speed and improving the timeliness of the semantic processing results.
[0108] In an optional embodiment of the present invention, after initiating the semantic processing corresponding to the semantic pre-classification before the recognition processing of the target speech is completed, the method may further include: starting the semantic processing corresponding to the semantic pre-classification when the confidence level corresponding to the semantic pre-classification exceeds a second preset threshold and the semantic pre-classification model generates only one semantic pre-classification; or, starting the semantic processing corresponding to the semantic pre-classification when the confidence level corresponding to the semantic pre-classification exceeds a third preset threshold; wherein the first preset threshold is lower than the second preset threshold, and the second preset threshold is lower than the third preset threshold.
[0109] Based on the semantic processing corresponding to semantic pre-classification initiated according to the first preset threshold, a second preset threshold and a third preset threshold are set, with the first preset threshold being lower than the second preset threshold and the second preset threshold being lower than the third preset threshold.
[0110] If the confidence level corresponding to a semantic pre-classification exceeds the second preset threshold, and the semantic pre-classification model generates only one semantic pre-classification, then the semantic pre-classification generated by the semantic pre-classification model is considered reliable. After the semantic processing corresponding to that semantic pre-classification is completed and started, the semantic processing for that semantic pre-classification will begin directly.
[0111] When the confidence level corresponding to a semantic pre-classification exceeds the second preset threshold, the semantic pre-classification model generates multiple semantic pre-classifications. Then, the recognized text is acquired, and the semantic pre-classification model generates corresponding semantic pre-classifications and confidence levels until the confidence level corresponding to a certain semantic pre-classification exceeds the third preset threshold. Then, the semantic processing corresponding to that semantic pre-classification begins.
[0112] Before the target speech recognition process is completed, semantic processing is started directly after the confidence level of semantic pre-classification is high enough. This speeds up the process of entering semantic processing, thereby avoiding the problem of slow processing speed and improving the timeliness of semantic processing results.
[0113] For example, such as Figure 4 The diagram illustrates semantic processing of target speech. The terminal device initiates target speech recognition. The recognition service performs speech recognition on the target speech, obtaining partial recognition results, i.e., the recognized text. These partial recognition results are distributed to the terminal device for display, and the recognized text is simultaneously sent to the semantic pre-classification model. When the recognition service finishes recognizing the target speech, it sends all recognition results to the terminal device for display. The semantic pre-classification model outputs a semantic pre-classification of the recognized text. When the confidence level corresponding to the semantic pre-classification exceeds a first preset threshold, semantic processing corresponding to the semantic pre-classification is initiated, and data preprocessing is performed on the recognized text. When the confidence level corresponding to the semantic pre-classification exceeds a second preset threshold, and the semantic pre-classification model generates only one semantic pre-classification, the semantic pre-classification and its corresponding semantic processing are confirmed, and semantic processing begins. However, if the semantic pre-classification model generates multiple semantic pre-classifications at this time, the semantic pre-classification and its corresponding semantic processing are confirmed and semantic processing begins when the confidence level corresponding to the semantic pre-classification exceeds a third preset threshold. The result of the semantic processing is returned to the terminal device.
[0114] According to an embodiment of the present invention, during the process of recognizing target speech, the recognized text is obtained and input into a semantic pre-classification model. The semantic pre-classification model is trained using text samples of various lengths and corresponding labeled sample classification information. Based on the recognized text, the semantic pre-classification model generates a corresponding semantic pre-classification. Before the recognition of the target speech is completed, the semantic processing corresponding to the semantic pre-classification is initiated. This allows for semantic pre-classification of the text while recognizing the speech, thus enabling the semantic pre-classification to be determined when only a portion of the text is recognized. This achieves early initiation of the semantic processing corresponding to the semantic pre-classification, avoiding slow processing speeds and improving the timeliness of the semantic processing results.
[0115] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0116] Reference Figure 5 The diagram illustrates a structural block diagram of a semantic processing apparatus according to an embodiment of the present invention, which may specifically include the following steps:
[0117] The text acquisition module 301 is used to acquire the recognized text during the process of recognizing and processing the target speech;
[0118] The pre-classification determination module 302 is used to determine the corresponding semantic pre-classification based on the identified text;
[0119] The semantic processing initiation module 303 is used to initiate the semantic processing corresponding to the semantic pre-classification before the recognition processing of the target speech is completed.
[0120] In an optional embodiment of the present invention, the pre-classification determination module includes:
[0121] The model input submodule is used to input the identified text into the semantic pre-classification model; wherein the semantic pre-classification model is trained by text samples of various lengths and corresponding labeled sample classification information;
[0122] The pre-classification generation submodule is used to generate corresponding semantic pre-classifications based on the identified text using the semantic pre-classification model.
[0123] In an optional embodiment of the present invention, the pre-classification generation submodule includes:
[0124] The confidence generation submodule is used to generate at least one corresponding semantic pre-classification and a confidence score corresponding to the semantic pre-classification based on the identified text by the semantic pre-classification model.
[0125] In an optional embodiment of the present invention, the sample classification information includes semantic classification and corresponding importance data, and the apparatus further includes:
[0126] The sample extraction module is used to extract text samples of various lengths based on historical text before inputting the identified text into the semantic pre-classification model, in an order of increasing word count from beginning to end; wherein, each length of text sample includes the first character of the historical text.
[0127] The semantic classification determination module is used to determine the semantic classification of the corresponding text samples of various lengths based on the historical text and the corresponding semantic classification.
[0128] The occurrence count accumulation module is used to accumulate the occurrence counts of the same semantic category for the same text samples in each historical text, so as to obtain the occurrence counts of various semantic categories for text samples of various lengths;
[0129] The importance data calculation module is used to calculate the importance data of various semantic categories of text samples of various lengths based on the frequency of occurrence of various semantic categories and the semantic category weights set for each semantic category; wherein, the semantic category weights set for valid semantic categories are positive numbers, and the semantic category weights set for invalid semantic categories are negative numbers.
[0130] The model training module is used to train the semantic pre-classification model based on text samples of various lengths and the corresponding labeled sample classification information.
[0131] In an optional embodiment of the present invention, the sample classification information includes the number of valid semantic instances and the number of invalid semantic instances corresponding to the text samples of various lengths, and the device further includes:
[0132] The frequency addition module is used to, before training the semantic pre-classification model based on the text samples of various lengths and the corresponding labeled sample classification information, add up the occurrence counts of effective semantic classifications for each text sample of various lengths to obtain the effective semantic counts, and add up the occurrence counts of invalid semantic classifications to obtain the invalid semantic counts.
[0133] The pre-classification generation submodule also includes:
[0134] The probability generation unit is used to generate, based on the identified text, the probability of the identified text being a valid semantic classification and the probability of an invalid semantic classification by the semantic pre-classification model.
[0135] In an optional embodiment of the present invention, the semantic processing initiation module includes:
[0136] The startup submodule is used to start semantic processing corresponding to the semantic pre-classification and perform data preprocessing on the identified text when the confidence level corresponding to the semantic pre-classification exceeds a first preset threshold.
[0137] In an optional embodiment of the present invention, the device further includes:
[0138] The semantic processing start module is used to start the semantic processing corresponding to the semantic pre-classification before the recognition processing of the target speech is completed. When the confidence level of the semantic pre-classification exceeds the second preset threshold and the semantic pre-classification model generates only one semantic pre-classification, the semantic processing corresponding to the semantic pre-classification is started.
[0139] Alternatively, the semantic processing start module is used to start semantic processing corresponding to the semantic pre-classification when the confidence level corresponding to the semantic pre-classification exceeds a third preset threshold.
[0140] Wherein, the first preset threshold is lower than the second preset threshold, and the second preset threshold is lower than the third preset threshold.
[0141] According to an embodiment of the present invention, during the process of recognizing target speech, the recognized text is obtained, and the corresponding semantic pre-classification is determined based on the recognized text. Before the recognition process of the target speech is completed, the semantic processing corresponding to the semantic pre-classification is started, so that the text is semantically pre-classified while the speech is being recognized as text. Thus, the semantic pre-classification can be determined when part of the text is recognized, thereby realizing the early start of the semantic processing corresponding to the semantic pre-classification, thereby avoiding the problem of slow processing speed and improving the timeliness of the semantic processing results.
[0142] This invention also provides an electronic device, such as... Figure 6 As shown, it includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904.
[0143] Memory 903 is used to store computer programs;
[0144] When the processor 901 executes the program stored in the memory 903, it implements the steps described in any of the foregoing method embodiments.
[0145] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0146] The communication interface is used for communication between the aforementioned terminal and other devices.
[0147] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0148] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0149] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the semantic processing methods described in the above embodiments.
[0150] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the semantic processing methods described in the above embodiments.
[0151] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0152] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0153] The various embodiments in this specification are described in a related 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 of the method embodiments.
[0154] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A semantic processing method, characterized in that, include: During the process of recognizing and processing the target speech, the recognized text is obtained; Based on the identified text, determine the corresponding semantic pre-classification; Before the recognition processing of the target speech is completed, the semantic processing corresponding to the semantic pre-classification is initiated; The step of determining the corresponding semantic pre-classification based on the identified text includes: The identified text is input into a semantic pre-classification model; wherein the semantic pre-classification model is trained using text samples of various lengths and corresponding labeled sample classification information; Based on the identified text, the semantic pre-classification model generates a corresponding semantic pre-classification; The sample classification information includes semantic classification and corresponding importance data. Before inputting the identified text into the semantic pre-classification model, the method further includes: Based on the historical text, text samples of various lengths are extracted by sequentially increasing the number of characters from beginning to end; wherein, each length of text sample includes the very first character of the historical text; Based on the historical text and the corresponding semantic classification, determine the semantic classification of the text samples of various lengths. For the same text samples in various historical texts, the occurrence counts of the same semantic category are accumulated to obtain the occurrence counts of various semantic categories for text samples of various lengths; Based on the frequency of occurrence of various semantic categories of text samples of various lengths and the semantic category weights set for each semantic category, the importance data of various semantic categories of text samples of various lengths are calculated; wherein, the semantic category weights set for valid semantic categories are positive numbers, and the semantic category weights set for invalid semantic categories are negative numbers. The semantic pre-classification model is trained based on text samples of various lengths and the corresponding labeled sample classification information.
2. The method according to claim 1, characterized in that, The step of generating a corresponding semantic preclassification based on the identified text by the semantic preclassification model includes: Based on the identified text, the semantic pre-classification model generates at least one corresponding semantic pre-classification and a confidence level corresponding to the semantic pre-classification.
3. The method according to claim 1, characterized in that, The sample classification information includes the number of valid semantic instances and the number of invalid semantic instances corresponding to the text samples of various lengths. Before training the semantic pre-classification model based on the text samples of various lengths and the corresponding labeled sample classification information, the method further includes: For text samples of various lengths, the occurrence counts of valid semantic categories are summed to obtain the number of valid semantic categories, and the occurrence counts of invalid semantic categories are summed to obtain the number of invalid semantic categories. The step of generating corresponding semantic pre-classifications from the semantic pre-classification model based on the identified text further includes: Based on the identified text, the semantic pre-classification model generates the probability that the identified text is a valid semantic classification and the probability that it is an invalid semantic classification.
4. The method according to claim 2, characterized in that, Before the recognition processing of the target speech is completed, the semantic processing corresponding to the semantic pre-classification is initiated, which includes: When the confidence level corresponding to the semantic pre-classification exceeds the first preset threshold, the semantic processing corresponding to the semantic pre-classification is initiated, and the identified text is preprocessed.
5. The method according to claim 4, characterized in that, After initiating the semantic processing corresponding to the semantic pre-classification before completing the recognition processing of the target speech, the method further includes: When the confidence level corresponding to the semantic pre-classification exceeds the second preset threshold, and the semantic pre-classification model generates only one semantic pre-classification, then the semantic processing corresponding to the semantic pre-classification begins. Alternatively, when the confidence level corresponding to the semantic pre-classification exceeds a third preset threshold, the semantic processing corresponding to the semantic pre-classification is started. Wherein, the first preset threshold is lower than the second preset threshold, and the second preset threshold is lower than the third preset threshold.
6. A semantic processing apparatus, characterized in that, include: The text acquisition module is used to acquire the recognized text during the process of recognizing and processing the target speech. The pre-classification determination module is used to determine the corresponding semantic pre-classification based on the identified text; A semantic processing initiation module is used to initiate the semantic processing corresponding to the semantic pre-classification before the recognition processing of the target speech is completed; The pre-classification determination module includes: The model input submodule is used to input the identified text into the semantic pre-classification model; wherein the semantic pre-classification model is trained by text samples of various lengths and corresponding labeled sample classification information; The pre-classification generation submodule is used to generate corresponding semantic pre-classifications based on the identified text using the semantic pre-classification model; The sample classification information includes semantic classification and corresponding importance data, and the device further includes: The sample extraction module is used to extract text samples of various lengths based on historical text before inputting the identified text into the semantic pre-classification model, in an order of increasing word count from beginning to end; wherein, each length of text sample includes the first character of the historical text. The semantic classification determination module is used to determine the semantic classification of the corresponding text samples of various lengths based on the historical text and the corresponding semantic classification. The occurrence count accumulation module is used to accumulate the occurrence counts of the same semantic category for the same text samples in each historical text, so as to obtain the occurrence counts of various semantic categories for text samples of various lengths; The importance data calculation module is used to calculate the importance data of various semantic categories of text samples of various lengths based on the frequency of occurrence of various semantic categories and the semantic category weights set for each semantic category; wherein, the semantic category weights set for valid semantic categories are positive numbers, and the semantic category weights set for invalid semantic categories are negative numbers. The model training module is used to train the semantic pre-classification model based on text samples of various lengths and the corresponding labeled sample classification information.
7. The apparatus according to claim 6, characterized in that, The pre-classification generation submodule includes: The confidence generation submodule is used to generate at least one corresponding semantic pre-classification and a confidence score corresponding to the semantic pre-classification based on the identified text by the semantic pre-classification model.
8. The apparatus according to claim 6, characterized in that, The sample classification information includes the number of valid semantic instances and the number of invalid semantic instances corresponding to text samples of various lengths. The device further includes: The frequency addition module is used to, before training the semantic pre-classification model based on the text samples of various lengths and the corresponding labeled sample classification information, add up the occurrence counts of effective semantic classifications for each text sample of various lengths to obtain the effective semantic counts, and add up the occurrence counts of invalid semantic classifications to obtain the invalid semantic counts. The pre-classification generation submodule also includes: The probability generation unit is used to generate, based on the identified text, the probability of the identified text being a valid semantic classification and the probability of an invalid semantic classification by the semantic pre-classification model.
9. The apparatus according to claim 7, characterized in that, The semantic processing initiation module includes: The startup submodule is used to start semantic processing corresponding to the semantic pre-classification and perform data preprocessing on the identified text when the confidence level corresponding to the semantic pre-classification exceeds a first preset threshold.
10. The apparatus according to claim 9, characterized in that, The device further includes: The semantic processing start module is used to start the semantic processing corresponding to the semantic pre-classification before the recognition processing of the target speech is completed. When the confidence level of the semantic pre-classification exceeds the second preset threshold and the semantic pre-classification model generates only one semantic pre-classification, the semantic processing corresponding to the semantic pre-classification is started. Alternatively, the semantic processing start module is used to start semantic processing corresponding to the semantic pre-classification when the confidence level corresponding to the semantic pre-classification exceeds a third preset threshold. Wherein, the first preset threshold is lower than the second preset threshold, and the second preset threshold is lower than the third preset threshold.
11. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-5.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Method and device for recognizing natural language, vehicle-mounted multi-media host and computer readable storage medium
CN109785840A
Sample data processing method, sample data processing device and electronic equipment
CN111198938A