An intent recognition method and device, an electronic device, and a storage medium

By using a matching model to initially identify the intent of the text to be identified, and combining lightweight and heavyweight classification models, the problem of difficulty in balancing accuracy and speed in intent recognition by classification models in intelligent customer service is solved, achieving a highly efficient intent recognition effect.

CN114595331BActive Publication Date: 2026-02-24DINGFU NEW POWER (BEIJING) INTELLIGENT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210302685.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-24
Publication Date
2026-02-24
Estimated Expiration
2042-03-24

AI Technical Summary

Technical Problem

In intelligent customer service scenarios, existing classification models struggle to balance accuracy and speed when recognizing the intent of the text to be identified, especially when faced with a large volume of text to be identified, where accuracy drops.

Method used

A matching model is used to initially identify the intent of the text to be identified. The matching identification results are used to determine whether it is a new intent. If so, it is determined to be the final intent. Otherwise, a combination of lightweight and heavyweight classification models is used for identification, taking advantage of the speed of the matching model and the accuracy of the classification model.

Benefits of technology

It achieves an increase in the speed of intent recognition while maintaining high accuracy, especially when dealing with a large amount of text to be recognized, and can effectively balance accuracy and speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114595331B_ABST
    Figure CN114595331B_ABST
Patent Text Reader

Abstract

The application provides an intention recognition method and device, electronic equipment and storage medium, which are used for improving the balance problem that it is difficult to balance the accuracy and speed when the intention of the text to be recognized is recognized. The method comprises the following steps: obtaining the text to be recognized; using a matching model to recognize the intention of the text to be recognized, and obtaining a matching recognition result; obtaining the text features corresponding to the matching recognition result, and judging whether the intention of the text to be recognized is a new intention which is not trained by a classification model according to the text features corresponding to the matching recognition result; if yes, the matching recognition result is determined as a final intention recognition result; otherwise, a classification model is used to recognize the intention of the text to be recognized, and a final intention recognition result is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical fields of artificial intelligence and natural language processing, and more specifically, to an intent recognition method, apparatus, electronic device, and storage medium. Background Technology

[0002] Intent identification refers to the process in the field of Natural Language Processing (NLP) of identifying the intent of text content and obtaining the semantic intent expressed by the text content.

[0003] Currently, in intelligent customer service scenarios, classification models based on neural network structures are typically used to identify and analyze the intent of the text to obtain the semantic intent expressed by the text content. However, in practice, it has been found that although classification models have high accuracy, their recognition speed is slow, and the accuracy decreases as the amount of text to be identified increases. Therefore, it is currently difficult to balance accuracy and speed when identifying the intent of the text. Summary of the Invention

[0004] The purpose of this application is to provide an intent recognition method, apparatus, electronic device, and storage medium to improve the balance between accuracy and speed when recognizing the intent of text to be recognized.

[0005] This application provides an intent recognition method, including: acquiring a text to be recognized; using a matching model to recognize the intent of the text to be recognized, and obtaining a matching recognition result; acquiring the text features corresponding to the matching recognition result, and determining whether the intent of the text to be recognized is a newly added intent that has not been trained by a classification model based on the text features corresponding to the matching recognition result; if so, determining the matching recognition result as the final intent recognition result; otherwise, using a classification model to recognize the intent of the text to be recognized, and obtaining the final intent recognition result.

[0006] In the above implementation process, the intent of the text to be identified is first determined based on the text features corresponding to the matching model. If the intent of the text to be identified is a new intent that has not been trained by the classification model, the matching recognition result is determined as the final intent recognition result. Otherwise, the classification model is directly used to identify the intent of the text to be identified. This fully leverages the advantages of different types of models and effectively combines the characteristics of the matching model and the classification model to achieve a balance between accuracy and speed.

[0007] Optionally, in this embodiment of the application, the intent of the text to be identified is identified using a matching model to obtain a matching identification result, including: extracting the feature vector of the text to be identified; matching the text feature with the highest similarity to the feature vector from multiple text features corresponding to the matching model, and taking the similarity as the highest similarity; obtaining the text intent corresponding to the text feature with the highest similarity, and determining the text intent as the matching identification result.

[0008] In the above implementation process, the text feature with the highest similarity to the feature vector is matched from multiple text features corresponding to the matching model, and the text intent corresponding to the text feature with the highest similarity to the feature vector is determined as the matching recognition result. This fully utilizes the advantage of the fast speed of the matching model and effectively improves the speed of intent recognition of the text to be recognized.

[0009] Optionally, in this embodiment of the application, determining whether the intent of the text to be identified is a newly added intent that has not been trained by the classification model based on the text features corresponding to the matching recognition result includes: obtaining the last editing time of the text features corresponding to the matching recognition result and the last training time of the classification model; determining whether the last editing time is later than the last training time of the classification model; if so, determining that the intent of the text to be identified is a newly added intent; otherwise, determining that the intent of the text to be identified is not a newly added intent.

