Intelligent question answering method based on multi-view answer representation
Through the multi-view intelligent question-and-answer method, combined with the BERT model and graph neural network, the problem of physical word interaction and the professional ability of the answerer in the community question-and-answer system is solved, and the accuracy and generalization ability of answer selection are improved.
Patent Information
- Application Number
- CN202411391532.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-10-08
AI Technical Summary
The existing community question and answer system is difficult to capture the impact of entity word interaction between question text and answer text, as well as the impact of the answer professional ability on answer quality, resulting in poor generalization ability of answer selection.
Using a multi-view-based intelligent question-and-answer method, a question-and-answer working diagram is constructed through BERT model, TextCNN, attention mechanism and graph neural network, a question-and-answer work diagram is integrated into the question description text, the answerer's professional ability and answer information interaction, and the matching score of the answer is calculated.
Improve the accuracy and generalization ability of answer selection, dynamically adjust the answerer's professional ability representation, and enhance the interpretability of the model and the ability to capture the influence of entity words.
Smart Images

Figure CN119166788A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of community question-answering systems, and in particular to an intelligent question-answering method based on multi-view answer representation. Background Art
[0002] With the rapid development of network technology, the way of obtaining information has become more diverse and convenient. As an important online knowledge sharing platform, community question-answering system has gradually attracted widespread attention and use from users. How to select the best answer to a question from many answers has become an important issue in the field of community question-answering.
[0003] Answer selection methods are mainly divided into feature engineering-based methods and deep learning-based methods. Among them, feature engineering-based methods rely on manually extracted features, such as word frequency, TF-IDF, n-gram, etc., and then use traditional machine learning algorithms for classification or regression to select the best answer, but this method is difficult to capture complex semantic information and has poor generalization ability. Deep learning-based methods can automatically learn the potential features in text data through neural network models, especially through pre-trained models, which can handle complex semantic relationships in natural language.
[0004] At present, few methods focus on the fact that when answerers publish answers, they will be affected by the entity words in the question and the existing answers under the question, which affects the quality of the answers published by the answerers. However, in practice, when answerers browse questions, they will not only pay attention to the overall semantics of the question, but also focus on the keywords in the question. Answerers often state their answers around the question vocabulary they are interested in. When answerers browse the existing answers under the question, they will understand and summarize the existing answers based on their professional ability to the question. The higher the answerer's professional ability to the question, the higher the understanding of the background knowledge of the high-quality answers and the terms in the answer text. Finally, the answerer publishes the answer based on the understanding of the existing answers and his own professional ability. Therefore, how to capture the fine-grained interaction between the question text and the answer text based on entity words and the information interaction between answers under the same question is a difficulty in the answer selection task. Summary of the invention
[0005] In order to overcome the shortcomings of the prior art, the present invention provides an intelligent question answering method based on multi-view answer representation, in order to mine the interactive influence of entity words in the question text and the entity words in the answer text, and the influence of the answers published first under the question on the answers published later, so as to accurately recommend the answer that has the highest degree of match with the question.
[0006] In order to achieve the above-mentioned purpose, the present invention adopts the following technical scheme:
[0007] The intelligent question answering method based on multi-view answer representation of the present invention is characterized in that it is performed according to the following steps:
[0008] Step 1: Build and preprocess question-answer data;
[0009] Collect question-and-answer data, including questions, answers, and their respondents. Questions include question category, question topic, and question body. Answers include answer body, release time of each answer, and real evaluation labels.
[0010] Any question in the question-answering data After all the corresponding answers are arranged according to the release time, the question is obtained Corresponding answer text set ;in, Representation problem No. The answer text after arrangement, Representation problem The total number of answers to the question The question topic is recorded as ; The problem The corresponding The set of respondents is denoted as ,in, express of the respondents;
[0011] Step 2: Build a text encoding module to encode the question topic and Problems After splicing the question text, we get the question Description text Then, use the BERT model to obtain the questions Description text The word vector matrix and sentence vector ,question No. The answer text after sorting The word vector matrix and sentence vector And the respondent Documentation The word vector matrix ;
[0012] Step 3: Construct the respondent professional ability representation module, including: TextCNN network and attention mechanism module, and use it to and Process and get the answer Questions Expression of professional ability ;
[0013] Step 4: Construct an LSTM module based on the attention mechanism and use it to and Processing, the result is Answer text The answer information interaction representation ;
[0014] Step 5: Construct an answer representation module based on the question description text sentence vector and use it to calculate With answer text No. Word vectors of word segments Match score , reuse Function answer text of The matching scores of the word segments are normalized to obtain No. Word vectors of word segments The weight value , thus answering the text of The word vector matrix of word segmentation Perform weighted aggregation to obtain Representation based on sentence vector of question description text ;
[0015] Step 6: Construct an answer representation module based on the question-answering work graph and use it to build Corresponding question-answering work subgraph and question and answer work map , thus obtaining Question-answer-based work map Representation ;
[0016] Step 7: Construct the answer representation fusion module to analyze the question-answering graph. Representation , Representation based on question description text sentence vector Representation of interaction with answer information Perform splicing and fusion to obtain Multi-view based representation ;
[0017] Step 8: Construct a prediction module and use it for multi-view representation , Respondent Questions Expression of professional ability and Problems Description text Sentence vector Fusion of information to predict problems and Answer text Match score ;
[0018] Step 9. Use the gradient descent method to train the intelligent question-answering network composed of a text encoding module, a respondent professional ability representation module, an LSTM module based on an attention mechanism, an answer representation module based on a question description text sentence vector, an answer representation module based on a question-answering work graph, an answer representation fusion module, and a prediction module. Calculate the cross-entropy loss value based on the true evaluation label and the predicted evaluation label to update the network parameters. Stop training when the cross-entropy loss value converges or the number of training times reaches a predetermined threshold, thereby obtaining the optimal intelligent question-answering model, which is used to predict the best answer to each input question.
[0019] The intelligent question answering method based on multi-view answer representation described in the present invention is also characterized in that step 2 is performed according to the following steps:
[0020] Step 2.1: Use the word segmenter to After word segmentation, it is converted into questions The text sequence is input into the BERT model for processing to obtain the question Description text The word vector matrix ,in, express After the participle The vector corresponding to the word segmentation, express Length;
[0021] Will The vector corresponding to the token [CLS] in the question Description text Sentence vector ;
[0022] Step 2.2: Use the word segmenter to check the answer text After word segmentation, it is converted into The text sequence is input into the BERT model for processing to obtain The word vector matrix ,in, express After the participle The vector corresponding to the word segmentation, express Length;
[0023] Will The vector corresponding to the token [CLS] in the answer is the answer text. Sentence vector ;
[0024] Step 2.3: According to the problem Question categories, get the answerer from the question and answer data Answers to other questions in the same question category are concatenated into the first Respondents Documentation ,in, express The words, express Length;
[0025] Using the word segmenter After word segmentation, it is converted into The text sequence is input into the BERT model for processing and obtained The word vector matrix .
[0026] Further, step 3 is performed as follows:
[0027] Step 3.1: Processing using the TextCNN network The word vector matrix ,get Vector representation of ,Will and After splicing, we get concatenation vector After that, it is input into the fully connected layer for processing to get the answer Intermediate representation of professional competence , where [ :] represents the concatenation operation and D represents the dimension of the column vector;
[0028] Step 3.2: Use the attention mechanism module to Process and get the answer Questions Professional ability ;
[0029] Step 3.2.1. Copy to dimensions D× Professional Competence Matrix , and then use formula (1) to get and Fusion representation :
[0030] (1)
[0031] In formula (1), express The weight matrix of express The weight matrix of express and The interaction weight matrix, represents the element-wise product of two matrices, is the activation function;
[0032] Step 3.2.2: Use formula (2) to After normalization, the answer is The attention score vector :
[0033] (2)
[0034] In formula (2), express The parameter vector of represents transpose, is the activation function;
[0035] Step 3.2.3. Utilization right After weighting, the respondents Questions Professional ability .
[0036] Further, step 4 is performed as follows:
[0037] Step 4.1, define the total number of time steps as , No. The input of the time step is Answer text Sentence vector , Respondent Questions Professional ability , No. The output of the time step is Answer text Answer information interactive representation ;
[0038] Step 4.2: According to the previous Answer text ,in, Indicates answer text, use formula (3) to calculate the answerer Acquisition and Problems Related information degree :
[0039] (3)
[0040] In formula (3), It is Answer text Respondent Questions an indication of professional competence;
[0041] Step 4.3: Use formula (4) to calculate the front The fusion vector of the interactive representation of the answer information of the answer body :
[0042] (4)
[0043] In formula (4), It is Answer text The interactive representation of answer information;
[0044] Step 4.4: Use equations (5) to (10) to obtain The answer information interaction representation :
[0045] (5)
[0046] (6)
[0047] (7)
[0048] (8)
[0049] (9)
[0050] (10)
[0051] In formula (5) to formula (10), , , , , Respectively represent The input gate, forget gate, output gate, candidate cell state, and cell state of each time step. Indicates The cell state at each time step, represents element-wise product, represents the sigmoid activation function, represents the tanh activation function, , , Represents the input gate The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Represents the input gate The bias vector of , , They represent the forget gate The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Forget gate The bias vector of , , Represents the output gate The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Output gate The bias vector of , , Represents the candidate cell states The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Represents candidate cell states The bias vector of .
[0052] Further, step 6 is performed as follows:
[0053] Step 6.1: Use ConceptNet knowledge graph to and Extract the corresponding entity word sets respectively and and its common additional entity word set ;
[0054] The problem Description text Perform word segmentation, part-of-speech tagging and stemming operations, and identify entity words that match the ConceptNet knowledge graph from the description text after the operation. The entity word set ;
[0055] Will Perform word segmentation, part-of-speech tagging and stemming operations, and identify entity words matching the ConceptNet knowledge graph from the answer text after the operation. The entity word set ;
[0056] Will The entity words in the ConceptNet knowledge graph are connected to adjacent entity word nodes, and The intersection of the adjacent entity word nodes connected in the ConceptNet knowledge graph is taken as The corresponding additional entity word set ;
[0057] Step 6.2: Get from ConceptNet knowledge graph , and The nodes corresponding to each entity word in , and construct Corresponding question-answering work subgraph ;
[0058] Step 6.3: After linear transformation, we get The low-dimensional vector representation of And as a text node, join the question-answering work subgraph and will Respectively and Connect each entity word in to get Corresponding question-answering work diagram ;
[0059] Step 6.4: Add the question-answering work subgraph Any entity word n in After concatenation, we get entity word n and The spliced text ,Will Perform word segmentation and convert into The text sequence is input into the BERT model for processing and obtained The vector representation of each word in , so as to obtain The prediction score for each word in ;
[0060] by The integer identifier of the text sequence is used as the actual label and the cross entropy loss function is used to calculate The difference between the predicted score and the actual label of each word in is used to obtain the loss value of entity word n, and the negative value of the loss value is taken as the score of entity word n. ;
[0061] Step 6.5: Use graph neural network to The embedding representations of all entity word nodes in are iteratively updated and processed using the attention mechanism and The embedding representation of all entity word nodes in the answer text is obtained Question-answer-based work map Representation .
[0062] Further, the step 6.5 is performed as follows:
[0063] Step 6.5.1: Question and answer work map For any entity word node n and its adjacent entity word node s on the , perform one-hot encoding on the node type of the adjacent entity word node s, the node type of the entity word node n, and the edge between the adjacent entity word node s and the entity word node n, and obtain the one-hot encoding representation of the node type of the adjacent entity word node s. , the one-hot encoding representation of the node type of entity word node n , the one-hot encoding representation of the edge between the entity word node n and the adjacent entity word node s , and then use formula (11) to get the relationship type vector representation between entity word node n and adjacent entity word node s :
[0064] (11)
[0065] In formula (11), It is a multi-layer perceptron that obtains the relationship type;
[0066] Use pre-trained vectors to solve the question answering problem The entity word node n and the adjacent entity word node s are represented to obtain the embedded representation of the adjacent entity word node s. and the embedding representation of entity word node n ;
[0067] One-hot encoding representation of the node type of the adjacent entity word node s Perform linear transformation to obtain the vector representation of the node type of the adjacent entity word node s ;
[0068] One-hot encoding representation of the node type of entity word node n Perform linear transformation to obtain the vector representation of the node type of entity word node n ;
[0069] Step 6.5.2, define the current number of iterations as , and initialize =1, let Indicates the maximum number of iterations;
[0070] Step 6.5.3: Use formula (12) to get The message transmitted from the adjacent entity word node s to the entity word node n in the iteration :
[0071] (12)
[0072] In formula (12), Indicates The embedding representation of the adjacent entity word node s in the iteration , It is the message linear layer;
[0073] Step 6.5.4: The score of the adjacent entity word node s and the score of entity word node n Input the node score mapping into the multi-layer perceptron for processing, and get the corresponding Vector representation of and Vector representation of ;
[0074] Step 6.5.5: Use formula (13) to calculate the The query vector of the adjacent entity word node s in the iteration :
[0075] (13)
[0076] In formula (13), is the query vector linear layer;
[0077] Step 6.5.6: Use formula (14) to calculate the The key vector of entity word node n in the iteration :
[0078] (14)
[0079] In formula (14), is the key vector linear layer;
[0080] Step 6.5.7: Calculate using formula (15) The attention weight :
[0081] (15)
[0082] In formula (15), is the neighborhood of the adjacent entity word node s; represents transpose, It is The key vector of entity word node n′ in the iteration;
[0083] Step 6.5.8: Use formula (16) to obtain The embedding representation of entity word node n in the iteration , thus obtaining The embedding representation of entity word node n after iterations :
[0084] (16)
[0085] In formula (16), represents the neighborhood of entity word node n, It is a multi-layer perceptron for message fusion; Indicates The message transmitted from the adjacent entity word node s′ to the entity word node n in the iteration The attention weight of
[0086] Step 6.5.9: Use formula (17) to calculate the The weight value of entity word node n after iterations ;
[0087] (17)
[0088] Step 6.5.10: Calculate the question-answering work subgraph After calculating the weight value of each entity word node in the question-answering subgraph We perform weighted summation on all entity word nodes in Question-answer-based work map Representation .
[0089] Further, the step 7 is performed as follows:
[0090] Step 7.1: Use formula (18) to get Problem-based The final expression :
[0091] (18)
[0092] In formula (18), yes and The concatenated vector The weight matrix of yes The bias vector of is the activation function;
[0093] Step 7.2: Use formula (19) to get Multi-view based representation :
[0094] (19)
[0095] In formula (19), yes and The concatenated vector The weight matrix of yes The bias vector of .
[0096] Further, the step 8 is performed as follows:
[0097] Step 8.1: Use formula (20) to obtain Multi-view based representation and the respondent Questions Expression of professional ability Fusion representation of :
[0098] (20)
[0099] In formula (20), yes and The concatenated vector The weight matrix of yes The bias vector of
[0100] Step 8.2: Use formula (21) to get With the problem Match score , thus obtaining The predicted evaluation label of:
[0101] (twenty one)
[0102] In formula (21), yes and The concatenated vector The weight matrix of yes The bias vector of yes and The parameter vector after information fusion through the fully connected layer, yes and The bias term after information fusion through the fully connected layer, sigmoid is the activation function.
[0103] An electronic device of the present invention includes a memory and a processor, wherein the memory is used to store a program that supports the processor to execute the intelligent question-answering method, and the processor is configured to execute the program stored in the memory.
[0104] The present invention provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, which is characterized in that when the computer program is executed by a processor, the steps of the intelligent question-answering method are executed.
[0105] Compared with the existing technology, the beneficial effects of the present invention are embodied in:
[0106] 1. The present invention combines the question subject and the question body as the question description text, thereby obtaining more complete semantic information of the question;
[0107] 2. The present invention integrates the information of the answer published by the respondent under the current question and the information of the answers published under other questions of the same question category, so as to better characterize the breadth of the respondent's understanding of the current question category. Then, the attention mechanism is used to obtain the representation of the respondent's professional ability for the current question. Compared with modeling the respondent's professional ability using all the answers published by the respondent, the present invention reduces noise and can dynamically adjust the respondent's professional ability representation for different questions of the same question category.
[0108] 3. Before publishing an answer, the respondent will be influenced by the existing answers under the question. The present invention adds an attention mechanism to the existing LSTM model. Based on the respondent's professional ability on the current question, the attention mechanism is used to obtain the comprehensive influence of all the answers published earlier on the subsequent answers under the question, thereby enhancing the interpretability of the model;
[0109] 4. The present invention introduces the knowledge graph, constructs a question-answering work graph that combines the pre-trained language model and the knowledge graph, and uses a graph neural network to capture the influence of question entity words and the overall semantics of the question on the answer entity words. Compared with the traditional method that uses the attention mechanism, it has stronger interpretability and generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0110] Figure 1 It is the overall model diagram of the present invention;
[0111] Figure 2 This is a single cell state structure diagram of the LSTM with attention mechanism added to the present invention;
[0112] Figure 3 It is a question-and-answer working diagram of the present invention. DETAILED DESCRIPTION
[0113] In this embodiment, an intelligent question-answering method based on multi-view answer representation uses a graph neural network to capture the fine-grained interaction between question text and answer text based on entity words in terms of semantic interaction between questions and answers, and uses the overall semantics of the question description text to obtain the semantic representation of the answer. In terms of modeling the information interaction between answers under the same question, it comprehensively considers the impact of the overall semantics of the question on the answer and the interaction between entity words and question text information in the question and answer text to obtain rich semantic information of the answer. It uses an LSTM module based on an attention mechanism to obtain the degree of influence of the first answer on the later answer based on the professional ability of the respondent to the question, thereby selecting the best answer for the question. Specifically, if Figure 1 As shown, the method is performed in the following steps:
[0114] Step 1: Build and preprocess question-answer data;
[0115] Collect question-and-answer data, including questions, answers, and their respondents. Questions include question category, question topic, and question body. Answers include answer body, release time of each answer, and real evaluation labels.
[0116] Any question in the question-answering data After all the corresponding answers are arranged according to the release time, the question is obtained Corresponding answer text set ;in, Representation problem No. The answer text after arrangement, Representation problem The total number of answers to the question The question topic is recorded as ; The problem The corresponding The set of respondents is denoted as ,in, express of the respondents;
[0117] In the specific implementation, the collected community question and answer data is stored in the form of XML files, and each record is a question and answer pair, which together constitute a question and answer pair set. Among them, each question records the question id, question category, question topic and question text; each answer records the answer text, release time, real evaluation label and the answerer id corresponding to the answer; finally, the answers corresponding to each question are sorted in chronological order.
[0118] Step 2: The BERT model can effectively capture the dependencies between long-distance words in the input text and build a text encoding module to encode the question topic. and Problems After splicing the question text, we get the question Description text Then, use the BERT model to obtain the questions Description text The word vector matrix and sentence vector ,question No. The answer text after sorting The word vector matrix and sentence vector And the respondent Documentation The word vector matrix ;
[0119] Step 2.1: Use the word segmenter to After word segmentation, it is converted into questions The text sequence is input into the BERT model for processing to obtain the question Description text The word vector matrix ,in, express After the participle The vector corresponding to the word segmentation, express Length;
[0120] The vector corresponding to the token [CLS] aggregates the information of the entire input sequence. In this embodiment, The vector corresponding to the token [CLS] in the question Description text Sentence vector .
[0121] Step 2.2: Use the word segmenter to check the answer text After word segmentation, it is converted into The text sequence is input into the BERT model for processing to obtain The word vector matrix ,in, express After the participle The vector corresponding to the word segmentation, express Length;
[0122] Will The vector corresponding to the token [CLS] in the answer is the answer text. Sentence vector .
[0123] Step 2.3: The answers posted by the respondent to other questions in the same question category reflect the breadth of the respondent's knowledge of the question category. Question categories, get the answerer from the question and answer data Answers to other questions in the same question category are concatenated into the first Respondents Documentation ,in, express The words, express Length;
[0124] Using the word segmenter After word segmentation, it is converted into The text sequence is input into the BERT model for processing and obtained The word vector matrix .
[0125] Step 3: Construct the respondent professional ability representation module, including: TextCNN network and attention mechanism module, and use it to and Process and get the answer Questions Expression of professional ability ;
[0126] Step 3.1: When processing text tasks, TextCNN can efficiently extract local features, avoid text sequence dependence, and perform multi-scale feature representation. In this embodiment, the TextCNN network is used to process The word vector matrix ,get Vector representation of , to the respondent In question Post the answer text below and the respondent Corresponding Documents By processing and merging them separately, we can get the answerer dynamically. The intermediate representation of the professional level of different problems under the same problem category, in specific implementation, and After splicing, we get concatenation vector After that, it is input into the fully connected layer for processing to get the answer Intermediate representation of professional competence , where [ : ] represents the concatenation operation and D represents the dimension of the column vector.
[0127] Step 3.2: Question categories involve a wide range of content. Question description texts often only reflect one or a few aspects of the question category. The attention mechanism can be used to obtain the answerer's Focus on the problem In this embodiment, the attention mechanism module is used to Process and get the answer Questions Professional ability ;
[0128] Step 3.2.1. Copy to dimensions D× Professional Competence Matrix , and then use formula (1) to get and Fusion representation :
[0129] (1)
[0130] In formula (1) express The weight matrix of express The weight matrix of express and The interaction weight matrix, represents the element-wise product of two matrices, is the activation function.
[0131] Step 3.2.2: Use formula (2) to After normalization, the answer is The attention score vector :
[0132] (2)
[0133] In formula (2), express The parameter vector of represents transpose, is the activation function;
[0134] Step 3.2.3. Utilization right After weighting, the respondents Questions Professional ability .
[0135] Step 4: Figure 2 As shown, in this embodiment, an LSTM module based on the attention mechanism is constructed, and the attention mechanism is added to the basic LSTM cell unit, and the input is no longer the first The output of the LSTM cell at the moment Answer text The answer information interaction representation , but in front The aggregate information of the answer information output by the LSTM cell unit at each moment is interactively represented and used to and Processing, the result is Answer text The answer information interaction representation ;
[0136] Step 4.1, define the total number of time steps as , No. The input of the time step is Answer text Sentence vector , Respondent Questions Professional ability , No. The output of the time step is Answer text Answer information interactive representation ;
[0137] Step 4.2: According to the previous Answer text ,in, Indicates answer text, use formula (3) to calculate the answerer Acquisition and Problems Related information degree , The higher the Answer text to the answerer Answers provided The greater the quality impact:
[0138] (3)
[0139] In formula (3), It is Answer text Respondent Questions expression of professional competence.
[0140] Step 4.3: Use formula (4) to calculate the front The fusion vector of the interactive representation of the answer information of the answer body :
[0141] (4)
[0142] In formula (4), It is Answer text The interactive representation of answer information;
[0143] Step 4.4: Use equations (5) to (10) to obtain The answer information interaction representation :
[0144] (5)
[0145] (6)
[0146] (7)
[0147] (8)
[0148] (9)
[0149] (10)
[0150] In formula (5) to formula (10), , , , , Respectively represent The input gate, forget gate, output gate, candidate cell state, and cell state of each time step. Indicates The cell state at each time step, represents element-wise product, represents the sigmoid activation function, represents the tanh activation function, , , Represents the input gate The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Represents the input gate The bias vector of , , They represent the forget gate The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Forget gate The bias vector of , , Represents the output gate The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Output gate The bias vector of , , Represents the candidate cell states The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Represents candidate cell states The bias vector of .
[0151] Step 5. Questions Description text The overall semantics of the answer text The representation of is very important. In this embodiment, an answer representation module based on the question description text sentence vector is constructed and used to calculate With answer text No. Word vectors of word segments Match score , in specific implementation, The calculation method is The transposed vector and The dot product of Function answer text of The matching scores of the word segments are normalized to obtain No. Word vectors of word segments The weight value , thus answering the text of The word vector matrix of word segmentation Perform weighted aggregation to obtain Representation based on sentence vector of question description text , thereby more accurately capturing the answer body semantics.
[0152] Step 6: By using the knowledge graph, a closer semantic connection can be established between the entity words in the question and the entity words in the answer, thereby enhancing the reasoning ability and interpretability of the model. In this embodiment, an answer representation module based on the question-answering work graph is constructed and used to construct Corresponding question-answering work subgraph and question and answer work map , thus obtaining Question-answer-based work map Representation ;
[0153] Step 6.1: Use ConceptNet knowledge graph to and Extract the corresponding entity word sets respectively and and its common additional entity word set ;
[0154] The problem Description text Perform word segmentation, part-of-speech tagging and stemming operations, and identify entity words that match the ConceptNet knowledge graph from the description text after the operation. The entity word set ;
[0155] Will Perform word segmentation, part-of-speech tagging and stemming operations, and identify entity words matching the ConceptNet knowledge graph from the answer text after the operation. The entity word set ;
[0156] Will The entity words in the ConceptNet knowledge graph are connected to adjacent entity word nodes, and The intersection of the adjacent entity word nodes connected in the ConceptNet knowledge graph is taken as The corresponding additional entity word set .
[0157] Step 6.2: Get from ConceptNet knowledge graph , and The nodes corresponding to each entity word in , and construct Corresponding question-answering work subgraph In this embodiment, and The same entity words in the question node type and the answer node type are assigned to the question node type and the answer node type respectively. Different entity word nodes in
[0158] Step 6.3: Question-answering subgraph retrieved from the knowledge graph Contains some entity word nodes that are not related to the question, in order to bridge the problem Description text The difference between the overall semantic information of and the entity word node information in the knowledge graph is that in this embodiment, After linear transformation, we get The low-dimensional vector representation of And as a text node, join the question-answering work subgraph and will Respectively and Connect each entity word in to get Corresponding question-answering work diagram ,like Figure 3 As shown, Include All entity word nodes in .
[0159] Step 6.4: Question and Answer Work Subgraph Description text The more relevant the entity words are, the more they can describe the text. In this embodiment, the question-answering work subgraph Any entity word n in After concatenation, we get entity word n and The spliced text ,Will Perform word segmentation and convert into The text sequence is input into the BERT model for processing and obtained The vector representation of each word in , so as to obtain The prediction score for each word in ;
[0160] by The integer identifier of the text sequence is used as the actual label and the cross entropy loss function is used to calculate The difference between the predicted score and the actual label of each word in is used to obtain the loss value of entity word n, and the negative value of the loss value is taken as the score of entity word n. , The higher the entity word n is, the closer it is to the description text The higher the degree of correlation.
[0161] Step 6.5: Use graph neural network to The embedding representations of all entity word nodes in are iteratively updated and processed using the attention mechanism and The embedding representation of all entity word nodes in the answer text is obtained Question-answer-based work map Representation ;
[0162] Step 6.5.1: Graph Neural Networks can use question-answering work graphs The relationship between all nodes in , thereby effectively capturing the answer body and Problems Description text Information interaction between them. For any entity word node n and its adjacent entity word node s on the , perform one-hot encoding on the node type of the adjacent entity word node s, the node type of the entity word node n, and the edge between the adjacent entity word node s and the entity word node n, and obtain the one-hot encoding representation of the node type of the adjacent entity word node s. , the one-hot encoding representation of the node type of entity word node n , the one-hot encoding representation of the edge between the entity word node n and the adjacent entity word node s , and then use formula (11) to get the relationship type vector representation between entity word node n and adjacent entity word node s :
[0163] (11)
[0164] In formula (11), , , Represents question-answering work graph The number of node types in , Represents question-answering work graph The number of edge types, It is a multi-layer perceptron that obtains the relationship type.
[0165] Use pre-trained vectors to solve the question answering problem The entity word node n and the adjacent entity word node s are represented to obtain the embedded representation of the adjacent entity word node s. and the embedding representation of entity word node n ;
[0166] One-hot encoding representation of the node type of the adjacent entity word node s Perform linear transformation to obtain the vector representation of the node type of the adjacent entity word node s ;
[0167] One-hot encoding representation of the node type of entity word node n Perform linear transformation to obtain the vector representation of the node type of entity word node n ;
[0168] Step 6.5.2, define the current number of iterations as , and initialize =1, let Indicates the maximum number of iterations;
[0169] Step 6.5.3: Use formula (12) to get The message transmitted from the adjacent entity word node s to the entity word node n in the iteration :
[0170] (12)
[0171] In formula (12), Indicates The embedding representation of the adjacent entity word node s in the iteration , It is the message linear layer.
[0172] Step 6.5.4: In this embodiment, in order to maintain the consistency of the data format, the scores of the adjacent entity word nodes s are and the score of entity word node n Input the node score mapping into the multi-layer perceptron for processing, and get the corresponding Vector representation of and Vector representation of ;
[0173] Step 6.5.5: Use formula (13) to calculate the The query vector of the adjacent entity word node s in the iteration , Represents the overall characteristics of the adjacent entity word node s:
[0174] (13)
[0175] In formula (13), is the query vector linear layer.
[0176] Step 6.5.6: Use formula (14) to calculate the The key vector of entity word node n in the iteration , Represents the overall characteristics of entity word node n relative to the adjacent entity word node s:
[0177] (14)
[0178] In formula (14), is the key vector linear layer.
[0179] Step 6.5.7: Calculate using formula (15) The attention weight :
[0180] (15)
[0181] In formula (15), is the neighborhood of the adjacent entity word node s; represents transpose, It is The key vector of entity word node n′ in the iteration;
[0182] Step 6.5.8: Use formula (16) to obtain The embedding representation of entity word node n in the iteration , thus obtaining The embedding representation of entity word node n after iterations :
[0183] (16)
[0184] In formula (16), represents the neighborhood of entity word node n, It is a multi-layer perceptron for message fusion; In the iteration, the neighborhood of entity word node n The importance of the messages transmitted to entity word node n by different entity word nodes is different. Indicates The message transmitted from the adjacent entity word node s′ to the entity word node n in the iteration The attention weight, The larger the value, For entity word node n The more iterations, the more important.
[0185] Step 6.5.9: Use formula (17) to calculate The weight value of entity word node n after iterations ;
[0186] (17)
[0187] Step 6.5.10: Calculate the question-answering work subgraph After calculating the weight value of each entity word node in the question-answering subgraph We perform weighted summation on all entity word nodes in Question-answer-based work map Representation .
[0188] Step 7: By combining the representations of different answer texts together, richer semantic information of the answer text can be obtained. In this embodiment, an answer representation fusion module is constructed to perform Representation , Representation based on question description text sentence vector Representation of interaction with answer information Perform splicing and fusion to obtain Multi-view based representation ;
[0189] Step 7.1: Use formula (18) to get Problem-based The final expression :
[0190] (18)
[0191] In formula (18), yes and The concatenated vector The weight matrix of yes The bias vector of is the activation function.
[0192] Step 7.2: Use formula (19) to get Multi-view based representation :
[0193] (19)
[0194] In formula (19), yes and The concatenated vector The weight matrix of yes The bias vector of .
[0195] Step 8: In this embodiment, the answer selection task is regarded as a binary classification problem, and a prediction module is constructed to represent the multi-view representation. , Respondent Questions Expression of professional ability and Problems Description text Sentence vector Fusion of information to predict problems and Answer text Match score , Between 0 and 1, indicating Answer text The probability of a high-quality answer;
[0196] Step 8.1: Use formula (20) to get Multi-view based representation and the respondent Questions Expression of professional ability Fusion representation :
[0197] (20)
[0198] In formula (20), yes and The concatenated vector The weight matrix of yes The bias vector of .
[0199] Step 8.2: Use formula (21) to get With the problem Match score , thus obtaining The predicted evaluation label of:
[0200] (twenty one)
[0201] In formula (21), yes and The concatenated vector The weight matrix of yes The bias vector of yes and The parameter vector after information fusion through the fully connected layer, yes and The bias term after information fusion through the fully connected layer, sigmoid is the activation function.
[0202] Step 9. Use the gradient descent method to train the intelligent question-answering network composed of a text encoding module, a respondent professional ability representation module, an LSTM module based on an attention mechanism, an answer representation module based on a question description text sentence vector, an answer representation module based on a question-answering work graph, an answer representation fusion module, and a prediction module. Calculate the cross-entropy loss value based on the true evaluation label and the predicted evaluation label to update the network parameters. Stop training when the cross-entropy loss value converges or the number of training times reaches a predetermined threshold, thereby obtaining the optimal intelligent question-answering model, which is used to predict the best answer to each input question.
[0203] In this embodiment, an electronic device includes a memory and a processor, wherein the memory is used to store a program that supports the processor to execute the above method, and the processor is configured to execute the program stored in the memory.
[0204] In this embodiment, a computer-readable storage medium stores a computer program on the computer-readable storage medium, and the computer program executes the steps of the above method when executed by a processor.
Claims
1. An intelligent question answering method based on multi-view answer representation, It is characterized in that The steps are as follows: Step 1: Build and preprocess question-answer data; Collect question-and-answer data, including questions, answers, and their respondents. Questions include question category, question topic, and question body. Answers include answer body, release time of each answer, and real evaluation labels. Any question in the question-answering data After all the corresponding answers are arranged according to the release time, the question is obtained Corresponding answer text set ;in, Representation problem No. The answer text after arrangement, Representation problem The total number of answers to the question The question topic is recorded as ; The problem The corresponding The set of respondents is denoted as ,in, express of the respondents; Step 2: Build a text encoding module to encode the question topic and Problems After splicing the question text, we get the question Description text Then, use the BERT model to obtain the questions Description text The word vector matrix and sentence vector ,question No. The answer text after sorting The word vector matrix and sentence vector And the respondent Documentation The word vector matrix ; Step 3: Construct the respondent professional ability representation module, including: TextCNN network and attention mechanism module, and use it to and Process and get the answer Questions Expression of professional ability ; Step 4: Construct an LSTM module based on the attention mechanism and use it to and Processing, the result is Answer text The answer information interaction representation ; Step 5: Construct an answer representation module based on the question description text sentence vector and use it to calculate With answer text No. Word vectors of word segments Match score , reuse Function answer text of The matching scores of the word segments are normalized to obtain No. Word vectors of word segments The weight value , thus answering the text of The word vector matrix of word segmentation Perform weighted aggregation to obtain Representation based on sentence vector of question description text ; Step 6: Construct an answer representation module based on the question-answering work graph and use it to build Corresponding question-answering work subgraph and question and answer work diagram , thus obtaining Question-answer-based work map Representation ; Step 7: Construct the answer representation fusion module to analyze the question-answering graph. Representation , Representation based on question description text sentence vector Representation of interaction with answer information Perform splicing and fusion to obtain Multi-view based representation ; Step 8: Construct a prediction module and use it for multi-view representation , Respondent Questions Expression of professional ability and Problems Description text Sentence vector Fusion of information to predict problems and Answer text Match score ; Step 9. Use the gradient descent method to train the intelligent question-answering network composed of a text encoding module, a respondent professional ability representation module, an LSTM module based on an attention mechanism, an answer representation module based on a question description text sentence vector, an answer representation module based on a question-answering work graph, an answer representation fusion module, and a prediction module. Calculate the cross-entropy loss value based on the true evaluation label and the predicted evaluation label to update the network parameters. Stop training when the cross-entropy loss value converges or the number of training times reaches a predetermined threshold, thereby obtaining the optimal intelligent question-answering model, which is used to predict the best answer to each input question.
2. The intelligent question answering method based on multi-view answer representation according to claim 1, It is characterized in that Step 2 is performed as follows: Step 2.1: Use the word segmenter to After word segmentation, it is converted into questions The text sequence is input into the BERT model for processing to obtain the question Description text The word vector matrix ,in, express After the participle The vector corresponding to the word segmentation, express Length; Will The vector corresponding to the token [CLS] in the question Description text Sentence vector ; Step 2.2: Use the word segmenter to check the answer text After word segmentation, it is converted into The text sequence is input into the BERT model for processing to obtain The word vector matrix ,in, express After the participle The vector corresponding to the word segmentation, express Length; Will The vector corresponding to the token [CLS] in the answer is the answer text. Sentence vector ; Step 2.3: According to the problem Question categories, get the answerer from the question and answer data Answers to other questions in the same question category are concatenated into the first Respondents Documentation ,in, express The words, express Length; Using the word segmenter After word segmentation, it is converted into The text sequence is input into the BERT model for processing and obtained The word vector matrix .
3. The intelligent question answering method based on multi-view answer representation according to claim 2, It is characterized in that Step 3 is performed as follows: Step 3.1: Processing using the TextCNN network The word vector matrix ,get Vector representation of ,Will and After splicing, we get concatenation vector After that, it is input into the fully connected layer for processing to get the answer Intermediate representation of professional competence , where [ :] represents the concatenation operation and D represents the dimension of the column vector; Step 3.2: Use the attention mechanism module to Process and get the answer Questions Professional ability ; Step 3.2.
1. Copy to dimensions D× Professional Competence Matrix , and then use formula (1) to get and Fusion representation of : (1) In formula (1), express The weight matrix of express The weight matrix of express and The interaction weight matrix, represents the element-wise product of two matrices, is the activation function; Step 3.2.2: Use formula (2) to After normalization, the answer is The attention score vector : (2) In formula (2), express The parameter vector of represents transpose, is the activation function; Step 3.2.
3. Utilization right After weighting, the respondents Questions Professional ability .
4. The intelligent question answering method based on multi-view answer representation according to claim 3, It is characterized in that Step 4 is performed as follows: Step 4.1, define the total number of time steps as , No. The input of the time step is Answer text Sentence vector , Respondent Questions Professional ability , No. The output of the time step is Answer text Answer information interactive representation ; Step 4.2: According to the previous Answer text ,in, Indicates answer text, use formula (3) to calculate the answerer Acquisition and Problems Related information degree : (3) In formula (3), It is Answer text Respondent Questions an indication of professional competence; Step 4.3: Use formula (4) to calculate the front The fusion vector of the interactive representation of the answer information of the answer body : (4) In formula (4), It is Answer text The interactive representation of answer information; Step 4.4: Use equations (5) to (10) to obtain The answer information interaction representation : (5) (6) (7) (8) (9) (10) In formula (5) to formula (10), , , , , Respectively represent The input gate, forget gate, output gate, candidate cell state, and cell state of each time step. Indicates The cell state at each time step, represents element-wise product, represents the sigmoid activation function, represents the tanh activation function, , , Represents the input gate The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Represents the input gate The bias vector of , , They represent the forget gate The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Forget gate The bias vector of , , Represents the output gate The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Output gate The bias vector of , , Represents the candidate cell states The answer text weight matrix, answer information fusion weight matrix and respondent professional ability weight matrix, Represents candidate cell states The bias vector of .
5. The intelligent question answering method based on multi-view answer representation according to claim 4, It is characterized in that The step 6 is carried out as follows: Step 6.1: Use ConceptNet knowledge graph to and Extract the corresponding entity word sets respectively and and its common additional entity word set ; The problem Description text Perform word segmentation, part-of-speech tagging and stemming operations, and identify entity words that match the ConceptNet knowledge graph from the description text after the operation. The entity word set ; Will Perform word segmentation, part-of-speech tagging and stemming operations, and identify entity words matching the ConceptNet knowledge graph from the answer text after the operation. The entity word set ; Will The entity words in the ConceptNet knowledge graph are connected to adjacent entity word nodes, and The intersection of the adjacent entity word nodes connected in the ConceptNet knowledge graph is taken as The corresponding additional entity word set ; Step 6.2: Get from ConceptNet knowledge graph , and The nodes corresponding to each entity word in , and construct Corresponding question-answering work subgraph ; Step 6.3: After linear transformation, we get The low-dimensional vector representation of And as a text node, join the question-answering work subgraph and will Respectively and Connect each entity word in to get Corresponding question-answering work diagram ; Step 6.4: Add the question-answering work subgraph Any entity word n in After concatenation, we get entity word n and The spliced text ,Will Perform word segmentation and convert into The text sequence is input into the BERT model for processing and obtained The vector representation of each word in , so as to obtain The prediction score for each word in ; by The integer identifier of the text sequence is used as the actual label and the cross entropy loss function is used to calculate The difference between the predicted score and the actual label of each word in is used to obtain the loss value of entity word n, and the negative value of the loss value is taken as the score of entity word n. ; Step 6.5: Use graph neural network to The embedding representations of all entity word nodes in are iteratively updated and processed using the attention mechanism and The embedding representation of all entity word nodes in the answer text is obtained Question-answer-based work map Representation .
6. The intelligent question answering method based on multi-view answer representation according to claim 5, It is characterized in that The step 6.5 is performed as follows: Step 6.5.1: Question and answer work map For any entity word node n and its adjacent entity word node s on the , perform one-hot encoding on the node type of the adjacent entity word node s, the node type of the entity word node n, and the edge between the adjacent entity word node s and the entity word node n, and obtain the one-hot encoding representation of the node type of the adjacent entity word node s. , the one-hot encoding representation of the node type of entity word node n , the one-hot encoding representation of the edge between the entity word node n and the adjacent entity word node s , and then use formula (11) to get the relationship type vector representation between entity word node n and adjacent entity word node s : (11) In formula (11), It is a multi-layer perceptron that obtains the relationship type; Use pre-trained vectors to solve the question answering problem The entity word node n and the adjacent entity word node s are represented to obtain the embedded representation of the adjacent entity word node s. and the embedding representation of entity word node n ; One-hot encoding representation of the node type of the adjacent entity word node s Perform linear transformation to obtain the vector representation of the node type of the adjacent entity word node s ; One-hot encoding representation of the node type of entity word node n Perform linear transformation to obtain the vector representation of the node type of entity word node n ; Step 6.5.2, define the current number of iterations as , and initialize =1, let Indicates the maximum number of iterations; Step 6.5.3: Use formula (12) to get The message transmitted from the adjacent entity word node s to the entity word node n in the iteration : (12) In formula (12), Indicates The embedding representation of the adjacent entity word node s in the iteration , It is the message linear layer; Step 6.5.4: The score of the adjacent entity word node s and the score of entity word node n Input the node score mapping into the multi-layer perceptron for processing, and get the corresponding Vector representation of and Vector representation of ; Step 6.5.5: Use formula (13) to calculate the The query vector of the adjacent entity word node s in the iteration : (13) In formula (13), is the query vector linear layer; Step 6.5.6: Use formula (14) to calculate the The key vector of entity word node n in the iteration : (14) In formula (14), is the key vector linear layer; Step 6.5.7: Calculate using formula (15) The attention weight : (15) In formula (15), is the neighborhood of the adjacent entity word node s; represents transpose, It is The key vector of entity word node n′ in the iteration; Step 6.5.8: Use formula (16) to obtain The embedding representation of entity word node n in the iteration , thus obtaining The embedding representation of entity word node n after iterations : (16) In formula (16), represents the neighborhood of entity word node n, It is a multi-layer perceptron for message fusion; Indicates Next iteration, the adjacent entity word node s′ to the entity word node The message delivered The attention weight of Step 6.5.9: Use formula (17) to calculate The weight value of entity word node n after iterations ; (17) Step 6.5.10: Calculate the question-answering work subgraph After calculating the weight value of each entity word node in the question-answering subgraph We perform weighted summation on all entity word nodes in Question-answer-based work map Representation .
7. The intelligent question answering method based on multi-view answer representation according to claim 6, It is characterized in that The step 7 is carried out as follows: Step 7.1: Use formula (18) to get Problem-based The final expression : (18) In formula (18), yes and The concatenated vector The weight matrix of yes The bias vector of is the activation function; Step 7.2: Use formula (19) to get Multi-view based representation : (19) In formula (19), yes and The concatenated vector The weight matrix of yes The bias vector of .
8. The intelligent question answering method based on multi-view answer representation according to claim 7, It is characterized in that The step 8 is carried out as follows: Step 8.1: Use formula (20) to obtain Multi-view based representation and the respondent Questions Expression of professional ability Fusion representation of : (20) In formula (20), yes and The concatenated vector The weight matrix of yes The bias vector of Step 8.2: Use formula (21) to get With the problem Match score , thus obtaining The predicted evaluation label of: (21) In formula (21), yes and The concatenated vector The weight matrix of yes The bias vector of yes and The parameter vector after information fusion through the fully connected layer, yes and The bias term after information fusion through the fully connected layer, sigmoid is the activation function.
9. An electronic device comprising a memory and a processor, It is characterized in that The memory is used to store a program that supports the processor to execute the intelligent question-answering method described in any one of claims 1 to 8, and the processor is configured to execute the program stored in the memory.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the intelligent question-answering method in any one of claims 1 to 8 are executed.
Citation Information
Patent Citations
Automatic question answering method and device, equipment and medium
CN113821614A
Question and answer matching method based on attention mechanism
CN116414962A
Intelligent question answering method and system based on domain knowledge graph
CN117648984A
