Question and answer intention recognition method and device and related equipment
Through multimodal data processing and time decay function screening historical Q&A data, combined with multi-label classification model, the accuracy of the generative Q&A model in the legal field is solved, and higher accuracy and interpretability of intention recognition are achieved.
Patent Information
- Application Number
- CN202510540940.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-08-22
AI Technical Summary
The existing generative question-and-answer model has hallucination problems, information redundancy, loss of timing relationships and weak entity correlation in the legal field, resulting in poor accuracy.
The current problem is obtained through multimodal data processing, and historical Q&A with low feature similarity below the threshold and low correlation of time decay is removed. The pre-trained multi-label classification model is used for intention recognition, and combined with attention feature extraction and entity recognition, intent recognition results are generated.
It significantly improves the accuracy of legal intention recognition, solves the shortcomings of traditional question-and-answer systems for context splicing methods, and provides higher interpretability and accuracy.
Smart Images

Figure CN120523901A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of artificial intelligence technology, and in particular to a method, apparatus, and related equipment for identifying question and answer intentions. Background Art
[0002] In the fields of modern information retrieval and intelligent question answering, with the rapid development of big data and artificial intelligence technologies, intelligent question answering systems have gained widespread application. Large language models have demonstrated outstanding performance in a variety of natural language processing (NLP) tasks, such as question answering, machine translation, and text generation. By training large language models with specialized knowledge corpora, they are able to understand complex user questions and provide effective responses. However, they also suffer from issues such as hallucinations and poor interpretability. Furthermore, applying large models to business areas with high accuracy requirements presents even greater challenges, such as ensuring legal timeliness and ensuring the logic and accuracy of knowledge reasoning.
[0003] At present, generative question-answering models generally have hallucination problems. The generated answer texts usually lack detailed explanations and basis, and there may be cases of fabricated answers. They are difficult to meet the requirements for professionalism and accuracy of generated content in question-answering scenarios, and have poor interpretability.
[0004] Existing methods simply concatenate the semantic vectors of historical conversations and current questions, which has the following problems:
[0005] Information redundancy: Historical conversations may contain irrelevant content, causing noise interference.
[0006] Temporal relationship loss: Simple splicing does not consider the temporal dependencies of the conversation context.
[0007] Weak entity association: The legal entity association in the context is not explicitly modeled. Summary of the Invention
[0008] The embodiments of the present invention provide a method, apparatus, and related equipment for identifying question and answer intent, aiming to solve the problem of poor accuracy in identifying question intent in existing legal question systems.
[0009] In a first aspect, an embodiment of the present invention provides a method for identifying question-answering intentions, comprising:
[0010] Obtaining a current question through multimodal data processing, and obtaining several rounds of historical question-and-answer data from a cache database, wherein the historical question-and-answer data includes multiple historical question-and-answer pairs;
[0011] Perform feature encoding on the current question and the historical question-and-answer data, and calculate the feature similarity between the current question and each round of historical question-and-answer pairs according to a preset similarity function, filter out historical questions and answers with feature similarity lower than a preset similarity threshold, and obtain a candidate question-and-answer set;
[0012] Calculating the time decay correlation of each round of historical question-answer pairs in the candidate question-answer set according to a preset time decay function, and annotating the corresponding historical question-answer pairs in the candidate question-answer set based on all time decay correlations to obtain an input data set;
[0013] The input data set is input into the pre-trained multi-label classification model for intent recognition to obtain the intent recognition result.
[0014] Optionally, the feature encoding of the current question and the historical question and answer data includes:
[0015] Input the current question and the historical question-answer data into a preset hybrid model to perform multi-level attention feature extraction, and aggregate the extracted attention features layer by layer to obtain the global feature vector of the current question and the global feature vector of each round of historical question-answer pairs;
[0016] Input the current question and the historical question-answer data into a preset entity recognition model to perform legal entity recognition, thereby obtaining a set of legal entities for the current question and each round of historical question-answer pairs;
[0017] Each of the legal entity sets is encoded to generate a corresponding entity vector.
[0018] Optionally, calculating the feature similarity between the current question and each round of historical question-answer pairs according to a preset similarity function includes:
[0019] Calculating the similarity between the global feature vector of the current question and the global feature vector of each round of historical question-answer pairs in the data set to obtain a first similarity set;
[0020] Calculate the similarity between the entity vector of the current question and the entity vector of each round of historical question-answer pairs to obtain a second similarity set;
[0021] A weighted sum is performed on the first similarity set and the second similarity set to calculate the feature similarity between the current question and each round of historical question-answer pairs, thereby obtaining a feature similarity set between the current question and all historical question-answer pairs.
[0022] Optionally, the step of filtering out historical questions and answers whose feature similarity is lower than a preset similarity threshold includes:
[0023] Based on the feature similarity set and the similarity threshold, determining a feature similarity in the feature similarity set that is less than the similarity threshold as a low similarity;
[0024] The historical question-answer pairs corresponding to the low similarity are removed, and the historical question-answer data corresponding to the remaining feature similarities are retained.
[0025] Optionally, calculating the time decay correlation of each round of historical question-answer pairs in the candidate question-answer set according to a preset time decay function includes:
[0026] Obtain the timestamp of each historical question-answer pair in the candidate question-answer set, and calculate the interval between the timestamp corresponding to each historical question-answer pair and the timestamp corresponding to the current question;
[0027] The time decay correlation of all historical question-answer pairs in the candidate question-answer set is calculated based on the interval time and the time decay function.
[0028] Optionally, after calculating the time decay correlation of all historical question and answer data in the candidate question and answer set based on the interval time and the time decay function, the method further includes:
[0029] Obtaining a preset decay threshold, and determining the magnitude relationship between the time decay correlation of all historical question-answer pairs in the candidate question-answer set and the decay threshold;
[0030] According to the size relationship, low-correlation question-answer pairs whose time decay correlation is less than the decay threshold are determined, and the low-correlation question-answer data are removed.
[0031] Optionally, obtaining the current problem through multimodal data processing includes:
[0032] Acquire voice data of the current question, and identify the current question in the voice data using a preset voice recognition model;
[0033] Alternatively, image data of the current question is obtained, and the current question in the image data is identified using OCR technology;
[0034] Alternatively, multimodal data of the current problem is obtained, the multimodal data is extracted using a pre-trained multimodal fusion model to obtain multimodal fusion features, and semantic recognition is performed based on the multimodal fusion features to obtain the current problem.
[0035] In a second aspect, an embodiment of the present invention provides a question-answering intention recognition device, comprising:
[0036] The multimodal data processing module is used to obtain the current question through multimodal data processing and obtain several rounds of historical question and answer data from the cache database;
[0037] A filtering module is used to perform feature encoding on the current question and the historical question-answer data, and calculate the feature similarity between the current question and each round of historical question-answer pairs according to a preset similarity function, and filter out historical questions and answers with feature similarity below a preset similarity threshold to obtain a candidate question-answer set;
[0038] A correlation calculation module is used to calculate the time decay correlation of each round of historical question and answer pairs in the candidate question and answer set according to a preset time decay function, and to mark the corresponding historical question and answer pairs in the candidate question and answer set based on all time decay correlations to obtain an input data set;
[0039] The intent recognition module is used to input the input data set into the pre-trained multi-label classification model for intent recognition and obtain the intent recognition result.
[0040] In a third aspect, an embodiment of the present invention further provides a computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the question-and-answer intention recognition method described in the first aspect when executing the computer program.
[0041] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the question-and-answer intention recognition method described in the first aspect above.
[0042] The embodiment of the present invention provides a question and answer intention recognition method, device and related equipment. The method obtains the current question through multimodal data processing, and obtains several rounds of historical question and answer data from the cache database; performs feature encoding on the current question and the historical question and answer data, and calculates the feature similarity between the current question and each round of historical question and answer pairs according to a preset similarity function, screens out historical questions and answers with feature similarity lower than a preset similarity threshold, and obtains a candidate question and answer set; calculates the time decay correlation of each round of historical question and answer pairs in the candidate question and answer set according to a preset time decay function, and labels the corresponding historical question and answer pairs in the candidate question and answer set based on all time decay correlations to obtain an input data set; inputs the input data set into a pre-trained multi-label classification model for intent recognition to obtain an intent recognition result. The method perceives the correlation between historical question and answer data and the current question, solves the shortcomings of the traditional question and answer system for context splicing methods, significantly improves the accuracy of legal intent recognition, and provides technical support for intelligent applications in the legal field. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0044] Figure 1 A flowchart of an embodiment of a method for identifying question and answer intentions provided by an embodiment of the present invention;
[0045] Figure 2 for Figure 1 A schematic diagram of a sub-process of an embodiment of step S120;
[0046] Figure 3 for Figure 1 A schematic diagram of a sub-process of an embodiment of step S130;
[0047] Figure 4 A flowchart of another embodiment of the question-answering intention recognition method provided by an embodiment of the present invention;
[0048] Figure 5 A schematic block diagram of a device for identifying question and answer intentions provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0050] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0051] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the present invention. As used in the specification and appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0052] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0053] See also Figure 1 A flowchart of a question-answering intention recognition method provided in an embodiment of the present invention is provided. The method includes steps S110 to S140.
[0054] Step S110: obtaining the current question through multimodal data processing, and obtaining several rounds of historical question and answer data from the cache database;
[0055] In this embodiment, for obtaining the current question, current questions of different formats are identified through multimodal data processing, including: obtaining the voice data of the current question and identifying the current question in the voice data through a preset voice recognition model (such as the Whisper model); and / or, obtaining the image data of the current question and identifying the current question in the image data through OCR technology; and / or, obtaining the multimodal data of the current question, using a pre-trained multimodal fusion model to extract the multimodal data to obtain multimodal fusion features, and performing semantic recognition based on the multimodal fusion features to obtain the current question. Among them, the Whisper model is a fine-tuned large model that uses Transformers as the basic architecture of its encoder and decoder, and can achieve the lowest word error rate on multiple data sets; OCR technology refers to the process in which an electronic device examines characters printed on paper, determines their shape by detecting dark and light patterns, and then uses character recognition methods to translate the shape into computer text.
[0056] In addition, to improve the recognition of the intent of the current question, several rounds of historical question and answer data are obtained, which can be extracted from the historical question and answer data cached in the local database. The historical question and answer data includes multiple historical question and answer pairs.
[0057] Step S120: Feature encoding is performed on the current question and the historical question-answer data, and the feature similarity between the current question and each round of historical question-answer pairs is calculated according to a preset similarity function. Historical questions and answers with feature similarity below a preset similarity threshold are filtered out to obtain a candidate question-answer set.
[0058] In this embodiment, in order to calculate the similarity between the current question and each round of historical question-answer pairs, a hierarchical Transformer is introduced after the Bert model encoding based on the attention mechanism, resulting in a hybrid model based on Bert encoding and hierarchical Transformer. The model extracts the hierarchical semantics of the historical question-answer data through a progressive fusion strategy, aggregates sentence-level vectors layer by layer, and extracts the global semantic representation of the current question and historical question-answer data. The hybrid model structure includes:
[0059] 1. Input representation layer:
[0060] Current question: Q current =[q1,q2,...,q m ];
[0061] History question and answer pair: H=[(A1,R)1,(A2,R2,...,(A n ,R n )];
[0062] 2. Bert encoding layer:
[0063] Encode the current question and each historical question-answer pair separately:
[0064] E Q =Bert(Q current )∈R m×d ,
[0065]
[0066]
[0067] Pooling is performed on each historical question-answer pair (e.g., CLS tagging):
[0068]
[0069] 3. Hierarchical Transformer encoding layer:
[0070] First layer: historical context encoding
[0071] H (1) =TransformerBlock1([h1;h2;...;h n ])∈R n×2d ,
[0072] Second layer: global semantic aggregation
[0073] H (2) =TransformerBlock2(H (1) )∈R n×2d ,
[0074] h global =MeanPool(H (2) )∈R 2d ,
[0075] 4. Cross-Attention Mechanism:
[0076] Interact with the current problem and the global history representation:
[0077] E′ Qcurrent =MultiHeadAttn(Q current =E Qcurrent ,K=V=h global )∈R m×d ,
[0078] e final =Concat(MeanPool(E′ Qcurrent ),h global )∈R 3d ,
[0079] 5. Output layer:
[0080] Design a classifier or generator based on the task:
[0081] y=Softmax(W out e final +b out ).
[0082] Parameter Description:
[0083]
[0084] The current question Q current and historical question-answering data H = [(A1, R1), (A2, R2), ..., (A n ,R n )] (A represents the question, R represents the answer) Input the hybrid model to extract multi-level attention features, and aggregate the extracted attention features layer by layer to obtain the current question Q current The global feature vector and each round of historical question and answer A i / R i The global eigenvector of , that is:
[0085] The global feature vector of each round of historical question answering is Then the global eigenvector of historical question-answering data is: v history =[v1,v2,...,v n ], where v n Represents the features of the nth historical question-answer pair;
[0086] The global eigenvector of the current problem is: v current =BERT(Q current );
[0087] Entity recognition models are a core technology in natural language processing (NLP), used to identify entity information such as names of people, places, and organizations in text. Key entity recognition models include rule-based models, statistical learning models (such as hidden Markov models and conditional random fields), and deep learning models (such as BiLSTM (bidirectional long short-term memory), BiLSTM-CRF (a combination of bidirectional long short-term memory and conditional random fields), and BERT). Deep learning-based models can automatically extract features by learning from large amounts of text data, avoiding complex feature engineering and significantly improving entity recognition. Specifically, Transformer-based models, with the rise of pre-trained language models such as BERT, RoBERTa, and GPT, have learned rich language representations through pre-training on large-scale corpora, significantly improving the performance of downstream tasks such as entity recognition. The advantage of these models lies in their ability to capture deep semantic information in text while also leveraging prior knowledge from pre-trained corpora to achieve better entity recognition results. To further improve the accuracy of feature comparison, we also need to extract entities from the current question and each round of historical question-answer pairs. Specifically, we use the entity recognition model to extract legal entities from the current question and each round of historical question-answer pairs in the historical question-answer data, and construct an entity set for the current question and historical question-answer data:
[0088] X={x current ,x1,x2,...,x n}, where x current ,x1,x2,...,x n are all entity sets, x current Represents the entity set of the current problem, x1,x2,...,x n Represents the entity set of each round of historical question-answer pairs in the historical question-answer data;
[0089] Encode the entity set of each round of historical question-answer pairs of the current question and historical question-answer data to generate the corresponding entity vector
[0090] In one embodiment, if Figure 2 As shown, step S120 includes:
[0091] Step S210: Calculate the similarity between the global feature vector of the current question and the global feature vectors of each round of historical question-answer pairs in the data set to obtain a first similarity set;
[0092] Step S220: Calculate the similarity between the entity vector of the current question and the entity vectors of each round of historical question-answer pairs to obtain a second similarity set;
[0093] Step S230: Perform a weighted summation on the first similarity set and the second similarity set, calculate the feature similarity between the current question and each round of historical question-answer pairs, and obtain a feature similarity set between the current question and all historical question-answer pairs.
[0094] In this embodiment, the similarity function is defined as the dot product similarity, and the formula is Similarity=v current ·v n , calculate the attention feature v of the current question current The global feature vector v corresponding to each round of historical question-answer pairs history =[v1,v2,...,v n ], and obtain the first similarity set: S=[s1,s2,...,s n ], where s n The attention feature v representing the current question current The attention feature v corresponding to the nth historical question-answering data n similarity.
[0095] And, calculate the entity vector of the current problem Entity vector corresponding to each round of historical question-answer pairs The similarity of s1′, s′2, ..., s′ is obtained as follows: n ], where s′n represents the entity vector of the current problem Attention features corresponding to the nth historical question-answer data similarity.
[0096] Finally, based on the weighted sum of the first similarity and the second similarity, the feature similarity between the current question and each round of historical question-answer pairs is obtained:
[0097] S final =α[s1,s2,...,s n ]+β[s1′,s′2,...,s′ n ], where α and β represent weight coefficients respectively. A large amount of experimental data shows that the dot product similarity function can achieve efficient calculation and more accurate similarity calculation in calculating the similarity of feature vectors output by the Bert model.
[0098] In one embodiment, step S120 includes:
[0099] Step S121: Based on the feature similarity set and the similarity threshold, determine the feature similarity in the feature similarity set that is smaller than the similarity threshold as a low similarity;
[0100] Step S122: remove the historical question-answer pairs corresponding to the low similarity, and retain the historical question-answer pairs corresponding to the remaining feature similarities.
[0101] In this embodiment, since irrelevant content may exist in the historical question and answer data, resulting in noise interference in the data, similarity judgment is performed based on feature similarity and a preset similarity threshold. If the feature similarity is lower than the similarity threshold, it indicates that the corresponding historical question and answer pair has a low correlation with the current question. This type of data can be removed, and the historical question and answer pairs with feature similarity greater than the similarity threshold are retained to obtain a candidate question and answer set to reduce information redundancy.
[0102] Step S130: Calculate the time decay correlation of each round of historical question-answer pairs in the candidate question-answer set according to a preset time decay function, and annotate the corresponding historical question-answer pairs in the candidate question-answer set based on all time decay correlations to obtain an input data set;
[0103] In this example, a time-decay function is introduced to account for the temporal nature of historical question-and-answer data and the current question. This function calculates the time-decayed correlation between each historical question-and-answer pair in the candidate question-and-answer set and the current question. To facilitate determining the correlation between each historical question-and-answer pair in the candidate question-and-answer set and the current question, the corresponding historical question-and-answer pairs in the candidate question-and-answer set are annotated based on all time-decayed correlations, yielding the input dataset for intent recognition.
[0104] In one embodiment, if Figure 3 As shown, step S130 includes:
[0105] Step S310: Obtain the timestamp of each historical question-answer pair in the candidate question-answer set, and calculate the interval between the timestamp corresponding to each historical question-answer pair and the timestamp corresponding to the current question;
[0106] Step S320: Calculate the time decay correlation of all historical question-answer pairs in the candidate question-answer set based on the interval time and the time decay function.
[0107] In this embodiment, the process of calculating the time decay correlation is as follows:
[0108] The candidate question-answer sets are:
[0109] Q1: "How do I file for divorce?", A1: "I need to prepare a complaint and marriage certificate...", t1: "2023-10-05 10:00:00";
[0110] Q2: "What evidence is required to file for divorce?" A2: "Evidence of a breakdown in the relationship is required...", t2: "2023-10-01 09:00:00";
[0111] The current question is: Q: "What materials are needed for property division after divorce?", T: "2023-10-05 14:00:00";
[0112] Among them, t1, t2, and T represent timestamps. The interval between the historical question-answer pair Q1 and the current question Q is 4 hours, and the interval between the historical question-answer pair Q2 and the current question Q is 96 hours. Define the time decay function a i =e -λ·Δti , where Δt i It represents the interval time between the historical question and answer pairs and the current question, and λ represents the decay rate coefficient, which can be adjusted according to actual conditions.
[0113] When the decay rate coefficient λ=0.1, then:
[0114] The time-decayed correlation between the historical question-answer pair Q1 and the current question Q is: a1 = e -0.1×4 ≈0.67;
[0115] The time-decayed correlation between the historical question-answer pair Q2 and the current question Q is: a2 = e -0.1×96 ≈0.0002.
[0116] In one embodiment, if Figure 4 As shown, after step S130, the following steps are included:
[0117] Step S410: Obtain a preset decay threshold, and determine the magnitude relationship between the time decay correlation of all historical question-answer pairs in the candidate question-answer set and the decay threshold;
[0118] Step S420: Determine, based on the size relationship, low-correlation question-answer pairs whose time-decay correlation is less than the decay threshold, and remove the low-correlation question-answer data.
[0119] In this embodiment, the judgment is made based on the length of the interval time. The longer the interval time, the lower the correlation between the historical question and answer data and the current question, resulting in noise interference in the data in the candidate question and answer set. Therefore, the judgment is made based on the time decay correlation and the preset decay threshold. If the time decay correlation is lower than the decay threshold, it indicates that the corresponding historical question and answer pair has a low correlation with the current question. Such historical question and answer pairs can be removed, and historical question and answer pairs with time decay correlation greater than the decay threshold are retained to reduce information redundancy.
[0120] Step S140: Input the input data set into the pre-trained multi-label classification model to perform intent recognition and obtain an intent recognition result.
[0121] In this embodiment, a multi-label classification model is pre-tuned to effectively handle the diversity and overlap of legal intent. This model supports the output of probabilities for multiple intent labels and uses a probability threshold to filter the final intent combination. For example, a multi-label classification model is constructed using a BERT+ classification head. The model structure consists of an input layer, a feature extraction layer (fully connected layer with ReLU activation function), and a classification layer (fully connected layer with Sigmoid activation).
[0122] In one embodiment, the annotated dataset used in the fine-tuning process is as follows:
[0123] Q: "What documents are needed for property division after divorce?"
[0124] Q1: "How do I file for divorce?", A1: "I need to prepare a complaint and marriage certificate...", [Time Decay Correlation]:;
[0125] Q2: "What evidence is needed to file for divorce?" A2: "Evidence of a breakdown in the relationship is required...", [Time Decay Correlation]:.
[0126] The corresponding label set is ["divorce", "property division"].
[0127] Fine-tune the multi-label classification model based on the labeled dataset, calculate the model loss between the output results of the multi-label classification model and the corresponding actual labels, and use the binary cross entropy loss function to calculate the model loss. Then, backpropagate the loss function to optimize the model parameters of the multi-label classification model.
[0128] This method obtains the current question through multimodal data processing and obtains several rounds of historical question and answer data from a cache database; performs feature encoding on the current question and historical question and answer data, and calculates the feature similarity between the current question and each round of historical question and answer pairs based on a preset similarity function, filtering out historical questions and answers with feature similarity below a preset similarity threshold to obtain a candidate question and answer set; calculates the time decay correlation of each round of historical question and answer pairs in the candidate question and answer set based on a preset time decay function, and annotates the corresponding historical question and answer pairs in the candidate question and answer set based on all time decay correlations to obtain an input data set; inputs the input data set into a pre-trained multi-label classification model for intent recognition, obtaining an intent recognition result. This method perceives the correlation between historical question and answer data and the current question, addresses the shortcomings of traditional question and answer systems in context splicing methods, significantly improves the accuracy of legal intent recognition, and provides technical support for intelligent applications in the legal field.
[0129] The embodiment of the present invention further provides a question-answering intention recognition device, which is used to execute any embodiment of the above-mentioned question-answering intention recognition method. Figure 5 , Figure 51 is a schematic block diagram of a question-answering intention recognition apparatus provided by an embodiment of the present invention. The question-answering intention recognition apparatus 100 can be configured in a server.
[0130] like Figure 5 As shown, the question-answering intention recognition device 100 includes a multimodal data processing module 110 , a filtering module 120 , a correlation calculation module 130 , and an intention recognition module 140 .
[0131] A multimodal data processing module 110 is configured to obtain a current question through multimodal data processing and obtain several rounds of historical question-answer data from a cache database, wherein the historical question-answer data includes multiple historical question-answer pairs;
[0132] A filtering module 120 is configured to perform feature encoding on the current question and the historical question-and-answer data, calculate the feature similarity between the current question and each round of historical question-and-answer pairs based on a preset similarity function, and filter out historical questions and answers with feature similarity below a preset similarity threshold to obtain a candidate question-and-answer set.
[0133] A correlation calculation module 130 is configured to calculate the time decay correlation of each round of historical question-answer pairs in the candidate question-answer set according to a preset time decay function, and to annotate the corresponding historical question-answer pairs in the candidate question-answer set based on all the time decay correlations to obtain an input data set;
[0134] The intention recognition module 140 is used to input the input data set into the pre-trained multi-label classification model to perform intention recognition and obtain an intention recognition result.
[0135] In one embodiment, the filtering module 120 includes:
[0136] An attention feature extraction unit is used to input the current question and the historical question and answer data into a preset hybrid model to perform multi-level attention feature extraction, and aggregate the extracted attention features layer by layer to obtain a global feature vector for the current question and a global feature vector for each round of historical question and answer pairs;
[0137] An entity recognition unit is used to input the current question and the historical question and answer data into a preset entity recognition model for entity recognition, thereby obtaining an entity set of the current question and each round of historical question and answer pairs;
[0138] The entity encoding unit is used to encode each of the legal entity sets to generate a corresponding entity vector.
[0139] In one embodiment, the filtering module 120 includes:
[0140] A first similarity calculation unit is configured to calculate the similarity between the global feature vector of the current question and the global feature vectors of each round of historical question-answer pairs in the data set to obtain a first similarity set;
[0141] A second similarity calculation unit is used to calculate the similarity between the entity vector of the current question and the entity vector of each round of historical question-answer pairs to obtain a second similarity set;
[0142] A weighted summation unit is used to perform weighted summation on the first similarity set and the second similarity set, calculate the feature similarity between the current question and each round of historical question-answer pairs, and obtain a feature similarity set between the current question and all historical question-answer pairs.
[0143] In one embodiment, the filtering module 120 includes:
[0144] a similarity comparison unit, configured to determine, based on the feature similarity set and the similarity threshold, a feature similarity in the feature similarity set that is smaller than the similarity threshold as a low similarity;
[0145] The removal unit is used to remove the historical question-answer pairs corresponding to the low similarity and retain the historical question-answer pairs corresponding to the remaining feature similarities.
[0146] In one embodiment, the correlation calculation module 130 includes:
[0147] An interval time calculation unit, configured to obtain the timestamp of each historical question-answer pair in the candidate question-answer set, and calculate the interval time between the timestamp corresponding to each historical question-answer pair and the timestamp corresponding to the current question;
[0148] A decay correlation calculation unit is used to calculate the time decay correlation of all historical question-answer pairs in the candidate question-answer set based on the interval time and the time decay function.
[0149] In one embodiment, the question-answering intention recognition apparatus 100 further includes:
[0150] A comparison module, configured to obtain a preset decay threshold and determine the magnitude relationship between the time decay correlation of all historical question-answer pairs in the candidate question-answer set and the decay threshold;
[0151] A screening module is used to determine, based on the size relationship, low-correlation question-answer pairs whose time decay correlation is less than the decay threshold, and remove the low-correlation question-answer data.
[0152] In one embodiment, the multimodal data processing module 110 further includes:
[0153] A semantic recognition unit, configured to obtain voice data of a current question and recognize the current question in the voice data using a preset voice recognition model;
[0154] An image recognition unit, configured to obtain image data of a current question and identify the current question in the image data using OCR technology;
[0155] The multimodal processing unit is used to obtain multimodal data of the current problem, extract the multimodal data using a pre-trained multimodal fusion model to obtain multimodal fusion features, and perform semantic recognition based on the multimodal fusion features to obtain the current problem.
[0156] An embodiment of the present invention also provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the question-and-answer intention recognition method as described above when executing the computer program.
[0157] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the above-described question-answering intent recognition method.
[0158] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0159] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, or units with the same function may be combined into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or units, or may be an electrical, mechanical or other form of connection.
[0160] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the objectives of the embodiments of the present invention.
[0161] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0162] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk.
[0163] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and such modifications or substitutions are intended to be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.
Claims
1. Question-answering intention recognition method, characterized by: include: Obtaining a current question through multimodal data processing, and obtaining several rounds of historical question-and-answer data from a cache database, wherein the historical question-and-answer data includes multiple historical question-and-answer pairs; Perform feature encoding on the current question and the historical question-and-answer data, and calculate the feature similarity between the current question and each round of historical question-and-answer pairs according to a preset similarity function, filter out historical questions and answers with feature similarity lower than a preset similarity threshold, and obtain a candidate question-and-answer set; Calculating the time decay correlation of each round of historical question-answer pairs in the candidate question-answer set according to a preset time decay function, and annotating the corresponding historical question-answer pairs in the candidate question-answer set based on all time decay correlations to obtain an input data set; The input data set is input into the pre-trained multi-label classification model for intent recognition to obtain the intent recognition result.
2. The question-answering intention recognition method according to claim 1, characterized in that: The feature encoding of the current question and the historical question-and-answer data includes: Input the current question and the historical question-answer data into a preset hybrid model to perform multi-level attention feature extraction, and aggregate the extracted attention features layer by layer to obtain the global feature vector of the current question and the global feature vector of each round of historical question-answer pairs; Input the current question and the historical question-answer data into a preset entity recognition model for entity recognition, and obtain an entity set of the current question and each round of historical question-answer pairs; Each entity set is encoded to generate a corresponding entity vector.
3. The question-answering intention recognition method according to claim 2, characterized in that: The calculation of the feature similarity between the current question and each round of historical question-answer pairs based on a preset similarity function includes: Calculating the similarity between the global feature vector of the current question and the global feature vector of each round of historical question-answer pairs in the data set to obtain a first similarity set; Calculate the similarity between the entity vector of the current question and the entity vector of each round of historical question-answer pairs to obtain a second similarity set; A weighted sum is performed on the first similarity set and the second similarity set to calculate the feature similarity between the current question and each round of historical question-answer pairs, thereby obtaining a feature similarity set between the current question and all historical question-answer pairs.
4. The question-answering intention recognition method according to claim 3, characterized in that: The process of filtering out historical questions and answers whose feature similarity is lower than a preset similarity threshold includes: Based on the feature similarity set and the similarity threshold, determining a feature similarity in the feature similarity set that is less than the similarity threshold as a low similarity; The historical question-answer pairs corresponding to the low similarity are removed, and the historical question-answer pairs corresponding to the remaining feature similarities are retained.
5. The question-answering intention recognition method according to claim 1, characterized in that: The calculating the time decay correlation of each round of historical question-answer pairs in the candidate question-answer set according to a preset time decay function includes: Obtain the timestamp of each historical question-answer pair in the candidate question-answer set, and calculate the interval between the timestamp corresponding to each historical question-answer pair and the timestamp corresponding to the current question; The time decay correlation of all historical question-answer pairs in the candidate question-answer set is calculated based on the interval time and the time decay function.
6. The question-answering intention recognition method according to claim 5, characterized in that: After calculating the time decay correlation of all historical question-answer pairs in the candidate question-answer set based on the interval time and the time decay function, the method further includes: Obtaining a preset decay threshold, and determining the magnitude relationship between the time decay correlation of all historical question-answer pairs in the candidate question-answer set and the decay threshold; According to the size relationship, low-correlation question-answer pairs whose time decay correlation is less than the decay threshold are determined, and the low-correlation question-answer data are removed.
7. The question-answering intention recognition method according to claim 1, characterized in that: The obtaining of the current problem through multimodal data processing includes: Acquire voice data of the current question, and identify the current question in the voice data using a preset voice recognition model; Alternatively, image data of the current question is obtained, and the current question in the image data is identified using OCR technology; Alternatively, multimodal data of the current problem is obtained, the multimodal data is extracted using a pre-trained multimodal fusion model to obtain multimodal fusion features, and semantic recognition is performed based on the multimodal fusion features to obtain the current problem.
8. A question-answering intention recognition device, characterized in that: include: A multimodal data processing module, configured to obtain a current question through multimodal data processing and obtain several rounds of historical question-and-answer data from a cache database, wherein the historical question-and-answer data includes multiple historical question-and-answer pairs; A filtering module is used to perform feature encoding on the current question and the historical question-answer data, and calculate the feature similarity between the current question and each round of historical question-answer pairs according to a preset similarity function, and filter out historical questions and answers with feature similarity below a preset similarity threshold to obtain a candidate question-answer set; A correlation calculation module is used to calculate the time decay correlation of each round of historical question and answer pairs in the candidate question and answer set according to a preset time decay function, and to mark the corresponding historical question and answer pairs in the candidate question and answer set based on all time decay correlations to obtain an input data set; The intent recognition module is used to input the input data set into the pre-trained multi-label classification model for intent recognition and obtain the intent recognition result.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the question-answering intention recognition method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to execute the question-and-answer intention recognition method according to any one of claims 1 to 7.