[0010] In the above implementation process, by matching the text features corresponding to the recognition results, it is possible to determine whether the intent of the text to be recognized is a newly added intent that has not been trained by the classification model. This effectively distinguishes between newly added intents and known intents, and processes newly added intents and known intents separately, thereby accelerating the efficiency of intent recognition.

[0011] Optionally, in this embodiment of the application, determining the matching recognition result as the final intent recognition result includes: after determining that the highest similarity is greater than the similarity threshold, determining the matching recognition result as the final intent recognition result.

[0012] In the above implementation process, the matching recognition result is determined as the final intent recognition result only after the highest similarity is determined to be greater than the similarity threshold. This avoids the problem of low accuracy caused by determining the uncertain matching recognition result of the matching model as the final intent recognition result, and effectively improves the accuracy of intent recognition of the text to be recognized.

[0013] Optionally, in this embodiment, the classification model includes: a first classification model and a second classification model, wherein the model parameters of the first classification model are fewer than those of the second classification model; using the classification model to perform intent recognition on the text to be recognized and obtain a final intent recognition result includes: using the first classification model to perform intent recognition on the text to be recognized and obtaining recognition probabilities of multiple intents; filtering out the intent corresponding to the highest recognition probability from the recognition probabilities of multiple intents; determining whether the highest recognition probability is greater than a probability threshold; if not, then using the second classification model to perform intent recognition on the text to be recognized and obtaining a final intent recognition result; if yes, then determining the intent corresponding to the highest recognition probability as the final intent recognition result.

[0014] In the above implementation process, by first using a lightweight first-class classification model for intent recognition and then using a heavyweight second-class classification model, the problem of slow response speed caused by the second-class classification model processing a large amount of text to be recognized is avoided, thus fully leveraging the advantages of the lightweight first-class classification model in terms of fast recognition speed and fast response speed. At the same time, the heavyweight second-class classification model is allowed to recognize text intents that the first-class classification model is uncertain, fully leveraging the high accuracy advantage of the heavyweight second-class classification model.

[0015] Optionally, in this embodiment of the application, the method further includes: obtaining the number of texts to be identified, and adjusting the probability threshold based on the number of texts to be identified.

[0016] In the above implementation process, by adjusting the probability threshold according to the number of texts to be recognized, the flexibility of the system in processing the texts to be recognized is improved. When the system is busy, the probability threshold and / or similarity threshold can be automatically lowered, allowing the system to recognize the intent of the text more quickly. When the system is idle, the probability threshold and / or similarity threshold can be automatically raised, allowing the system to recognize the intent of the text more accurately.

[0017] This application also provides an intent recognition device, including: a text acquisition module for acquiring text to be recognized; a recognition result acquisition module for using a matching model to recognize the intent of the text to be recognized and obtaining a matching recognition result; a new intent judgment module for acquiring text features corresponding to the matching recognition result and judging whether the intent of the text to be recognized is a new intent that has not been trained by a classification model based on the text features corresponding to the matching recognition result; and a final result acquisition module for determining the matching recognition result as the final intent recognition result if the intent of the text to be recognized is a new intent that has not been trained by a classification model; and for using a classification model to recognize the intent of the text to be recognized if the intent of the text to be recognized is not a new intent, thereby obtaining the final intent recognition result.

[0018] Optionally, in this embodiment of the application, the recognition result acquisition module includes: a feature vector extraction submodule, used to extract the feature vector of the text to be recognized; a text feature matching submodule, used to match the text feature with the highest similarity to the feature vector from multiple text features corresponding to the matching model, and take the similarity as the highest similarity; and a recognition result determination submodule, used to obtain the text intent corresponding to the text feature with the highest similarity, and determine the text intent as the matching recognition result.

[0019] Optionally, in this embodiment, an intent determination module is added, including: an edit time acquisition submodule, used to acquire the last edit time of the text features corresponding to the matching recognition result and the last training time of the classification model; an edit time determination submodule, used to determine whether the last edit time is later than the last training time of the classification model; and a new intent determination submodule, used to determine that the intent of the text to be recognized is a new intent if the last edit time is later than the last training time of the classification model, otherwise, to determine that the intent of the text to be recognized is not a new intent.

[0020] Optionally, in this embodiment of the application, the final result acquisition module includes: a final result determination submodule, used to determine the matching recognition result as the final intent recognition result after determining that the highest similarity is greater than the similarity threshold.

[0021] Optionally, in this embodiment, the classification model includes: a first classification model and a second classification model, wherein the model parameters of the first classification model are fewer than those of the second classification model; the final result acquisition module includes: a recognition probability acquisition submodule, used to perform intent recognition on the text to be recognized using the first classification model to obtain recognition probabilities of multiple intents; an intent recognition filtering submodule, used to filter out the intent corresponding to the highest recognition probability from the recognition probabilities of multiple intents; a recognition probability judgment submodule, used to determine whether the highest recognition probability is greater than a probability threshold; a first result acquisition submodule, used to perform intent recognition on the text to be recognized using the second classification model if the highest recognition probability is not greater than the probability threshold to obtain the final intent recognition result; and a second result acquisition submodule, used to determine the intent corresponding to the highest recognition probability as the final intent recognition result if the highest recognition probability is greater than the probability threshold.

