Question-answering method and system based on text-knowledge expansion graph collaborative reasoning network

By constructing a text-knowledge extended graph collaborative reasoning network, the problem of insufficient interaction between text and knowledge feature information is solved, and higher accuracy in answer selection is achieved.

CN116361438BActive Publication Date: 2026-02-27FUZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310333880.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2026-02-27
Estimated Expiration
2043-03-31

AI Technical Summary

Technical Problem

Existing models lack interaction between text and knowledge graph in answer selection tasks, resulting in a semantic gap between text and knowledge feature information, which affects model accuracy.

Method used

We adopt a question-answering method based on a text-knowledge extended graph collaborative reasoning network. By constructing a deep learning network model, we perform text-knowledge matching and multi-hop node expansion, use a graph attention network to evaluate semantic understanding, and combine a BiGRU network and a multi-head self-attention mechanism to achieve collaborative reasoning of text and knowledge.

Benefits of technology

It improved the accuracy of answer selection, enhanced the model's understanding of the problem, and increased the precision of answer selection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116361438B_ABST
    Figure CN116361438B_ABST
Patent Text Reader

Abstract

The application relates to a question and answer method and system based on a text-knowledge expansion graph collaborative reasoning network, which comprises the following steps: step A: collecting user questions and answer records in a question and answer platform, and labeling the true labels of each question-answer pair to build a training set DS; step B: using the training set DS and a knowledge graph to train a deep learning network model M based on the text-knowledge expansion graph collaborative reasoning network, so as to analyze a given question through the model M and give a corresponding answer; and step C: inputting a user question into the trained deep learning network model M to output a matched answer. The method and system are favorable for improving the accuracy of selecting answers for given questions.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, and particularly relates to a question and answer method and system based on a text-knowledge expansion graph collaborative reasoning network. BACKGROUND

[0002] Answer selection is an important sub-task in the field of intelligent question answering, which aims to use algorithms to enable computers to understand the semantic of the question input by people and return the most appropriate candidate answer. The core of this task lies in the semantic matching problem between question and answer pairs. With the improvement of Internet technology, the way of accessing the Internet to obtain knowledge is also changing. Since 1994, when Yahoo launched the world's first directory-based search engine, providing a convenient way for people to obtain the knowledge they need from the Internet, in the following twenty years, online search engines such as Google, Baidu, Bing, etc. have sprung up like mushrooms. Through the question and answer search box, people can query the answers to the questions they want. However, as people's demand for information increases, the traditional search engine returns the related answers to the user by matching the question keywords, which is easy to cause information overload, inaccurate search results and other problems, and it is increasingly difficult to meet the user's demand for specific problem solving and in-depth communication.

[0003] In recent years, the model method based on deep learning, especially the pre-trained language model, has been widely used in answer selection tasks due to its end-to-end training and powerful feature extraction capability. Through a large amount of unlabeled text, pre-training can help the model learn potential general language representations. And only need to increase specific network layers and classification layers after the output of the pre-trained language model, and locally fine-tune the model, which can directly act on the NLP downstream task, avoiding the waste of resources caused by retraining the entire model. At present, researchers have shifted their focus to using pre-trained language models for answer selection tasks and proposed MFIN, BERT-GSAMN, and BERT-BIG models. The common ground of these models is to further extract fine semantic features based on the rich semantic information obtained from the pre-trained language model, and all of them have achieved good results.

[0004] Graph neural networks, a deep learning method that works on graph domains, have received extensive attention in recent years due to their excellent performance and high interpretability. By constructing a graph data structure to represent the connection between different words, the graph node information is propagated and updated. In the research work of Tian et al., GCN is used to model and encode the question and answer relationship graph constructed from different perspectives such as sentence distance, word co-occurrence, semantic matching degree, and dynamic attention, and finally obtain the aggregated question and answer feature representation from multiple perspectives.

[0005] There are also many advances in the research of answer selection based on knowledge graph. Yang et al. proposed a knowledge-rich hierarchical attention mechanism. External knowledge is introduced, and semantic features guide the generation of knowledge features. Then, semantic features and knowledge features at the word, paragraph and document levels are generated progressively and interactively fused. However, knowledge graph can be abstractly understood as a graph data structure in nature, and a large number of structured knowledge entities in the graph are connected by various node relationships. Therefore, it is very suitable for graph neural networks to capture knowledge graph information. At the same time, existing models usually model text semantic representation and knowledge entities independently, lack of interaction between knowledge and text, and the parameter information between them cannot be shared in time, resulting in a certain semantic gap between text and knowledge feature information, which affects the model accuracy. SUMMARY

[0006] The present application aims to provide a question and answer method and system based on a text-knowledge expansion graph collaborative reasoning network, which is beneficial to improve the accuracy of selecting answers to given questions.

[0007] To achieve the above-mentioned purpose, the technical scheme adopted by the present application is as follows: a question and answer method based on a text-knowledge expansion graph collaborative reasoning network, comprising the following steps:

[0008] Step A: Collecting user's questions and answer records in the question and answer platform, and labeling the true label of each question-answer pair to build a training set DS;

[0009] Step B: Using the training set DS and the knowledge graph to train a deep learning network model M based on the text-knowledge expansion graph collaborative reasoning network, so as to analyze the given question and give the corresponding answer through the model M;

[0010] Step C: Inputting the user's question into the trained deep learning network model M to output the matched answer.

[0011] Further, the step B specifically comprises the following steps:

[0012] Step B1: Initial encoding of all training samples in the training set DS, thereby obtaining the initial features H q 、H a of the question and answer text content, the global semantic features H cls of the question and answer, and the knowledge expansion sequence N q and N aand each knowledge node information in the knowledge expansion sequence is mapped into a continuous low-dimensional vector, finally forming the knowledge expansion sequence characteristics C of the question and the answer q 、 a ;

[0013] Step B2: the question and the answer knowledge expansion sequence N q and N a are constructed into a question and answer knowledge matching-expansion node structure subgraph according to the connection relationship of the nodes, and are converted into corresponding l2-order adjacency matrices and l3-order matrices Then the K-layer graph attention network is used to evaluate the semantic understanding degree of each node in the knowledge matching-expansion node structure subgraph, and the feature state information of each node is spliced to obtain the knowledge matching-expansion node semantic feature of the question

[0014] Step B3: the question and the answer knowledge expansion sequence N q and N a are respectively constructed into corresponding syntax dependency trees by external parsing tools, and are converted into corresponding l2-order adjacency matrices and l3-order matrices Then the K-layer graph attention network is used to obtain the knowledge matching node context semantic feature of the question and the answer and the feature is masked to reduce semantic noise;

[0015] Step B4: the initial features H q and H a of the question and the answer obtained in step B1 are respectively fused by BiGRU network to obtain the sequence semantic features of the question and the answer and The knowledge matching node context semantic features of the question and the answer obtained in step B3 and the corresponding sequence semantic features and are obtained by the interactive attention mechanism to obtain the text attention feature representation of the question and the answer and and the knowledge attention feature representation of the question and the answer and Then the text attention features and are combined with the initial features H q and H a obtained in step B1, the knowledge attention features and are combined with the knowledge matching node context semantic features Textual collaborative reasoning features are obtained by performing residual connections pairwise and then passing each pairwise through a feedforward neural network to obtain the final question and answer. and Features of Knowledge Collaborative Reasoning and

[0016] Step B5: Analyze the textual collaborative reasoning features of the questions and answers obtained in Step B4. and The self-attention semantic features of the question and answer are obtained through a multi-head self-attention mechanism respectively. and Then, the obtained self-attention semantic features are processed through an interactive attention mechanism. and The interactive attention semantic features of questions and answers are obtained by merging them together. and Then, a gating mechanism is used to focus the attention semantic features of the question and answer interaction. and The global semantic features H of the question and answer respectively cls Filtering and fusion are performed to obtain multi-granular semantic features of questions and answers. and

