Intention recognition method and device, electronic device, and storage medium
By combining preset intent determination rules, deep learning models, and large language models in a multi-path recognition approach, the problem of a single intent recognition method in existing technologies is solved, achieving more efficient and accurate intent recognition, and improving recall rate and the system's ability to understand user intent.
Patent Information
- Application Number
- CN202310988734.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-07
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2043-08-07
AI Technical Summary
Existing technologies rely on a single method for intent recognition, resulting in poor generalization, insufficient recall, or poor model prediction performance, and also in high model training costs.
By combining preset intent determination rules, deep learning models, and large language models, intent recognition is performed on the prompt text to be recognized, and the final intent recognition result is obtained by fusing the three recognition results.
It improves the performance and recall coverage of intent recognition, reduces the cost of manual data annotation, and enhances the accuracy and efficiency of the system in understanding user intent.
Smart Images

Figure CN116863495B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, in particular to the technical field of computer, and more particularly to the technical field of artificial intelligence such as natural language processing and deep learning. Specifically disclosed is an intent recognition method and device, an electronic device, and a storage medium. BACKGROUND
[0002] In some human-computer interaction application scenarios, for example, in a scenario where a user needs a machine to help write, the robot needs to perform intent recognition on the prompt input by the user. The intent recognition is to classify the intent according to the understanding of the prompt of the user, and the system decides whether the prompt needs to be supplemented with context or clarified with internal proper noun entity concepts, so as to enable a downstream large language model to better understand the prompt instruction intent of the current user.
[0003] However, in the prior art, the intent classification is usually performed based on a rule determination or a model prediction method, the intent recognition method is relatively single, which leads to poor generalization effect of the rule determination method, insufficient recall, poor prediction performance of the model prediction method, and high model training cost. SUMMARY
[0004] The present disclosure provides an intent recognition method and device, an electronic device, and a storage medium.
[0005] According to a first aspect of the present disclosure, an intent recognition method is provided, comprising:
[0006] obtaining a prompt text to be recognized;
[0007] performing intent recognition on the prompt text to be recognized, comprising:
[0008] performing intent recognition on the prompt text to be recognized based on a preset intent determination rule to obtain a first intent recognition result;
[0009] performing intent recognition on the prompt text to be recognized based on a pre-trained deep learning model to obtain a second intent recognition result;
[0010] performing intent recognition on the prompt text to be recognized by querying a large language model to obtain a historical intent recognition result to obtain a third intent recognition result;
[0011] fusing the first intent recognition result, the second intent recognition result, and the third intent recognition result to obtain a final intent recognition result.
[0012] According to a second aspect of the present disclosure, an intent recognition device is provided, comprising:
[0013] an acquisition module configured to acquire prompt text to be recognized;
[0014] an intent recognition module configured to perform intent recognition on the prompt text to be recognized, including:
[0015] an intent rule determination submodule configured to perform intent recognition on the prompt text to be recognized based on preset intent determination rules to obtain a first intent recognition result;
[0016] an intent model prediction submodule configured to perform intent recognition on the prompt text to be recognized based on a pre-trained deep learning model to obtain a second intent recognition result;
[0017] an intent semantic matching submodule configured to perform intent recognition on the prompt text to be recognized by querying a large language model for historical intent recognition results obtained by intent labeling to obtain a third intent recognition result;
[0018] a fusion module configured to fuse the first intent recognition result, the second intent recognition result, and the third intent recognition result to obtain a final intent recognition result.
[0019] According to a third aspect of the present disclosure, an electronic device is provided, including:
[0020] at least one processor; and
[0021] a memory in communication connection with the at least one processor; wherein
[0022] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of the above technical solutions.
[0023] According to a fourth aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to perform the method of any one of the above technical solutions.
[0024] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program which, when executed by a processor, implements the method of any one of the above technical solutions.
[0025] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0026] The accompanying drawings are used to better understand the present scheme and do not constitute a limitation on the present disclosure. Among them:
[0027] Figure 1 is a step schematic diagram of the intent recognition method in the embodiments of the present disclosure;
[0028] Figure 2 is a system flowchart of the intent recognition method in the embodiments of the present disclosure;
[0029] Figure 3 is an operation interface diagram of the intelligent creation scene in the embodiments of the present disclosure;
[0030] Figure 4 is a block diagram of an electronic device for implementing the intent recognition method in the embodiments of the present disclosure. DETAILED DESCRIPTION
[0031] Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, which include various details of the embodiments of the present disclosure to help understanding, and should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, in order to be clear and concise, the description below omits the description of well-known functions and structures.
[0032] The existing intent recognition scheme usually includes the following two:
[0033] Scheme 1: Manually label the intent classification of the user's prompt, summarize the rules, and determine the prompt that meets certain rules as the corresponding intent classification based on regular matching based on the rule set. However, this rule-based determination method has poor generalization effect, resulting in insufficient recall.
[0034] Scheme 2: Manually label the intent classification of the user's prompt, train a multi-classification model using the labeled data, and give the intent classification of the user's prompt through model prediction. Through the model, the prediction performance is poor, and the prediction result is returned in seconds. The model training cost is high, the iteration period is long, and thousands of data samples need to be labeled for one training.
[0035] In view of the technical problems that the single intent recognition method has poor generalization effect, or the model prediction method has high model training cost and low prediction accuracy, the present disclosure provides an intent recognition method, as shown in Figure 1 , which includes:
[0036] Step S101, obtaining a to-be-recognized prompt text;
[0037] Step S102, performing intent recognition on the to-be-recognized prompt text, including:
[0038] Step S102A: Based on the preset intent determination rules, the text to be identified is subjected to intent recognition to obtain the first intent recognition result;
[0039] Step S102B: Based on the pre-trained deep learning model, perform intent recognition on the prompt text to be recognized to obtain the second intent recognition result;
[0040] Step S102C: By querying the historical intent recognition results obtained from intent annotation using the Large Language Model (LLM), intent recognition is performed on the prompt text to be recognized to obtain the third intent recognition result;
[0041] Step S103: The first intent recognition result, the second intent recognition result, and the third intent recognition result are fused to obtain the final intent recognition result.
[0042] like Figure 2 The illustrated recognition process addresses the issue of insufficient generalization in rule-based judgment by integrating model prediction into the system. It also integrates semantic matching for intent recognition. By simultaneously using three different recognition methods to identify the intent of the user-input prompt, the results from multiple paths are fused to obtain the optimal intent recognition result. It should be noted that steps S102A, S102B, and S102C are parallel and do not have a specific order. Specifically, the intent recognition method in this embodiment can be applied to some intelligent writing scenarios. For example, it can determine whether to introduce the preceding text based on the user's prompt. If the user's prompt is "summarize the above document content," the intent classification result is "introduce the preceding document content." If the user's prompt is "expand the above paragraph to 1000 words," the intent classification result is also "introduce the preceding document content."
[0043] Specifically, determining intent through rules refers to obtaining the query intent by parsing rule templates. For example, today's airfare from Beijing to Shanghai can be converted to: [location] to [location] [date] [bus ticket / air ticket / train ticket]; 1 kilogram equals how many grams can be converted to: [number] [unit of measurement] equals [number] [unit of measurement]. In the process of determining intent through rules, the domain is determined first, followed by the intent. An overall framework of entity-main domain-template can be used to determine the domain. After the domain is matched, the template uses intent verbs (download, query, etc.) or intent interrogative words (how, why, etc.) to determine the intent.
[0044] The model prediction method in this embodiment is an intent recognition method based on a deep learning model, which is a small language model. The deep learning model calculates the probability of each intent through the model for the prompt input by the user, and finally gives the intent of the query. Through this model prediction method, a large amount of training data is needed to train the deep learning model. The intent recognition model based on deep learning can select a model combined with LSTM (Long Short-Term Memory) + attention (attention model) or a BERT (Bidirectional Encoder Representations from Transformer) network for intent recognition.
[0045] Large language models and small language models have obvious differences in scale and function. Large language models generally refer to models trained based on deep learning algorithms with large-scale parameter sizes, which can handle various natural language understanding tasks such as text classification, sentiment analysis, and question answering. Large language models have stronger language processing capabilities and wider applicability, and can handle more complex and abstract language tasks. Small language models, on the other hand, are typically smaller in size and have fewer parameters, and handle relatively simple tasks, often used for specific natural language processing tasks such as syntax analysis and part-of-speech tagging. Small language models generally have faster inference speed and smaller storage space, and can efficiently handle natural language tasks in resource-constrained scenarios. The disclosed embodiments can use the labeling capabilities of large language models as a supplement, and use large language models to label data that cannot produce intent classification results through traditional rule determination and model prediction to generate historical intent recognition results for use in the next intent recognition.
[0046] In this way, the advantages and disadvantages of rule determination and model prediction can be complementary. Considering that model prediction has good generalization, fast performance (millisecond level return), and insufficient accuracy; rule determination has high accuracy, insufficient recall, and long performance time (second level). When multiple determinations simultaneously output intent recognition results, the best output is selected from the intent recognition results output by each method. Through the above technical solutions, the performance of the system based on user prompt word understanding intent classification and the coverage rate of intent recognition recall are improved. At the same time, the historical intent recognition results obtained by labeling the intent classification using a large language model for semantic matching can make up for the recall deficiency of the rule determination method.
[0047] As an optional implementation, as shown in Figure 2 As shown in step S102, before performing intent recognition on the prompt text to be recognized, the method further includes:
[0048] The prompt text to be recognized is tagged with part-of-speech.
[0049] Text annotation is the process of labeling text features, and putting specific semantic, composition, context, purpose, emotion, etc. Data tags, through the labeled training data, we can teach the machine how to recognize the implied intent or emotion in the text, so that the machine can understand language more humanly. Therefore, we must need very comprehensive and accurate high-quality text data to ensure that the machine can accurately identify the intent of the people, if the text processing is not handled properly, then the machine cannot understand the content we marked.
[0050] In this embodiment, a pre-trained word segmentation model can be used to annotate the prompt to mark the internal special nouns in the prompt. In some intelligent creation application scenarios, such as Figure 3 As shown in the figure, when the user calls up the intelligent creation component on the knowledge base document, the user needs to input the prompt word prompt, and the system determines the user's writing scene according to the user's input prompt word Figure 3 The text input box "Tell AI what you want to write?" As shown in the figure, it is determined that the user's writing scene is to write internal work documents or external public knowledge. To determine whether the user's intention is to write internal documents or to need external public knowledge, first, the prompt needs to be annotated to mark which nouns are internal special nouns, and then the next step of intent recognition can be performed.
[0051] As an optional implementation, before the step S102 performs intent recognition on the to-be-recognized prompt text, and after the to-be-recognized prompt text is morphologically annotated, the step S102 further includes:
[0052] Based on the second historical intent recognition result, the to-be-recognized prompt text is subjected to semantic matching, and if the keywords in the to-be-recognized prompt text hit the second historical intent recognition result, the numerical value corresponding to the keywords in the second historical intent recognition result is returned as the final intent recognition result.
[0053] This embodiment adds an intervention function, which is an intervention capability for the overall system. For example Figure 2As shown, the intervention module 205 is arranged after the prompt of the user is annotated with the intent classification and before the intent recognition module. The second historical intent recognition result is pre-stored in the key-value cache in the form of a key-value index table. For example, when the prompt of the user is “write a product operation plan about product A” and the intent recognition result is “internal product” during the last intent recognition, the prompt of the user can be converted into a key value, and the corresponding intent recognition result can be converted into a value value, to establish a key-value index relationship. When the prompt is semantically matched with the second historical intent recognition result, if the key word in the prompt hits the key word (key) in the key-value cache, the value value corresponding to the key word is directly used as the intent recognition result, and the intent classification is no longer performed through the intent recognition module, thereby improving the efficiency of intent recognition. The key refers to some key words in the cache. For example, the prompt input by the user is “please help me write a document about large models”, and after the prompt is segmented and tagged with the part of speech, the key word “large models” is cut out. If the key “large models” in the current key-value cache is hit, the value corresponding to “large models” is returned as the intent recognition result.
[0054] As an optional implementation, after the step S103 fuses the first intent recognition result, the second intent recognition result and the third intent recognition result to obtain the final intent recognition result, the method further includes:
[0055] obtaining data without an intent classification result in the first intent recognition result, the second intent recognition result and the third intent recognition result;
[0056] calling a large language model to annotate the data without the intent classification result with intent classification, to obtain a historical intent recognition result, including:
[0057] calling the large language model to automatically induce an intent classification regular expression corresponding to the data without the intent classification result;
[0058] generating a second prompt text corresponding to the data without the intent classification result based on the intent classification regular expression;
[0059] converting the second prompt text into a semantic vector, and converting annotated data corresponding to the second prompt text into an index value;
[0060] establishing an index relationship between the semantic vector and the index value as the historical intent recognition result.
[0061] Specifically, as Figure 2As shown, in this embodiment, the active scheduling module is designed to prompt data of users without outputting intent classification results, and to pull data of the unoutput intent classification results at regular intervals to generate rule-extracted prompts, and to call a large language model to automatically induce regular expressions of the intent classification corresponding to the data. The corresponding prompt is as follows:
[0062] The current product provides intelligent writing capabilities on a document knowledge base. Please understand the user's input instructions and determine the writing intent classification. The writing intent classification and determination criteria are as follows:
[0063] 1. Write internal / external documents: If there are proper nouns in the prompt that you cannot understand, please output: Write external documents, otherwise output: Write internal documents. If the prompt explicitly tells you that a certain word is an internal proper noun, please output: Write internal documents.
[0064] 2. Whether to introduce the previous text: Please automatically determine whether the user needs to provide the previous text information based on the user prompt. If so, output: Introduce the previous text, otherwise output: No need to introduce the previous text.
[0065] Please classify the following prompts based on the above rules.
[0066] In this embodiment, the large language model can be used to automatically annotate the unrecalled data, and the new user prompt (second prompt text) can be stored in the vector database after semantic vectorization, so that the intent semantic matching submodule can recall similar prompts with the same semantics, which can make up for the shortcomings of rule recall. Among them, the large language model is used to annotate the data without outputting the intent classification result, and the annotation result of the large model is maintained in the vector database (the text is converted into an index, and the annotation result is converted into an index value). The vector database milvus is used to establish and maintain the index, and the result is shown in Table 1:
[0067]
[0068] Table 1
[0069] Through the intent recognition scheduling system and the annotation capability based on the large language model, a closed-loop mechanism for intent recognition and determination of new user prompts is constructed, which reduces the cost of manual data annotation and improves the efficiency of recall strategy iteration.
[0070] As an optional implementation, after step S103 fuses the first intent recognition result, the second intent recognition result, and the third intent recognition result to obtain the final intent recognition result, it further includes:
[0071] The first intention recognition result, the second intention recognition result, and the third intention recognition result are stored in the database through an asynchronous warehousing mode. When the large language model is scheduled to label data without an output intention classification result, data can be pulled from the database.
[0072] As an optional implementation, the first intention recognition result, the second intention recognition result, and the third intention recognition result are fused to obtain a final intention recognition result.
[0073] The final intention recognition result is determined from the first intention recognition result, the second intention recognition result, and the third intention recognition result based on the priority of each intention recognition result.
[0074] Specifically, the priority of the third intention recognition result is higher than that of the first intention recognition result, and the priority of the first intention recognition result is higher than that of the second intention recognition result. As shown in FIG. 6, when multiple intention determination results are output simultaneously, the intention recognition result generated by the rule determination method is preferentially selected due to the higher accuracy of the rule determination recall, and the intention recognition result obtained by the model prediction is used when the rule determination method recall is insufficient. The intention recognition result obtained by semantic matching can make up for the insufficient rule recall, and therefore the third intention recognition result is preferentially used when the intention semantic matching submodule generates the third intention recognition result. Figure 2
[0075] The present disclosure also provides an intention recognition device, as shown in FIG. 7, comprising: Figure 2
[0076] The acquisition module 201 is configured to acquire a prompt text to be recognized.
[0077] The intention recognition module is configured to perform intention recognition on the prompt text to be recognized, comprising:
[0078] The intention rule determination submodule 202A is configured to perform intention recognition on the prompt text to be recognized based on a preset intention determination rule to obtain a first intention recognition result.
[0079] The intention model prediction submodule 202B is configured to perform intention recognition on the prompt text to be recognized based on a pre-trained deep learning model to obtain a second intention recognition result.
[0080] The intention semantic matching submodule 202C is configured to perform intention recognition on the prompt text to be recognized by querying a large language model to obtain a historical intention recognition result obtained by intention labeling.
[0081] The fusion module 203 is configured to fuse the first intention recognition result, the second intention recognition result, and the third intention recognition result to obtain a final intention recognition result.
[0082] As Figure 2 shown in the schematic flow of intent recognition, in this embodiment, in order to solve the problem of insufficient generalization of the intent rule determination submodule 202A, the intent model prediction submodule 202B is integrated into the system, and the intent semantic matching submodule 202C is also integrated. Through three different intent recognition methods, the prompt input by the user is simultaneously subjected to intent recognition, and finally the optimal intent recognition result is obtained by fusing the multiple intent recognition results. Specifically, the intent recognition method in this embodiment can be applied to some intelligent writing scenarios, for example, judging whether the previous text needs to be introduced based on the user's prompt word. If the user's prompt word is "summarize the content of the above document", the intent classification result is "need to introduce the content of the document above"; if the user's prompt word is "expand the above paragraph to 1000 words", the intent classification result is "need to introduce the content of the document above".
[0083] Specifically, the rule-determined intent refers to obtaining the query intent through rule template analysis. For example, the ticket price from Beijing to Shanghai today can be converted to: [place] to [place] [date] [train ticket / air ticket / train ticket]; 1 kilogram is equal to how many grams, which can be converted to: [number] [unit of measurement] is equal to [number] [unit of measurement]. In the rule-determined intent process, the domain is first determined and then the intent is determined. The overall framework of entity-main domain-template can be used to determine and identify the domain. After hitting the domain, the template uses intent verbs (download, query, etc.) or intent interrogative words (how, why, etc.) to determine the intent.
[0084] The model prediction method in this embodiment is an intent recognition method based on a deep learning model. The deep learning model in this embodiment refers to a small language model. The model calculates the probability of each intent for the prompt input by the user, and finally gives the query intent. Through this model prediction method, a large amount of training data is required to train the deep learning model. The intent recognition model based on deep learning can select a model combined with LSTM+attention, or a BERT network classification intent recognition.
[0085] In this way, the advantages and disadvantages of the rule-determined method and the model-predicted method can be complementary. Considering that the model prediction has good generalization, fast performance (millisecond level return), and insufficient accuracy; the rule-determined method has high accuracy, insufficient recall, and long performance time (second level). When multiple determination methods simultaneously output intent recognition results, the best output is selected from the intent recognition results output by each method. Through the above technical solution, the performance of the system based on the user's prompt word understanding intent classification and the coverage rate of intent recognition recall are improved. At the same time, the historical intent recognition results obtained by using a large language model for intent classification annotation for semantic matching can make up for the problem of insufficient recall of the rule-determined method.
[0086] As an optional implementation, the apparatus further comprises:
[0087] The labeling module 204 is configured to perform part-of-speech tagging on the to-be-recognized prompt text before the fusion module 203 performs intent recognition on the to-be-recognized prompt text based on the preset intent determination rule to obtain a first intent recognition result.
[0088] In this embodiment, the labeling module 204 can use a pre-trained word segmentation model (wordseg) to label the prompt and label the internal special nouns in the prompt. In some intelligent creation application scenarios, such as Figure 3 As shown in the figure, when the user calls up the intelligent creation component on the knowledge base document, the user needs to input the prompt word prompt. The system determines the user's writing scenario based on the user's input prompt word (whether to write an internal work document or an external public knowledge) and judges the user's intent (whether to write an internal document or need external public knowledge). First, the prompt needs to be labeled to label the internal special nouns in the prompt, and then the intent recognition can be performed. Figure 3
[0089] As an optional implementation, as shown in the figure, the apparatus further comprises: Figure 2
[0090] The intervention module 205 is configured to perform semantic matching on the to-be-recognized prompt text based on the second historical intent recognition result before the intent recognition module performs intent recognition on the to-be-recognized prompt text, and after the labeling module 204 performs part-of-speech tagging on the to-be-recognized prompt text. If the keywords in the to-be-recognized prompt text hit the second historical intent recognition result, the numerical value corresponding to the keywords in the second historical intent recognition result is returned as the final intent recognition result.
[0091] In this embodiment, the intervention module 205 is added, which adds an intervention capability to the overall system. As shown in the figure, Figure 2 As shown, the intervention module 205 is arranged after the prompt of the user is annotated with the intent classification, and before the intent recognition module. The second historical intent recognition result is pre-stored in the key-value cache in the form of a key-value index table. For example, when the prompt of the user is “write a product operation plan about product A” and the intent recognition result is “internal product” during the last intent recognition, the prompt of the user can be converted into a key value, and the corresponding intent recognition result can be converted into a value value, to establish a key-value index relationship. When the prompt is semantically matched with the second historical intent recognition result, if the key word in the prompt hits the key word (key) in the key-value cache, the value value corresponding to the key word is directly used as the intent recognition result, and the intent classification is no longer performed by the intent recognition module. The key refers to some key words in the cache. For example, the prompt input by the user is “please help me write a document about large models”, and after the prompt is segmented and tagged with the part of speech, the key word “large models” is cut out. If the key-value cache library is configured with a “large models” key, the value corresponding to “large models” is returned as the intent recognition result.
[0092] As an optional implementation, after the fusion module 203 fuses the first intent recognition result, the second intent recognition result, and the third intent recognition result to obtain the final intent recognition result, the following is further included:
[0093] The data pulling module 206 is configured to obtain data for which no intent classification result is produced from the first intent recognition result, the second intent recognition result, and the third intent recognition result.
[0094] The model scheduling module 207 is configured to call a large language model to perform intent classification annotation on the data for which no intent classification result is produced, to obtain a historical intent recognition result, including:
[0095] The large language model is called to automatically induce an intent classification regular expression corresponding to the data for which no intent classification result is produced.
[0096] The second prompt text corresponding to the data for which no intent classification result is produced is generated based on the intent classification regular expression.
[0097] The second prompt text is converted into a semantic vector, and the annotation data corresponding to the second prompt text is converted into an index value.
[0098] An index relationship between the semantic vector and the index value is established as the historical intent recognition result, and is stored in Figure 2The vector database 208 shown in the figure.
[0099] Specifically, as Figure 2 shown, the active scheduling module in this embodiment schedules the user prompt data that does not output the intent classification result, pulls the data that does not output the intent classification result at regular intervals, calls the large language model to automatically induce the regular expression of the intent classification corresponding to the data, and generates the corresponding prompt.
[0100] In this embodiment, the large language model can be actively scheduled to automatically annotate the data that is not recalled. After the new user prompt is semantically vectorized, it is stored in the vector database (as shown in Table 1), and the intent semantic matching submodule can be used to recall similar prompts with the same semantics, thereby making up for the shortcomings of rule-based recall. In this embodiment, through the intent recognition scheduling system and the labeling capability based on the large language model, a closed-loop mechanism for intent recognition and determination of new user prompts is constructed, which reduces the cost of manual data labeling and improves the efficiency of recall strategy iteration.
[0101] As an optional implementation, after the fusion module 203 fuses the first intent recognition result, the second intent recognition result, and the third intent recognition result to obtain the final intent recognition result, the method further includes:
[0102] The storage module is configured to store the first intent recognition result, the second intent recognition result, and the third intent recognition result in the database 209 through an asynchronous storage method. When the large language model is scheduled to label the data that does not output the intent classification result, the data can be pulled from the database 209.
[0103] As an optional implementation, the fusion module 203 fuses the first intent recognition result, the second intent recognition result, and the third intent recognition result to obtain the final intent recognition result, which includes:
[0104] Based on the priority of each intent recognition result, the final intent recognition result is determined from the first intent recognition result, the second intent recognition result, and the third intent recognition result.
[0105] Specifically, the priority of the third intent recognition result is higher than that of the first intent recognition result, and the priority of the first intent recognition result is higher than that of the second intent recognition result. As Figure 2As shown, when the multi-intention determination simultaneously outputs a result, due to the high accuracy of the rule determination recall, the intention recognition result generated by the rule determination mode is preferentially selected, and when the rule determination mode recall is insufficient, the intention recognition result obtained by the model prediction is used. The intention recognition result obtained by the intention semantic matching submodule 202C based on the vector database through semantic matching can be used to make up for the insufficient rule recall, and therefore when the third intention recognition result is generated by the intention semantic matching submodule, the third intention recognition result can be preferentially used.
[0106] In the technical solutions of the present disclosure, the acquisition, storage and application of user personal information comply with relevant laws and regulations and do not violate public order and good customs.
[0107] According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0108] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present disclosure described and / or claimed in this document.
[0109] As Figure 4 shown, the device 400 includes a computing unit 401 that can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded into a random access memory (RAM) 403 from a storage unit 408. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0110] A plurality of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a magnetic disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunications networks.
[0111] The computing unit 401 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning objective function algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 401 performs various methods and processes described above, such as the intent recognition method. For example, in some embodiments, the intent recognition method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 408. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded onto the RAM 403 and executed by the computing unit 401, one or more steps of the intent recognition method described above can be performed. Alternatively, in other embodiments, the computing unit 401 can be configured to perform the intent recognition method by any other suitable means, such as by means of firmware.
[0112] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0113] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or the block diagrams. The program code can be entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine or server, or entirely on a remote machine or server.
[0114] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0115] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0116] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0117] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0118] It should be understood that the various forms of flow shown above can be re-ordered, steps added or removed, etc. For example, the steps recited in the present disclosure can be performed in parallel, in series, in a different order, etc., as long as the desired results of the present disclosure are achieved, which is not limited herein.
[0119] The specific implementation described above does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. An intent recognition method, comprising: obtaining prompt text to be recognized; performing intent recognition on the prompt text to be recognized, comprising: performing intent recognition on the prompt text to be recognized based on a preset intent determination rule to obtain a first intent recognition result; performing intent recognition on the prompt text to be recognized based on a pre-trained deep learning model to obtain a second intent recognition result; performing intent recognition on the prompt text to be recognized by querying a large language model to obtain a historical intent recognition result, to obtain a third intent recognition result; fusing the first intent recognition result, the second intent recognition result, and the third intent recognition result to obtain a final intent recognition result; obtaining data for which no intent classification result is output from the first intent recognition result, the second intent recognition result, and the third intent recognition result; calling the large language model to perform intent classification labeling on the data for which no intent classification result is output to obtain the historical intent recognition result.
2. The method of claim 1, wherein, Before the intent recognition on the prompt text to be recognized, the method further comprises: performing part-of-speech tagging on the prompt text to be recognized.
3. The method of claim 2, wherein, Before the intent recognition on the prompt text to be recognized and after the part-of-speech tagging on the prompt text to be recognized, the method further comprises: performing semantic matching on the prompt text to be recognized based on a second historical intent recognition result, and if a keyword in the prompt text to be recognized hits the second historical intent recognition result, returning a value corresponding to the keyword in the second historical intent recognition result as the final intent recognition result, the second historical intent recognition result being an intent classification result obtained by analyzing historical input text of a user in a historical intent recognition process.
4. The method of claim 1, wherein, The calling of the large language model to perform intent classification labeling on the data for which no intent classification result is output to obtain the historical intent recognition result comprises: calling the large language model to automatically induce an intent classification regular expression corresponding to the data for which no intent classification result is output; generating a second prompt text corresponding to the data for which no intent classification result is output based on the intent classification regular expression; converting the second prompt text into a semantic vector and converting labeling data corresponding to the second prompt text into an index value; establishing an index relationship between the semantic vector and the index value as the historical intent recognition result.
5. The method of claim 1, wherein, After the fusing of the first intent recognition result, the second intent recognition result, and the third intent recognition result to obtain the final intent recognition result, the method further comprises: storing the first intent recognition result, the second intent recognition result, and the third intent recognition result in a database through an asynchronous storage mode.
6. The method of claim 1, wherein, The fusing of the first intent recognition result, the second intent recognition result, and the third intent recognition result to obtain the final intent recognition result comprises: determining the final intent recognition result from the first intent recognition result, the second intent recognition result, and the third intent recognition result based on a priority of each intent recognition result.
7. The method of claim 6, wherein, The priority of each of the intention recognition results comprises: The priority of the third intention recognition result is higher than that of the first intention recognition result, and the priority of the first intention recognition result is higher than that of the second intention recognition result.
8. An intention recognition device, comprising: an acquisition module configured to acquire prompt text to be recognized; an intention recognition module configured to perform intention recognition on the prompt text to be recognized, comprising: an intention rule determination submodule configured to perform intention recognition on the prompt text to be recognized based on a preset intention determination rule to obtain a first intention recognition result; an intention model prediction submodule configured to perform intention recognition on the prompt text to be recognized based on a pre-trained deep learning model to obtain a second intention recognition result; an intention semantic matching submodule configured to perform intention recognition on the prompt text to be recognized by querying a large language model for historical intention recognition results obtained through intention labeling; a fusion module configured to fuse the first intention recognition result, the second intention recognition result, and the third intention recognition result to obtain a final intention recognition result; a data pulling module configured to acquire data for which no intention classification result is output from the first intention recognition result, the second intention recognition result, and the third intention recognition result; a model scheduling module configured to call the large language model to perform intention classification labeling on the data for which no intention classification result is output to obtain the historical intention recognition result.
9. The apparatus of claim 8, wherein, Further comprising: a labeling module configured to perform part-of-speech labeling on the prompt text to be recognized before the intention recognition module performs intention recognition on the prompt text to be recognized.
10. The apparatus of claim 9, wherein, Before the intention recognition module performs intention recognition on the prompt text to be recognized and after the labeling module performs part-of-speech labeling on the prompt text to be recognized, further comprising: an intervention module configured to perform semantic matching on the prompt text to be recognized based on a second historical intention recognition result, and if a keyword in the prompt text to be recognized hits the second historical intention recognition result, returning a value corresponding to the keyword in the second historical intention recognition result as the final intention recognition result, the second historical intention recognition result being an intention classification result obtained by analyzing user historical input text in a historical intention recognition process.
11. The apparatus of claim 8, wherein, The model scheduling module calling the large language model to perform intention classification labeling on the data for which no intention classification result is output to obtain the historical intention recognition result comprises: calling the large language model to automatically induce an intention classification regular expression corresponding to the data for which no intention classification result is output; generating a second prompt text corresponding to the data for which no intention classification result is output based on the intention classification regular expression; converting the second prompt text into a semantic vector and converting labeling data corresponding to the second prompt text into an index value; establishing an index relationship between the semantic vector and the index value as the historical intention recognition result.
12. The apparatus of claim 8, wherein, After the fusion module fuses the first intention recognition result, the second intention recognition result, and the third intention recognition result to obtain a final intention recognition result, the method further includes: The storage module is configured to store the first intention recognition result, the second intention recognition result, and the third intention recognition result in the fusion module into a database in an asynchronous storage manner.
13. The apparatus of claim 8, wherein, After the fusion module fuses the first intention recognition result, the second intention recognition result, and the third intention recognition result to obtain a final intention recognition result, the method further includes: The final intention recognition result is determined from the first intention recognition result, the second intention recognition result, and the third intention recognition result based on a priority of each intention recognition result.
14. The apparatus of claim 13, wherein, The priority of each intention recognition result in the fusion module includes: The priority of the third intention recognition result is higher than that of the first intention recognition result, and the priority of the first intention recognition result is higher than that of the second intention recognition result.
15. An electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
16. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1-7.
17. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1-7.
Citation Information
Patent Citations
Semantic recognition method and device, electronic equipment and storage medium
CN114691841A