A deep learning question answering method, device and system based on a mass knowledge graph
By preprocessing, entity recognition and iterative training the text to be processed, the problems of answer accuracy and query efficiency in the deep learning question-answering system are solved, and more efficient and accurate answer output is achieved.
Patent Information
- Application Number
- CN202310756615.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-25
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2043-06-25
AI Technical Summary
The uncertainty and ambiguity of natural language in existing knowledge graph-based deep learning question-answering systems lead to low answer accuracy, and the query efficiency and computing speed of massive knowledge graphs are not perfect.
By receiving and preprocessing the text to be processed, calling the named entity recognition model to identify entities and relationships, using the retrieval model to retrieve candidate answer sets in massive knowledge graphs, and outputting the answer text through iterative training.
It improves the accuracy of answers and the query efficiency of the system, reduces computing resource requirements, and enhances user experience.
Smart Images

Figure CN117112738B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computer natural language processing, and in particular to a deep learning question-answering method, device and system based on a mass knowledge graph. BACKGROUND
[0002] In recent years, with the development of artificial intelligence technology, deep learning question-answering systems have gradually become an important part in the fields of information retrieval, speech synthesis, machine translation, etc. Knowledge graphs have also become an important framework for representing complex information structures in deep learning question-answering systems. Deep learning question-answering systems based on knowledge graphs have been widely used in the industry and have shown better results than previous methods.
[0003] However, the existing deep learning question-answering method based on knowledge graphs still has the following defects: firstly, due to the uncertainty and ambiguity of natural language, the existing deep learning question-answering system has low correctness and accuracy of the answers returned to the user; secondly, the mass knowledge graph contains tens of millions or hundreds of millions of nodes and relationships, so the query efficiency and calculation rate of the existing deep learning question-answering system are not perfect. SUMMARY
[0004] The present application provides a deep learning question-answering method, device and system based on a mass knowledge graph to solve the problem of natural language uncertainty and ambiguity, and to achieve the technical effect of improving the accuracy of the output answers and the query efficiency of the system.
[0005] To solve the above technical problems, the present application provides a deep learning question-answering method based on a mass knowledge graph, comprising the following steps:
[0006] receiving and performing text preprocessing on a first to-be-processed text to obtain a first question text;
[0007] calling a pre-set named entity recognition model to perform recognition processing on the first question text to obtain a plurality of first entities and a first entity relationship corresponding to each of the first entities;
[0008] retrieving a first candidate answer set in a mass knowledge graph according to the first entities and the first entity relationship through a pre-set retrieval model;
[0009] iteratively training the first entities, the first entity relationship and the first candidate answer set until an answer text is output, and outputting and displaying the output answer text as a first answer text.
[0010] The deep learning question and answer method provided by the application obtains first question text by performing text preprocessing on the first generation of processed text, thereby providing a data basis for subsequent recognition processing of the first question text, and meanwhile, the text preprocessing also reduces the computing resources required by the subsequent recognition processing, thereby improving the operation efficiency of the deep learning recognition processing. The first entity and the first entity relationship are obtained by calling a preset named entity recognition model to perform deep learning recognition processing on the first question text, thereby further clarifying and simplifying the question raised by the user and improving the accuracy and efficiency of subsequent answer text retrieval matching for the first entity and the corresponding entity relationship.
[0011] The first candidate answer set is obtained by performing retrieval on the first entity and the first entity relationship through a preset retrieval model, thereby providing a data basis for subsequent iterative training and further improving the efficiency of obtaining the answer text. The first answer text is obtained by performing iterative training on the first entity, the first entity relationship, and the first candidate answer set until only one output answer text is obtained, thereby further improving the accuracy of the obtained answer text and the matching degree and compliance of the answer text with the question input by the user.
[0012] As a preferred example, the receiving and performing text preprocessing on the first to-be-processed text to obtain the first question text specifically comprises:
[0013] The first to-be-processed text is sequentially subjected to word segmentation processing and stop word removal processing, and the processed first to-be-processed text is subjected to vector conversion, thereby converting the first to-be-processed text into a vector form to obtain the first question text.
[0014] The application obtains the corresponding first question text by converting the first to-be-processed text into a vector form, thereby providing a data basis for subsequent recognition processing of the first question text and facilitating the subsequent recognition processing of the first question text. Meanwhile, the first to-be-processed text is sequentially subjected to word segmentation processing and stop word removal processing before being subjected to vector conversion, thereby simplifying and highlighting the key part of the first question text and facilitating the subsequent deep learning recognition processing of the first question text to obtain the corresponding first entity and first entity relationship.
[0015] As a preferred example, the calling of the preset named entity recognition model to perform deep learning recognition processing on the first question text to obtain a plurality of first entities and the first entity relationship corresponding to each first entity specifically comprises:
[0016] The first question text is encoded by calling the named entity recognition model to obtain a word vector corresponding to each word in the first question text.
[0017] Feature extraction is performed on the word vector through a deep learning neural network to obtain a contextual relationship corresponding to the word vector one by one, and the first entity and the first entity relationship are determined based on the word vector and the contextual relationship.
[0018] The first question text is encoded through the named entity recognition model to obtain the word vector corresponding to each word in the text, and the features of each word vector are extracted through a deep learning neural network to obtain the contextual relationship corresponding to each word vector, that is, the contextual feature representation of each word vector, which provides a parameter basis for the subsequent acquisition of the first entity and the first entity relationship.
[0019] As a preferred example, determining the first entity and the first entity relationship based on the word vector and the context relationship is specifically:
[0020] Determine and extract an entity word vector from the word vector according to the contextual relationship, and use the entity word vector as the first entity;
[0021] The contextual relationship is annotated by the named entity recognition model, the relationship between the word vectors other than the first entity in the word vector and the first entity is determined, and the first entity relationship in the word vector is extracted based on the determined relationship.
[0022] The type of the word vector is obtained by analyzing the contextual relationship corresponding to each word vector, determining whether it is an entity word vector, and then all the entity word vectors obtained are combined to obtain the first entity, providing a parameter basis for the subsequent retrieval process. At the same time, the contextual relationship corresponding to each word vector is annotated by the naming recognition model, so that the corresponding relationship between all the remaining word vectors except the first entity and the first entity can be obtained, and then the first entity relationship corresponding to the first entity in the word vector is determined, providing a parameter basis for the subsequent retrieval process.
[0023] As a preferred example, the first candidate answer set is obtained by searching the massive knowledge graph based on the first entity and the first entity relationship using a preset retrieval model, specifically:
[0024] Calling a retrieval module in the retrieval model to search a massive knowledge graph according to the first entity and the first entity relationship to obtain an initial answer set, and sending the initial answer set to a generation module of the retrieval model;
[0025] The generation module classifies and labels the first entity, the first entity relationship and the initial answer set, concatenates the labeled text, performs encoding and decoding calculation on the concatenated text, obtains a corresponding training label, trains the retrieval module through the training label, and retrieves the first entity and the first entity relationship through the trained retrieval module to obtain the first candidate answer set.
[0026] The method of retrieving the first entity and the first entity relationship through the retrieval module in the retrieval model obtains an initial answer set, providing a data basis for obtaining the first candidate answer set subsequently. Meanwhile, the training label obtained by the generation module through encoding and decoding calculation based on the initial answer set, the first entity and the first entity relationship is used to train the retrieval module, thereby improving the retrieval efficiency of the retrieval module and the accuracy of retrieving the corresponding first candidate answer set based on the first entity and the first entity relationship, further improving the accuracy of determining the first answer text based on the first candidate answer set subsequently.
[0027] The way of determining the first candidate answer set based on the initial answer set reduces the computational load of subsequent iterative training for the first candidate answer set, thereby improving the efficiency and accuracy of subsequent iterative training.
[0028] As a preferred example, the retrieval module in the retrieval model is called to retrieve in a massive knowledge graph based on the first entity and the first entity relationship to obtain an initial answer set, specifically:
[0029] A preset mapping model is called to map the first entity and the first entity relationship into a vector form to obtain a first entity vector, and the similarity of the first entity vector with a plurality of nodes in the massive knowledge graph is calculated respectively;
[0030] A first similarity table is obtained by sorting the plurality of nodes in descending order of similarity, and a corresponding number of nodes are extracted from the first similarity table according to a preset first numerical value to generate the initial answer set.
[0031] The initial answer set is obtained by the above method, providing a data basis for determining the first candidate answer set subsequently, and the first entity and the first entity relationship are mapped into a vector form, facilitating subsequent similarity calculation based on the first entity vector and a plurality of nodes in the massive knowledge graph. The way of determining the initial answer set based on the obtained similarity sorting improves the scientificity and accuracy of determining the initial answer set.
[0032] As a preferred example, the generation module classifies and labels the first entity, the first entity relationship and the initial answer set, concatenates the labeled text, performs encoding and decoding calculation on the concatenated text, and obtains a corresponding training label, specifically:
[0033] The generation module performs entity annotation on the text corresponding to the first entity, relation annotation on the text corresponding to the first entity relation, and answer annotation on the text contained in the initial answer set, and concatenates the annotated texts;
[0034] The concatenated texts are independently encoded to obtain encoding results corresponding to the texts, the encoding results are concatenated and decoded, and the attention scores corresponding to the texts are calculated after decoding, and the attention scores are used as the training labels.
[0035] The training labels obtained by the above method are used to train the retrieval module, improving the retrieval efficiency of the retrieval module and the accuracy of the first answer text obtained by the retrieval module. The concatenation result of the first entity, the first entity relation, and the initial answer set is used as input data for encoding and decoding calculation, which improves the accuracy of the attention score determined based on the encoding and decoding process. The obtained attention score is used as a training label. The higher the attention score, the higher the matching degree of the corresponding answer set and the entity and the entity relation, i.e., the higher the matching degree of the answer text and the question text. Therefore, by training the retrieval model with the training label, the retrieval accuracy of the answer text corresponding to the corresponding question text can be improved.
[0036] As a preferred example, the first entity, the first entity relation, and the first candidate answer set are iteratively trained until an answer text is output, specifically:
[0037] The first entity, the first entity relation, and the first candidate answer set are trained by the generation module, and the corresponding training labels are calculated. The training labels obtained by calculation are used to train the retrieval module.
[0038] The trained retrieval module is used to retrieve the first entity and the first entity relation to obtain a second candidate answer set, and the first candidate answer set and the parameters of the generation module are updated based on the second candidate answer set. The updated first candidate answer set, the first entity, and the first entity relation are trained by the updated generation module until an answer text is output.
[0039] The accuracy of the answer text obtained by the above iterative training method is improved, thereby improving the user experience. The iterative training in the above method includes a retrieval process, a label calculation process, and a training process, which further improves the accuracy of the obtained first answer text. At the same time, the computing resources required by this method are reduced compared to the computing resources required by the retrieval process of the prior art.
[0040] Accordingly, the present invention also provides a deep learning question-answering device based on a massive knowledge graph, the deep learning question-answering device comprising a preprocessing module, an entity recognition module, a retrieval module, and an iterative training module;
[0041] The preprocessing module is used to receive and perform text preprocessing on the first text to be processed to obtain a first question text;
[0042] The entity recognition module is used to call a preset named entity recognition model to perform deep learning recognition processing on the first question text to obtain a first entity relationship between a plurality of first entities and the first entity in one-to-one correspondence;
[0043] The retrieval module is used to retrieve a first candidate answer set in a massive knowledge graph based on the first entity and the first entity relationship through a preset retrieval model;
[0044] The iterative training module is used to iteratively train the first entity, the first entity relationship and the first candidate answer set until an answer text is output, and the output answer text is output as the first answer text and displayed.
[0045] Correspondingly, the present invention also provides a deep learning question-answering system based on a massive knowledge graph, wherein the deep learning question-answering system includes a memory, a processor, and a computer program stored on the memory and running on the processor. When the processor processes the computer program, it implements any of the above-mentioned deep learning question-answering methods based on a massive knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 : A flowchart of an embodiment of a deep learning question-answering method based on a massive knowledge graph provided by the present invention;
[0047] Figure 2 : A flow chart of an embodiment of step 102 provided by the present invention;
[0048] Figure 3 : A schematic flow chart of an embodiment of step 103 provided by the present invention;
[0049] Figure 4 : A schematic flow chart of an embodiment of step 301 provided by the present invention;
[0050] Figure 5 : A flow chart of an embodiment of step 104 provided by the present invention;
[0051] Figure 6 : A structural diagram of an embodiment of a deep learning question-answering device based on massive knowledge graph provided by the present invention. DETAILED DESCRIPTION
[0052] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work are within the protection scope of the present application.
[0053] Embodiment one
[0054] Please refer to Figure 1 A flowchart of an embodiment of a deep learning question answering method based on a mass knowledge graph provided by the present application is shown in the figure, which includes steps 101 to 104, and each step is specifically as follows:
[0055] Step 101: receiving and text preprocessing of the first to-be-processed text to obtain the first question text.
[0056] In this embodiment, the first to-be-processed text input by the user is received and text preprocessing is performed on the first to-be-processed text to obtain the first question text, which provides a data basis for deep learning recognition processing of the first question text in the subsequent text, and at the same time, the text preprocessing also reduces the computing resources required by the subsequent deep learning recognition processing, thereby improving the operation efficiency of the deep learning recognition processing.
[0057] Meanwhile, the method for text preprocessing provided by the present embodiment is specifically as follows:
[0058] The received first to-be-processed text is sequentially subjected to word segmentation processing and stop word removal processing, and the processed first to-be-processed text is subjected to vector conversion, so that the first to-be-processed text is converted into a vector form to obtain the first question text.
[0059] The word segmentation processing of the first to-be-processed text in this embodiment is specifically to divide continuous text into meaningful words. If the first to-be-processed text is a patent file, the meaningful words can include patent names, patent numbers, patent application dates, patent publication dates, patent applicants, patent abstracts, and other corresponding types of words. The method for word segmentation processing is not further limited in this embodiment, but jieba word segmentation library is preferred in this embodiment.
[0060] The embodiment removes meaningless words in the text, such as "of", "is", "in", etc. The text will not change in any semantic after removing the above words, so the key part of the first to-be-processed text input by the user is extracted by removing the stop words, so as to facilitate subsequent vector conversion of the extracted text to obtain the first question text.
[0061] The embodiment does not further limit the specific implementation of vector conversion, but preferably converts the text into a vector form by using a Word2Vec model to obtain the first question text.
[0062] The embodiment obtains the corresponding first question text by converting the first to-be-processed text into a vector form, provides a data basis for subsequent deep learning recognition processing of the first question text, and facilitates the deep learning recognition processing of the first question text. Meanwhile, the first to-be-processed text is sequentially subjected to word segmentation processing and stop word removal processing before being subjected to vector conversion, which simplifies and highlights the key part of the first question text, and also facilitates the deep learning recognition processing of the first question text to obtain the corresponding first entity and first entity relationship.
[0063] Step 102: calling a preset named entity recognition model to perform deep learning recognition processing on the first question text to obtain a plurality of first entities and a first entity relationship corresponding to each of the first entities.
[0064] The embodiment obtains the first entity and the first entity relationship by calling the preset named entity recognition model to perform deep learning recognition processing on the first question text, further clarifies and simplifies the question raised by the user, and improves the accuracy and efficiency of subsequent answer text retrieval matching for the first entity and the corresponding entity relationship.
[0065] Step 103: retrieving a first candidate answer set from a massive knowledge graph according to the first entity and the first entity relationship by using a preset retrieval model.
[0066] Step 104: iteratively training the first entity, the first entity relationship, and the first candidate answer set until an answer text is output, and outputting and displaying the output answer text as the first answer text.
[0067] The embodiment performs retrieval on the first entity and the first entity relationship through a preset retrieval model to obtain a first candidate answer set, thereby providing a data basis for subsequent iterative training and further improving the efficiency of obtaining an answer text. The first entity, the first entity relationship and the first candidate answer set are iteratively trained until a unique output answer text is obtained as the first answer text for display, thereby further improving the accuracy of the obtained answer text.
[0068] As another example of the embodiment, refer to Figure 2 , Figure 2 An embodiment of step 102 provided by the present application is shown in a flowchart, including steps 201 to 203, which are as follows:
[0069] Step 201: encode the first question text by calling the named entity recognition model to obtain a word vector corresponding to each word in the first question text, and extract features of the word vector by a deep learning neural network to obtain a context relationship corresponding to the word vector.
[0070] In this example, the first question text is encoded by a preset named entity recognition model to obtain a word vector corresponding to each word in the text, and features of the word vector are extracted by a deep learning neural network to obtain a context relationship corresponding to each word vector, i.e., a context feature representation of each word vector, thereby providing a parameter basis for subsequent obtaining of the first entity and the first entity relationship.
[0071] The embodiment does not further limit the specific type of the named entity recognition model, but the named entity recognition model of the embodiment is preferably a BERT-BiLSTM-CRF model. In this example, a BERT model is used as an encoder to encode the first question text to obtain a word vector representation of each word in the text, and the obtained word vector serves as a data basis for subsequent feature extraction.
[0072] Further, the example adopts a BiLSTM model, i.e., a deep learning neural network, to perform feature extraction on the obtained word vectors, and further obtain the context relationship corresponding to each word vector. The BiLSTM model is a bidirectional long short-term memory (BiLSTM) model, which is a bidirectional recurrent neural network model and can extract feature information of the context relationship between two word vectors. The BiLSTM model uses a gated recurrent unit (GRU) to replace the LSTM, effectively avoiding the problem of gradient disappearance. The GRU includes two LSTM layers, a forward LSTM and a reverse LSTM. The forward LSTM is used to learn the forward features of the text sequence, and the reverse LSTM is used to learn the reverse features of the text sequence. The forward propagation and the reverse propagation are performed to extract features of each word vector and obtain the context relationship corresponding to each word vector, i.e., the context feature representation.
[0073] Step 202: determining and extracting an entity word vector in the word vector according to the context relationship, and taking the entity word vector as the first entity.
[0074] By analyzing the context relationship corresponding to each word vector, it is determined whether the word vector is an entity word vector or a relationship word vector, and the word vectors determined as the entity word vectors are extracted and collected as the first entity, thereby providing a parameter basis for a subsequent retrieval process.
[0075] Step 203: labeling the context relationship by using the named entity recognition model, determining the relationship between the word vectors other than the first entity and the first entity, and extracting the first entity relationship in the word vectors according to the determined relationship.
[0076] By labeling the context relationship corresponding to each word vector by using the named entity recognition model, the corresponding relationship between the remaining word vectors other than the first entity and the first entity can be obtained, and the first entity relationship corresponding to the first entity in the word vectors is determined, thereby providing a parameter basis for a subsequent retrieval process.
[0077] The method for labeling the context of each word vector in the embodiment of the application is preferably realized by using a conditional random field (CRF). The CRF is a sequence modeling method, and by labeling the context relationship, i.e., the context feature representation, the probability of each label, i.e., the probability of the corresponding relationship of the first entity, can be obtained, thereby realizing the extraction and classification of the first entity and the first entity relationship.
[0078] In the BERT-BiLSTM-CRF model, there is also a loss function for minimizing the difference between the model prediction result and the true label. Since the model needs to be trained to improve the accuracy and generalization performance of the model, the embodiment sums the cross-entropy error of each label in each sentence to obtain the average error of the entire model on the training set, and takes the average error as the optimization target. The model is trained and optimized by the Adam optimization algorithm and the optimization target.
[0079] The loss function adopted is a cross-entropy loss function as follows:
[0080]
[0081] Where N represents the number of samples in the training set, T represents the number of annotated entity word vectors and relationship word vectors in each sentence in the text, y i,t represents the target classification result of the i-th sentence, p i,t represents the probability of the i-th sentence predicted by the model.
[0082] As another example of the embodiment, see Figure 3 , Figure 3 The flowchart of an embodiment of step 103 provided by the present application includes steps 301 to 303, and each step is as follows:
[0083] Step 301: calling the retrieval module in the retrieval model to retrieve the initial answer set according to the first entity and the first entity relationship in the massive knowledge graph, and sending the initial answer set to the generation module of the retrieval model.
[0084] The method of retrieving the first entity and the first entity relationship by the retrieval module in the retrieval model above obtains the initial answer set, which provides a data basis for obtaining the first candidate answer set subsequently.
[0085] Step 302: The generation module classifies and labels the first entity, the first entity relationship and the initial answer set and splices them, and performs encoding and decoding calculation on the spliced text to obtain the corresponding training label.
[0086] The specific implementation method of the above method is that the generation module performs entity labeling on the text corresponding to the first entity, relationship labeling on the text corresponding to the first entity relationship, and answer labeling on the text contained in the initial answer set, and splices the labeled texts.
[0087] In the example, the specific implementation method of entity tagging for the text corresponding to the first entity is to add a special mark [question] before the corresponding text, and the specific implementation method of relation tagging for the text corresponding to the first entity relation is to add a special mark [context] before the corresponding text, and the tagged text is spliced after the tagging, that is, the first entity and the corresponding first entity relation are spliced.
[0088] The spliced texts are independently encoded and calculated to obtain the encoding results corresponding to the texts, the encoding results are concatenated and then decoded, and the attention scores corresponding to the texts are calculated after the decoding calculation is completed, and the attention scores are used as the training labels.
[0089] The spliced text is independently input into the encoder, that is, each entity and its corresponding entity relation are independently input into the encoder, and the encoder encodes them, and the encoding results are concatenated and then decoded, that is, the encoding results are spliced, and the spliced encoding results are input into the decoder to obtain the decoding results. After obtaining the decoding results, the generation module calculates the attention scores of the texts for the encoding and decoding process of the texts, and uses the calculated attention scores as training labels to train the retrieval module.
[0090] In the embodiment, the attention score is calculated by calling a preset knowledge graph of the first entity q and the type corresponding to the entity (p k ) 1≤k≤n , and calling the query vector Q annotated by the zeroth attention head of each layer of the decoder, and the key vector K annotated by each node p k on the encoding sequence of the encoder, and calculating the attention score according to the called data. k The calculation formula of the attention score is as follows:
[0091]
[0092] In the example, the specific implementation method of entity tagging for the text corresponding to the first entity is to add a special mark [question] before the corresponding text, and the specific implementation method of relation tagging for the text corresponding to the first entity relation is to add a special mark [context] before the corresponding text, and the tagged text is spliced after the tagging, that is, the first entity and the corresponding first entity relation are spliced.
[0093]
[0094] z i is the output value of the i-th node, and T is the number of output nodes, that is, the number of categories. Through the softmax function, the output value of the multi-classification can be converted into a probability distribution with a range of [0, 1] and a sum of 1. Therefore, the higher the attention score , the higher the attention score.k The corresponding answer text is more likely to be an effective reference answer matching the entity q.
[0095] The training label obtained by the above method trains the retrieval module, improves the retrieval efficiency of the retrieval module, and also improves the accuracy of the first answer text obtained by the retrieval module. The splicing result of the first entity, the first entity relationship and the initial answer set is used as input data for encoding and decoding calculation, which improves the accuracy of the attention score determined according to the encoding and decoding process. The obtained attention score is used as a training label. Since the higher the attention score is, the higher the matching degree of the corresponding answer set and the entity and the entity relationship is, that is, the higher the matching degree of the answer text and the question text is, the training label is used to train the retrieval model, which can improve the retrieval accuracy of the corresponding answer text for the corresponding question text.
[0096] Step 303: training the retrieval module by the training label, and retrieving the first entity and the first entity relationship by the trained retrieval module to obtain the first candidate answer set.
[0097] The training label obtained by the encoding and decoding calculation of the initial answer set, the first entity and the first entity relationship by the generation module is used to train the retrieval module, thereby improving the retrieval efficiency of the retrieval module, and also improving the accuracy of the corresponding first candidate answer set retrieved by the retrieval module according to the first entity and the first entity relationship, and further improving the accuracy of the first answer text determined according to the first candidate answer set.
[0098] The way of determining the first candidate answer set from the initial answer set reduces the computational load of subsequent iterative training for the first candidate answer set, and therefore improves the efficiency and accuracy of subsequent iterative training.
[0099] As another example of the present embodiment, it is participated Figure 4 , Figure 4 The flowchart of an embodiment of step 301 provided by the present application includes steps 401 to 403, and each step is as follows:
[0100] Step 401: calling a preset mapping model to map the first entity and the first entity relationship into a vector form to obtain a first entity vector.
[0101] In the present example, the first entity and the first entity relationship are mapped into a vector mode by using the word embedding model in the BERT model, and the first entity and the first entity relationship are mapped into a d-dimensional dense vector E(p).
[0102] Step 402: Calculate the similarity between the first entity vector and several nodes in the massive knowledge graph respectively, and sort the several nodes in descending order according to the similarity to obtain a first similarity table.
[0103] In this example, the similarity S between the first entity image vector and the knowledge graph node is calculated. θ (q,p), providing data support for the subsequent determination of the initial answer set. The similarity calculation formula is as follows:
[0104]
[0105] Step 403: extracting a corresponding number of nodes from the first similarity table according to a preset first value to generate the initial answer set.
[0106] In this example, according to the table obtained by sorting in step 402, nodes with the greatest similarity and a number corresponding to the first value are selected in descending order of similarity as a candidate answer set.
[0107] The above method generates an initial answer set, providing a data foundation for the subsequent determination of the first candidate answer set. The first entity and its relationship are mapped into vector form, facilitating subsequent similarity calculations between the first entity vector and several nodes in the massive knowledge graph. The initial answer set is determined based on the obtained similarity ranking, improving the scientific nature and accuracy of the initial answer set determination.
[0108] As another example of this embodiment, see Figure 5 , Figure 5 The flowchart of an embodiment of step 104 provided by the present invention includes steps 501 to 503, and each step is specifically as follows:
[0109] Step 501: The first entity, the first entity relationship and the first candidate answer set are trained by a generation module, and corresponding training labels are calculated. The retrieval module is trained by the calculated training labels.
[0110] The training method of the training labels described in the above steps is the same as that in step 302. The first entity, the first entity relationship and the first candidate answer set are spliced and encoded and decoded, and the corresponding attention scores are calculated to obtain corresponding training labels. The retrieval module is then trained with the corresponding training labels to improve the retrieval efficiency and retrieval accuracy of the retrieval module.
[0111] In this embodiment, the method of training the retrieval module by training labels is to calculate the training objective function of the retrieval module by the attention score of the training label set. The calculation formula is as follows:
[0112]
[0113] The calculation formula is specifically to minimize the KL divergence between the normalized similarity S θ (q,p) and the normalized attention score .
[0114] Step 502: retrieving the first entity and the first entity relationship through the trained retrieval module to obtain a second candidate answer set, and updating the first candidate answer set and the parameters of the generation module through the second candidate answer set.
[0115] Through the above method, the second candidate answer set obtained by the trained retrieval module is more accurate than the first candidate answer set and is closer to the correct answer of the question proposed by the user, so that after the second candidate answer set is retrieved, the first candidate answer set is updated according to the second candidate answer set, so that the updated first candidate answer set is used as data for the next generation module training, and the corresponding parameters of the generation module are initialized, so that the generation module can better train the updated first candidate answer set, improve the training efficiency of the generation module and the accuracy of the training label obtained by training the generation module, and further improve the improvement degree of the retrieval efficiency of the retrieval module by the training label.
[0116] Step 503: training the updated first candidate answer set, the first entity and the first entity relationship through the updated generation module until an answer text is retrieved.
[0117] Through the above method, the retrieval of the first entity and the first entity relationship is continuously iterated and circulated in the generation module and the retrieval module, and the generation module is trained according to the candidate answer set obtained by retrieval, until an answer text is retrieved by the retrieval module. The output answer text is the first answer text, and the accuracy of the answer text obtained through multiple iteration cycles and training is effectively improved, thereby improving the user experience. At the same time, the retrieval, label calculation process and training in the above iterative training are continuously circulated, which further improves the accuracy of the obtained first answer text, and the calculation resources required by the method are reduced compared with the calculation resources occupied by the retrieval process of the prior art.
[0118] In order to better illustrate the working principle and step flow of the mass knowledge graph-based question answering method, device and system of the present application, reference can be made to the related description in the above, but not limited thereto.
[0119] Correspondingly, reference can be made to Figure 6 , Figure 6 is an embodiment of a deep learning question answering device based on a mass knowledge graph provided by the present application. As shown inFigure 6 As shown, the question and answer device includes a preprocessing module 601, an entity recognition module 602, a retrieval module 603, and an iterative training module 604.
[0120] The preprocessing module 601 is configured to receive and perform text preprocessing on a first to-be-processed text to obtain a first question text, specifically including: sequentially performing word segmentation processing and stop word removal processing on the received first to-be-processed text, and performing vector conversion on the processed first to-be-processed text to convert the first to-be-processed text into a vector form to obtain the first question text.
[0121] The entity recognition module 602 is configured to call a preset named entity recognition model to perform deep learning recognition processing on the first question text to obtain a plurality of first entities and a first entity relationship corresponding to each of the first entities, specifically including: encoding the first question text by calling the named entity recognition model to obtain a word vector corresponding to each word in the first question text, extracting features of the word vector by a deep learning neural network to obtain a context relationship corresponding to the word vector, and determining the first entities and the first entity relationship according to the word vector and the context relationship.
[0122] Specifically, the first entities and the first entity relationship are determined according to the word vector and the context relationship, specifically including: determining and extracting an entity word vector in the word vector according to the context relationship, taking the entity word vector as the first entity, labeling the context relationship by the named entity recognition model, determining a relationship between a word vector other than the first entity in the word vector and the first entity, and extracting the first entity relationship in the word vector according to the determined relationship.
[0123] The retrieval module 603 is configured to retrieve a first candidate answer set from a massive knowledge graph according to the first entities and the first entity relationship by a preset retrieval model, specifically including: calling a retrieval module in the retrieval model to retrieve an initial answer set from the massive knowledge graph according to the first entities and the first entity relationship, and sending the initial answer set to a generation module of the retrieval model; the generation module classifies and labels the first entities, the first entity relationship, and the initial answer set and splices them, performs encoding and decoding calculation on the spliced text to obtain a corresponding training label, trains the retrieval module by the training label, retrieves the first entities and the first entity relationship by the trained retrieval module, and obtains the first candidate answer set.
[0124] The retrieval module in the retrieval model is called to retrieve in a mass knowledge graph according to the first entity and the first entity relationship to obtain an initial answer set, specifically: a preset mapping model is called to map the first entity and the first entity relationship into a vector form to obtain a first entity vector, and the similarity of the first entity vector with a plurality of nodes in the mass knowledge graph is calculated respectively; and the plurality of nodes are sorted in descending order according to the similarity to obtain a first similarity table, and a corresponding number of nodes are extracted from the first similarity table according to a preset first numerical value to generate the initial answer set.
[0125] Meanwhile, the generation module classifies and labels the first entity, the first entity relationship and the initial answer set and splices them, and performs encoding and decoding calculation on the spliced text to obtain a corresponding training label, specifically: the generation module performs entity labeling on the text corresponding to the first entity, relation labeling on the text corresponding to the first entity relationship, and answer labeling on the text contained in the initial answer set, and splices the labeled texts; the spliced texts are independently encoded to obtain the encoding results of the texts, the encoding results are concatenated and then decoded, and the attention scores of the texts are calculated after decoding, and the attention scores are taken as the training labels.
[0126] The iteration training module 604 is configured to iteratively train the first entity, the first entity relationship and the first candidate answer set until an answer text is output, and output and display the output answer text as a first answer text, specifically including: training the first entity, the first entity relationship and the first candidate answer set by the generation module, and calculating a corresponding training label, and training the retrieval module by the calculated training label; retrieving the first entity and the first entity relationship by the trained retrieval module to obtain a second candidate answer set, updating the first candidate answer set and the parameters of the generation module by the second candidate answer set, and training the updated first candidate answer set, the first entity and the first entity relationship by the updated generation module until an answer text is output by retrieval.
[0127] Correspondingly, the embodiment of the application also provides a deep learning question and answer system based on a mass knowledge graph, which comprises a memory, a processor and a computer program stored in the memory and running on the processor, and the processor implements the deep learning question and answer method based on the mass knowledge graph when processing the computer program.
[0128] In summary, the application provides a kind of question and answer method, device and system based on mass knowledge graph, first question text is obtained by text preprocessing to first generation processing text, and first entity and first entity relationship are obtained by calling preset named entity recognition model to first question text identification processing;First candidate answer set is obtained by searching first entity and first entity relationship by preset search model, and first entity, first entity relationship and first candidate answer set are iteratively trained until an output answer text is obtained as first answer text for output and display.The application simplifies and clarifies the problem input by user through text preprocessing and named entity recognition model, improves the accuracy and efficiency of obtaining first entity and first entity relationship, and further improves the matching degree of obtained answer text and problem text input by user through search model and cyclic iterative training.
[0129] The above specific embodiments further illustrate the purpose, technical solutions and beneficial effects of the application, and it should be understood that the above only describes specific embodiments of the application and is not intended to limit the protection scope of the application. It is particularly pointed out that any modification, equivalent replacement, improvement, etc. made by those skilled in the art within the spirit and principles of the application shall be included in the protection scope of the application.
Claims
1. A deep learning question answering method based on massive knowledge graph, characterized by: The following steps are involved: Receiving and performing text preprocessing on a first text to be processed to obtain a first question text; Calling a preset named entity recognition model to perform deep learning recognition processing on the first question text to obtain a first entity relationship between a plurality of first entities and the first entity in one-to-one correspondence; Retrieving a first candidate answer set in a massive knowledge graph based on the first entity and the first entity relationship using a preset retrieval model; Iteratively training the first entity, the first entity relationship, and the first candidate answer set until an answer text is output, and outputting and displaying the output answer text as the first answer text; The first candidate answer set is obtained by searching the massive knowledge graph based on the first entity and the first entity relationship using a preset retrieval model, specifically: Calling a retrieval module in the retrieval model to search a massive knowledge graph according to the first entity and the first entity relationship to obtain an initial answer set, and sending the initial answer set to a generation module of the retrieval model; The generation module classifies and labels the first entity, the first entity relationship, and the initial answer set, performs encoding and decoding calculations on the spliced text to obtain corresponding training labels, trains the retrieval module using the training labels, and uses the trained retrieval module to search the first entity and the first entity relationship to obtain the first candidate answer set; The generation module classifies and labels the first entity, the first entity relationship, and the initial answer set, and performs encoding and decoding calculations on the spliced text to obtain corresponding training labels, specifically: The generation module performs entity annotation on the text corresponding to the first entity, performs relationship annotation on the text corresponding to the first entity relationship, performs answer annotation on the text included in the initial answer set, and concatenates the annotated texts; The spliced texts are encoded separately to obtain encoding results corresponding to the texts, the encoding results are connected in series and then decoded, and the attention scores corresponding to the texts are calculated after the decoding is completed, and the attention scores are used as the training labels.
2. A deep learning question-answering method based on massive knowledge graphs as claimed in claim 1, characterized in that: The receiving and performing text preprocessing on the first to-be-processed text to obtain the first question text is specifically as follows: The received first text to be processed is sequentially subjected to word segmentation and stop word removal processing, and the processed first text to be processed is subjected to vector conversion, the first text to be processed is converted into a vector form, and the first question text is obtained.
3. The deep learning question answering method based on massive knowledge graph according to claim 1, characterized in that: The calling of a preset named entity recognition model to perform deep learning recognition processing on the first question text to obtain a first entity relationship in which a plurality of first entities correspond to the first entity in one-to-one manner is specifically: Encode the first question text by calling the named entity recognition model to obtain a word vector corresponding to each word in the first question text; Feature extraction is performed on the word vector through a deep learning neural network to obtain a contextual relationship corresponding to the word vector one by one, and the first entity and the first entity relationship are determined based on the word vector and the contextual relationship.
4. A deep learning question-answering method based on massive knowledge graphs as claimed in claim 3, characterized in that: The determining of the first entity and the first entity relationship according to the word vector and the context relationship is specifically: Determine and extract an entity word vector from the word vector according to the contextual relationship, and use the entity word vector as the first entity; The contextual relationship is annotated by the named entity recognition model, the relationship between the word vectors other than the first entity in the word vector and the first entity is determined, and the first entity relationship in the word vector is extracted based on the determined relationship.
5. The deep learning question answering method based on massive knowledge graph according to claim 1, characterized in that: The calling of the retrieval module in the retrieval model to search the massive knowledge graph according to the first entity and the first entity relationship to obtain the initial answer set is specifically as follows: Calling a preset mapping model to map the first entity and the first entity relationship into a vector form to obtain a first entity vector, and respectively calculating the similarity between the first entity vector and several nodes in the massive knowledge graph; According to the similarity, several nodes are sorted in descending order to obtain a first similarity table, and a corresponding number of nodes are extracted from the first similarity table according to a preset first value to generate the initial answer set.
6. The deep learning question answering method based on massive knowledge graph according to claim 1, characterized in that: The iterative training of the first entity, the first entity relationship, and the first candidate answer set until an answer text is output is specifically as follows: Training the first entity, the first entity relationship, and the first candidate answer set through a generation module, and calculating corresponding training labels, and training the retrieval module through the calculated training labels; The first entity and the first entity relationship are retrieved through the trained retrieval module to obtain a second candidate answer set, and the parameters of the first candidate answer set and the generation module are updated through the second candidate answer set, and the updated first candidate answer set, the first entity and the first entity relationship are trained through the updated generation module until an answer text is retrieved and output.
7. A deep learning question-answering device based on massive knowledge graph, characterized in that: The deep learning question-answering device includes a preprocessing module, an entity recognition module, a retrieval module and an iterative training module; The preprocessing module is used to receive and perform text preprocessing on the first text to be processed to obtain a first question text; The entity recognition module is used to call a preset named entity recognition model to perform deep learning recognition processing on the first question text to obtain a first entity relationship between a plurality of first entities and the first entity in one-to-one correspondence; The retrieval module is used to retrieve a first candidate answer set in a massive knowledge graph based on the first entity and the first entity relationship through a preset retrieval model; The iterative training module is used to iteratively train the first entity, the first entity relationship, and the first candidate answer set until an answer text is output, and output and display the output answer text as the first answer text; The first candidate answer set is obtained by searching the massive knowledge graph based on the first entity and the first entity relationship using a preset retrieval model, specifically: Calling a retrieval module in the retrieval model to search a massive knowledge graph according to the first entity and the first entity relationship to obtain an initial answer set, and sending the initial answer set to a generation module of the retrieval model; The generation module classifies and labels the first entity, the first entity relationship, and the initial answer set, performs encoding and decoding calculations on the spliced text to obtain corresponding training labels, trains the retrieval module using the training labels, and uses the trained retrieval module to search the first entity and the first entity relationship to obtain the first candidate answer set; The generation module classifies and labels the first entity, the first entity relationship, and the initial answer set, and performs encoding and decoding calculations on the spliced text to obtain corresponding training labels, specifically: The generation module performs entity annotation on the text corresponding to the first entity, performs relationship annotation on the text corresponding to the first entity relationship, performs answer annotation on the text included in the initial answer set, and concatenates the annotated texts; The spliced texts are encoded separately to obtain encoding results corresponding to the texts, the encoding results are connected in series and then decoded, and the attention scores corresponding to the texts are calculated after the decoding is completed, and the attention scores are used as the training labels.
8. A deep learning question-answering system based on massive knowledge graphs, characterized by: The deep learning question-answering system includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor processes the computer program, it implements a deep learning question-answering method based on a massive knowledge graph as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Knowledge graph-based question and answer implementation method and system
CN112328773A
Seat-assisted question-answering method and system fusing semantic classification and knowledge graph
CN113505586A