[0017] Step B6: Analyze the multi-granular semantic features of the questions and answers obtained in Step B5. and The knowledge collaborative reasoning features obtained in step B4 and By performing a connection, the final representation features of the question and answer are obtained. and And connect them to obtain the final answer for the feature representation H. final ;

[0018] Step B7: Pair the final answer obtained in B6 with the feature representation H final The relevance matching score f(q,a)∈[0,1] between question-answer pairs is obtained through the softmax function; then, based on the target loss function loss, the gradient of each parameter in the deep learning network model is calculated through backpropagation, and the parameters are updated using the stochastic gradient descent method.

[0019] Step B8: When the change in loss value generated by the deep learning network model in each iteration is less than the given threshold, or when the maximum number of iterations is reached, terminate the training process of the deep learning network model.

[0020] Furthermore, step B1 specifically includes the following steps:

[0021] Step B11: Traverse the training set DS, segment the question and candidate answer texts and remove stop words. Each training sample in DS is represented as ds = (q, a, p); where q is the text content of the question, a is the text content of the candidate answer corresponding to the question, and p is the label corresponding to whether the question and answer are correct, p ∈ [0, 1], 0 indicates that the candidate answer is incorrect, and 1 indicates that the candidate answer is correct.

[0022] Problem q is represented as:

[0023]

[0024] in, Let be the i-th word in question q, where i = 1, 2, ..., m, and m is the length of the text in question q;

[0025] Answer 'a' is represented as:

[0026]

[0027] in, Let i be the i-th word in answer a, where i = 1, 2, ..., n, and n is the length of the text in answer a.

[0028] Step B12: Regarding the problem obtained in step B11 and answer Concatenate the sequences and insert [CLS] markers before question q and [SEP] markers before and after answer a to construct the question-answer input sequence X for the BERT coding model. s ;

[0029] The question-and-answer input sequence is represented as follows:

[0030]

[0031] Where m and n represent the text lengths of question q and answer a, respectively;

[0032] Step B13: Place X s The input is fed into the BERT model to obtain the output sequence of the i-th layer of the BERT model. The output sequence H of the last layer of the model s According to the [CLS] and [SEP] tags in H s The positions in the sequence are used to segment the initial features of the question and the answer, thereby obtaining the initial features H of the question and the answer respectively. q and H a The feature vectors corresponding to the [CLS] labels output by BERT are considered as the global semantics of the question and answer. d is the dimension of the feature vector;

[0033] wherein, is represented as:

[0034]

[0035] Initial features of question q is represented as:

[0036]

[0037] wherein, is the ith word corresponding word vector, m is the text length of answer q, and d is the dimension of the feature vector;

[0038] Initial features of answer a is represented as:

[0039]

[0040] wherein is the ith word corresponding word vector, n is the text length of answer a, and d is the dimension of the feature vector;

[0041] Global semantic H of question and answer cls is represented as:

[0042] H cls = [CLS]

[0043] wherein d is the dimension of the feature vector;

[0044] Step B14: text-knowledge matching and multi-hop node expansion of each word in question q and answer a in the knowledge graph; first, each word in question q is text-knowledge matched in the knowledge graph to obtain its corresponding knowledge node Similarly, each word in answer a corresponding knowledge node Secondly, in the process of multi-hop expansion of knowledge nodes, according to the text matching knowledge node and the relationship between the nodes in the knowledge graph, multi-hop node selection is performed; the multi-hop selected knowledge nodes are sorted according to their initial weight size in the knowledge graph, and the max_n expansion knowledge nodes with the largest weight are selected; the expansion nodes and the text matching knowledge nodes are connected to form a knowledge expansion sequence; each knowledge node in the knowledge expansion sequence is mapped to a continuous low-dimensional vector using knowledge embedding, and finally the knowledge expansion sequence features C q of question q and answer a are formed. a ;

[0045] wherein the question knowledge expansion sequence feature C q is expressed as:

[0046]

[0047] wherein, is the length of the question knowledge expansion sequence, and d is the dimension of the feature vector; is the expansion knowledge node of, and max_n is the set number of expansion nodes;

[0048] the answer a knowledge expansion sequence feature C a is expressed as:

[0049]

[0050] wherein, is the length of the answer knowledge expansion sequence, and d is the dimension of the feature vector; is the expansion knowledge node of, and max_n is the set number of expansion nodes.

[0051] Further, the step B2 specifically comprises the following steps:

[0052] Step B21: the question and answer knowledge expansion sequence N q and N a are respectively constituted into question and answer knowledge matching-expansion node structure subgraphs according to whether there is a connection relationship between nodes to obtain fusion information between knowledge expansion nodes and knowledge matching nodes, and are converted into corresponding l2-order adjacency matrixes and l3-order matrixes

[0053] wherein is expressed as follows:

[0054]

[0055] In the adjacency matrix , the matrix element is 0, indicating that there is no node connection relationship between the knowledge node and the knowledge node ; the matrix element is 1, indicating that there is a node connection relationship between the word and the word , that is, is the expansion knowledge node of, and both are adjacency matrix nodes;

[0056] wherein The representation is as follows:

[0057]

[0058] In the adjacency matrix In the matrix, elements A value of 0 indicates a knowledge node. and knowledge nodes There are no node connections between them; matrix elements 1 represents a word and words There are node connections between them. for The extended knowledge nodes, and both are adjacent matrix nodes;

[0059] Step B22: Expand the knowledge of question q into sequence features C q As node features of the graph, a K-layer graph attention network is used in the adjacency matrix. Graph attention calculations are performed to update graph node information; each layer of the graph attention network contains X attention heads.

[0060] In each layer of the graph attention network, the computation and update process of graph node i is as follows:

[0061]

[0062]

[0063]

[0064]

[0065] in d is the dimension of the feature vector, W1 and W2 are the shared parameter matrices, ":" is the concatenation operation, and σ(·) is the activation function;

[0066] Step B23: Concatenate the feature information of each node in the graph after passing through the Kth layer graph attention network to obtain the knowledge matching-extended node semantic features of the problem.

[0067] The calculation formula is as follows:

[0068]

[0069] in Let d be the length of the knowledge extension sequence for the question, and d be the dimension of the feature vector. Similarly, the knowledge matching for obtaining the answer involves extending the semantic features of the node.

[0070] Further, the step B3 specifically includes the following steps:

[0071] Step B31: Knowledge expansion sequence N for question and answer q and N a Syntactic dependency parsing is performed using an external parsing tool, and a corresponding syntactic dependency tree is obtained; knowledge matching node syntactic dependency subgraphs for questions and answers are respectively constructed, and converted into corresponding l2-order adjacency matrices and l3-order matrices

[0072] Wherein is represented as follows:

[0073]

[0074] In the adjacency matrix , the matrix element is 0, indicating that there is no syntactic structure dependency relationship between knowledge nodes and ; the matrix element is 1, indicating that there is a certain syntactic structure dependency relationship between the words and , and both are adjacency matrix nodes; similarly, the definition of the adjacency matrix is consistent with ;

[0075] Wherein is represented as follows:

[0076]

[0077] In the adjacency matrix , the matrix element is 0, indicating that there is no syntactic structure dependency relationship between knowledge nodes and ; the matrix element is 1, indicating that there is a certain syntactic structure dependency relationship between the words and , and both are adjacency matrix nodes.