[0022] Optionally, in this embodiment of the application, the intent recognition device further includes: a probability threshold adjustment module, used to obtain the number of texts to be recognized and adjust the probability threshold according to the number of texts to be recognized.

[0023] This application also provides an electronic device, including a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the machine-readable instructions, when executed by the processor, perform the method described above.

[0024] This application also provides a computer-readable storage medium storing a computer program that is executed by a processor to perform the methods described above. Attached Figure Description

[0025] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 The diagram shown is a flowchart illustrating the intent recognition method provided in an embodiment of this application.

[0027] Figure 2 The diagram shown is a flowchart illustrating the intent recognition process of the classification model provided in this application embodiment;

[0028] Figure 3 The diagram shown is a structural schematic of the intent recognition device provided in an embodiment of this application;

[0029] Figure 4 The diagram shows a structural schematic of an electronic device provided in an embodiment of this application. Detailed Implementation

[0030] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. The components of the embodiments of this application described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed embodiments of this application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of the embodiments of this application.

[0031] It is understood that the terms "first" and "second" in the embodiments of this application are used to distinguish similar objects. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that the terms "first" and "second" are not necessarily different.

[0032] Before introducing the intent recognition method provided in the embodiments of this application, let's first introduce some concepts involved in the embodiments of this application:

[0033] Natural Language Processing (NLP) refers to the study of natural language cognition, which is related to the need for extensive knowledge about the external world and the ability to manipulate that knowledge in order to understand natural language. Natural language cognition is also considered a problem related to AI-completeness, and natural language processing is an important component of machine learning.

[0034] Speech recognition refers to the technology or discipline related to voice communication with machines, that is, enabling machines to understand what humans say. The fields involved in speech recognition technology include: signal processing, pattern recognition, probability theory and information theory, vocalization and auditory mechanisms, front-end processing, etc.

[0035] The attention mechanism originates from research on human vision. In cognitive science, due to the bottleneck of information processing, humans selectively focus on a portion of all information while ignoring other visible information; this mechanism is commonly referred to as the attention mechanism.

[0036] It should be noted that the intent recognition method provided in this application embodiment can be executed by an electronic device. Here, an electronic device refers to a device terminal with the function of executing computer programs or the aforementioned server. Device terminals include, for example, smartphones, personal computers, tablets, personal digital assistants, or mobile internet devices. A server refers to a device that provides computing services through a network. Servers include, for example, x86 servers and non-x86 servers. Non-x86 servers include, for example, mainframes, minicomputers, and UNIX servers.

[0037] The following describes the application scenarios applicable to this intent recognition method. These scenarios include, but are not limited to, intelligent customer service, human-computer dialogue, and natural language processing (NLP). Taking intelligent customer service as an example, after receiving the audio file stream sent by the user terminal, the server performs speech recognition on the audio file stream to obtain the text of the intent to be recognized. Then, the intent recognition method can be used to recognize the intent of the text, thereby obtaining the intent of the text. Then, the response content or response voice, etc., can be determined based on the intent of the text.

[0038] Please see Figure 1The illustrated flowchart illustrates the intent recognition method provided in this application embodiment. The main idea of ​​this intent recognition method is that, since the matching model has a faster recognition speed and a higher accuracy rate in recognizing new intents, while the classification model has a higher accuracy rate in recognizing known intents, the method first determines whether the intent of the text to be recognized is a new intent that has not been trained by the classification model based on the text features corresponding to the matching model. If it is a new intent, the matching recognition result is determined as the final intent recognition result; otherwise, the classification model is directly used to recognize the intent of the text to be recognized. This effectively combines the characteristics of the matching model and the classification model to achieve a balance between accuracy and speed. Specifically, the above-mentioned intent recognition method may include:

[0039] Step S110: Obtain the text to be recognized.

[0040] There are many ways to implement step S110 above, including: a first method of obtaining text by receiving a sound file stream sent by a user terminal, performing voice recognition on the sound file stream, and obtaining the text to be recognized; a second method of obtaining text by receiving the text to be recognized sent by other terminal devices and storing the text to be recognized in a file system, database, or mobile storage device; and a third method of obtaining text by obtaining pre-stored text to be recognized, specifically, for example, obtaining the text to be recognized from a file system, database, or mobile storage device.

[0041] Step S120: Use a matching model to identify the intent of the text to be identified and obtain the matching identification result.

[0042] A matching model refers to a model that identifies intent based on text matching. Specifically, this matching model can employ the Enhanced Sequential Inference Model (ESIM), an interactive matching model based on Long Short-Term Memory (LSTM) network encoding and attention mechanisms. Because the process of identifying the intent of the text using a matching model is quite complex, it will be described in detail below.

