Intention recognition method for multiple rounds of dialogues in question and answer
By performing text filtering and semantic analysis on multiple rounds of user input, combined with the text rewriting technology of the LLM model, the changes in user intentions are identified, and the problem of difficulty in knowledge retrieval in multiple rounds of conversations is solved, and a more efficient and personalized dialogue flow is achieved. .
Patent Information
- Application Number
- CN202510033277.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2045-01-09
AI Technical Summary
During multiple rounds of conversations, user intentions may change with the change of conversation rounds, resulting in increased difficulty in retrieving knowledge during conversations, and it is difficult for the prior art to effectively identify changes in user intentions.
By obtaining multiple rounds of input text from the user, performing text filtering and semantic analysis, we determine the intent tags and related fields in the input text. The preset LLM model is used to calculate the similarity between input texts. If the similarity reaches a threshold, text rewrite is performed to generate synthetic text, which is used to identify user intent and optimize conversation flow.
Effectively identify the similarity between user input and previous input, identify whether the user's intentions have changed, avoid repeated or irrelevant answers, improve the context coherence, personalization and adaptability of the conversation, and reduce the difficulty of knowledge retrieval during multiple rounds of conversations.
Smart Images

Figure CN119441464A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language understanding, and in particular to a method for identifying intentions in multi-round conversations in question and answering. Background Art
[0002] With the popularization of smart electronic devices such as mobile phones, tablets, and smart watches, network products and applications that rely on such electronic devices have gradually developed to use conversational human-computer interaction methods.
[0003] Nowadays, smart electronic devices usually have built-in chatbots. Chatbots refer to computer programs or software that can use text, voice, pictures or touch operations sent by users as input data, understand the user's intention expressed by the input data, and then realize human-computer interaction. It can be understood as an intelligent dialogue system that automatically responds based on the content sent by the user. Chatbots can replace real people in conversations to a certain extent and can be integrated into dialogue systems as automatic online assistants for scenarios such as intelligent chat, customer service, and information inquiries. In the process of human-computer dialogue, whether the chatbot can recognize the user's intention and give an answer that matches the dialogue initiated by the user, or execute an operation instruction that matches the user's intention, has a significant impact on improving the quality of dialogue between people and machines.
[0004] However, during a multi-round conversation, user intentions may change at any time during different conversation rounds. Due to the diversity and long-tail characteristics of conversational search scenarios, this increases the difficulty of knowledge retrieval during the conversation. Therefore, it is urgent to build a technical solution for identifying user intentions based on user-initiated conversations. Summary of the invention
[0005] The purpose of the present invention is to provide a method for identifying the intention of multiple rounds of dialogue in question and answer, and to solve the following technical problems:
[0006] During a multi-round conversation, user intentions may change at any time during different conversation rounds. Due to the diversity and long-tail characteristics of conversational search scenarios, this increases the difficulty of knowledge retrieval during the conversation. Therefore, it is urgent to build a technical solution for identifying user intentions based on user-initiated conversations.
[0007] The purpose of the present invention can be achieved through the following technical solutions:
[0008] A method for identifying intentions in multi-round dialogues in question-answering includes the following steps:
[0009] S1. Obtain the first input text of the current user and mark it as input text y1. Perform text filtering on the input text y1, conduct semantic analysis on the filtered input text y1, determine the intent tags corresponding to each word in the input text y1 according to the results of the semantic analysis, and determine the relevant field corresponding to the input text y1 according to the intent tags.
[0010] S2. Obtain the second input text of the current user and mark it as input text y2. Obtain the relevant field corresponding to the input text y2, calculate the similarity between the input text y2 and the input text y1 according to the relevant field. If the similarity is greater than or equal to the preset similarity threshold, rewrite the input text y2 through the preset LLM model and the input text y1, and determine the synthesized text Y1 according to the result of the text rewriting, and reply to the synthesized text Y1.
[0011] S3. Obtain the third input text of the current user and mark it as input text y3. Obtain the relevant field corresponding to the input text y3, and calculate the similarity between the input text y3 and the synthesized text Y1 according to the relevant field.
[0012] If the similarity is greater than or equal to the similarity threshold, rewrite the input text y3 through the preset LLM model and the synthesized text Y1, and determine the synthesized text Y2 according to the result of the text rewriting, and reply to the synthesized text Y2.
[0013] As a further solution of the present invention: In the S1, the specific process of text filtering is as follows:
[0014] Remove the special characters in the text through regular expressions and replace the special characters with blank strings. The special characters include punctuation marks and special control characters; use a predefined stop word list to remove the stop words in the text. The stop words include "de", "shi", and "le".
[0015] As a further solution of the present invention: In the S2, the following steps are further included:
[0016] If the similarity is less than the preset similarity threshold, directly reply to the input text y2.
[0017] As a further solution of the present invention: In the S2, the specific process of determining the synthesized text Y1 is as follows:
[0018] S11. Obtain all the results of text rewriting and mark them as hypothetical texts b1, b2,..., ba, where a is a positive integer. Select any one of the hypothetical texts and reply to it to obtain the hypothetical text reply corresponding to the hypothetical text, and obtain all the hypothetical text replies and mark them as h1, h2,..., ha;
[0019] S12, obtaining non-numerical data of any hypothetical text reply, encoding the non-numerical data to obtain numerical data, converting the encoded hypothetical text reply into a number of feature vectors, and generating a feature set for each hypothetical text reply; calculating the Euclidean distance I between all feature sets, and performing K-means clustering using the Euclidean distance I as a similarity metric to obtain a target category cluster;
[0020] S13, taking any feature set in the target category cluster as the center, calculating the aggregation degree of the feature set and marking it as DP, and marking the hypothetical text corresponding to the feature set with the smallest DP value as the synthetic text Y1;
[0021] The calculation formula of DP is: ;
[0022] Among them, z is the number of feature sets in the target category cluster, z0 is the central feature set point, and v0 is the other feature set points in the target category cluster.
[0023] As a further solution of the present invention: S3 further includes the following steps:
[0024] If the similarity is less than the similarity threshold, perform the following steps:
[0025] S21, calculating the similarity X1 between the input text y3 and the input text y1, and calculating the similarity X2 between the input text y3 and the input text y2;
[0026] S22, calculating the difference between the similarity X1 and the similarity X2, if the difference is greater than 0, rewriting the input text y3 by using the LLM model and the input text y1, and determining the synthetic text Y3 according to the result of the text rewriting, and replying to the synthetic text Y3;
[0027] If the difference is less than 0, the input text y3 is rewritten by using the LLM model and the input text y2, and a synthetic text Y4 is determined according to the result of the text rewriting, and the synthetic text Y4 is replied;
[0028] If the difference is equal to 0, the input text y3 is rewritten through the LLM model, the input text y1 and the input text y2, and the synthetic text Y5 is determined according to the result of the text rewriting, and the synthetic text Y5 is replied.
[0029] As a further solution of the present invention: In S1, the specific process of determining the relevant field corresponding to the input text y1 according to the intention label is:
[0030] Establish a database, which stores the intention labels of the marked fields. The intention labels are related to several fields at the same time, generate the relevance p of the intention labels to different fields, summarize all the words in the input text y1 as corresponding intention labels, count the relevance p1, p2, ..., pq of the intention labels involved in any field and calculate them according to the calculation formula The total relevance x of the field is calculated. If the total relevance x is greater than or equal to a preset threshold, the field is marked as the relevant field corresponding to the input text y1; if the total relevance x is less than the preset threshold, the field is not marked as the relevant field corresponding to the input text y1.
[0031] As a further solution of the present invention: In S2, the specific calculation process of the similarity is: obtain the relevant fields corresponding to the input text y2 and the input text y1, and then obtain all overlapping relevant fields and mark them as L1, L2, ..., LN, and the calculation formula is The similarity C is calculated, where M is the number of related fields corresponding to the input text y1, and N is the number of overlapping related fields.
[0032] Beneficial effects of the present invention:
[0033] The present invention processes texts of multiple rounds of conversations, calculates similarities and rewrites texts, and can effectively identify the similarity between user inputs and previous inputs, thereby identifying whether the user's intention has changed and avoiding repeated or irrelevant answers. For example, if the user's input is highly similar to the previous content, the user input text is optimized through text rewriting to provide more accurate and relevant content. Through semantic analysis and intent recognition of each input text, the conversation flow can be adjusted in real time and modified as needed, and a more reasonable response can be made according to the actual situation. This makes the conversation more contextually coherent, personalized, and adaptable. The present invention reduces the difficulty of knowledge retrieval during multiple rounds of conversations and improves the quality and efficiency of multiple rounds of conversations. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The present invention will be further described below in conjunction with the accompanying drawings.
[0035] Figure 1 It is a flow chart of a method for identifying intentions in multiple rounds of dialogue in question and answering according to the present invention. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0037] See also Figure 1 As shown, the present invention is a method for identifying intentions in multiple rounds of dialogue in question and answer, comprising the following steps:
[0038] S1, obtaining the first input text of the current user and marking it as input text y1, performing text filtering on the input text y1, performing semantic analysis on the filtered input text y1, determining the intention label corresponding to each word in the input text y1 according to the result of the semantic analysis, and determining the relevant field corresponding to the input text y1 according to the intention label;
[0039] S2, obtaining the second input text of the current user and marking it as input text y2, obtaining the relevant field corresponding to the input text y2, calculating the similarity between the input text y2 and the input text y1 according to the relevant field, and if the similarity is greater than or equal to a preset similarity threshold, rewriting the input text y2 by using a preset LLM model and the input text y1, and determining a synthetic text Y1 according to the result of the text rewriting, and replying to the synthetic text Y1;
[0040] S3, obtaining the third input text of the current user and marking it as input text y3, obtaining the relevant field corresponding to the input text y3, and calculating the similarity between the input text y3 and the synthesized text Y1 according to the relevant field;
[0041] If the similarity is greater than or equal to the similarity threshold, the input text y3 is rewritten using the preset LLM model and the synthetic text Y1, and the synthetic text Y2 is determined according to the result of the text rewriting, and the synthetic text Y2 is replied.
[0042] The present invention processes texts of multiple rounds of conversations, calculates similarities and rewrites texts, and can effectively identify the similarity between user inputs and previous inputs, thereby identifying whether the user's intention has changed and avoiding repeated or irrelevant answers. For example, if the user's input is highly similar to the previous content, the user input text is optimized through text rewriting to provide more accurate and relevant content. Through semantic analysis and intent recognition of each input text, the conversation flow can be adjusted in real time and modified as needed, and a more reasonable response can be made according to the actual situation. This makes the conversation more contextually coherent, personalized, and adaptable. The present invention reduces the difficulty of knowledge retrieval during multiple rounds of conversations and improves the quality and efficiency of multiple rounds of conversations.
[0043] It should be noted that the present invention only discusses the solutions for the first three conversations of the user. In actual applications, the number of conversations of the user may far exceed three. Therefore, when the user has the fourth, fifth, and more conversations, the above-mentioned step S3 can be repeatedly executed, thereby reducing the difficulty of knowledge retrieval in the multi-round conversation process and improving the quality and efficiency of the multi-round conversation.
[0044] In a preferred embodiment of the present invention, in S1, the specific process of text filtering is as follows:
[0045] Remove special characters in the text through regular expressions and replace the special characters with blank strings. The special characters include punctuation marks and special control characters; use a predefined stop word list to remove stop words in the text. The stop words include "de", "shi", and "le".
[0046] In another preferred embodiment of the present invention, in S2, the following steps are further included:
[0047] If the similarity is less than the preset similarity threshold, directly reply to the input text y2.
[0048] In another preferred embodiment of the present invention, in S2, the specific process of determining the synthesized text Y1 is as follows:
[0049] S11, obtain all the results of text rewriting and mark them as hypothetical texts b1, b2,..., ba, where a is a positive integer. Select any one of the hypothetical texts and reply to obtain the hypothetical text reply corresponding to the hypothetical text. Obtain all the hypothetical text replies and mark them as h1, h2,..., ha;
[0050] S12, obtain the non-numerical data of any one of the hypothetical text replies, encode the non-numerical data to obtain numerical data, convert the encoded hypothetical text reply into several feature vectors, and generate a feature set for each hypothetical text reply; calculate the Euclidean distance I between all the feature sets, and use the Euclidean distance I as the similarity measure for K-means clustering to obtain the target category cluster;
[0051] S13, take any one of the feature sets in the target category cluster as the center, calculate the aggregation degree of the feature set and mark it as DP, and calibrate the hypothetical text corresponding to the feature set with the smallest DP value as the synthesized text Y1;
[0052] The calculation formula of DP is: ;
[0053] Where z is the number of feature sets in the target category cluster, z0 is the central feature set point, and v0 is the other feature set points in the target category cluster.
[0054] The LLM model can analyze the user's query and identify the core intent. For example, if the user asks "How is the weather today?", LLM will understand that the user wants to know the current weather conditions and extract key information. After understanding the intent, LLM will extract the key information in the query, such as time, location, subject, etc. In the example of "How is the weather today?", LLM will identify "today" and "weather" as key information. Based on the analysis of the original query intent and key information, LLM can rewrite the query in different ways. This process is not limited to literal replacement, but may involve different expressions, tones, details, etc. For example, for "How is the weather today?", it will generate: "What is today's weather forecast?" "Will it rain today?" "How is the weather today?" "What is the temperature today?" These different query rewrites, although different in terms of sentences, all convey the same core intent - querying about today's weather conditions, thus obtaining multiple text rewrite results.
[0055] In another preferred embodiment of the present invention, said S3 further comprises the following steps:
[0056] If the similarity is less than the similarity threshold, perform the following steps:
[0057] S21, calculating the similarity X1 between the input text y3 and the input text y1, and calculating the similarity X2 between the input text y3 and the input text y2;
[0058] S22, calculating the difference between the similarity X1 and the similarity X2, if the difference is greater than 0, rewriting the input text y3 by using the LLM model and the input text y1, and determining the synthetic text Y3 according to the result of the text rewriting, and replying to the synthetic text Y3;
[0059] If the difference is less than 0, the input text y3 is rewritten by using the LLM model and the input text y2, and a synthetic text Y4 is determined according to the result of the text rewriting, and the synthetic text Y4 is replied;
[0060] If the difference is equal to 0, the input text y3 is rewritten through the LLM model, the input text y1 and the input text y2, and the synthetic text Y5 is determined according to the result of the text rewriting, and the synthetic text Y5 is replied.
[0061] In another preferred embodiment of the present invention, in S1, the specific process of determining the relevant field corresponding to the input text y1 according to the intention label is:
[0062] Establish a database, which stores the intention labels of the marked fields. The intention labels are related to several fields at the same time, generate the relevance p of the intention labels to different fields, summarize all the words in the input text y1 as corresponding intention labels, count the relevance p1, p2, ..., pq of the intention labels involved in any field and calculate them according to the calculation formula The total relevance x of the field is calculated. If the total relevance x is greater than or equal to a preset threshold, the field is marked as the relevant field corresponding to the input text y1; if the total relevance x is less than the preset threshold, the field is not marked as the relevant field corresponding to the input text y1.
[0063] In another preferred embodiment of the present invention, the specific calculation process of the similarity in S2 is: obtaining the relevant fields corresponding to the input text y2 and the input text y1, and then obtaining all overlapping relevant fields and marking them as L1, L2, ..., LN, and the calculation formula is The similarity C is calculated, where M is the number of related fields corresponding to the input text y1, and N is the number of overlapping related fields.
[0064] The above is a detailed description of an embodiment of the present invention, but the content is only a preferred embodiment of the present invention and cannot be considered to limit the scope of implementation of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of the patent coverage of the present invention.
Claims
1. A method for identifying intentions in multi-round dialogues in question and answer, characterized in that: Including the following steps: S1. Obtain the first input text of the current user and label it as input text y1. Filter the words in the input text y1, perform semantic analysis on the filtered input text y1, determine the intent labels corresponding to each word in the input text y1 according to the results of the semantic analysis, and determine the relevant field corresponding to the input text y1 according to the intent labels; S2. Obtain the second input text of the current user and label it as input text y2. Obtain the relevant field corresponding to the input text y2. Calculate the similarity between the input text y2 and the input text y1 according to the relevant field. If the similarity is greater than or equal to the preset similarity threshold, rewrite the input text y2 through the preset LLM model and the input text y1, and determine the synthesized text Y1 according to the results of the text rewriting, and reply to the synthesized text Y1; S3. Obtain the third input text of the current user and label it as input text y3. Obtain the relevant field corresponding to the input text y3. Calculate the similarity between the input text y3 and the synthesized text Y1 according to the relevant field; If the similarity is greater than or equal to the similarity threshold, rewrite the input text y3 through the preset LLM model and the synthesized text Y1, and determine the synthesized text Y2 according to the results of the text rewriting, and reply to the synthesized text Y2.
2. The method for identifying intentions in multi-round dialogues in question and answer according to claim 1, characterized in that: In the S1, the specific process of word filtering is as follows: Remove the special characters in the text through regular expressions and replace the special characters with blank strings. The special characters include punctuation marks and special control characters; use a predefined stop word list to remove the stop words in the text. The stop words include "de", "shi", and "le".
3. The method for identifying intentions in multi-round dialogues in question and answer according to claim 1, characterized in that: In the S2, the following steps are further included: If the similarity is less than the preset similarity threshold, directly reply to the input text y2.
4. The method for identifying intentions in multi-round dialogues in question and answer according to claim 1, characterized in that: In the S2, the specific process of determining the synthesized text Y1 is as follows: S11. Obtain all the results of text rewriting and label them as hypothesis texts b1, b2,..., ba, where a is a positive integer. Select any hypothesis text and reply to it to obtain the hypothesis text reply corresponding to the hypothesis text, and obtain all the hypothesis text replies and label them as h1, h2,..., ha; S12. Obtain the non-numerical data of any hypothesis text reply, encode the non-numerical data to obtain numerical data, convert the encoded hypothesis text reply into several feature vectors, and generate the feature set of each hypothesis text reply; calculate the Euclidean distance I between all the feature sets, use the Euclidean distance I as the similarity metric for K-means clustering, and obtain the target category cluster; S13. Take any feature set in the target category cluster as the center, calculate the aggregation degree of the feature set and label it as DP, and calibrate the hypothesis text corresponding to the feature set with the smallest DP value as the synthesized text Y1; The calculation formula of DP is: ; where z is the number of feature sets in the target category cluster, z0 is the central feature set point, and v0 is the other feature set points in the target category cluster.
5. The method for identifying intentions in multi-round dialogues in question and answer according to claim 1, characterized in that: In the S3, the following steps are further included: If the similarity is less than the similarity threshold, perform the following steps: S21, calculating the similarity X1 between the input text y3 and the input text y1, and calculating the similarity X2 between the input text y3 and the input text y2; S22, calculating the difference between the similarity X1 and the similarity X2, if the difference is greater than 0, rewriting the input text y3 by using the LLM model and the input text y1, and determining the synthetic text Y3 according to the result of the text rewriting, and replying to the synthetic text Y3; If the difference is less than 0, the input text y3 is rewritten by using the LLM model and the input text y2, and a synthetic text Y4 is determined according to the result of the text rewriting, and the synthetic text Y4 is replied; If the difference is equal to 0, the input text y3 is rewritten through the LLM model, the input text y1 and the input text y2, and the synthetic text Y5 is determined according to the result of the text rewriting, and the synthetic text Y5 is replied.
6. The method for identifying intentions in multi-round dialogues in question and answer according to claim 1, characterized in that: In S1, the specific process of determining the relevant field corresponding to the input text y1 according to the intention label is as follows: Establish a database, which stores the intention labels of the marked fields. The intention labels are related to several fields at the same time, generate the relevance p of the intention labels to different fields, summarize all the words in the input text y1 as corresponding intention labels, count the relevance p1, p2, ..., pq of the intention labels involved in any field and calculate them according to the calculation formula The total relevance x of the field is calculated. If the total relevance x is greater than or equal to a preset threshold, the field is marked as the relevant field corresponding to the input text y1; if the total relevance x is less than the preset threshold, the field is not marked as the relevant field corresponding to the input text y1.
7. The method for identifying intentions in multi-round dialogues in question and answer according to claim 1, characterized in that: In S2, the specific calculation process of the similarity is: obtain the relevant fields corresponding to the input text y2 and the input text y1, and then obtain all overlapping relevant fields and mark them as L1, L2, ..., LN, and the calculation formula is The similarity C is calculated, where M is the number of related fields corresponding to the input text y1, and N is the number of overlapping related fields.
Citation Information
Patent Citations
Label extraction method based on short text clustering technology
CN111414479A
Multi-round dialogue generation method and device for chat robot and chat robot
CN112231457A
Intention recognition method and device, electronic equipment and readable storage medium
CN115186071A
Conversation interaction processing method and device, terminal equipment and storage medium
CN118069813A
Multi-source and multi-mode fused knowledge reasoning method, system and device and medium
CN119005340A