[0078] Step B32: Masking the features of the expansion nodes in the knowledge expansion sequence feature C q of the question q, i.e. masking the expansion nodes and not participating in the calculation; then taking the knowledge expansion sequence feature C q after the masking operation as the node feature of the graph, and using a K-layer graph attention network in the adjacency matrix The graph attention calculation is performed on the upper graph node feature information, and each layer of the graph attention network contains X attention heads;

[0079] In each layer of the graph attention network, the calculation and updating process of the graph node i is as follows:

[0080]

[0081]

[0082]

[0083]

[0084] wherein d is the dimension of the feature vector, W3 and W4 are shared parameter matrices, ":" is a splicing operation, and σ(·) is an activation function.

[0085] Step B33: Splice the feature state information of each node in the graph after the Kth layer of the graph attention network to obtain the knowledge matching node context semantic feature of the question

[0086] The representation is as follows:

[0087]

[0088] wherein is the length of the question knowledge expansion sequence, and d is the dimension of the feature vector; similarly, the knowledge matching node context semantic feature of the answer

[0089] Step B34: Perform an expansion node pruning operation on the knowledge matching node context semantic features of the question and the answer After pruning, the pruned knowledge matching node context semantic features of the question and the answer are m is the text length of the question q, n is the text length of the answer a, and d is the dimension of the feature vector.

[0090] Further, the step B4 specifically comprises the following steps:

[0091] Step B41: Use the pre-trained language model to output the initial features H q and H a of the question and answer texts respectively, and use a BiGRU network to perform sequence fusion to obtain the sequence semantic features of the question and answer and The calculation formula is as follows:

[0092]

[0093]

[0094] wherein m is the text length of the question q, n is the text length of the answer a, and d is the dimension of the feature vector;

[0095] Step B42: using the interactive attention mechanism, the knowledge matching node context semantic features of the question and answer obtained in step B34 are calculated and respectively with the sequence semantic features obtained in step B41 and to obtain the text attention feature representations of the question and answer and respectively, and the knowledge attention feature representations and

[0096] and and The calculation formula is as follows:

[0097]

[0098]

[0099]

[0100]

[0101] wherein m is the text length of the question q, n is the text length of the answer a, and d is the dimension of the feature vector; W3, W4, W5, W6 are trainable attention matrix parameters;

[0102] Step B43: the text attention features of the question and answer and are respectively connected with the initial features H q , H a of the question and answer obtained in step B13, and the knowledge attention features of the question and answer and are respectively connected with the knowledge matching node context semantic features of the question and answer , and through a forward feedback neural network, linear transformation is performed on them, thereby obtaining the final text collaborative reasoning features of the question and answer and knowledge collaborative reasoning features and

[0103] and The calculation formula is as follows:

[0104]

[0105]

[0106] in m is the text length of question q, and d is the dimension of the feature vector; W9, W 10 W 11 W 12 Here are the trainable linear transformation parameters, and b1, b2, b3, b4 are the bias vectors; similarly, the following calculations are performed. and n is the length of the text in answer a.

[0107] Furthermore, step B5 specifically includes the following steps:

[0108] Step B51: Textual collaborative reasoning features of the questions and answers obtained in step B43 and Each question and answer uses a multi-head self-attention mechanism to calculate the contextual semantic relationships between words in the sentence, thereby obtaining the self-attention semantic features. and The calculation formula is as follows:

[0109]

[0110]

[0111] Where MHA represents multi-head attention mechanism, num is the number of parallel heads, and Q(query), k(key), and V(value) are the text collaborative reasoning features of the question and answer. m is the text length of question q; W 13 W 14 W 15 W 16 For trainable attention parameters, head i This represents the output of the i-th attention function, where i ∈ [1, num]; similarly, the self-attention semantic features of the answer are obtained. n is the length of the text in answer a;

[0112] Step B52: Employ an interactive attention mechanism to analyze the self-attention characteristics of questions and answers. and A multiplication operation is performed and normalized by using a softmax function to obtain the perception answer semantic question interaction attention semantic feature and the perception question semantic answer interaction attention semantic feature

[0113] The calculation formula is as follows:

[0114]

[0115]

[0116] wherein, m is the text length of the question q, n is the text length of the answer a, and d is the dimension of the feature vector; W 17 ,W 18 is a trainable attention matrix parameter;

[0117] Step B53: respectively filter and fuse the fine-grained question and answer interaction attention semantic features and and the coarse-grained question and answer global semantic features H cls to obtain the multi-granularity semantic features of the semantic representation accurate question and answer and and The calculation formula is as follows:

[0118]

[0119]

[0120]

[0121]

[0122] wherein, d is the dimension of the feature vector; In order to ensure the consistency of the feature size, the average pooling operation is performed on and avg_pooling(·) is an average pooling function, W 19 ,W 20 ,W 21 ,W 22 is a trainable gating network parameter.

[0123] Further, the step B6 specifically comprises the following steps:

[0124] Step B61: Concatenate the multi-granularity semantic features of the question and the answer and the knowledge reasoning features obtained in step B43 and to obtain the final features of the question and the answer and

[0125] and The representation of the question and the answer is as follows:

[0126]

[0127]

[0128] Step B62: Concatenate the final representation features of the question and the final representation features of the answer to obtain the final question-answer pair feature representation H final ;

[0129] H final is represented as follows:

[0130]

[0131] Further, the step B7 specifically comprises the following steps:

[0132] Step B71: Normalize the final question-answer pair feature representation H final using a softmax function to obtain the relevance matching score f(q,a) between the question-answer pair, where f(q,a) ∈ [0,1];

[0133] The calculation formula of f(q,a) is as follows:

[0134] f(q,a) = softmax(H final W 23 +b5)

[0135] wherein, is a trainable parameter matrix, is a bias vector;

[0136] Step B72: Use cross-entropy as the loss function to calculate the loss value, update the learning rate through the gradient optimization algorithm Adam, and update the model parameters through backpropagation iteration to train the model to minimize the loss function;

[0137] The calculation formula of the loss function L is as follows:

[0138]

[0139] where f(q, a) i ∈ [0, 1] is the relevance score of question-answer calculated by the softmax classifier, y i ∈ [0, 1] is the binary classification label.

[0140] The application also provides a question and answer system based on the text-knowledge expansion graph collaborative reasoning network using the above method, comprising:

[0141] A data collection module is configured to collect questions and answer records of users in a question and answer platform, and label a true label of each question-answer, so as to build a training set DS;

[0142] A text preprocessing module is configured to preprocess training samples in the training set, including word segmentation processing and stop word removal;

[0143] A text encoding module is configured to perform initial encoding on all training samples in the training set DS, so as to obtain initial features of question and answer text contents, global semantic features of question and answer pairs, and knowledge expansion sequence features of questions and answers obtained by text-knowledge matching of the questions and answers and multi-hop knowledge node expansion query from a knowledge graph;

[0144] A network model training module is configured to input the initial features of the question and answer texts, the global semantic features of the question-answer, the knowledge matching node context semantic features of the question-answer pair, and the knowledge expansion sequence features of the questions and answers into a deep learning network model, to obtain final features of the question-answer pair, to predict a probability of correctness of the answer by using the final features of the question-answer pair, and to calculate a loss by comparing with a true class label in the training set, so as to train the entire deep learning network by taking minimizing the loss as an objective, to obtain a deep learning network model based on the text-knowledge expansion graph collaborative reasoning network;

[0145] An answer selection module is configured to select a correct answer for a given question, to analyze and process the input question by using the deep learning network model of the text-knowledge expansion graph collaborative reasoning network, and to output a candidate answer with the highest relevance score of the question-answer pair, representing the correct answer selected for the question.