[0043] Step S130: Obtain the text features corresponding to the matching recognition result, and determine whether the intent of the text to be recognized is a newly added intent that has not been trained by the classification model based on the text features corresponding to the matching recognition result.

[0044] A new intent refers to an intent category that has not been trained by the classification model. After this intent category is added to the matching model, the matching model can determine the intent category corresponding to the query based on the similarity between the received user query and the statements under each intent category (including the category of the new intent).

[0045] It is understandable that the above intent recognition process can be interpreted as a process of classifying the intents corresponding to the text features extracted from the text to be recognized. Therefore, the obtained matching recognition result is still a classification result of intent, and the final intent recognition result below is also a classification result of intent. In practice, a text feature can be used by both a classification model and a matching model (for inference or training). The classification model is trained periodically using text features, while the text features used by the matching model are updated in real time. Therefore, the text features of newly added text to be recognized have been recognized and processed by the matching model, but have not been trained by the classification model. Based on the above principle, we can determine whether the intent corresponding to the text feature is an unknown category (i.e., a newly added intent that has not been trained by the classification model) or a known category (i.e., a known intent that has been trained by the classification model and can be recognized) based on whether the text feature has been trained by the classification model.

[0046] Step S140: If the intent of the identified text is a new intent, then the matching identification result is determined as the final intent identification result; otherwise, the classification model is used to identify the intent of the text to be identified, and the final intent identification result is obtained.

[0047] Optionally, after determining whether the intent of the text to be identified is a newly added intent that has not been trained by a classification model, only the matching recognition results with a similarity threshold greater than the threshold can be determined as the final intent recognition result. Specifically, if the intent of the identified text is a newly added intent, and the highest similarity is greater than the similarity threshold, then the matching recognition result is determined as the final intent recognition result. The similarity threshold can be set according to specific circumstances, such as 0.85 or 0.9. Taking a similarity threshold of 0.9 as an example, it can be represented in the configuration file as: "models":[{"model-type":"match","min-threshold":0.9}], meaning the minimum similarity threshold of the matching model is 0.9. Since the classification model has not been trained on texts with newly added intents, it cannot effectively recognize such texts, meaning the accuracy of the classification results is very high. Therefore, a classification model is used to recognize texts with known intents. If the intent of the identified text is not a newly added intent, then the classification model is used to perform intent recognition on the text to be identified, obtaining the final intent recognition result. Since the process of intent recognition using classification models (including lightweight primary classification models and heavyweight secondary classification models) is quite complex, it will be described in detail later.

[0048] In some implementations of the above step S120, which uses a matching model to identify the intent of the text to be identified, steps S121 to S123 may be included.

[0049] Step S121: Extract the feature vector of the text to be recognized.

[0050] Step S121 above can be implemented in many ways, including but not limited to: A first implementation uses machine learning algorithms to extract feature vectors of the text to be recognized. These machine learning algorithms include, but are not limited to, decision trees, Bayesian learning, instance-based learning, genetic algorithms, rule-based learning, explanation-based learning, and histogram of oriented gradients (HOR) feature extraction algorithms. A second implementation uses neural network models to extract feature vectors of the text to be recognized. These neural network models include, but are not limited to, LSTM network encoding models, LeNet networks, AlexNet networks, GoogLeNet networks, VGG networks, ResNet networks, Wide ResNet networks, and Inception networks.

[0051] Step S122: Match the text feature with the highest similarity to the feature vector from multiple text features corresponding to the matching model, and take this similarity as the highest similarity.

[0052] For example, step S122 can be implemented by matching the text feature with the highest similarity to the feature vector from multiple text features in the database (also known as the knowledge base) corresponding to the matching model. The database can be an in-memory database, a relational database, or a non-relational database. In-memory databases such as Memcached and Redis can be used as cache databases. Relational databases such as MySQL, PostgreSQL, Oracle, and SQL Server can be used. Non-relational databases such as Grakn database, Neo4j graph database, Hadoop subsystem HBase, MongoDB, and CouchDB can be used.

[0053] Step S123: Obtain the text intent corresponding to the text feature with the highest similarity and determine the text intent as the matching recognition result.

[0054] The implementation of step S123 above includes, for example, obtaining the text intent corresponding to the text feature with the highest similarity from a relational or non-relational database (i.e., the text feature corresponds to a pre-defined intent category), and determining the text intent as the matching recognition result. This matching recognition result is the intent category of the text intent corresponding to the text feature with the highest similarity. In the above implementation process, by matching the text feature with the highest similarity to the feature vector from multiple text features corresponding to the matching model, and determining the text intent corresponding to the text feature with the highest similarity as the matching recognition result, the advantage of the fast speed of the matching model is fully utilized, effectively improving the speed of intent recognition of the text to be recognized.

