Question answering method and device based on knowledge graph and related equipment
By combining the statement vectors of the question text with the entity vectors of the knowledge graph to generate a joint vector, the problem of insufficient information interaction in the existing model is solved, and the accuracy of question answering and the ability to handle complex relationships are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CORP LTD BEIJING RESEARCH INSTITUTE
- Filing Date
- 2023-05-23
- Publication Date
- 2026-06-26
AI Technical Summary
Existing models lack the interaction of encoded information between questions and knowledge graph entities when dealing with complex relationship types in knowledge graphs, resulting in limited reasoning capabilities.
By acquiring the question text, processing it into statement vectors, and matching them with a pre-built knowledge graph vector model to generate a joint vector, which is then input into a pre-trained question-answering model to output the answer text, the problem of information interaction is solved by combining the statement vectors in the question text and the entity vectors in the knowledge graph.
It significantly improves the accuracy of multi-hop question answering, can handle more complex questions, and enhances the reasoning ability of knowledge graph models.
Smart Images

Figure CN116578684B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of natural language processing technology, and in particular to a question-answering method, apparatus, and related equipment based on knowledge graphs. Background Technology
[0002] Existing models primarily separate question encoding from the knowledge graph, i.e., sequence-to-sequence tasks or knowledge graph embedding tasks. They lack interaction between the encoded information of the question and entities in the knowledge graph. Furthermore, existing model algorithms only consider matching the question encoding with the relation embedding at each hop. These works cannot handle complex relation types in the knowledge graph, such as one-to-many relationships, which limits the reasoning ability in relation encoding.
[0003] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0004] This disclosure provides a question-answering method, apparatus, and related equipment based on knowledge graphs, which at least to some extent overcomes the problem of the lack of coded information interaction between natural language issues and entities in knowledge graphs in related technologies.
[0005] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.
[0006] According to one aspect of this disclosure, a knowledge graph-based question answering method is provided. The method includes: acquiring question text, wherein the question text includes one or more statements; processing the question text to obtain a statement vector for each statement in the question text; matching the statement vector of each statement with a knowledge graph vector model to obtain one or more entity vectors corresponding to each statement, wherein the knowledge graph vector model is a model obtained by vectorizing entities and relationships between entities in a pre-constructed entity relationship knowledge graph; generating a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector; inputting the joint vector corresponding to each statement in the question text into a pre-trained question answering model, and outputting the answer text corresponding to the question text.
[0007] In some exemplary embodiments of this disclosure, based on the foregoing scheme, the problem text is processed to obtain a statement vector for each statement in the problem text, including: performing word segmentation on the problem text to obtain a word segmentation result; processing the word segmentation result using a word vector model to obtain a word vector for each word in each statement in the problem text; and performing a weighted average of the word vectors for each word in each statement in the problem text to obtain a statement vector for each statement in the problem text.
[0008] In some exemplary embodiments of this disclosure, based on the foregoing scheme, before matching the statement vector of each statement with the knowledge graph vector model, the method further includes: vectorizing the entities and relationships between entities in the pre-constructed entity relationship knowledge graph to obtain the knowledge graph vector model.
[0009] In some exemplary embodiments of this disclosure, based on the foregoing scheme, before inputting the joint vector corresponding to each statement in the question text into a pre-trained question-answering model and outputting the answer text corresponding to the question text, the method further includes: training a pre-constructed neural network to obtain the question-answering model.
[0010] In some exemplary embodiments of this disclosure, based on the foregoing scheme, generating a joint vector corresponding to each statement vector according to each statement vector and its corresponding entity vector includes: inputting the statement vector of each statement in the question text and its corresponding entity vector into a pre-trained joint model, and outputting the joint vector corresponding to each statement vector.
[0011] In some exemplary embodiments of this disclosure, based on the foregoing scheme, before inputting the statement vector of each statement in the question text and the corresponding entity vector into the pre-trained joint model and outputting the joint vector corresponding to each statement vector, the method further includes: training a bidirectional long short-term memory network LSTM to obtain the joint model.
[0012] In some exemplary embodiments of this disclosure, based on the foregoing scheme, when the question text includes multiple statements, the question text is processed to obtain multiple statement vectors, and the multiple statement vectors are stored in a statement query module, which is used to query any of the statement vectors.
[0013] According to another aspect of this disclosure, a knowledge graph-based question-answering device is also provided. The device includes: a question acquisition module for acquiring question text, wherein the question text includes one or more statements; a vector processing module for processing the question text to obtain a statement vector for each statement in the question text; an entity vector matching module for matching the statement vector of each statement with a knowledge graph vector model to obtain one or more entity vectors corresponding to each statement, wherein the knowledge graph vector model is a model obtained by vectorizing entities and relationships between entities in a pre-constructed entity relationship knowledge graph; a joint vector generation module for generating a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector; and an answer output module for inputting the joint vector corresponding to each statement in the question text into a pre-trained question-answering model and outputting the answer text corresponding to the question text.
[0014] According to another aspect of this disclosure, an electronic device is also provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any of the above-described knowledge graph-based question-answering methods by executing the executable instructions.
[0015] According to another aspect of this disclosure, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements any of the above-described knowledge graph-based question-answering methods.
[0016] The knowledge graph-based question-answering method, apparatus, and related devices provided in the embodiments of this disclosure first acquire question text, which includes one or more statements; second, process the question text to obtain a statement vector for each statement in the question text; then, match the statement vector of each statement with a knowledge graph vector model to obtain one or more entity vectors corresponding to each statement; then, generate a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector; finally, input the joint vector corresponding to each statement in the question text into a pre-trained question-answering model to output the answer text corresponding to the question text. This embodiment generates a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector. The joint vector includes information about each statement's statement vector and its corresponding entity vector, avoiding the problem in existing knowledge graph models of lacking the interaction of encoded information between questions and entities in the knowledge graph. Furthermore, this embodiment inputs the joint vector corresponding to each statement in the question text into a pre-trained question-answering model, and the output corresponding answer text integrates the statement vector and the corresponding entity vector in the question text. That is, the question encoding information is combined with the entity vector in the knowledge graph vector model, which can handle more complex questions and significantly improve the accuracy of multi-hop question answering.
[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0019] Figure 1 This diagram illustrates a knowledge graph-based question-answering system architecture according to an embodiment of the present disclosure.
[0020] Figure 2 A schematic diagram of a knowledge graph-based question-answering method is shown in an embodiment of this disclosure;
[0021] Figure 3 A schematic diagram illustrating the processing flow of a statement vector in an embodiment of this disclosure is shown.
[0022] Figure 4 This diagram illustrates the output flow of a question-and-answer model according to an embodiment of the present disclosure.
[0023] Figure 5This illustration shows a detailed flowchart of a knowledge graph-based question-answering method according to an embodiment of the present disclosure.
[0024] Figure 6 A schematic diagram of a knowledge graph-based question-answering device is shown in an embodiment of this disclosure;
[0025] Figure 7 A schematic diagram of an electronic device illustrating a knowledge graph-based question-answering method according to an embodiment of this disclosure is shown. Detailed Implementation
[0026] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0027] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0028] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0029] Figure 1 This is a schematic diagram of the structure of a computer system provided in an exemplary embodiment of this application. The system includes: a plurality of terminals 120 and a server cluster 140.
[0030] Terminal 120 can be a mobile terminal such as a mobile phone, game console, tablet computer, e-book reader, smart glasses, MP4 (Moving Picture Experts Group Audio Layer IV) player, smart home device, AR (Augmented Reality) device, VR (Virtual Reality) device, etc. Alternatively, terminal 120 can also be a personal computer (PC), such as a laptop computer and a desktop computer, etc.
[0031] The terminal 120 may contain an application for providing answer text.
[0032] Terminal 120 is connected to server cluster 140 via a communication network. Optionally, the communication network can be a wired network or a wireless network.
[0033] Server cluster 140 is a single server, or a combination of several servers, or a virtualization platform, or a cloud computing service center. Server cluster 140 provides background services for applications that provide answer text. Optionally, server cluster 140 undertakes the primary computing task, and terminal 120 undertakes secondary computing tasks; or, server cluster 140 undertakes secondary computing tasks, and terminal 120 undertakes the primary computing tasks; or, terminal 120 and server cluster 140 collaborate on computing using a distributed computing architecture.
[0034] Optionally, the application clients installed on different terminals 120 may be the same, or the application clients installed on two terminals 120 may be clients of the same type of application on different control system platforms. Depending on the terminal platform, the specific form of the application client may also differ; for example, the application client may be a mobile client, a PC client, or a World Wide Web (WWW) client.
[0035] Those skilled in the art will understand that the number of terminals 120 described above can be more or less. For example, there may be only one terminal, or there may be dozens or hundreds of terminals, or even more. This application does not limit the number of terminals or the type of device.
[0036] Optionally, the system may also include a management device ( Figure 1 (Not shown), the management device is connected to the server cluster 140 via a communication network. Optionally, the communication network can be a wired network or a wireless network.
[0037] Optionally, the aforementioned wireless or wired networks use standard communication technologies and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to Local Area Networks (LANs), Metropolitan Area Networks (MANs), Wide Area Networks (WANs), mobile, wired or wireless networks, private networks, or any combination of virtual private networks. In some embodiments, technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc., are used to represent data exchanged over the network. Furthermore, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Networks (VPNs), and Internet Protocol Security (IPsec) can be used to encrypt all or some links. In other embodiments, custom and / or dedicated data communication technologies can be used to replace or supplement the aforementioned data communication technologies.
[0038] The steps of the knowledge graph-based question-answering method in this exemplary embodiment will now be described in more detail with reference to the accompanying drawings and embodiments.
[0039] Figure 2 This diagram illustrates a flowchart of a knowledge graph-based question-answering method according to an embodiment of this disclosure. The method provided in this embodiment can be executed by any electronic device with computing power, such as... Figure 2 Terminal 120 and / or server cluster 140 in the example. In the following illustration, server cluster 140 is used as the execution subject.
[0040] First, this disclosure provides a question-answering method that can be applied, but is not limited to, based on knowledge graphs. This question-answering method can generate a joint vector that includes the statement vector of each statement and the entity vector corresponding to the statement, thereby avoiding the problems of lack of knowledge graph models and the interaction of encoded information between entities in knowledge graphs in the prior art.
[0041] Figure 2 This illustration shows a schematic diagram of a knowledge graph-based question-answering method according to an embodiment of the present disclosure, such as... Figure 2 As shown in the embodiments of this disclosure, the question-answering method based on knowledge graphs includes the following steps:
[0042] S201, Obtain the problem text, wherein the problem text includes: one or more statements.
[0043] In some embodiments, the question text may be a collection of texts containing one or more questions to be answered, which may include one or more question statements.
[0044] S202, process the problem text to obtain the statement vector of each statement in the problem text.
[0045] In some embodiments, processing the question text involves segmenting or vectorizing one or more question statements obtained in step S201, ultimately obtaining a vector for each question statement in the question text.
[0046] In some embodiments, the specific process of processing the problem text to obtain the statement vector of each statement in the problem text is as follows: Figure 3 As shown, the specific process includes:
[0047] S2301, Perform word segmentation on the problem text to obtain the word segmentation results;
[0048] S2302, the word segmentation results are processed by the word vector model to obtain the word vectors of each word in each sentence of the problem text;
[0049] S2303, perform a weighted average of the word vectors of each word in each sentence of the problem text to obtain the sentence vector of each sentence in the problem text.
[0050] Specifically, for example, given a question text in this embodiment of the disclosure, which contains a single statement, that is, a single natural language question statement Q, firstly, the natural language question statement Q is segmented into n words, i.e., natural language question statement Q = {w1, w2, w3, ..., wn}, where w1, w2, w3, ..., wn are the segmentation results of natural language question statement Q; then, using a pre-trained word vector Glove (Global Vectors for Word Representation) model, the segmentation results of the natural language question statement Q are input into the Glove model, and the word vectors of natural language question statement Q are output; finally, all the word vectors of natural language question statement Q are weighted and averaged to obtain the statement vector q of natural language question statement Q.
[0051] Furthermore, in this embodiment of the disclosure, the statement vector of each statement in the problem text is stored in the statement query module. The required statement vector can be queried through the statement query module and processed. This not only makes it easier to query each statement vector, but also allows for focusing on the required statement vector, facilitating further processing.
[0052] S203, match the statement vector of each statement with the knowledge graph vector model to obtain one or more entity vectors corresponding to each statement. The knowledge graph vector model is a model obtained by vectorizing entities and relationships between entities in a pre-constructed entity relationship knowledge graph.
[0053] In some embodiments, the statement vector of each statement is a vectorized representation of the question statement in the question text. The statement vector of each statement in the question text is matched with the entity vector in the knowledge graph vector model to obtain the entity vector corresponding to each statement.
[0054] Furthermore, before matching the statement vector of each statement with the knowledge graph vector model, it is necessary to vectorize the entities and relationships between entities in the pre-constructed entity relationship knowledge graph to obtain the knowledge graph vector model. Since the search space is very large, this embodiment of the disclosure uses the entity relationship vector to initialize the entity vector.
[0055] S204, generate a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector.
[0056] In some embodiments, the statement vectors obtained by vectorizing the statements in the question text obtained in step S203 are processed with the entity vectors corresponding to each statement vector to generate a joint vector corresponding to each statement vector. The joint vector includes the question information of the statements in the question text and the corresponding knowledge graph entity information, which alleviates the problem of lack of coded information interaction between natural language questions and entities in the knowledge graph in the prior art.
[0057] More specifically, the statement vector and the corresponding entity vector of each statement in the question text are input into a pre-trained joint model, and the joint vector corresponding to each statement vector is output.
[0058] Furthermore, in order to construct the interaction between natural language questions and entity vector information in the knowledge graph, before inputting the statement vector and the corresponding entity vector of each statement in the question text into the pre-trained joint model and outputting the joint vector corresponding to each statement vector, this embodiment of the disclosure needs to train a bidirectional LSTM to obtain a joint model.
[0059] S205: Input the joint vector corresponding to each statement in the question text into the pre-trained question-answering model, and output the answer text corresponding to the question text.
[0060] In some embodiments, the joint vector of each statement, including the question information in the question text and the corresponding knowledge graph entity information, is input into a pre-trained question-answering model to output the answer text corresponding to the question text.
[0061] Furthermore, in this embodiment of the disclosure, a pre-built neural network needs to be trained to obtain a question-answering model. Then, the joint vector corresponding to each statement in the question text is input into the pre-trained question-answering model, and the answer text corresponding to the question text is output.
[0062] The knowledge graph-based question-answering method in this embodiment first obtains the question text, which includes one or more statements; second, it processes the question text to obtain a statement vector for each statement; then, it matches the statement vector of each statement with a knowledge graph vector model to obtain one or more entity vectors corresponding to each statement; next, it generates a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector; finally, it inputs the joint vector corresponding to each statement in the question text into a pre-trained question-answering model to output the answer text corresponding to the question text. This embodiment generates a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector. The joint vector includes information about each statement's statement vector and its corresponding entity vector, avoiding the problem in existing knowledge graph models of lacking the interaction of encoded information between questions and entities in the knowledge graph. Furthermore, this embodiment inputs the joint vector corresponding to each statement in the question text into a pre-trained question-answering model, and the output corresponding answer text integrates the statement vector and the corresponding entity vector in the question text. That is, the question encoding information is combined with the entity vector in the knowledge graph vector model, which can handle more complex questions and significantly improve the accuracy of multi-hop question answering.
[0063] More specifically, this embodiment of the disclosure uses GNN (Graph Neural Networks) to construct the question-answering model. The joint vector corresponding to each statement vector in the question text is input into the question-answering model to obtain the answer text corresponding to the question text. Specifically, the steps for the question-answering model in this embodiment to obtain the answer text corresponding to the question text are as follows: Figure 4 As shown, the specific steps include:
[0064] S401, calculate the correlation between the vectors of entities and relationships between entities in the knowledge graph vector model and any statement vector. For example, in this embodiment of the disclosure, we want to obtain the statement vector of the kth sentence in the question text, that is, q. k That is, the statement vector q corresponding to the k-th statement. k Take the dot product with the vectors of entities and relationships between entities in the knowledge graph vector model;
[0065] S402, obtain the vector q of the k-th statement by using a preset activation function. k Importance score for each matched triplet;
[0066] S403, for the statement vector q of the kth sentence k The importance scores of each matched triple are aggregated to obtain the sentence vector q of the k-th sentence. k Importance information, the importance information is the statement vector q of the k-th sentence. k The answer text.
[0067] Furthermore, the question-answering model in this embodiment adopts a GNN approach, making full use of the joint vector corresponding to each statement vector in the question text generated by the joint model. The joint vector corresponding to each statement vector includes both the question information of the statement in the question text and the knowledge graph entity information corresponding to the entity in the statement. That is, the joint vector in this embodiment is a representation of the mutual association between the question information of the statement in the question text and the knowledge graph entity information corresponding to the entity in the statement. Moreover, the joint vector generated by the joint model helps to assign the question information of the statement in the question text to entities that are more likely to match the question information, thereby guiding the triple to match the question in each reasoning step. This solves the problem in related technologies that only consider matching the question encoding with the relation vector at each hop, which cannot handle complex relation types in the knowledge graph. This embodiment can handle more complex questions and greatly improve the accuracy of question answering.
[0068] In an optional embodiment, when the question text includes multiple statements, the question text is processed to obtain multiple statement vectors, and these statement vectors are stored in a statement query module. The statement query module in this embodiment is used to query any statement vector. If this embodiment requires the answer text for the k-th statement, it can query the statement vector of the k-th statement, i.e., q, through the query module. k The statement vector q of the k-th statement k By matching with the knowledge graph vector model, the statement vector q of the k-th statement is obtained. k The corresponding entity vector in the middle is used to generate the statement vector q of the k-th statement. kThe corresponding joint vector, finally the statement vector q of the k-th statement. k The corresponding joint vector is input into the pre-trained question-answering model, and the output is the statement vector q of the k-th statement. k The corresponding answer text.
[0069] In an alternative embodiment, to update entity vectors in the knowledge graph vector model, this disclosure uses multi-head attention to allow the joint model to make multiple choices, thereby reducing the impact of noise and bias. Finally, the importance score of each matching triple corresponding to any statement vector is calculated using a normalized exponential function. This disclosure, through the above method, can help computers better understand the complex relationships and semantic information in question text; the advantage of multi-head attention is that it can handle different types of text data and can adaptively learn different features.
[0070] In one alternative embodiment, when training a pre-built neural network, the loss during training is calculated by using a relative entropy function as the objective function between the joint vector corresponding to each statement vector and the manually labeled answer text. The training is then gradually continued until the loss is minimized, at which point the answer accuracy is highest.
[0071] In summary, the specific process of the knowledge graph-based question-answering method in this disclosure is as follows: Figure 5 As shown, the obtained question text is input into the GloVe model. Each sentence in the question text is segmented and vectorized. Then, the word vectors of each sentence are weighted and averaged to obtain the sentence vector of each sentence in the question text. All sentence vectors are stored in the sentence query module. At the same time, the knowledge graph vector model obtained by vectorizing the entities and relationships between entities in the pre-constructed entity relationship knowledge graph is input into the joint model along with the entity vectors, the relationship vectors between entities, and the sentence vectors to obtain the joint vector corresponding to each sentence vector. The joint vector is then input into the question answering model, and finally, the answer text is output. This is an embodiment of the present disclosure.
[0072] Based on the same inventive concept, this disclosure also provides a knowledge graph-based question-answering device, as shown in the following embodiment. Since the principle of this device embodiment in solving the problem is similar to that of the above method embodiment, the implementation of this device embodiment can refer to the implementation of the above method embodiment, and repeated details will not be described again.
[0073] Figure 6 This illustration shows a schematic diagram of a knowledge graph-based question-answering device according to an embodiment of the present disclosure, such as... Figure 6 As shown, the device includes:
[0074] Problem acquisition module 601 is used to acquire problem text, wherein the problem text includes one or more statements;
[0075] The vector processing module 602 is used to process the question text and obtain the statement vector of each statement in the question text;
[0076] The entity vector matching module 603 is used to match the statement vector of each statement with the knowledge graph vector model to obtain one or more entity vectors corresponding to each statement. The knowledge graph vector model is a model obtained by vectorizing entities and relationships between entities in a pre-built entity relationship knowledge graph.
[0077] The joint vector generation module 604 is used to generate a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector.
[0078] The answer output module 605 is used to input the joint vector corresponding to each statement in the question text into the pre-trained question-answering model and output the answer text corresponding to the question text.
[0079] The knowledge graph-based question-answering device provided in the embodiments of this disclosure acquires question text through a question acquisition module. The question text includes one or more statements. A vector processing module processes the question text to obtain a statement vector for each statement in the question text. An entity vector matching module matches the statement vector of each statement with a knowledge graph vector model to obtain one or more entity vectors corresponding to each statement. A joint vector generation module generates a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector. An answer output module inputs the joint vector corresponding to each statement in the question text into a pre-trained question-answering model and outputs the answer text corresponding to the question text. This embodiment generates a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector. The joint vector includes information about each statement's statement vector and its corresponding entity vector, avoiding the problem in existing knowledge graph models of lacking the interaction of encoded information between questions and entities in the knowledge graph. Furthermore, this embodiment inputs the joint vector corresponding to each statement in the question text into a pre-trained question-answering model, and the output corresponding answer text integrates the statement vector and the corresponding entity vector in the question text. That is, the question encoding information is combined with the entity vector in the knowledge graph vector model, which can handle more complex questions and significantly improve the accuracy of multi-hop question answering.
[0080] In one optional embodiment, the vector processing module in this disclosure includes: performing word segmentation on the question text to obtain the word segmentation result; processing the word segmentation result through a word vector model to obtain the word vector of each word in each sentence of the question text; and performing a weighted average of the word vectors of each word in each sentence of the question text to obtain the sentence vector of each sentence of the question text.
[0081] In one optional embodiment, the knowledge graph-based question answering device in this disclosure further includes: before matching the statement vector of each statement with the knowledge graph vector model, vectorizing the entities and relationships between entities in the pre-constructed entity relationship knowledge graph to obtain the knowledge graph vector model.
[0082] In one optional embodiment, the knowledge graph-based question answering device in this disclosure further includes: before inputting the joint vector corresponding to each statement in the question text into a pre-trained question answering model and outputting the answer text corresponding to the question text, training a pre-constructed neural network to obtain a question answering model.
[0083] In one optional embodiment, the joint vector generation module in this disclosure includes: inputting the statement vector and the corresponding entity vector of each statement in the question text into a pre-trained joint model, and outputting the joint vector corresponding to each statement vector.
[0084] In one optional embodiment, the knowledge graph-based question answering device in this disclosure further includes: training a bidirectional long short-term memory network LSTM to obtain a joint model before inputting the statement vector and the corresponding entity vector of each statement in the question text into a pre-trained joint model and outputting the joint vector corresponding to each statement vector.
[0085] In an optional embodiment, the above apparatus further includes: when the problem text includes multiple statements, processing the problem text to obtain multiple statement vectors, storing the multiple statement vectors in a statement query module, the statement query module being used to query any statement vector.
[0086] Those skilled in the art will understand that various aspects of this disclosure can be implemented as a system, method, or program product. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."
[0087] The following reference Figure 7 To describe an electronic device 700 according to such an embodiment of the present disclosure. Figure 7The electronic device 700 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0088] like Figure 7 As shown, the electronic device 700 is manifested in the form of a general-purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 701, at least one storage unit 702, and a bus 703 connecting different system components (including storage unit 702 and processing unit 701).
[0089] The storage unit stores program code, which can be executed by the processing unit 701, causing the processing unit 701 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.
[0090] In some embodiments, when an electronic device is used to control, for example, the knowledge graph-based question-answering method described above, the processing unit 701 may execute the following steps of the method embodiments described above:
[0091] Retrieve the issue text, which includes one or more statements.
[0092] The problem text is processed to obtain the statement vector for each statement in the problem text.
[0093] The statement vector of each statement is matched with the knowledge graph vector model to obtain one or more entity vectors corresponding to each statement. The knowledge graph vector model is a model obtained by vectorizing entities and relationships between entities in a pre-constructed entity relationship knowledge graph.
[0094] Generate a joint vector for each statement vector based on each statement vector and its corresponding entity vector.
[0095] The joint vector corresponding to each statement in the question text is input into a pre-trained question-answering model, which outputs the answer text corresponding to the question text.
[0096] Storage unit 702 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 7021 and / or a cache memory unit 7022, and may further include a read-only memory unit (ROM) 7023.
[0097] Storage unit 702 may also include a program / utility 7024 having a set (at least one) program module 7025, such program module 7025 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0098] Bus 703 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0099] Electronic device 700 can also communicate with one or more external devices 704 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 700, and / or with any device that enables electronic device 700 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 850. Furthermore, electronic device 700 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 706. As shown, network adapter 706 communicates with other modules of electronic device 700 via bus 703. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0100] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0101] In particular, according to embodiments of this disclosure, the process described above with reference to the flowchart can be implemented as a computer program product, which includes a computer program that, when executed by a processor, implements the above-described knowledge graph-based question-answering method.
[0102] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the methods described above is stored thereon. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.
[0103] More specific examples of computer-readable storage media in this disclosure may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0104] In this disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device.
[0105] Optionally, the program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0106] In practical implementation, program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0107] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0108] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0109] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0110] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.
Claims
1. A question-answering method based on knowledge graphs, characterized in that, include: Obtain the problem text, wherein the problem text includes: one or more statements; The question text is processed to obtain a statement vector for each statement in the question text; The statement vector of each statement is matched with the knowledge graph vector model to obtain one or more entity vectors corresponding to each statement. The knowledge graph vector model is a model obtained by vectorizing entities and relationships between entities in a pre-constructed entity relationship knowledge graph. Based on each statement vector and its corresponding entity vector, a joint vector corresponding to each statement vector is generated. The process of generating a joint vector corresponding to each statement vector and its corresponding entity vector includes: inputting each statement vector and its corresponding entity vector into a joint model obtained by training a bidirectional long short-term memory network LSTM, and outputting a joint vector corresponding to each statement vector. The joint vector corresponding to each statement in the question text is input into a pre-trained question-answering model, and the answer text corresponding to the question text is output.
2. The question-answering method based on knowledge graphs according to claim 1, characterized in that, The question text is processed to obtain a statement vector for each statement in the question text, including: The problem text is segmented into words to obtain the segmentation results; The word segmentation results are processed by a word vector model to obtain the word vectors of each word in each sentence of the problem text. The sentence vector of each sentence in the question text is obtained by weighted averaging of the word vectors of each word in each sentence.
3. The question-answering method based on knowledge graphs according to claim 1, characterized in that, Before matching the statement vector of each statement with the knowledge graph vector model, the method further includes: The entities and relationships between entities in the pre-constructed entity relationship knowledge graph are vectorized to obtain the knowledge graph vector model.
4. The question-answering method based on knowledge graphs according to claim 1, characterized in that, Before inputting the joint vector corresponding to each statement in the question text into a pre-trained question-answering model and outputting the answer text corresponding to the question text, the method further includes: The question-answering model is obtained by training a pre-built neural network.
5. The question-answering method based on knowledge graphs according to claim 1, characterized in that, Based on each statement vector and its corresponding entity vector, generate a joint vector for each statement vector, including: The statement vector of each statement in the question text and the corresponding entity vector are input into a pre-trained joint model, and the joint vector corresponding to each statement vector is output.
6. The question-answering method based on knowledge graphs according to claim 5, characterized in that, Before inputting the statement vector and the corresponding entity vector of each statement in the question text into the pre-trained joint model and outputting the joint vector corresponding to each statement vector, the method further includes: The joint model is obtained by training a bidirectional long short-term memory network (LSTM).
7. The question-answering method based on knowledge graphs according to claim 1, characterized in that, When the question text includes multiple statements, the question text is processed to obtain multiple statement vectors, and the multiple statement vectors are stored in the statement query module, which is used to query any of the statement vectors.
8. A question-answering device based on a knowledge graph, characterized in that, include: The problem acquisition module is used to acquire problem text, wherein the problem text includes one or more statements; The vector processing module is used to process the question text to obtain the statement vector of each statement in the question text; The entity vector matching module is used to match the statement vector of each statement with the knowledge graph vector model to obtain one or more entity vectors corresponding to each statement. The knowledge graph vector model is a model obtained by vectorizing entities and relationships between entities in a pre-constructed entity relationship knowledge graph. The joint vector generation module is used to generate a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector. The process of generating a joint vector corresponding to each statement vector based on each statement vector and its corresponding entity vector includes: inputting each statement vector and its corresponding entity vector into a joint model obtained by training a bidirectional long short-term memory network LSTM, and outputting a joint vector corresponding to each statement vector. The answer output module is used to input the joint vector corresponding to each statement in the question text into a pre-trained question-answering model and output the answer text corresponding to the question text.
9. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the knowledge graph-based question-answering method according to any one of claims 1 to 7 by executing the executable instructions.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the knowledge graph-based question-answering method according to any one of claims 1 to 7.