[0146] Compared with the prior art, the application has the following beneficial effects: the question and answer method and system based on the text-knowledge expansion graph collaborative reasoning network are provided, the deep learning network model based on the text-knowledge expansion graph collaborative reasoning network is constructed to analyze and process the input question, to select and output a matched answer, and the accuracy of selecting a corresponding answer for a given question is improved, so that the application has strong practicability and broad application prospect. BRIEF DESCRIPTION OF DRAWINGS

[0147] Figure 1 is a method implementation flowchart of an embodiment of the present application;

[0148] Figure 2 is an architecture diagram of a deep learning network model based on a text-knowledge expansion graph collaborative reasoning network in an embodiment of the present application;

[0149] Figure 3 is a system structure schematic diagram of an embodiment of the present application. DETAILED DESCRIPTION

[0150] The present application will be further described below in conjunction with the accompanying drawings and embodiments.

[0151] It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the present application. Unless otherwise indicated, all technical and scientific terms used herein have the same meaning as would be commonly understood by one of ordinary skill in the art to which the present application belongs.

[0152] It should be noted that the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, the singular form is intended to include the plural form unless the context clearly indicates otherwise, and it should also be understood that when the terms "comprise" and / or "include" are used in the specification, there is a presence of a feature, step, operation, device, component, and / or combinations thereof.

[0153] As shown in Figure 1 , the present embodiment provides a question and answer method based on a text-knowledge expansion graph collaborative reasoning network, comprising the following steps:

[0154] Step A: Collecting user questions and answer records in a question and answer platform, and labeling the true label of each question-answer pair to build a training set DS.

[0155] Step B: Using the training set DS and the knowledge graph, training a deep learning network model M based on a text-knowledge expansion graph collaborative reasoning network, and the model architecture is as shown in Figure 2 , to analyze a given question and give a corresponding answer through the model M.

[0156] Step C: Inputting the user's question into the trained deep learning network model M, and outputting the matched answer.

[0157] In the present embodiment, the step B specifically comprises the following steps:

[0158] Step B1: Initial encoding of all training samples in the training set DS, thereby obtaining initial features H q , H aGlobal semantic features H of questions and answers cls Simultaneously, text-knowledge matching and multi-hop knowledge node expansion queries are performed on the question and answer texts from the knowledge graph. The matched knowledge nodes and expansion nodes are connected to obtain the knowledge expansion sequence N of the question and answer. q and N a Furthermore, the information of each knowledge node in the knowledge expansion sequence is mapped into a continuous low-dimensional vector, ultimately forming the knowledge expansion sequence feature C of the question and answer. q C a .

[0159] In this embodiment, step B1 specifically includes the following steps:

[0160] Step B11: Traverse the training set DS, segment the question and candidate answer texts and remove stop words. Each training sample in DS is represented as ds = (q, a, p); where q is the text content of the question, a is the text content of the candidate answer corresponding to the question, and p is the label corresponding to whether the question and answer are correct, p ∈ [0, 1], 0 indicates that the candidate answer is wrong, and 1 indicates that the candidate answer is correct.

[0161] Problem q is represented as:

[0162]

[0163] in, Let be the i-th word in question q, where i = 1, 2, ..., m, and m is the length of the text in question q.

[0164] Answer 'a' is represented as:

[0165]

[0166] in, Let be the i-th word in answer a, where i = 1, 2, ..., n, and n is the length of the text in answer a.

[0167] Step B12: Regarding the problem obtained in step B11 and answer Concatenate the sequences and insert [CLS] markers before question q and [SEP] markers before and after answer a to construct the question-answer input sequence X for the BERT coding model. s .

[0168] The question-and-answer input sequence is represented as follows:

[0169]

[0170] Where m and n represent the text lengths of question q and answer a, respectively.

[0171] Step B13: Place X s The input is fed into the BERT model to obtain the output sequence of the i-th layer of the BERT model. The output sequence H of the last layer of the model s According to the [CLS] and [SEP] tags in H s The positions in the sequence are used to segment the initial features of the question and the answer, thereby obtaining the initial features H of the question and the answer respectively. q and H a The feature vectors corresponding to the [CLS] labels output by BERT are considered as the global semantics of the question and answer. d is the dimension of the feature vector.

[0172] in, Represented as:

[0173]

[0174] Initial characteristics of problem q Represented as:

[0175]

[0176] in, For the i-th word The corresponding word vectors are m, which is the text length of the answer q, and d, which is the dimension of the feature vector.

[0177] Initial characteristics of answer a Represented as:

[0178]

[0179] in For the i-th word The corresponding word vectors, n is the text length of answer a, and d is the dimension of the feature vector.

[0180] Global semantics H of questions and answers cls Represented as:

[0181] H cls =[CLS]

[0182] in d is the dimension of the feature vector.

[0183] Step B14: Perform question-text-knowledge matching and multi-hop node expansion on the knowledge graph for each word in question q and answer a; first, for each word in question q... Text-knowledge matching is performed in the knowledge graph to obtain the corresponding knowledge nodes. obtained in the same way as each word in answer a corresponding knowledge nodes Secondly, in the process of multi-hop expansion of knowledge nodes, the knowledge nodes are selected according to the multi-hop relationship between the nodes in the text matching knowledge nodes and the knowledge graph; the multi-hop selected knowledge nodes are sorted according to their initial weight in the knowledge graph, and the max_n expansion knowledge nodes with the largest weight are selected; the expansion nodes and the text matching knowledge nodes are connected to form a knowledge expansion sequence; each knowledge node in the knowledge expansion sequence is mapped into a continuous low-dimensional vector by using knowledge embedding, and finally the knowledge expansion sequence features C q of the question q and the answer a are formed a .

[0184] wherein the question q knowledge expansion sequence feature C q is expressed as:

[0185]

[0186] wherein, is the length of the question knowledge expansion sequence, and d is the dimension of the feature vector; is the expansion knowledge node of , and max_n is the set number of expansion nodes.

[0187] the answer a knowledge expansion sequence feature C a is expressed as:

[0188]

[0189] wherein, is the length of the answer knowledge expansion sequence, and d is the dimension of the feature vector; is the expansion knowledge node of , and max_n is the set number of expansion nodes.

[0190] Step B2: the knowledge expansion sequence N q and N a of the question and the answer obtained in step B1 are constructed into a question and answer knowledge matching-expansion node structure subgraph according to the connection relationship of the nodes, and are converted into corresponding l2-order adjacency matrix and l3-order matrix Then the K-layer graph attention network is used to evaluate the semantic understanding degree of each node in the knowledge matching-expansion node structure subgraph, and the feature state information of each node is spliced to obtain the knowledge matching-expansion node semantic feature

[0191] In this embodiment, the step B2 specifically comprises the following steps:

[0192] Step B21: knowledge expansion sequence N of question and answer q and N a According to whether there is a connection relationship between nodes, the knowledge matching-expansion node structure subgraph of the question and the answer is constructed to obtain the fusion information between the knowledge expansion nodes and the knowledge matching nodes, and is converted into the corresponding l2-order adjacency matrix and l3-order matrix

[0193] wherein is represented as follows:

[0194]

[0195] In the adjacency matrix , the matrix element is 0, indicating that there is no node connection relationship between the knowledge node and the knowledge node ; the matrix element is 1, indicating that there is a node connection relationship between the word and the word , i.e. is the expansion knowledge node , and both are adjacency matrix nodes.

[0196] wherein is represented as follows:

[0197]

[0198] In the adjacency matrix , the matrix element is 0, indicating that there is no node connection relationship between the knowledge node and the knowledge node ; the matrix element is 1, indicating that there is a node connection relationship between the word and the word , i.e. is the expansion knowledge node , and both are adjacency matrix nodes.