[0055] In some implementations of step S130 above, determining whether the intent of the text to be identified is a newly added intent that has not been trained by a classification model based on the text features corresponding to the matching recognition result may include steps S131 to S134.

[0056] Step S131: Obtain the text features corresponding to the matching recognition result, and obtain the last editing time of the text features corresponding to the matching recognition result and the last training time of the classification model.

[0057] For example, the above step S131 can be implemented by: obtaining the text features corresponding to the matching recognition result from multiple text features corresponding to the matching model (i.e., the text features with the highest similarity to the feature vector above), and obtaining the last editing time of the text features corresponding to the matching recognition result and the last training time of the classification model from the database. The database here can be an in-memory database, a relational database, or a non-relational database.

[0058] Step S132: Determine whether the last edit time is later than the last training time of the classification model.

[0059] An example of implementing step S132 above is as follows: Since the text features used by the matching model have all been trained by the classification model, meaning the classification model edits the text features during training, if the last edit time is equal to the last training time of the classification model, it indicates that the intent of the text feature is a known intent that the classification model can recognize. Conversely, if the last edit time is later than the last training time of the classification model, it indicates that the text feature was used by the matching model after the most recent acquisition, but not during the training of the classification model; that is, the intent of the text feature is a newly added intent that the classification model cannot recognize. Therefore, it can be seen that the last edit time of the text feature can be compared with the last training time of the classification model to determine whether the intent of the text feature is a newly added intent that has not been trained by the classification model.

[0060] Step S133: If the last editing time is later than the last training time of the classification model, then determine that the intent of the text to be identified is a new intent; otherwise, determine that the intent of the text to be identified is not a new intent.

[0061] For example, in implementing step S133 above: if the last editing time is later than the last training time of the classification model, then the intent of the text to be identified is determined to be a newly added intent that is difficult for the classification model to recognize. If the last editing time is not later than the last training time of the classification model, then the intent of the text to be identified is determined not to be a newly added intent. In the above implementation process, by matching the text features corresponding to the recognition result, it is possible to determine whether the intent of the text to be identified is a newly added intent that has not been trained by the classification model, effectively distinguishing between newly added intents and known intents, and processing newly added intents and known intents separately, thereby accelerating the efficiency of intent recognition.

[0062] In the above implementation process, since the matching model has a faster recognition speed and a higher accuracy in recognizing new intents, while the classification model has a higher accuracy in recognizing known intents, the intention of the text to be recognized is first determined based on the text features corresponding to the matching model to determine whether it is a new intent that has not been trained by the classification model. If the intention of the text to be recognized is a new intent, the matching recognition result is determined as the final intent recognition result; otherwise, the classification model is directly used to recognize the intent of the text to be recognized. This fully leverages the advantages of different types of models and effectively combines the characteristics of the matching model and the classification model to achieve a balance between accuracy and speed, thus achieving the technical effect of high accuracy and high concurrency in text intent recognition.

[0063] It is understandable that the classification model and the matching model mentioned above can be trained simultaneously. However, due to the differences in their network result features and input / output, the classification model and the matching model trained simultaneously will have different recognition results for the new intent. The differences between the two are as follows:

[0064] When the classification model identifies new intents, since no sample of the new intent (e.g., a user query) has been trained by the classification model, after the sample of the new intent is input into the trained classification model, the output layer of the classification model does not have an output node for the new intent. Therefore, the classification model cannot output the category corresponding to the new intent, nor can it identify whether a sample is a sample of the new intent.

[0065] When identifying new intents, the matching model, after receiving a sample of the new intent (e.g., a user query), pairs the query with all statements (e.g., 100 sentences) in its corresponding database (also known as a knowledge base). Assuming 100 sentence pairs are obtained, the matching model calculates the similarity score between the two statements in each pair, resulting in 100 similarity scores. These 100 similarity scores are then sorted to determine the intent category (which may or may not be a new intent) corresponding to the two statements with the highest similarity scores. This intent category is then identified as the intent category of the query. Therefore, the matching model is capable of identifying new intent categories that have not been trained by a classification model.

[0066] Please see Figure 2 The illustrated flowchart shows a classification model for intent recognition provided in an embodiment of this application. The classification model may include a lightweight first classification model and a heavyweight second classification model. It is understood that the difference between the lightweight first classification model and the heavyweight second classification model is that the first classification model has fewer model parameters than the second classification model. The implementation method for using the classification model to perform intent recognition on the text to be recognized in step S140 may include:

[0067] Step S210: Use the first classification model to perform intent recognition on the text to be recognized and obtain the recognition probabilities of multiple intents.

[0068] The first-classification model refers to a lightweight neural network model used for intent recognition or classification, which has fewer parameters than the second-classification model. Specifically, the first-classification model can use a Text-CNN layer, an algorithm that uses convolutional neural networks to classify text.

[0069] Step S220: Select the intent with the highest recognition probability from the recognition probabilities of multiple intents.