[0199] Step B22: taking question q as an example, the knowledge expansion sequence feature C q of question q is taken as the node feature of the graph, and the K-layer graph attention network is used to perform graph attention calculation on the adjacency matrix , and the graph node information is updated; wherein each layer of the graph attention network contains X attention heads.

[0200] Then in each layer of the graph attention network, the calculation and updating process of the graph node i is as follows:

[0201]

[0202]

[0203]

[0204]

[0205] wherein d is the dimension of the feature vector, W1, W2 is the shared parameter matrix, ":" is the concatenation operation, and σ(·) is the activation function.

[0206] Step B23: The feature information of each node in the graph passing through the K-layer graph attention network is spliced to obtain the knowledge matching-expansion node semantic feature of the question

[0207] The calculation formula is as follows:

[0208]

[0209] wherein is the length of the question knowledge expansion sequence, d is the dimension of the feature vector, and similarly, the knowledge matching-expansion node semantic feature of the answer

[0210] Step B3: The question and answer knowledge expansion sequences N q and N a are constructed into corresponding syntax dependency trees through an external parsing tool, and are converted into corresponding l2-order adjacency matrices and l3-order matrices Then, the K-layer graph attention network is used to obtain the knowledge matching node context semantic features of the question and the answer and the features are masked to reduce semantic noise.

[0211] In this embodiment, the step B3 specifically comprises the following steps:

[0212] Step B31: For the question and answer knowledge expansion sequences N q and N a , the syntax dependency relationship is parsed using an external parsing tool, and the corresponding syntax dependency tree is obtained; the question and answer knowledge matching node syntax dependency subgraph is constructed, and is converted into corresponding l2-order adjacency matrices and l3-order matrices

[0213] wherein is represented as follows:

[0214]

[0215] In the adjacency matrix , the matrix element is 0, indicating that there is no syntactic structure dependency relationship between the knowledge nodes and the knowledge nodes ; the matrix element is 1, indicating that there is a certain syntactic structure dependency relationship between the word and the word , and the two are adjacency matrix nodes. The definition of the adjacency matrix is consistent.

[0216] Wherein is represented as follows:

[0217]

[0218] In the adjacency matrix , the matrix element is 0, indicating that there is no syntactic structure dependency relationship between the knowledge nodes and the knowledge nodes ; the matrix element is 1, indicating that there is a certain syntactic structure dependency relationship between the word and the word , and the two are adjacency matrix nodes.

[0219] Step B32: Taking question q as an example, the features of the expansion nodes in the knowledge expansion sequence feature C q of question q are masked, that is, the expansion nodes are shielded and do not participate in the calculation; then the knowledge expansion sequence feature C q after the mask operation is used as the node feature of the graph, and the K-layer graph attention network is used to perform graph attention calculation on the adjacency matrix , and the graph node feature information is updated, wherein each layer of the graph attention network contains X attention heads.

[0220] Then in each layer of the graph attention network, the calculation and updating process of the graph node i is as follows:

[0221]

[0222]

[0223]

[0224]

[0225] wherein d is the dimension of the feature vector, W3, W4 is the shared parameter matrix, ":" is the splicing operation, and σ(·) is the activation function.

[0226] Step B33: The feature state information of each node in the graph after passing through the Kth layer of the graph attention network is spliced to obtain the knowledge matching node context semantic feature of the question

[0227] is represented as follows:

[0228]

[0229] wherein is the length of the question knowledge expansion sequence, and d is the dimension of the feature vector; similarly, the knowledge matching node context semantic feature of the answer

[0230] Step B34: The knowledge matching node context semantic features of the question and the answer are expanded and pruned, and then the pruned m is the text length of the question q, n is the text length of the answer a, and d is the dimension of the feature vector.

[0231] Step B4: The initial features H q and H a of the question and the answer obtained in step B1 are respectively fused by a BiGRU network to obtain the sequence semantic features of the question and the answer and The knowledge matching node context semantic features of the question and the answer obtained in step B3 are respectively combined with the corresponding sequence semantic features and to obtain the text attention feature representations of the question and the answer and and the knowledge attention feature representations and Then the text attention features and are respectively combined with the initial features H q and H a , the knowledge attention features and are respectively combined with the knowledge matching node context semantic features , and the residual connections are respectively established between them, and the forward feedback neural networks are respectively passed to obtain the text collaborative reasoning features of the question and the answer and and the knowledge collaborative reasoning features and

[0232] In the embodiment, the step B4 specifically comprises the following steps:

[0233] Step B41: outputting initial features H of question and answer texts by the pre-trained language model q , H a respectively using BiGRU network for sequence fusion to obtain sequence semantic features of question and answer and The calculation formula is as follows:

[0234]

[0235]

[0236] Wherein m is the text length of the question q, n is the text length of the answer a, and d is the dimension of the feature vector.

[0237] Step B42: using the interactive attention mechanism, the question and answer knowledge matching node context semantic features obtained in step B34 and respectively with the sequence semantic features obtained in step B41 and Calculate the correlation matrix to obtain the text attention feature representation of the question and answer and and the knowledge attention feature representation and

[0238] and and The calculation formula is as follows:

[0239]

[0240]

[0241]

[0242]

[0243] Wherein m is the text length of the question q, n is the text length of the answer a, and d is the dimension of the feature vector; W3, W4, W5, W6 are trainable attention matrix parameters.

[0244] Step B43: the text attention features of question and answer and The initial characteristic H of the question and answer obtained in step B13 q , a The knowledge attention characteristic of the question and answer and The knowledge matching node context semantic characteristic of the question and answer Residual connection is made between each two respectively, and linear transformation is made on it through a forward feedback neural network, so as to obtain the final text collaborative reasoning characteristic of the question and answer and The knowledge collaborative reasoning characteristic and

[0245] and The calculation formula is as follows:

[0246]

[0247]

[0248] Wherein m is the text length of the question q, and d is the dimension of the characteristic vector; W9,W 10 ,W 11 ,W 12 are trainable linear transformation parameters, and b1,b2,b3,b4 are bias vectors; similarly, the calculation of and n is the text length of the answer a.

[0249] Step B5: the text collaborative reasoning characteristic of the question and answer obtained in step B4 and respectively through a multi-head self-attention mechanism to obtain the self-attention semantic characteristic of the question and answer and Then the obtained self-attention semantic characteristics of the question and answer and are fused with each other through an interaction attention mechanism to obtain the interaction attention semantic characteristics of the question and answer and After that, the interaction attention semantic characteristics of the question and answer and are respectively filtered and fused with the global semantic characteristics H cls of the question and answer to obtain the multi-granularity semantic characteristics of the question and answer and

[0250] In the embodiment, the step B5 specifically comprises the following steps:

[0251] Step B51: Textual collaborative reasoning features of the question and the answer obtained in step B43 and respectively utilize a multi-head self-attention mechanism to obtain the contextual semantic relationship between the words of the sentence through weight calculation, thereby obtaining the self-attention semantic features of the question and the answer and The calculation formula is as follows:

[0252]

[0253]

[0254] Wherein, MHA represents a multi-head attention mechanism, num represents the number of parallel heads, Q (query), k (key), and V (value) are all textual collaborative reasoning features of the question and the answer m represents the text length of the question q; W 13 ,W 14 ,W 15 ,W 16 are trainable attention parameters, head i represents the output of the i-th attention function, i∈[1,num]; similarly, the self-attention semantic features of the answer can be obtained n represents the text length of the answer a. head i is the calculation formula of each head in the multi-head attention mechanism, Q, K, and V are the parameters required in the calculation process of head i , and represents the input parameters.

[0255] Step B52: Interactive attention mechanism is adopted to obtain the self-attention features of the question and the answer and perform a multiplication operation and utilize a softmax function for normalization processing to obtain the question interactive attention semantic features that perceive the semantic of the answer and the answer interactive attention semantic features that perceive the semantic of the question

[0256] The calculation formula is as follows:

[0257]

[0258]

[0259] Wherein, m is the text length of the question q, n is the text length of the answer a, and d is the dimension of the feature vector; W 17 ,W 18 is a trainable attention matrix parameter.

[0260] Step B53: respectively filter and fuse the fine-grained question and answer interaction attention semantic features and and the global semantic features H cls of the question and answer to obtain the multi-granularity semantic features of the semantic representation accurate question and answer and and The calculation formula is as follows:

[0261]

[0262]

[0263]

[0264]

[0265] wherein, d is the dimension of the feature vector; in order to ensure the consistency of the feature size, the average pooling operation is performed on and , and avg_pooling(·) is the average pooling function, W 19 ,W 20 ,W 21 ,W 22 is a trainable gating network parameter.

[0266] Step B6: connect the multi-granularity semantic features of the question and answer and obtained in step B5 and the knowledge collaborative reasoning features and obtained in step B4 to obtain the final representation features of the question and answer and and connect them to obtain the final answer pair feature representation H final .

[0267] In this embodiment, step B6 specifically comprises the following steps:

[0268] Step B61: respectively connect the multi-granularity semantic features of the question and answer and and the knowledge collaborative reasoning features obtained in step B43 and The final features of the question and the answer are obtained by splicing and

[0269] and The representation is as follows:

[0270]

[0271]

[0272] Step B62: connect the final question feature representation and the final answer feature to obtain the final question-answer pair feature representation H final .

[0273] H final The representation is as follows:

[0274]

[0275] Step B7: the final answer pair feature representation H final obtained in B6 is processed by a softmax function to obtain a relevance matching score f(q, a) between the question-answer pair, and then the gradients of each parameter in the deep learning network model are calculated by the back propagation method according to the target loss function loss, and each parameter is updated by the stochastic gradient descent method.

[0276] In this embodiment, the step B7 specifically comprises the following steps:

[0277] Step B71: normalize the final question-answer pair feature representation H final by using a softmax function to obtain a relevance matching score f(q, a) between the question-answer pair.

[0278] The calculation formula of f(q, a) is as follows:

[0279] f(q, a) = softamx(H final W 23 +b5)

[0280] wherein, is a trainable parameter matrix, is a bias vector.

[0281] Step B72: use cross-entropy as a loss function to calculate a loss value, update the learning rate by the gradient optimization algorithm Adam, update the model parameters by the back propagation iteration, and train the model by minimizing the loss function.

[0282] The calculation formula of the loss function L is as follows:

[0283]

[0284] where f(q,a) i is the relevance score of question-answer calculated by the softmax classifier, y i is the binary classification label.

[0285] Step B8: When the loss value produced by the deep learning network model each iteration changes less than a given threshold, or reaches the maximum number of iterations, terminate the training process of the deep learning network model.

[0286] As Figure 3 shown, the embodiment also provides a question and answer system based on the text-knowledge expansion graph collaborative reasoning network using the above method, including: a data collection module, a text preprocessing module, a text encoding module, a network model training module and an answer selection module.

[0287] The data collection module is used to collect user questions and answer records in the question and answer platform, and label the true label of each question-answer, so as to build a training set DS.

[0288] The text preprocessing module is used to preprocess the training samples in the training set, including word segmentation processing, removing stop words.

[0289] The text encoding module is used to encode all training samples in the training set DS, so as to obtain the initial features of question and answer text content, the global semantic features of question and answer pairs, and the knowledge expansion sequence features of question and answer obtained by text-knowledge matching of question and answer text from the knowledge graph and multi-hop knowledge node expansion query.

[0290] The network model training module is used to input the initial features of question and answer text, the global semantic features of question and answer, the knowledge matching node context semantic features of question and answer pairs, and the knowledge expansion sequence features of question and answer into the deep learning network model, to obtain the final features of the question and answer pair, predict the probability of the correctness of the answer using the final features of the question and answer pair, and calculate the loss by comparing with the true class label in the training set, to minimize the loss as the goal to train the entire deep learning network, to obtain the deep learning network model based on the text-knowledge expansion graph collaborative reasoning network.

[0291] The answer selection module is configured to select a correct answer for a given question, analyze and process the input question by using a deep learning network model of a text-knowledge expansion graph collaborative reasoning network, and output a candidate answer with the highest correlation score of a question and answer pair, indicating the correct answer selected for the question.

[0292] Those skilled in the art will understand that embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk memory, CD-ROMs, optical memory, etc.) containing computer-usable program code.

[0293] The present application is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions, which are executed via the processor of the computer or other programmable data processing apparatus, generate a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 means for carrying out the functions specified in the flowcharts and / or block diagrams.

[0294] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including instruction means, which implement the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 means for carrying out the functions specified in the flowcharts and / or block diagrams.

[0295] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable data processing apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable data processing apparatus provide a process for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 means for carrying out the functions specified in the flowcharts and / or block diagrams.

[0296] The above merely describes preferred embodiments of the present application, but is not intended to limit the present application to other forms, and any person skilled in the art can make changes or modifications to the above disclosed technical contents into equivalent embodiments with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiments without departing from the technical solution content of the present application and according to the technical essence of the present application still belongs to the protection scope of the technical solution of the present application.

Claims

1. A question-answering method based on a text-knowledge extension graph collaborative reasoning network, characterized in that, Includes the following steps: Step A: Collect users' questions and answers from the question-and-answer platform, and label each question-and-answer pair with its true label to construct the training set DS; Step B: Using the training set DS and the knowledge graph, train a deep learning network model M based on the text-knowledge extension graph collaborative reasoning network, so as to analyze the given question and give the corresponding answer through the model M; Step C: Input the user's question into the trained deep learning network model M and output the matching answer; Step B specifically includes the following steps: Step B1: Initialize the encoding of all training samples in the training set DS to obtain the initial features H of the question and answer text content. q H a Global semantic features H of questions and answers cls Simultaneously, text-knowledge matching and multi-hop knowledge node expansion queries are performed on the question and answer texts from the knowledge graph. The matched knowledge nodes and expansion nodes are connected to obtain the knowledge expansion sequence N of the question and answer. q and N a Furthermore, the information of each knowledge node in the knowledge expansion sequence is mapped into a continuous low-dimensional vector, ultimately forming the knowledge expansion sequence feature C of the question and answer. q C a ; Step B2: Expand the knowledge sequence N of the questions and answers obtained in Step B1. q and N a Based on the node connectivity, a knowledge matching and expansion node structure subgraph is constructed for the questions and answers, and then converted into the corresponding L2 adjacency matrix. and l3 matrix Next, a K-layer graph attention network is used to evaluate the semantic understanding of each node in the knowledge matching-expansion node structure subgraph, and the feature state information of each node is concatenated to obtain the semantic features of the knowledge matching-expansion nodes for the question. Step B3: Expand the knowledge sequence N of the questions and answers obtained in Step B1. q and N a The corresponding syntactic dependency trees are constructed using external parsing tools and then converted into corresponding L2 adjacency matrices. and l3 matrix Next, a K-layer graph attention network is used to obtain the knowledge matching node context semantic features of the question and answer. The features are masked to reduce semantic noise. Step B4: Calculate the initial features H of the questions and answers obtained in Step B1. q H a Sequence semantic features of questions and answers were obtained by using BiGRU networks for sequence fusion. and The knowledge matching node context semantic features obtained in step B3 will be used to match the questions and answers. Each with its corresponding sequence semantic features and Text attention feature representation of questions and answers obtained through interactive attention mechanism and and knowledge attention feature representation and Next, text attention features and Compared with the initial feature H obtained in step B1 q H a Knowledge attention characteristics and Matching the knowledge node context semantic features obtained in step B3 The textual collaborative reasoning features of the question and answer are obtained by performing residual connections pairwise and passing them separately through a feedforward neural network. and Features of Knowledge Collaborative Reasoning and Step B5: Analyze the textual collaborative reasoning features of the questions and answers obtained in Step B4. and The self-attention semantic features of the question and answer are obtained through a multi-head self-attention mechanism respectively. and Then, the obtained self-attention semantic features are processed through an interactive attention mechanism. and The interactive attention semantic features of questions and answers are obtained by merging them together. and Then, a gating mechanism is used to focus the attention semantic features of the question and answer interaction. and The global semantic features H of the question and answer respectively cls Filtering and fusion are performed to obtain multi-granular semantic features of questions and answers. and Step B6: Analyze the multi-granular semantic features of the questions and answers obtained in Step B5. and The knowledge collaborative reasoning features obtained in step B4 and By performing a connection, the final representation features of the question and answer are obtained. and And connect them to obtain the final answer for the feature representation H. final ; Step B7: Pair the final answer obtained in B6 with the feature representation H final The relevance matching score f(q,a)∈[0,1] between question-answer pairs is obtained through the softmax function; then, based on the target loss function loss, the gradient of each parameter in the deep learning network model is calculated through backpropagation, and the parameters are updated using the stochastic gradient descent method. Step B8: When the change in loss value generated by the deep learning network model in each iteration is less than the given threshold, or when the maximum number of iterations is reached, terminate the training process of the deep learning network model.