[0070] Step S230: Determine whether the highest recognition probability is greater than the probability threshold.

[0071] An example implementation of step S230 above is as follows: The probability threshold mentioned above is the threshold corresponding to the lightweight first classification model. This threshold can be set according to specific circumstances. The probability threshold can be represented by a configuration file as: "models":[{"model-type":"classify-small","min-threshold":0.6}], meaning that the minimum preset probability threshold of the lightweight first classification model is 0.6. An executable program compiled or interpreted using a preset programming language is used to determine whether the highest recognition probability is greater than the probability threshold; among which, the programming languages ​​that can be used are, for example: C, C++, Java, BASIC, JavaScript, LISP, Shell, Perl, Ruby, Python, and PHP, etc.

[0072] Step S240: If the highest recognition probability is not greater than the probability threshold, then the second classification model is used to perform intent recognition on the text to be recognized, and the final intent recognition result is obtained.

[0073] The second classification model refers to a heavyweight neural network model used for intent recognition or classification, which has more parameters than the first classification model. Specifically, the second classification model can employ a Bidirectional Encoder Representations from Transformers (BERT) model. BERT is also translated as Transformer-based bidirectional encoder representation, or bidirectional encoder representation from Transformers, and is also known as bidirectional self-attention layer encoder-decoder, often simply abbreviated as BERT. BERT is a language representation model.

[0074] The implementation of step S240 above is as follows: If the highest recognition probability is not greater than a probability threshold (e.g., 0.6), then the second classification model is used to perform intent recognition on the text to be recognized, obtaining multiple second recognition probabilities. The highest second recognition probability is selected from these multiple second recognition probabilities. If the highest second recognition probability is greater than a preset probability threshold (e.g., 0.3, which can be set according to specific circumstances), then the intent corresponding to the highest second recognition probability is determined as the final intent recognition result; conversely, if the highest second recognition probability is not greater than the preset probability threshold, then the final intent recognition result is determined as a newly added intent that no model can recognize. The preset probability threshold mentioned above can be represented using a configuration file as: "models":[{"model-type":"classify-big","min-threshold":0.3}], meaning that the minimum preset probability threshold for the heavyweight second classification model is 0.3.

[0075] Step S250: If the highest recognition probability is greater than the probability threshold, then the intent corresponding to the highest recognition probability is determined as the final intent recognition result.

[0076] For example, in the implementation of step S250 above: if the highest recognition probability is greater than the probability threshold, the intent corresponding to the highest recognition probability is directly determined as the final intent recognition result; wherein, the probability threshold here can be set according to the specific situation, for example, set to 0.6 or 0.7.

[0077] The aforementioned intent recognition method effectively combines the fast prediction speed of a lightweight model with the high accuracy of a heavyweight model. For example, suppose the lightweight first-class classification model (referred to as the lightweight model) has a prediction response time of 2 milliseconds (MS) and an accuracy of 87%; however, the heavyweight second-class classification model (referred to as the heavyweight model) has a prediction response time of 60 milliseconds (MS) and an accuracy of 91%. When there are a large number of text requests to be recognized, the lightweight model can be used first to recognize all the text requests.

[0078] If the highest recognition probability among multiple intents for each text to be identified is greater than the probability threshold (e.g., 0.6), it indicates that the lightweight model is highly certain of its recognition, and the intent category corresponding to the highest recognition probability can be directly determined as the final intent category. If the highest recognition probability among multiple intents for each text to be identified is less than the probability threshold (e.g., 0.6), it indicates that the lightweight model is not very certain of its recognition, and in this case, a heavyweight model can be used to perform intent recognition on the text to be identified. The reason for this is that heavyweight models have a greater advantage in accuracy when processing intents that are more difficult to recognize, while lightweight models have a greater advantage in speed when processing intents that are easier to recognize. Effectively combining the fast prediction speed of lightweight models and the high accuracy of heavyweight models can effectively balance both the speed and accuracy of intent recognition.

[0079] In the above implementation process, since the lightweight first-class classification model can recognize most frequently submitted user-submitted text, it is used first for intent recognition, followed by the heavyweight second-class classification model. This avoids the slow response time caused by the second-class classification model processing a large amount of text, fully leveraging the advantages of the lightweight first-class classification model's fast recognition and response speed. Simultaneously, the heavyweight second-class classification model is allowed to recognize text intents uncertain by the first-class classification model, fully utilizing its high accuracy.

[0080] Optionally, the probability thresholds mentioned above can be dynamically adjusted based on the number of texts to be identified. The process of dynamically adjusting the probability thresholds can include: obtaining the number of texts to be identified and adjusting the probability thresholds and the similarity thresholds corresponding to the matching models based on that number. In practice, the probability thresholds and similarity thresholds can also be dynamically adjusted based on the overall system response time and the number of texts to be identified, thereby controlling the overall number of texts processed by the matching model, the lightweight first-class classification model, and the heavyweight second-class classification model. For example, when the number of texts to be identified is very large and the concurrency is very high, to ensure overall system performance, the probability threshold corresponding to the lightweight first-class classification model and / or the similarity threshold corresponding to the matching model can be automatically lowered, allowing fewer texts to be identified by the heavyweight second-class classification model. Conversely, when the number of texts to be identified is very small and the system is relatively idle, the probability threshold corresponding to the lightweight first-class classification model and / or the similarity threshold corresponding to the matching model can be automatically lowered, allowing more texts to be identified by the heavyweight second-class classification model.

[0081] In the above implementation process, by adjusting the probability threshold according to the number of texts to be recognized, the flexibility of the system in processing the texts to be recognized is improved. When the system is busy, the probability threshold and / or similarity threshold can be automatically lowered, allowing the system to recognize the intent of the text more quickly. When the system is idle, the probability threshold and / or similarity threshold can be automatically raised, allowing the system to recognize the intent of the text more accurately.

[0082] Please see Figure 3 The diagram shown is a structural schematic of the intent recognition device provided in an embodiment of this application; this application provides an intent recognition device 300, including:

[0083] The text acquisition module 310 is used to acquire the text to be recognized.

[0084] The recognition result acquisition module 320 is used to identify the intent of the text to be recognized using a matching model and obtain the matching recognition result.

[0085] A new intent judgment module 330 is added to obtain the text features corresponding to the matching recognition result, and to determine whether the intent of the text to be recognized is a new intent that has not been trained by the classification model based on the text features corresponding to the matching recognition result.

[0086] The final result acquisition module 340 is used to determine the matching recognition result as the final intent recognition result if the intent of the text to be recognized is a new intent; if the intent of the text to be recognized is not a new intent, the classification model is used to perform intent recognition on the text to be recognized to obtain the final intent recognition result.

[0087] Optionally, in this embodiment of the application, the identification result acquisition module includes:

[0088] The feature vector extraction submodule is used to extract the feature vectors of the text to be recognized.

[0089] The text feature matching submodule is used to match the text feature with the highest similarity to the feature vector from multiple text features corresponding to the matching model, and to take this similarity as the highest similarity.

[0090] The recognition result determination submodule is used to obtain the text intent corresponding to the text feature with the highest similarity and determine the text intent as the matching recognition result.

[0091] Optionally, in this embodiment of the application, an intent determination module is added, including:

[0092] The Edit Time Acquisition submodule is used to obtain the last edit time of the text features corresponding to the matching and recognition results and the last training time of the classification model.

[0093] The edit timing determination submodule is used to determine whether the last edit timing is later than the last training timing of the classification model.

[0094] A new intent determination submodule is added, which determines the intent of the text to be identified as a new intent if the last edit time is later than the last training time of the classification model; otherwise, it determines that the intent of the text to be identified is not a new intent.

[0095] Optionally, in this embodiment of the application, the final result obtaining module includes:

[0096] The final result determination submodule is used to determine the matching recognition result as the final intent recognition result after determining that the highest similarity is greater than the similarity threshold.

[0097] Optionally, in this embodiment, the classification model includes: a first classification model and a second classification model, wherein the model parameters of the first classification model are fewer than the model parameters of the second classification model; the final result acquisition module includes:

[0098] The recognition probability acquisition submodule is used to perform intent recognition on the text to be recognized using the first classification model, and obtain the recognition probability of multiple intents.

[0099] The intent recognition and filtering submodule is used to filter out the intent with the highest recognition probability from multiple intents.

[0100] The recognition probability judgment submodule is used to determine whether the highest recognition probability is greater than the probability threshold.

[0101] The first result acquisition submodule is used to perform intent recognition on the text to be recognized using the second classification model if the highest recognition probability is not greater than the probability threshold, and to obtain the final intent recognition result.

[0102] The second result acquisition submodule is used to determine the intent corresponding to the highest recognition probability as the final intent recognition result if the highest recognition probability is greater than the probability threshold.

[0103] Optionally, in embodiments of this application, the intent recognition device further includes:

[0104] The probability threshold adjustment module is used to obtain the number of texts to be recognized and adjust the probability threshold based on the number of texts to be recognized.

[0105] It should be understood that this device corresponds to the above-described intent recognition method embodiment and is capable of performing the various steps involved in the above method embodiment. The specific functions of this device can be found in the description above, and detailed descriptions are omitted here to avoid repetition. The device includes at least one software functional module that can be stored in memory or embedded in the device's operating system (OS) in the form of software or firmware.

[0106] Please see Figure 4 The diagram shows a structural schematic of an electronic device provided in an embodiment of this application. An electronic device 400 provided in this application includes a processor 410 and a memory 420. The memory 420 stores machine-readable instructions executable by the processor 410. When the machine-readable instructions are executed by the processor 410, the method described above is performed.

[0107] This application embodiment also provides a computer-readable storage medium 430, on which a computer program is stored, and the computer program is executed by a processor 410 to perform the above method.