2. The question-answering method based on a text-knowledge extension graph collaborative reasoning network according to claim 1, characterized in that, Step B1 specifically includes the following steps: Step B11: Traverse the training set DS, segment the question and candidate answer texts and remove stop words. Each training sample in DS is represented as ds = (q, a, p); where q is the text content of the question, a is the text content of the candidate answer corresponding to the question, and p is the label corresponding to whether the question and answer are correct, p ∈ [0, 1], 0 indicates that the candidate answer is incorrect, and 1 indicates that the candidate answer is correct. Problem q is represented as: in, Let be the i-th word in question q, where i = 1, 2, ..., m, and m is the length of the text in question q; Answer 'a' is represented as: in, Let i be the i-th word in answer a, where i = 1, 2, ..., n, and n is the length of the text in answer a. Step B12: Regarding the problem obtained in step B11 and answer Concatenate the sequences and insert [CLS] markers before question q and [SEP] markers before and after answer a to construct the question-answer input sequence X for the BERT coding model. s ; The question-and-answer input sequence is represented as follows: Where m and n represent the text lengths of question q and answer a, respectively; Step B13: Place X s The input is fed into the BERT model to obtain the output sequence of the i-th layer of the BERT model. The output sequence H of the last layer of the model s According to the [CLS] and [SEP] tags in H s The positions in the sequence are used to segment the initial features of the question and answer, thereby obtaining the initial features H of the question and answer respectively. q and H a The feature vectors corresponding to the [CLS] labels output by BERT are considered as the global semantics of the question and answer. d is the dimension of the feature vector; in, Represented as: Initial characteristics of problem q Represented as: in, For the i-th word The corresponding word vectors, where m is the text length of the answer q and d is the dimension of the feature vector; Initial characteristics of answer a Represented as: in, For the i-th word The corresponding word vectors, where n is the text length of answer a and d is the dimension of the feature vector; Step B14: Perform question-text-knowledge matching and multi-hop node expansion on the knowledge graph for each word in question q and answer a; first, for each word in question q... Text-knowledge matching is performed in the knowledge graph to obtain the corresponding knowledge nodes. Similarly, we can obtain each word in answer a. Corresponding knowledge nodes Secondly, in the process of expanding knowledge nodes through multiple hops, knowledge nodes are matched based on the text. Multi-hop node selection is performed based on the relationships between nodes in the knowledge graph. The selected knowledge nodes are then sorted according to their initial weights in the knowledge graph, and the maximum number of extended knowledge nodes with the highest weights (max_n) are chosen. These extended nodes are connected to text-matching knowledge nodes to form a knowledge extension sequence. Knowledge embedding is used to map each knowledge node in the knowledge extension sequence into a continuous low-dimensional vector, ultimately forming the knowledge extension sequence feature C for question q and answer a. q C a ; Among them, the knowledge extension sequence feature C of question q q Represented as: in, l2 = (m + max_n × m) is the length of the knowledge expansion sequence, and d is the dimension of the feature vector; for The extended knowledge nodes, where max_n is the set number of extended nodes; Answer a Knowledge extension sequence features C a Represented as: in l3 = (n + max_n × n) is the length of the answer knowledge expansion sequence, and d is the dimension of the feature vector; for The extended knowledge nodes, where max_n is the set number of extended nodes.

3. The question-answering method based on a text-knowledge extension graph collaborative reasoning network according to claim 2, characterized in that, Step B2 specifically includes the following steps: Step B21: Expand the knowledge sequence N of the questions and answers. q and N a Based on the existence of connections between nodes, knowledge matching-expansion node structure subgraphs are constructed for both questions and answers to obtain fusion information between knowledge expansion nodes and knowledge matching nodes, and then converted into corresponding L2-order adjacency matrices. and l3 matrix in The representation is as follows: In the adjacency matrix In the matrix, elements A value of 0 indicates a knowledge node. and knowledge nodes There are no node connections between them; matrix elements 1 represents a word and words There are node connections between them. for The extended knowledge nodes, and both are adjacent matrix nodes; in The representation is as follows: In the adjacency matrix In the matrix, elements A value of 0 indicates a knowledge node. and knowledge nodes There are no node connections between them; matrix elements 1 represents a word and words There are node connections between them. for The extended knowledge nodes, and both are adjacent matrix nodes; Step B22: Expand the knowledge of question q into sequence features C q As node features of the graph, a K-layer graph attention network is used in the adjacency matrix. Graph attention calculations are performed to update graph node information; each layer of the graph attention network contains X attention heads. In each layer of the graph attention network, the computation and update process of graph node i is as follows: in d is the dimension of the feature vector, W1 and W2 are the shared parameter matrices, ":" is the concatenation operation, and σ(·) is the activation function; Step B23: Concatenate the feature information of each node in the graph after passing through the Kth layer graph attention network to obtain the knowledge matching-extended node semantic features of the problem. The calculation formula is as follows: in l2 = (m + max_n × m) is the length of the question knowledge expansion sequence, and d is the dimension of the feature vector. Similarly, the knowledge matching and semantic features of the expansion nodes are used to obtain the answer.