[0108] The computer-readable storage medium 430 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0109] It should be understood that the disclosed apparatus and methods can also be implemented in other ways, as provided in the embodiments of this application. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending primarily on the functions involved.

[0110] Furthermore, the functional modules of each embodiment in this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part. In addition, in the description of this specification, the reference to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., means that the specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0111] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.

[0112] The above description is only an optional implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application.

Claims

1. An intent recognition method, characterized in that, include: Obtain the text to be recognized; The intent of the text to be identified is identified using a matching model to obtain a matching identification result. The matching model is a model for intent identification based on text matching. Obtain the text features corresponding to the matching and recognition results, and determine whether the intent of the text to be identified is a newly added intent that has not been trained by the classification model based on the text features corresponding to the matching and recognition results; If so, the matching recognition result is determined as the final intent recognition result; otherwise, the classification model is used to perform intent recognition on the text to be recognized to obtain the final intent recognition result. The step of determining whether the intent of the text to be identified is a newly added intent that has not been trained by the classification model based on the text features corresponding to the matching recognition result includes: obtaining the last editing time of the text features corresponding to the matching recognition result and the last training time of the classification model; determining whether the last editing time is later than the last training time of the classification model; if so, determining that the intent of the text to be identified is a newly added intent; otherwise, determining that the intent of the text to be identified is not a newly added intent; the newly added intent is a category that has been identified and processed by the matching model and has not been trained by the classification model, and the text features of the newly added intent are used to periodically train the classification model.

2. The method according to claim 1, characterized in that, The step of using a matching model to identify the intent of the text to be identified and obtaining a matching identification result includes: Extract the feature vector of the text to be identified; From multiple text features corresponding to the matching model, the text feature with the highest similarity to the feature vector is matched, and the similarity is taken as the highest similarity. Obtain the text intent corresponding to the text feature with the highest similarity, and determine the text intent as the matching and recognition result.

3. The method according to claim 2, characterized in that, Determining the matching recognition result as the final intent recognition result includes: After determining that the highest similarity is greater than the similarity threshold, the matching recognition result is determined as the final intent recognition result.

4. The method according to claim 1, characterized in that, The classification model includes: a first classification model and a second classification model, wherein the model parameters of the first classification model are fewer than those of the second classification model; the step of using the classification model to perform intent recognition on the text to be recognized and obtaining a final intent recognition result includes: The first classification model is used to perform intent recognition on the text to be recognized, and the recognition probabilities of multiple intents are obtained. The intent with the highest recognition probability is selected from the multiple intents. Determine whether the highest recognition probability is greater than the probability threshold; If not, the second classification model is used to perform intent recognition on the text to be recognized to obtain the final intent recognition result; If so, the intent corresponding to the highest recognition probability is determined as the final intent recognition result.

5. The method according to claim 4, characterized in that, Also includes: The number of texts to be identified is obtained, and the probability threshold is adjusted based on the number of texts to be identified.

6. An intent recognition device, characterized in that, include: The text acquisition module is used to acquire the text to be recognized. The recognition result acquisition module is used to identify the intent of the text to be identified using a matching model and obtain a matching recognition result. The matching model is a model for intent recognition based on text matching. A new intent determination module is added to obtain the text features corresponding to the matching and recognition results, and to determine whether the intent of the text to be identified is a new intent that has not been trained by the classification model based on the text features corresponding to the matching and recognition results. The final result acquisition module is used to determine the matching recognition result as the final intent recognition result if the intent of the text to be recognized is a new intent. If the intent of the text to be identified is not a new intent, then a classification model is used to identify the intent of the text to be identified, and the final intent identification result is obtained. The step of determining whether the intent of the text to be identified is a newly added intent that has not been trained by the classification model based on the text features corresponding to the matching recognition result includes: obtaining the last editing time of the text features corresponding to the matching recognition result and the last training time of the classification model; determining whether the last editing time is later than the last training time of the classification model; if so, determining that the intent of the text to be identified is a newly added intent; otherwise, determining that the intent of the text to be identified is not a newly added intent; the newly added intent is a category that has been identified and processed by the matching model and has not been trained by the classification model, and the text features of the newly added intent are used to periodically train the classification model.

7. The apparatus according to claim 6, characterized in that, The module for obtaining the recognition result includes: The feature vector extraction submodule is used to extract the feature vector of the text to be identified; The text feature matching submodule is used to match the text feature with the highest similarity to the feature vector from multiple text features corresponding to the matching model, and to use the similarity as the highest similarity. The identification result determination submodule is used to obtain the text intent corresponding to the text feature with the highest similarity, and determine the text intent as the matching identification result.

8. An electronic device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, which, when executed by the processor, perform the method as described in any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Natural language processing method and device and storage medium

    CN113590831A

  • Text classification method and device

    CN113849653A

  • Intention recognition method and device based on text classification and matching fusion model

    CN114064898A