4. The question-answering method based on a text-knowledge extension graph collaborative reasoning network according to claim 3, characterized in that, Step B3 specifically includes the following steps: Step B31: Expand the knowledge sequence N for the question and answer. q and N a We use an external parsing tool to parse syntactic dependencies and obtain the corresponding syntactic dependency tree; we construct syntactic dependency subgraphs for knowledge matching nodes of questions and answers respectively, and convert them into corresponding L2 adjacency matrices. and l3 matrix in The representation is as follows: In the adjacency matrix In the matrix, elements A value of 0 indicates a knowledge node. and knowledge nodes There is no syntactic structural dependency between them; matrix elements 1 represents a word and words There is a certain syntactic structural dependency between them, and they are each other's adjacency matrix nodes; similarly, the adjacency matrix... Definition and Consistent; in The representation is as follows: In the adjacency matrix In the matrix, elements A value of 0 indicates a knowledge node. and knowledge nodes There is no syntactic structural dependency between them; matrix elements 1 represents a word and words There is a certain syntactic structural dependency between them, and they are adjacent matrix nodes of each other; Step B32: Expand the knowledge of question q into sequence features C q The features of the extended nodes in the sequence are masked, meaning the extended nodes are excluded from computation; then the knowledge extended sequence features C after the masking operation are applied. q As node features of the graph, a K-layer graph attention network is used in the adjacency matrix. Graph attention calculations are performed to update the feature information of graph nodes. Each layer of the graph attention network contains X attention heads. In each layer of the graph attention network, the computation and update process of graph node i is as follows: in d is the dimension of the feature vector, W3 and W4 are the shared parameter matrices, ":" is the concatenation operation, and σ(·) is the activation function; Step B33: Concatenate the feature state information of each node in the graph after passing through the Kth layer graph attention network to obtain the semantic context of the knowledge matching node for the problem. The representation is as follows: in l2 = (m + max_n × m) is the length of the question knowledge expansion sequence, and d is the dimension of the feature vector; similarly, the knowledge matching node context semantic features are used to obtain the answer. Step B34: Match the knowledge of questions and answers with the contextual semantic features of the nodes. Performing pruning on expanded nodes will result in the following: m is the text length of question q, n is the text length of answer a, and d is the dimension of the feature vector.

5. The question-answering method based on a text-knowledge extension graph collaborative reasoning network according to claim 4, characterized in that, Step B4 specifically includes the following steps: Step B41: Output the initial features H of the question and answer texts from the pre-trained language model. q H a Sequence fusion was performed using BiGRU networks to obtain the sequence semantic features of questions and answers. and The calculation formula is as follows: in m is the text length of question q, n is the text length of answer a; d is the dimension of the feature vector; Step B42: Utilize the interactive attention mechanism to match the knowledge of the question and answer obtained in step B34 with the contextual semantic features of the node. and Compare with the sequence semantic features obtained in step B41 respectively and Calculate the relevance matrix to obtain the text attention feature representations of the question and answer respectively. and and knowledge attention feature representation and and and The calculation formula is as follows: in m is the text length of question q, n is the text length of answer a, d is the dimension of the feature vector; W3, W4, W5, W6 are the parameters of the trainable attention matrix. Step B43: Apply text attention features to questions and answers and The initial features H of the question and answer are obtained from step B13. q H a Knowledge attention characteristics of questions and answers and Knowledge matching node context semantic features of questions and answers Each pair of questions is connected using residual connections, and then linearly transformed using a feedforward neural network to obtain the textual collaborative reasoning features of the final question and answer. and Features of Knowledge Collaborative Reasoning and and The calculation formula is as follows: in m is the text length of question q, and d is the dimension of the feature vector; W9, W 10 W 11 W 12 Here are the trainable linear transformation parameters, and b1, b2, b3, b4 are the bias vectors; similarly, the following calculations are performed. and n is the length of the text in answer a.

6. The question-answering method based on a text-knowledge extension graph collaborative reasoning network according to claim 5, characterized in that, Step B5 specifically includes the following steps: Step B51: Textual collaborative reasoning features of the questions and answers obtained in step B43 and Each question and answer uses a multi-head self-attention mechanism to calculate the contextual semantic relationships between words in the sentence, thereby obtaining the self-attention semantic features. and The calculation formula is as follows: Where MHA represents multi-head attention mechanism, num is the number of parallel heads, and Q(query), k(key), and V(value) are the text collaborative reasoning features of the question and answer. m is the text length of question q; W 13 W 14 W 15 W 16 For trainable attention parameters, head i This represents the output of the i-th attention function, where i ∈ [1, num]; similarly, the self-attention semantic features of the answer are obtained. n is the length of the text in answer a; Step B52: Employ an interactive attention mechanism to analyze the self-attention characteristics of questions and answers. and Perform a multiplication operation and normalize using the softmax function to obtain the semantic features of question interaction attention that perceive the answer semantics. Interactive attention to semantic features of the answer to the perceived question The calculation formula is as follows: in, m is the text length of question q, n is the text length of answer a, and d is the dimension of the feature vector; W 17 W 18 These are the parameters of the trainable attention matrix; Step B53: Separately analyze the fine-grained interactive attention semantic features of questions and answers. and Global semantic features H of coarse-grained questions and answers cls By performing filtering and fusion, we obtain multi-granular semantic features for questions and answers with precise semantic representations. and and The calculation formula is as follows: in, d is the dimension of the feature vector; to ensure consistent feature size, for and Perform average pooling operation; avg_pooling(·) is the average pooling function. W 19 W 20 W 21 W 22 These are the parameters of a trainable gating network.

7. The question-answering method based on a text-knowledge extension graph collaborative reasoning network according to claim 6, characterized in that, Step B6 specifically includes the following steps: Step B61: Separately process the multi-granular semantic features of the question and the answer. and Collaborative reasoning features with knowledge obtained in step B43 and By piecing them together, we obtain the final characteristics of the question and the answer. and and The representation is as follows: Step B62: Finalize the problem representation features and the final characteristics of the answer Perform a connection to obtain the final question-answer pair feature representation H. final ; H final It is expressed as follows:

8. The question-answering method based on a text-knowledge extension graph collaborative reasoning network according to claim 7, characterized in that, Step B7 specifically includes the following steps: Step B71: Use a softmax function to refine the final question-answer feature representation H. final After normalization, the relevance matching score f(q,a)∈[0,1] between the question and answer pairs is obtained; The formula for calculating f(q,a) is as follows: f(q,a)=softamx(H final W 23 +b5) in, For a trainable parameter matrix, It is the bias vector; Step B72: Calculate the loss value using cross-entropy as the loss function, update the learning rate using the Adam gradient optimization algorithm, and iteratively update the model parameters using backpropagation to train the model by minimizing the loss function. The formula for minimizing the loss function L is as follows: Where f(q,a) i ∈[0,1] is the question-answer relevance score calculated by the softmax classifier, y i ∈[0,1] is a binary classification label.

9. A question-answering system based on a text-knowledge extension graph collaborative reasoning network employing the method described in any one of claims 1-8, characterized in that, include: The data collection module is used to collect users' questions and answers on the question-and-answer platform, and to label each question-and-answer pair with its true label, thereby constructing the training set DS. The text preprocessing module is used to preprocess the training samples in the training set, including word segmentation and stop word removal. The text encoding module is used to initially encode all training samples in the training set DS, thereby obtaining the initial features of the question and answer text content, the global semantic features of the question and answer pair, and to obtain the knowledge extension sequence features of the question and answer by performing text-knowledge matching and multi-hop knowledge node extension query on the knowledge graph. The network model training module is used to input the initial features of the question and answer texts, the global semantic features of the question-answer pair, the contextual semantic features of the knowledge matching nodes of the question-answer pair, and the knowledge extension sequence features of the question and answer into the deep learning network model to obtain the final features of the question-answer pair. The final features of the question-answer pair are used to predict the probability of the correctness of the answer. The loss is calculated by comparing with the real class labels in the training set. The entire deep learning network is trained with the goal of minimizing the loss, resulting in a deep learning network model based on the text-knowledge extension graph collaborative reasoning network. The answer selection module is used to select a correct answer for a given question. It uses a deep learning network model of text-knowledge extension graph collaborative reasoning network to analyze and process the input question and output the candidate answer with the highest question-answer pair relevance score, which represents the correct answer selected for the question.

Citation Information

Patent Citations

  • Question and answer matching method and system fusing text and knowledge characterization

    CN112800203A

  • Intelligence intelligent question and answer method based on knowledge graph

    CN115422323A