CN113392197A - Question-answer reasoning method and device, storage medium and electronic equipment - Google Patents
Question-answer reasoning method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN113392197A CN113392197A CN202110659490.6A CN202110659490A CN113392197A CN 113392197 A CN113392197 A CN 113392197A CN 202110659490 A CN202110659490 A CN 202110659490A CN 113392197 A CN113392197 A CN 113392197A
- Authority
- CN
- China
- Prior art keywords
- entity
- question
- entities
- answer
- candidate
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 66
- 238000013528 artificial neural network Methods 0.000 claims description 46
- 230000006870 function Effects 0.000 claims description 22
- 238000000605 extraction Methods 0.000 claims description 13
- 238000007476 Maximum Likelihood Methods 0.000 claims description 9
- 238000012216 screening Methods 0.000 claims description 9
- 230000001186 cumulative effect Effects 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 4
- 238000004364 calculation method Methods 0.000 abstract description 15
- 230000008569 process Effects 0.000 description 15
- 238000010586 diagram Methods 0.000 description 14
- 238000004891 communication Methods 0.000 description 12
- 238000012545 processing Methods 0.000 description 10
- 239000000284 extract Substances 0.000 description 5
- 239000013598 vector Substances 0.000 description 5
- 238000007477 logistic regression Methods 0.000 description 4
- 230000008520 organization Effects 0.000 description 4
- 238000011160 research Methods 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000002452 interceptive effect Effects 0.000 description 2
- 238000003058 natural language processing Methods 0.000 description 2
- 230000011218 segmentation Effects 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- 230000001960 triggered effect Effects 0.000 description 2
- 241000282412 Homo Species 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- PCHJSUWPFVWCPO-UHFFFAOYSA-N gold Chemical compound [Au] PCHJSUWPFVWCPO-UHFFFAOYSA-N 0.000 description 1
- 239000010931 gold Substances 0.000 description 1
- 229910052737 gold Inorganic materials 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation or dialogue systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
- G06F16/367—Ontology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/04—Inference or reasoning models
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Artificial Intelligence (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Life Sciences & Earth Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Evolutionary Computation (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses a question-answer reasoning method, a question-answer reasoning device, a storage medium and electronic equipment, and belongs to the technical field of computers. The question-answer reasoning method comprises the following steps: the method comprises the steps of obtaining a question entity, determining a reference entity corresponding to the question entity, and obtaining a candidate answer set corresponding to the question entity from a knowledge graph based on the reference entity, wherein the knowledge graph at least comprises a plurality of entities and a relation between any two entities, the reference entity is any one of the entities included in the knowledge graph, the candidate set comprises a plurality of candidate answer entities corresponding to the question entity and a relation between any two candidate answer entities, the candidate answer entities are entities associated with the reference entity, and a target answer entity corresponding to the question entity is determined from the candidate answer set. The method and the device can improve the accuracy and the calculation efficiency of question-answering reasoning.
Description
Technical Field
The application relates to the technical field of computers, in particular to a question-answer reasoning method, a question-answer reasoning device, a storage medium and electronic equipment.
Background
A Knowledge Base Question Answering (KBQA) refers to a process of giving a constructed Knowledge graph, converting a user Question into an inquiry statement on the Knowledge graph by understanding the user Question, and executing the inquiry statement to obtain an answer and return. Because current knowledge graphs are generally fact-based graphs, KBQA is generally used to answer knowledge questions such as facts or encyclopedias.
Most of the existing research works on multi-hop knowledge graph reasoning question-answering assume a reasoning track as a linear chain, however, in practical application, problems may be associated with various structures in the knowledge graph, from a simple linear chain to a complex directed acyclic graph, and the prior art completely depends on a language model to carry out the reasoning of the linear chain, thereby causing the reduction of the computational efficiency and the accuracy.
Disclosure of Invention
The embodiment of the application provides a question-answer reasoning method, a question-answer reasoning device, a storage medium and electronic equipment, and can improve the accuracy rate and the calculation efficiency of question-answer reasoning. The technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a question and answer reasoning method, including:
acquiring a problem entity;
determining a reference entity corresponding to the problem entity, and acquiring a candidate answer set corresponding to the problem entity from a knowledge graph based on the reference entity; the knowledge graph at least comprises a plurality of entities and a relation between any two entities, the reference entity is any one of the entities included in the knowledge graph, the candidate set comprises a plurality of candidate answer entities corresponding to the question entity and a relation between any two candidate answer entities, and the candidate answer entities are entities associated with the reference entity;
and determining a target answer entity corresponding to the question entity from the candidate answer set.
In a second aspect, an embodiment of the present application provides a question-answering reasoning apparatus, where the apparatus includes:
the acquisition module is used for acquiring the problem entity;
the first determination module is used for determining a reference entity corresponding to the question entity and acquiring a candidate answer set corresponding to the question entity from a knowledge graph based on the reference entity; the knowledge graph at least comprises a plurality of entities and a relation between any two entities, the reference entity is any one of the entities included in the knowledge graph, the candidate set comprises a plurality of candidate answer entities corresponding to the question entity and a relation between any two candidate answer entities, and the candidate answer entities are entities associated with the reference entity;
and the second determining module is used for determining a target answer entity corresponding to the question entity from the candidate answer set.
In a third aspect, embodiments of the present application provide a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the above-mentioned method steps.
In a fourth aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the above-mentioned method steps.
The beneficial effects brought by the technical scheme provided by some embodiments of the application at least comprise:
the embodiment of the application determines a reference entity corresponding to a question entity by obtaining the question entity, and obtains a candidate answer set corresponding to the question entity from a knowledge graph based on the reference entity, wherein the knowledge graph at least comprises a plurality of entities and a relationship between any two entities, the reference entity is any one of the plurality of entities included by the knowledge graph, the candidate set comprises a plurality of candidate answer entities corresponding to the question entity and a relationship between any two candidate answer entities, the candidate answer entities are entities associated with the reference entity, and a target answer entity corresponding to the question entity is determined from the candidate answer set. According to the method and the device, the target answer entity corresponding to the question entity can be obtained only by analyzing the question entity and the candidate answer set, and compared with the prior art that the target answer entity is determined by analyzing the question entity and the whole knowledge graph, the accuracy and the calculation efficiency of question-answer reasoning can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic network architecture diagram of a question-answering reasoning system according to an embodiment of the present application;
FIG. 2 is an interaction diagram of a question-answer reasoning method provided in the embodiment of the present application;
FIG. 3 is another schematic interaction diagram of a question-answer reasoning method provided in the embodiment of the present application;
FIG. 4 is a schematic diagram of problem entity acquisition provided by an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating a candidate answer set generation according to an embodiment of the present disclosure;
FIG. 6 is another schematic diagram illustrating generation of a candidate answer set according to an embodiment of the present disclosure;
FIG. 7 is a schematic diagram of a neural network structure provided in an embodiment of the present application;
fig. 8 is a schematic structural diagram of a question answering reasoning apparatus provided in an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The following description refers to the accompanying drawings in which like numerals refer to the same or similar elements throughout the different views, unless otherwise specified. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application, as detailed in the appended claims.
In the description of the present application, it is to be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. The specific meaning of the above terms in the present application can be understood in a specific case by those of ordinary skill in the art. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The present application will be described in detail with reference to specific examples.
FIG. 1 illustrates an exemplary system architecture 100 that may be applied to the question-and-answer reasoning method of the present application.
As shown in fig. 1, system architecture 100 may include a user 101, an electronic device 102, and a network 103. The network 103 is used to provide a medium for communication links between the user 101 and the electronic device 102. The system architecture 100 may be applied to various practical application scenarios, for example, when the system architecture 100 is applied to a course query system, the user 101 may be a person such as a teacher, a student, and a parent of the student, and the user 101 may be configured to trigger a user operation on the electronic device 102, for example: the user 101 needs to know the name of the professor in the third lesson, and the user 101 can trigger the user operation on the electronic device 102 to inquire the name of the professor in the inferred lesson. The electronic device 102 may be, but is not limited to, responsible for reading various user operations triggered by the user 101, decoding the user operations, and executing the user operations to complete a service triggered by the user 101. For example: the electronic device 102 may first receive a question sentence from the user 101, extract a question entity, then the electronic device 102 may determine a reference entity corresponding to the question entity, obtain a candidate answer set corresponding to the question entity based on the reference entity, and finally the electronic device 102 may determine a target answer entity corresponding to the question entity from the candidate answer set to answer a question of the user 101.
For example, in the course of conducting the course query, the electronic device 102 may first receive a user operation from the user 101 to upload a question sentence (for example, but not limited to, "who is a scientific and healthy teacher") and then the electronic device 102 extracts a question entity (for example, but not limited to, "scientific and healthy" and "teacher in class") from the question sentence, the electronic device 102 may obtain a candidate answer set (for example, but not limited to, "zhao di", "zhang tri", and "li tetra", etc.) corresponding to the question entity by determining a reference entity (for example, but not limited to, "zhang tri") corresponding to the question entity, and then the electronic device 102 may determine a target answer entity (for example, but not limited to, "zhang tri") corresponding to the question entity from the candidate answer set, by obtaining the candidate answer set first and then specifically determining the target answer entity therefrom, the accuracy rate, the calculation efficiency and the like of the question-answering reasoning can be improved.
The electronic device 102 may be hardware or software. When the electronic device 102 is hardware, it may be a variety of devices with question and answer reasoning, including but not limited to smart phones, tablets, laptop portable computers, desktop computers, and the like. When the electronic device 102 is software, it may be implemented as a plurality of software or software modules (for example, for providing distributed processing services), or as a single software or software module, and is not limited in this respect.
The network 103 may include various types of wired or wireless communication links, and the user 101 and the electronic device 102 may interact with each other via the network 103, for example: the wired communication link includes an optical fiber, a twisted pair wire or a coaxial cable, and the Wireless communication link includes a bluetooth communication link, a Wireless-Fidelity (Wi-Fi) communication link, a microwave communication link, or the like.
It should be understood that the number of users 101, electronic devices 102, and networks 103 in fig. 1 is merely illustrative. Any number of users 101, electronic devices 102, and networks 103 may be present and support a distributed cluster deployment, as desired for the implementation.
In the following method embodiments, for convenience of description, only the main execution subject of each step is described as an electronic device.
The question-answer reasoning method provided by the embodiment of the present application will be described in detail below with reference to fig. 2 to 3.
Please refer to fig. 2, which provides an interactive schematic diagram of a question-answer reasoning method according to an embodiment of the present application. The method may comprise the steps of:
s201, problem entities are obtained.
Specifically, the problem entity refers to the entity that appears in the problem, such as for the problem "where is the place of origin of yaoming? "the problem entity is judged to be" Yaoming "through the character string" Yaoming ", and the problem entity is also the reasoning starting point in the subsequent reasoning process. Theoretically, the number of problem entities in a problem is not limited, in the field of multi-hop question answering based on a knowledge graph, only one problem entity exists in a problem, and the number of the problem entities is not specifically limited in the application. An entity refers to something that is distinguishable and independent, such as a person, a city, a plant, etc., a commodity, etc. All things in the world are composed of specific things, such as China, the United states, Japan and the like, and entities are the most basic elements in a knowledge graph, and different relationships exist among different entities. A Knowledge Graph (knowledgegraph) is a data structure that stores human Knowledge in the form of a relational directed Graph, where each node in the Knowledge Graph represents an entity and the directed edges between two nodes represent the relationship between them. For example: the < yaoming > is an entity, the < shanghai > is also an entity, the relation between the < yaoming > and the < shanghai > is that the < yaoming, shanghai > represents a fact. The knowledge graph can comprise data such as entities, types, attributes, relations, domains and values and the like and also serves as a question and answer data source, and compared with unstructured text data, the structured knowledge graph represents human knowledge in a clearer and more accurate mode, so that unprecedented development opportunities are brought to the construction of a high-quality question and answer system.
Question Answering (Question Answering) is an important research area for Natural Language Processing (Natural Language Processing), in which researchers aim to build such a system: it can automatically give answers to questions posed by humans in natural language. Research efforts in the area of question-answering have already spread everyone's lives, for example, when a user gets up in the morning asking your intelligent voice assistant "how do the weather today", the user gets an answer like this: "today is sunny day, temperature 15-22 ℃. Knowledge graph Question Answering (Question Answering questions) refers to a Question Answering scene using a Knowledge graph as a main data source, and for a given Question, reasoning can be carried out based on the Knowledge graph to obtain an answer. This technology has been widely used by the industry in related intelligent search and recommendation services, the most well-known and common search engine services, such as: for such a simpler question "where is the place of origin of yaoming? ", the search engine obtains the answer entity with the answer being < shanghai > through the triad of < yaoming, born in, shanghai > in the knowledge map. The theoretical answer to the question is not necessarily an entity such as, "how many gold medals are available in the olympic games of beijing in china? "the answer is a number, and in the field of knowledge-graph multi-hop question-answering, it is generally assumed that the answer to the question is an entity in the knowledge-graph, namely an answer entity.
The electronic device can obtain the problem entity in various ways, such as: the electronic equipment can crawl text data uploaded by a user from the Internet through a crawler technology to determine question sentences, and then extract question entities from the question sentences. The electronic device can also directly receive problem entities sent by other electronic devices, the electronic device a receives problem entities such as "yaoming" sent by the electronic device b, the electronic device can also collect voice data of a user, and then the problem entities are obtained through semantic analysis, for example: the electronic device may collect audio data of a user "who is a director of a dragon-forming leading movie" through a microphone and other devices, and then the electronic device may recognize the audio data as text data, and finally the electronic device may perform word segmentation processing on the text data through semantic parsing to obtain a plurality of segmented words "dragon-forming", "leading" and "movie", and determine a problem entity by recognizing part-of-speech types of each segmented word, for example: the electronic device recognizes "dragon in" as a noun, "lead actor" as a verb, and the like, and determines that the problem entities include "dragon in", "movie", and "director", and the like.
S202, determining a reference entity corresponding to the question entity, and acquiring a candidate answer set corresponding to the question entity from a knowledge graph based on the reference entity.
Specifically, the knowledge graph at least includes a plurality of entities and a relationship between any two entities, the reference entity is any one of the plurality of entities included in the knowledge graph, the candidate set includes a plurality of candidate answer entities corresponding to the question entity and a relationship between any two candidate answer entities, and the candidate answer entities are entities associated with the reference entity. After the electronic device obtains the problem entity, a reference entity corresponding to the problem entity may be determined, for example: there are 100 entities in the knowledge graph, and the electronic device first determines a problem entity and then may obtain a corresponding reference entity, where the reference entity is any one of the 100 entities, that is, there is a correspondence between the problem entity and the reference entity, for example: the problem entity "yaoming" and "height" correspond to the reference entity "2 meters", and the problem entity "arbor" corresponds to the reference entity "microsoft", etc. In this application, the reference entity may be one or more, and is not specifically limited herein, and the electronic device may obtain the corresponding reference entity through a preset correspondence.
After the electronic device determines the reference entity corresponding to the question entity, the candidate answer set corresponding to the question entity may be determined based on the reference entity, for example: the electronic device determines that the reference entity is "2 meters", and then the electronic device may obtain all entities of the same type (for example, but not limited to, the same number of types) "2.1 meters", "2.2 meters", and "2.26 meters" as the candidate answer set among the 100 entities of the knowledge-graph. For example: the electronic device determines that the reference entity is "microsoft," then the electronic device may obtain all entities of the same type (e.g., without limitation, the same company type) such as "apple," "google," and "tesla" as the candidate answer set among the 100 entities of the knowledge graph. The candidate answer set can be a set formed by summarizing concrete or abstract entities with certain specific properties, and the candidate archive set can be stored in a knowledge graph subgraph mode or a database mode without specific limitation, so that the electronic equipment can quickly and accurately store the candidate answer set.
The electronic equipment can also determine the correlation between each entity in the knowledge graph and the reference entity, based on the magnitude of the correlation, the electronic equipment can judge the strength of the correlation between each entity and the reference entity, and construct a candidate answer set based on the entities with the correlations larger than a preset correlation threshold. The way in which the electronic device determines the correlation is various and is not particularly limited.
In one possible embodiment, the electronic device may determine the correlation between each entity in the knowledge-graph and the reference entity by determining an acquisition source of each entity in the knowledge-graph, and determining the correlation between each entity in the knowledge-graph and the reference entity according to a corresponding relationship between the acquisition source and the correlation, where the acquisition source may include an official database, a certified organization database, or an unauthenticated organization database, and if each entity in the knowledge-graph is acquired from the official database, determining the correlation size as a first correlation value, if each entity in the knowledge-graph is acquired from the certified organization database, determining the correlation size as a second correlation value, and if each entity in the knowledge-graph is acquired from the unauthenticated organization database, determining the correlation size as a third correlation value, where the first correlation value is greater than the second correlation value, the second correlation value is greater than the third correlation value, wherein the official database may be a database corresponding to data published by a government agency, the certified agency may possess a certificate of certification issued by the certification agency, the database corresponding to the published data is a certified agency database, and the unauthenticated agency database may be a database storing data issued by each user in the internet. The above approach may determine the correlation between each entity in the knowledge-graph and the reference entity based on different data sources. For example: the electronic device determines that the entity a is obtained from an official database, the correlation size is 0.9, determines that the entity a is obtained from a certificate authority database, the correlation size is 0.7, and if a preset correlation threshold value is 0.8, the electronic device can determine that the entity a is a candidate answer entity set.
S203, determining a target answer entity corresponding to the question entity from the candidate answer set.
Specifically, after acquiring a candidate answer set corresponding to the question entity from a knowledge graph based on the reference entity, the electronic device may determine a target answer entity corresponding to the question entity from the candidate answer set. The electronic device may calculate a confidence between each candidate answer entity and the question entity, and determine the target answer entity according to the magnitude of the confidence, where the confidence may refer to the accuracy of the candidate answer entity as the question entity, for example: the electronic equipment acquires text information from the associated data, determines the common times of each candidate answer entity and the question entity in the same text information, and the first times of each candidate answer entity in the associated data, and can determine the ratio of the common times to the first times and the like as the confidence degree of each candidate answer entity and the question entity. For example: the electronic device determines that the number of times that the candidate answer entity a and the question entity a have in common in the same text message is 80 times, the first time that the candidate answer entity a has in the associated data is 100 times, and then the confidence level of the candidate answer entity a and the question entity a is 0.8, the number of times that the candidate answer entity b and the question entity a have in common in the same text message is 180 times, and the first time that the candidate answer entity b has in the associated data is 200 times, and then the confidence level of the candidate answer entity b and the question entity a is 0.9, and then the electronic device may determine that the candidate answer entity b is the target answer entity corresponding to the question entity a.
In a possible embodiment, the electronic device may further calculate the confidence between each candidate answer entity and the question entity through a trained neural network, and the way that the electronic device determines the target answer entity corresponding to the question entity is not particularly limited. Compared with the prior art that answers of questions are directly inquired through knowledge graphs, the problem that research on a fact type question-answering task based on the knowledge graphs inevitably faces the problem complexity and reasoning efficiency is found, most of the prior art cannot well solve the problems, the method and the device for predicting the answer entity of the question through reasoning on the evidence graphs can effectively improve reasoning accuracy and calculation efficiency by generating a concise candidate answer set (such as but not limited to a knowledge graph subgraph-evidence graph and the like) with high semantic relevance and fact coverage, taking the question entity and the evidence graph of the problem as input of a neural network and predicting the target answer entity of the question through reasoning on the evidence graph.
As can be seen from the above, a question entity is obtained, a reference entity corresponding to the question entity is determined, and a candidate answer set corresponding to the question entity is obtained from a knowledge graph based on the reference entity, where the knowledge graph at least includes a plurality of entities and a relationship between any two entities, the reference entity is any one of the plurality of entities included in the knowledge graph, the candidate set includes a plurality of candidate answer entities corresponding to the question entity and a relationship between any two candidate answer entities, the plurality of candidate answer entities are entities associated with the reference entity, and a target entity corresponding to the question entity is determined from the candidate answer set. According to the method and the device, the target answer entity corresponding to the question entity can be obtained only by analyzing the question entity and the candidate answer set, and compared with the prior art that the target answer entity is determined by analyzing the question entity and the whole knowledge graph, the accuracy and the calculation efficiency of question-answer reasoning can be improved.
Referring to fig. 3, another interactive diagram of a question-answering reasoning method is provided for the embodiment of the present application. The question-answer reasoning method can comprise the following steps:
s301, collecting question sentence texts, and extracting question entities in the question sentence texts.
Specifically, the electronic device may collect a question sentence text, extract a question entity in the question sentence text, where the question sentence text may refer to a representation of a written language about a question, for example: the question sentence text may be audio data, word language data, or the like. Problem entity refers to the entity that appears in the problem, as for the problem "where is the place of birth of yaoming? "the problem entity is judged to be" Yaoming "through the character string" Yaoming ", and the problem entity is also the reasoning starting point in the subsequent reasoning process. Theoretically, the number of problem entities in a problem is not limited, in the field of multi-hop question answering based on a knowledge graph, only one problem entity exists in a problem, and the number of the problem entities is not specifically limited in the application.
The electronic equipment can collect the question sentence text in the form of audio data of who the director of the user's ' dragon-forming leading actor movie is ' through equipment such as a microphone, then the electronic equipment can recognize the audio data as the question sentence text in the form of words, finally the electronic equipment can perform word segmentation processing on the question sentence text through semantic analysis to obtain a plurality of segmented words ' dragon-forming ', ' leading actor ' and ' movie ', etc., and the problem entity is determined by recognizing the part of speech type of each segmented word, for example: the electronic device recognizes "dragon in" as a noun, "lead actor" as a verb, and the like, and determines that the problem entities include "dragon in", "movie", and "director", and the like. As shown in fig. 4, the user may use controls such as a virtual keyboard on a navigation bar interface in the question-answering system, the electronic device may directly input a specific question sentence text such as "how much height of yaoming" and the like through the controls such as the virtual keyboard, the user may generate a corresponding question inference instruction by clicking a corresponding "inference" button, and then the electronic device processes a corresponding question inference service.
S302, determining a reference entity corresponding to the problem entity through a pre-trained extraction model.
Specifically, after the electronic device extracts the question entity in the question sentence text, a reference entity corresponding to the question entity may be determined, where the reference entity is any one of a plurality of entities included in the knowledge graph and used for the electronic device to obtain a candidate answer set, and the number of the reference entities corresponding to the question entity may be one or more, and the application is not particularly limited. The electronic device may determine, by pre-training the extraction model, a reference entity corresponding to the problem entity, for example: in the training process of the extraction model, the electronic device may set a problem entity and reference entity pair, the reference entity belongs to a reference entity set, the reference entity set may be a set composed of all reference entities, the artificially labeled problem entity and reference entity pair are input into the extraction model to train model parameters, then in the prediction process, the problem entity is input into the pre-trained extraction model, and the reference entity corresponding to the problem entity may be output. For example: the input problem entities are 'science and health course' and 'teachers giving lessons', then 1 first reference entity can be obtained as 'three's, then the electronic equipment can obtain 5 teachers from other types of teachers with the first reference entity as 'three's as second reference entities, and finally the electronic equipment obtains 6 reference entities.
In this embodiment of the present application, after the electronic device determines the reference entity corresponding to the question entity, there are various ways of obtaining the candidate answer set corresponding to the question entity from the knowledge graph based on the reference entity, which are not specifically limited in this embodiment of the present application, in a possible embodiment, the electronic device may determine the candidate answer set by the method of step S303, or may determine the candidate answer set by the method of step S304:
s303, acquiring adjacent entities of the reference entity from the knowledge graph, and generating a candidate answer set based on the adjacent entities.
Specifically, the neighboring entity is an entity in the candidate answer set that is directly associated with the reference entity, and after the electronic device determines the reference entity corresponding to the question entity through a pre-trained extraction model, the candidate answer set may be generated based on the neighboring entity. For example: the electronic device determines that the reference entity is "china", and then may acquire neighboring entities of the reference entity from the knowledge graph as "usa", "uk", and "japan", etc., and the electronic device may generate a candidate answer set based on the neighboring entities of the reference entity and a relationship between the neighboring entities, such as "usa", "uk", and "japan". As shown in fig. 5, Q may be represented as the problem entity, N represents the first reference entity, P represents the second reference entity, e may represent the neighboring entity, and R represents the relationship existing with the reference entity.
S304, determining a connection path between the question entity and the reference entity from the knowledge graph, and generating a candidate answer set based on entities on the connection path.
Specifically, after the electronic device determines a reference entity corresponding to the problem entity through a pre-trained extraction model, connection paths between the problem entity and the reference entity may be determined from the knowledge graph, the number of the connection paths may be one or multiple, and the application is not particularly limited, and then a candidate answer set is generated based on the connection paths. For example: the electronic equipment determines that the reference entity is 'china', the question entity is 'yaoming', then the electronic equipment determines that a connection path between the question entity and the reference entity comprises entities such as 'jiangsu', 'beijing' and 'shanghai', and the electronic equipment can generate a candidate answer set based on the entities such as 'jiangsu', 'beijing' and 'shanghai' on the connection path and the relationship among the entities. As shown in fig. 6, Q may be represented as the problem entity, N represents the first reference entity, P represents the second reference entity, e may represent an entity on a connection path, R represents a relationship existing between entities, and a connection path exists between Q and N and P in a knowledge graph.
S305, initializing the candidate answer set and the question entity through a language model BERT, and generating candidate entity characteristics, overall question characteristics, question entity characteristics and relation characteristics.
Specifically, the candidate entity features refer to features corresponding to the candidate answer entities, the overall question features refer to features corresponding to all question entities, the question entity features refer to features corresponding to each question entity, and the relationship features refer to features corresponding to a relationship between any two candidate answer entities. After the electronic equipment generates a candidate answer set, the candidate answer set and the question entity can be initialized through a language model BERT, and candidate entity characteristics, overall question characteristics, question entity characteristics and relation characteristics are generated. The language model BERT may refer to a fine-tuning-based multi-layer bi-directional encoder, wherein the bi-directional encoder is the same as the original encoder, and the encoder is an attention mechanism that learns the context between words (or sub-words) in the text. The feature may refer to a characteristic such as data corresponding to the entity, and may be represented in a form of a vector or an array, and the present application is not limited specifically. For example: the electronic equipment determines that the question entities are 'Yaoming' and 'work place', the candidate answer entities are 'Shanghai' and 'Xunji', the relation between the two candidate answer entities is 'belong', then the electronic equipment can initialize each question entity into question entity characteristics such as vectors [1,2,3] and [4,5,6] through a trained language model BERT, initialize the two question entities into overall question characteristics such as vectors [7,8,9], initialize the candidate answer entities into vectors [2,4,6] and [1,3,5] for selecting entity characteristics, and initialize the relation between any two candidate answer entities into relation characteristics such as vectors [9,8,7 ].
In an embodiment of the present application, after the electronic device generates a candidate entity feature, an overall question feature, a question entity feature, and a relationship feature, a predictive answer entity may be screened from the candidate answer set based on the candidate entity feature, the overall question feature, the question entity feature, and the relationship feature, where the predictive answer entity is a plurality of candidate answer entities whose relevance to the question entity exceeds a preset threshold. For example: the electronic device may calculate the candidate entity feature by performing a simple four-rule algorithm on the overall question feature, the question entity feature, and the relationship feature, and then determine that the candidate entity feature is the predicted answer entity.
The electronic device may filter the predicted answer entity from the candidate answer set in various ways, which are not specifically limited in the embodiment of the present application, and in a possible embodiment, the electronic device may filter the predicted answer entity by the way of step S306:
s306, the candidate entity characteristics are updated through a formula, and the updated candidate entity characteristics are analyzed to determine the corresponding predicted answer entity.
Specifically, after the electronic device generates the candidate entity feature, the overall problem feature, the problem entity feature and the relationship feature, the candidate entity feature may be updated through a pre-trained neural network. For example: the electronic device may update the candidate entity features by:
wherein v isqRepresenting a question entity, r representing a relationship between said two candidate answer entities, viRepresents the candidate answer entity, XqA set of problem entities is represented that,represents the candidate entity characteristics of the l-th layer, l represents the current layer number of the pre-trained neural network FFN (), l is a positive integer greater than 1,representing candidate entity features of layer l-1,represents the global problem feature of the l-th layer, f(l)() Problem entities, relationships and candidates representing the l-th layerThe connection between the pickanswer entities is characterized by Σ, which represents the cumulative sum.
The electronic device can initialize the generated candidate entity characteristics, the whole problem characteristics, the problem entity characteristics and the relationship characteristics as layer 1 characteristic data of the neural network, then the layer 2 characteristic data can be calculated through the layer 1 characteristic data, the layer 3 characteristic data can be calculated through the layer 2 characteristic data, and the like, the neural network transmits messages from the problem entity to the candidate entity through combining a plurality of characteristic data, and in this way, the characteristic data of the candidate entity in the last layer can be fused with high-order information of a plurality of sources, and the neural network is beneficial to simply and accurately updating the candidate entity characteristics. For example: the electronic equipment determines that the candidate entity characteristics of the first layer are [1,2,3], the overall problem characteristics are [4,5,6], the connection characteristics are [7,8,9], and the candidate entity characteristics of the second layer are [3,2,1] and the like after calculation of the neural network.
After the electronic device updates the candidate entity features through a formula, the updated candidate entity features may be analyzed to determine a corresponding predicted answer entity, for example: the electronic equipment initially determines candidate answer entities including entities such as "china", "britain", "usa" and "japan", obtains updated candidate entity features as [1,2,3,4,5,6], and can analyze the corresponding entities as "china" and "usa" through reverse application of a trained language model BERT.
In one possible embodiment, the connection features between the question entity, the relationship and the candidate answer entity are updated by the following formula:
wherein f is(l)() Representing connection features between question entities, relations, and candidate answer entities of the l-th layer, FFN () representing a pre-trained neural network,problem representation of layer IThe characteristics of the body are as follows,the relationship characteristics of the l-th layer are shown,the correlation coefficient of the l-th layer is represented, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1. For example: the electronic device determines that the correlation coefficient of layer 2 is [1,2,3]]The problem entity is characterized by [4,5,6]]The relationship is characterized by [3,4, 5]]The connection characteristics of the layer 2 obtained by calculation of the neural network are [9,8,7]]And the like.
In one possible embodiment, the correlation coefficient is calculated by the following formula:
wherein,represents the correlation coefficient of the l-th layer, Sigmoid () represents a logistic regression function,the overall problem characteristic of the l-th layer is shown,the relation characteristic of the l-th layer is represented, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1. For example: the electronic device determines that the overall problem characteristic of layer 2 is [1,7, 3]]The relationship is characterized by [3,8, 3]]The correlation coefficient of the 2 nd layer obtained by the calculation of the logistic regression function is [1,2,3]]And the like.
In one possible embodiment, the problem entity characteristic is updated by the following formula:
wherein,the problem entity characteristics of the l-th layer are represented,represents the problem entity characteristics of layer l-1,the overall problem characteristic of the l-th layer is represented, FFN () represents a pre-trained neural network, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1. For example: the electronic device determines that the problem entity at layer 1 is characterized by [6,7,2 ]]The overall problem characteristic of layer 2 is [7,2, 6]]The problem entity characteristics of the layer 2 obtained by calculation of the neural network are [4,5,6]]And the like.
In one possible embodiment, the overall problem characteristic is updated by the following formula:
wherein,the overall problem characteristic of the l-th layer is shown,the overall problem characteristic of the l-1 layer is represented, FFN () represents a pre-trained neural network, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1. For example: the electronic device determines that the overall problem characteristic of layer 1 is [3,6,8 ]]The overall problem characteristics of layer 2 obtained by neural network calculation are [7,2, 6]]And the like.
In one possible embodiment, the relationship characteristic is updated by the following formula:
wherein,the relationship characteristics of the l-th layer are shown,representing the relation characteristic of the l-1 layer, wherein FFN () represents a pre-trained neural network, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1. For example: the electronic device determines the layer 1 relationship characteristic as [8,5, 9]]The relation characteristic of the 2 nd layer obtained by calculation of the neural network is [3,8, 3]]And the like.
In this embodiment, after the electronic device filters the predicted answer entity from the candidate answer set, the electronic device may determine a target answer entity based on the predicted answer entity, for example: the electronic device determines that the screening predictive answer entities include "china" and "usa", and the question answer entity is "yaoming", then the electronic device may determine that the target answer entity is "china" by the correlation between the characteristics of each screening predictive answer entity and the characteristics of the question answer entity being 0.9 and 0.8, respectively.
The electronic device determines the target answer entity based on the predicted answer entity in various ways, which are not specifically limited in the embodiment of the present application, and in a possible embodiment, the electronic device may determine the target answer entity through the ways of steps S307 to S308:
and S307, calculating likelihood estimation corresponding to each predicted answer entity.
Specifically, after screening the predicted answer entities from the candidate answer set, the electronic device may calculate likelihood estimates corresponding to the predicted answer entities by using the following formula:
wherein L isADenotes vtThe corresponding likelihood estimates are then used to estimate the likelihood,represents that the target answer entity is vtThe time corresponding label, y () represents the label function, the label being 0 or 1, vtRepresenting the t-th predicted answer entity, n representing the number of predicted answer entities, t, n being integers greater than 1, XqRepresenting a problem entity set, p () representing a probability function, log () representing a logarithmic function, and Σ representing a cumulative sum. For example: the electronic device determines that the predicted answer entities include "china" and "usa", and calculates the corresponding likelihood estimates to be 0.85 and 0.6 through the formula, respectively.
S308, determining the maximum likelihood estimation, and determining the target answer entity based on the maximum likelihood estimation.
Specifically, after the electronic device calculates the likelihood estimates corresponding to the predicted answer entities, the target answer entity may be determined, for example: the electronic device determines that the predicted answer is 'Chinese' and 'American', the corresponding likelihood estimates are 0.85 and 0.6 respectively, then the electronic device determines that 0.85 is the maximum likelihood estimate, and determines that 'Chinese' is the target answer entity. As shown in fig. 7, a schematic diagram of a neural network structure may be shown, the corresponding neural network may first input an existing knowledge graph and natural text (for example, but not limited to, "what concepts are covered by courses of John Guttag and jin Furong professor"), then the neural network may generate a candidate answer set (for example, but not limited to, an evidence graph) through an evidence retrieval process, then may obtain a target answer entity through an answer search process, and may specifically calculate a recursive function through image reasoning, and the like.
When the scheme of the embodiment of the application is executed, a question entity is obtained, a reference entity corresponding to the question entity is determined, a candidate answer set corresponding to the question entity is obtained from a knowledge graph based on the reference entity, wherein the knowledge graph at least comprises a plurality of entities and the relation between any two entities, the reference entity is any one of the entities included in the knowledge graph, the candidate set comprises a plurality of candidate answer entities corresponding to the question entity and the relation between any two candidate answer entities, the candidate answer entities are entities associated with the reference entity, and a target answer entity corresponding to the question entity is determined from the candidate answer set. According to the method and the device, the target answer entity corresponding to the question entity can be obtained only by analyzing the question entity and the candidate answer set, and compared with the prior art that the target answer entity is determined by analyzing the question entity and the whole knowledge graph, the accuracy and the calculation efficiency of question-answer reasoning can be improved.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Referring to fig. 8, a schematic structural diagram of a question answering reasoning apparatus provided in an exemplary embodiment of the present application is shown, which is hereinafter referred to as a reasoning apparatus 8. The inference means 8 can be implemented as all or part of the terminal in software, hardware or a combination of both. The method comprises the following steps:
an obtaining module 801, configured to obtain a problem entity;
a first determining module 802, configured to determine a reference entity corresponding to the question entity, and obtain a candidate answer set corresponding to the question entity from a knowledge graph based on the reference entity; the knowledge graph at least comprises a plurality of entities and a relation between any two entities, the reference entity is any one of the entities included in the knowledge graph, the candidate set comprises a plurality of candidate answer entities corresponding to the question entity and a relation between any two candidate answer entities, and the candidate answer entities are entities associated with the reference entity;
a second determining module 803, configured to determine, from the candidate answer set, a target answer entity corresponding to the question entity.
In a possible embodiment, the obtaining module 801 includes:
and the acquisition unit is used for acquiring the question sentence text and extracting the question entity in the question sentence text.
In a possible embodiment, the first determining module 802 comprises:
the first determining unit is used for determining a reference entity corresponding to the problem entity through a pre-trained extraction model;
a first obtaining unit, configured to obtain neighboring entities of the reference entity from the knowledge-graph; wherein the neighboring entity is an entity in the candidate answer set that is directly associated with the reference entity;
a first generating unit, configured to generate a candidate answer set based on the neighboring entities.
In a possible embodiment, the first determining module 802 comprises:
the second determining unit is used for determining a reference entity corresponding to the problem entity through a pre-trained extraction model;
a third determination unit for determining a connection path between the problem entity and the reference entity from the knowledge-graph;
and the second generating unit is used for generating a candidate answer set based on the entity on the connection path.
In a possible embodiment, the second determining module 803 comprises:
a third generating unit, configured to perform initialization processing on the candidate answer set and the question entity through a language model BERT, and generate a candidate entity feature, an overall question feature, a question entity feature, and a relationship feature; the candidate entity features refer to features corresponding to the candidate answer entities, the overall question features refer to features corresponding to all question entities, the question entity features refer to features corresponding to each question entity, and the relationship features refer to features corresponding to the relationship between any two candidate answer entities;
a screening unit, configured to screen a predicted answer entity from the candidate answer set based on the candidate entity feature, the overall question feature, the question entity feature, and the relationship feature; the predicted answer entity is a plurality of candidate answer entities of which the relevance with the question entity exceeds a preset threshold;
a fourth determination unit for determining a target answer entity based on the predicted answer entity.
In a possible embodiment, the screening unit comprises:
an updating subunit, configured to update the candidate entity feature according to the following formula:
wherein v isqRepresenting a question entity, r representing a relationship between said two candidate answer entities, viRepresents the candidate answer entity, XqA set of problem entities is represented that,represents the candidate entity characteristics of the l-th layer, l represents the current layer number of the pre-trained neural network FFN (), l is a positive integer greater than 1,representing candidate entity features of layer l-1,represents the global problem feature of the l-th layer, f(l)() Expressing the connection characteristics among the question entities, the relations and the candidate answer entities of the ith layer, and sigma expressing cumulative summation;
and the analysis subunit is used for analyzing the updated candidate entity characteristics to determine a corresponding predicted answer entity.
In one possible embodiment, the connection features between the question entity, the relationship and the candidate answer entity are updated by the following formula:
wherein f is(l)() Representing connection features between question entities, relations, and candidate answer entities of the l-th layer, FFN () representing a pre-trained neural network,the problem entity characteristics of the l-th layer are represented,the relationship characteristics of the l-th layer are shown,the correlation coefficient of the l-th layer is represented, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In one possible embodiment, the correlation coefficient is calculated by the following formula:
wherein,represents the correlation coefficient of the l-th layer, Sigmoid () represents a logistic regression function,the overall problem characteristic of the l-th layer is shown,the relation characteristic of the l-th layer is represented, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In one possible embodiment, the problem entity characteristic is updated by the following formula:
wherein,the problem entity characteristics of the l-th layer are represented,represents the problem entity characteristics of layer l-1,the overall problem characteristic of the l-th layer is represented, FFN () represents a pre-trained neural network, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In one possible embodiment, the overall problem characteristic is updated by the following formula:
wherein,the overall problem characteristic of the l-th layer is shown,the overall problem characteristic of the l-1 layer is represented, FFN () represents a pre-trained neural network, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In one possible embodiment, the relationship characteristic is updated by the following formula:
wherein,the relationship characteristics of the l-th layer are shown,representing the relation characteristic of the l-1 layer, wherein FFN () represents a pre-trained neural network, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In a possible embodiment, the fourth determination unit comprises:
the calculating subunit is used for calculating the likelihood estimation corresponding to each predicted answer entity;
and the selecting subunit is used for determining the maximum likelihood estimation and determining the target answer entity based on the maximum likelihood estimation.
In one possible embodiment, the likelihood estimate is calculated by the following formula:
wherein L isADenotes vtThe corresponding likelihood estimates are then used to estimate the likelihood,represents that the target answer entity is vtThe time corresponding label, y () represents the label function, the label being 0 or 1, vtRepresenting the t-th predicted answer entity, n representing the number of predicted answer entities, t, n being integers greater than 1, XqRepresenting a problem entity set, p () representing a probability function, log () representing a logarithmic function, and Σ representing a cumulative sum.
The embodiment of the present application and the method embodiments of fig. 2 to 3 are based on the same concept, and the technical effects brought by the embodiment are also the same, and the specific process may refer to the description of the method embodiments of fig. 2 to 3, and will not be described again here.
The device 8 may be a field-programmable gate array (FPGA), an application-specific integrated chip, a system on chip (SoC), a Central Processing Unit (CPU), a Network Processor (NP), a digital signal processing circuit, a Micro Controller Unit (MCU), or a Programmable Logic Device (PLD) or other integrated chips.
When the scheme of the embodiment of the application is executed, a question entity is obtained, a reference entity corresponding to the question entity is determined, a candidate answer set corresponding to the question entity is obtained from a knowledge graph based on the reference entity, wherein the knowledge graph at least comprises a plurality of entities and the relation between any two entities, the reference entity is any one of the entities included in the knowledge graph, the candidate set comprises a plurality of candidate answer entities corresponding to the question entity and the relation between any two candidate answer entities, the candidate answer entities are entities associated with the reference entity, and a target answer entity corresponding to the question entity is determined from the candidate answer set. According to the method and the device, the target answer entity corresponding to the question entity can be obtained only by analyzing the question entity and the candidate answer set, and compared with the prior art that the target answer entity is determined by analyzing the question entity and the whole knowledge graph, the accuracy and the calculation efficiency of question-answer reasoning can be improved.
An embodiment of the present application further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, where the instructions are suitable for being loaded by a processor and executing the above method steps, and a specific execution process may refer to specific descriptions of the embodiment shown in fig. 2 or fig. 3, which is not described herein again.
The present application further provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the template control method according to the above embodiments.
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 9, the electronic device 900 may include: at least one processor 901, at least one network interface 904, a user interface 903, memory 905, at least one communication bus 902.
Wherein a communication bus 902 is used to enable connective communication between these components.
The user interface 903 may include a Display screen (Display) and a Camera (Camera), and the optional user interface 903 may also include a standard wired interface and a wireless interface.
The network interface 904 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), among others.
The Memory 905 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). Optionally, the memory 905 includes a non-transitory computer-readable medium. The memory 905 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 905 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above-described method embodiments, and the like; the storage data area may store data and the like referred to in the above respective method embodiments. The memory 905 may optionally be at least one memory device located remotely from the processor 901. As shown in fig. 9, the memory 905, which is a type of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a question-and-answer reasoning application.
In the electronic device 900 shown in fig. 9, the user interface 903 is mainly used for providing an input interface for a user to obtain data input by the user; the processor 901 may be configured to call the question-answering reasoning application stored in the memory 905, and specifically perform the following operations:
acquiring a problem entity;
determining a reference entity corresponding to the problem entity, and acquiring a candidate answer set corresponding to the problem entity from a knowledge graph based on the reference entity; the knowledge graph at least comprises a plurality of entities and a relation between any two entities, the reference entity is any one of the entities included in the knowledge graph, the candidate set comprises a plurality of candidate answer entities corresponding to the question entity and a relation between any two candidate answer entities, and the candidate answer entities are entities associated with the reference entity;
and determining a target answer entity corresponding to the question entity from the candidate answer set.
In a possible embodiment, when the processor 901 executes the problem entity obtaining, the following specific steps are executed:
collecting question sentence texts, and extracting question entities in the question sentence texts.
In a possible embodiment, the processor 901 performs the determining of the reference entity corresponding to the question entity, and when acquiring the candidate answer set corresponding to the question entity from the knowledge graph based on the reference entity, specifically performs:
determining a reference entity corresponding to the problem entity through a pre-trained extraction model;
obtaining neighboring entities of the reference entity from the knowledge-graph; wherein the neighboring entity is an entity in the candidate answer set that is directly associated with the reference entity;
a set of candidate answers is generated based on the neighboring entities.
In a possible embodiment, the processor 901 performs the determining of the reference entity corresponding to the question entity, and when acquiring the candidate answer set corresponding to the question entity from the knowledge graph based on the reference entity, specifically performs:
determining a reference entity corresponding to the problem entity through a pre-trained extraction model;
determining a connection path between the problem entity and the reference entity from the knowledge-graph;
generating a set of candidate answers based on entities on the connection path.
In a possible embodiment, when the processor 901 determines the target answer entity corresponding to the question entity from the candidate answer set, the following steps are specifically performed:
initializing the candidate answer set and the question entity through a language model BERT to generate candidate entity characteristics, overall question characteristics, question entity characteristics and relation characteristics; the candidate entity features refer to features corresponding to the candidate answer entities, the overall question features refer to features corresponding to all question entities, the question entity features refer to features corresponding to each question entity, and the relationship features refer to features corresponding to the relationship between any two candidate answer entities;
screening a predictive answer entity from the set of candidate answers based on the candidate entity features, the overall question features, the question entity features, and the relationship features; the predicted answer entity is a plurality of candidate answer entities of which the relevance with the question entity exceeds a preset threshold;
determining a target answer entity based on the predicted answer entity.
In one possible embodiment, the processor 901 specifically performs the following when screening predicted answer entities from the candidate answer set based on the candidate entity features, the overall question features, the question entity features and the relationship features:
updating the candidate entity features by the following formula:
wherein v isqRepresenting a question entity, r representing a relationship between said two candidate answer entities, viRepresents the candidate answer entity, XqA set of problem entities is represented that,represents the candidate entity characteristics of the l-th layer, l represents the current layer number of the pre-trained neural network FFN (), l is a positive integer greater than 1,representing candidate entity features of layer l-1,represents the global problem feature of the l-th layer, f(l)() Expressing the connection characteristics among the question entities, the relations and the candidate answer entities of the ith layer, and sigma expressing cumulative summation;
and analyzing the updated candidate entity characteristics to determine a corresponding predicted answer entity.
In one possible embodiment, the connection features between the question entity, the relationship and the candidate answer entity are updated by the following formula:
wherein f is(l)() Representing connection features between question entities, relations, and candidate answer entities of the l-th layer, FFN () representing a pre-trained neural network,the problem entity characteristics of the l-th layer are represented,the relationship characteristics of the l-th layer are shown,the correlation coefficient of the l-th layer is represented, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In one possible embodiment, the correlation coefficient is calculated by the following formula:
wherein,represents the correlation coefficient of the l-th layer, Sigmoid () represents a logistic regression function,the overall problem characteristic of the l-th layer is shown,the relation characteristic of the l-th layer is represented, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In one possible embodiment, the problem entity characteristic is updated by the following formula:
wherein,the problem entity characteristics of the l-th layer are represented,represents the problem entity characteristics of layer l-1,the overall problem characteristic of the l-th layer is represented, FFN () represents a pre-trained neural network, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In one possible embodiment, the overall problem characteristic is updated by the following formula:
wherein,the overall problem characteristic of the l-th layer is shown,the overall problem characteristic of the l-1 layer is represented, FFN () represents a pre-trained neural network, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In one possible embodiment, the relationship characteristic is updated by the following formula:
wherein,the relationship characteristics of the l-th layer are shown,representing the relation characteristic of the l-1 layer, wherein FFN () represents a pre-trained neural network, l represents the current layer number of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In one possible embodiment, the processor 901 performs the determining the target answer entity based on the predicted answer entity, including:
calculating likelihood estimation corresponding to each predicted answer entity;
determining a maximum likelihood estimate, and determining a target answer entity based on the maximum likelihood estimate.
In one possible embodiment, the likelihood estimate is calculated by the following formula:
wherein L isADenotes vtThe corresponding likelihood estimates are then used to estimate the likelihood,represents that the target answer entity is vtThe time corresponding label, y () represents the label function, the label being 0 or 1, vtRepresenting the t-th predicted answer entity, n representing the number of predicted answer entities, t, n being integers greater than 1, XqRepresenting a problem entity set, p () representing a probability function, log () representing a logarithmic function, and Σ representing a cumulative sum.
The technical concept of the embodiment of the present application is the same as that of fig. 2 or fig. 3, and the specific process may refer to the method embodiment of fig. 2 or fig. 3, which is not described herein again.
In an embodiment of the present application, a question entity is obtained, a reference entity corresponding to the question entity is determined, a candidate answer set corresponding to the question entity is obtained from a knowledge graph based on the reference entity, wherein the knowledge graph at least includes a plurality of entities and a relationship between any two entities, the reference entity is any one of the plurality of entities included in the knowledge graph, the candidate set includes a plurality of candidate answer entities corresponding to the question entity and a relationship between any two candidate answer entities, the plurality of candidate answer entities are entities associated with the reference entity, and a target answer entity corresponding to the question entity is determined from the candidate answer set. According to the method and the device, the target answer entity corresponding to the question entity can be obtained only by analyzing the question entity and the candidate answer set, and compared with the prior art that the target answer entity is determined by analyzing the question entity and the whole knowledge graph, the accuracy and the calculation efficiency of question-answer reasoning can be improved.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory or a random access memory.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.
Claims (10)
1. A question-answer reasoning method, characterized in that the method comprises:
acquiring a problem entity;
determining a reference entity corresponding to the problem entity, and acquiring a candidate answer set corresponding to the problem entity from a knowledge graph based on the reference entity; the knowledge graph at least comprises a plurality of entities and a relation between any two entities, the reference entity is any one of the entities included in the knowledge graph, the candidate set comprises a plurality of candidate answer entities corresponding to the question entity and a relation between any two candidate answer entities, and the candidate answer entities are entities associated with the reference entity;
and determining a target answer entity corresponding to the question entity from the candidate answer set.
2. The method of claim 1, wherein the determining a reference entity corresponding to the question entity, and obtaining a candidate answer set corresponding to the question entity from a knowledge graph based on the reference entity comprises:
determining a reference entity corresponding to the problem entity through a pre-trained extraction model;
obtaining neighboring entities of the reference entity from the knowledge-graph; wherein the neighboring entity is an entity in the candidate answer set that is directly associated with the reference entity;
a set of candidate answers is generated based on the neighboring entities.
3. The method of claim 1, wherein the determining a reference entity corresponding to the question entity, and obtaining a candidate answer set corresponding to the question entity from a knowledge graph based on the reference entity comprises:
determining a reference entity corresponding to the problem entity through a pre-trained extraction model;
determining a connection path between the problem entity and the reference entity from the knowledge-graph;
generating a set of candidate answers based on entities on the connection path.
4. The method according to claim 1, wherein the determining a target answer entity corresponding to the question entity from the candidate answer set comprises:
initializing the candidate answer set and the question entity through a language model BERT to generate candidate entity characteristics, overall question characteristics, question entity characteristics and relation characteristics; the candidate entity features refer to features corresponding to the candidate answer entities, the overall question features refer to features corresponding to all question entities, the question entity features refer to features corresponding to each question entity, and the relationship features refer to features corresponding to the relationship between any two candidate answer entities;
screening a predictive answer entity from the set of candidate answers based on the candidate entity features, the overall question features, the question entity features, and the relationship features; the predicted answer entity is a plurality of candidate answer entities of which the relevance with the question entity exceeds a preset threshold;
determining a target answer entity based on the predicted answer entity.
5. The method of claim 4, wherein the screening predictive answer entities from the candidate answer set based on the candidate entity features, the overall question features, the question entity features, and the relationship features comprises:
updating the candidate entity features by the following formula:
wherein v isqRepresenting a question entity, r representing a relationship between said two candidate answer entities, viRepresents the candidate answer entity, XqA set of problem entities is represented that,represents the candidate entity characteristics of the l-th layer, l represents the current layer number of the pre-trained neural network FFN (), l is a positive integer greater than 1,representing candidate entity features of layer l-1,denotes the entirety of the l-th layerProblem feature, f(l)() Expressing the connection characteristics among the question entities, the relations and the candidate answer entities of the ith layer, and sigma expressing cumulative summation;
and analyzing the updated candidate entity characteristics to determine a corresponding predicted answer entity.
6. The method of claim 4, wherein the determining a target answer entity based on the predictive answer entity comprises:
calculating likelihood estimation corresponding to each predicted answer entity;
determining a maximum likelihood estimate, and determining a target answer entity based on the maximum likelihood estimate.
7. The method of claim 6, wherein the likelihood estimate is calculated by the formula:
wherein L isADenotes vtCorresponding likelihood estimate, yvtRepresents that the target answer entity is vtThe time corresponding label, y () represents the label function, the label being 0 or 1, vtRepresenting the t-th predicted answer entity, n representing the number of predicted answer entities, t, n being integers greater than 1, XqRepresenting a problem entity set, p () representing a probability function, log () representing a logarithmic function, and Σ representing a cumulative sum.
8. A question-answering reasoning apparatus comprising:
the acquisition module is used for acquiring the problem entity;
the first determination module is used for determining a reference entity corresponding to the question entity and acquiring a candidate answer set corresponding to the question entity from a knowledge graph based on the reference entity; the knowledge graph at least comprises a plurality of entities and a relation between any two entities, the reference entity is any one of the entities included in the knowledge graph, the candidate set comprises a plurality of candidate answer entities corresponding to the question entity and a relation between any two candidate answer entities, and the candidate answer entities are entities associated with the reference entity;
and the second determining module is used for determining a target answer entity corresponding to the question entity from the candidate answer set.
9. A computer storage medium, characterized in that it stores a plurality of instructions adapted to be loaded by a processor and to carry out the method steps according to any one of claims 1 to 7.
10. An electronic device, comprising: a memory and a processor; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110659490.6A CN113392197B (en) | 2021-06-15 | 2021-06-15 | Question-answering reasoning method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110659490.6A CN113392197B (en) | 2021-06-15 | 2021-06-15 | Question-answering reasoning method and device, storage medium and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113392197A true CN113392197A (en) | 2021-09-14 |
CN113392197B CN113392197B (en) | 2023-08-04 |
Family
ID=77621008
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110659490.6A Active CN113392197B (en) | 2021-06-15 | 2021-06-15 | Question-answering reasoning method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113392197B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114817512A (en) * | 2022-06-28 | 2022-07-29 | 清华大学 | Question-answer reasoning method and device |
CN116226478A (en) * | 2022-12-27 | 2023-06-06 | 北京百度网讯科技有限公司 | Information processing method, model training method, device, equipment and storage medium |
CN116955560A (en) * | 2023-07-21 | 2023-10-27 | 广州拓尔思大数据有限公司 | Data processing method and system based on thinking chain and knowledge graph |
Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070073533A1 (en) * | 2005-09-23 | 2007-03-29 | Fuji Xerox Co., Ltd. | Systems and methods for structural indexing of natural language text |
CN110688486A (en) * | 2019-09-26 | 2020-01-14 | 北京明略软件系统有限公司 | Relation classification method and model |
CN110837550A (en) * | 2019-11-11 | 2020-02-25 | 中山大学 | Knowledge graph-based question and answer method and device, electronic equipment and storage medium |
CN110895561A (en) * | 2019-11-13 | 2020-03-20 | 中国科学院自动化研究所 | Medical question and answer retrieval method, system and device based on multi-mode knowledge perception |
CN111008272A (en) * | 2019-12-04 | 2020-04-14 | 深圳市新国都金服技术有限公司 | Knowledge graph-based question and answer method and device, computer equipment and storage medium |
CN111708873A (en) * | 2020-06-15 | 2020-09-25 | 腾讯科技(深圳)有限公司 | Intelligent question answering method and device, computer equipment and storage medium |
CN112182179A (en) * | 2020-09-27 | 2021-01-05 | 北京字节跳动网络技术有限公司 | Entity question-answer processing method and device, electronic equipment and storage medium |
US20210012217A1 (en) * | 2019-07-10 | 2021-01-14 | International Business Machines Corporation | Leveraging entity relations to discover answers using a knowledge graph |
CN112487827A (en) * | 2020-12-28 | 2021-03-12 | 科大讯飞华南人工智能研究院(广州)有限公司 | Question answering method, electronic equipment and storage device |
CN112507061A (en) * | 2020-12-15 | 2021-03-16 | 康键信息技术(深圳)有限公司 | Multi-relation medical knowledge extraction method, device, equipment and storage medium |
CN112650840A (en) * | 2020-12-04 | 2021-04-13 | 天津泰凡科技有限公司 | Intelligent medical question-answering processing method and system based on knowledge graph reasoning |
CN112784590A (en) * | 2021-02-01 | 2021-05-11 | 北京金山数字娱乐科技有限公司 | Text processing method and device |
CN112785347A (en) * | 2021-02-08 | 2021-05-11 | 苏宁金融科技(南京)有限公司 | Intelligent customer service question and answer recommendation method and system based on knowledge graph |
-
2021
- 2021-06-15 CN CN202110659490.6A patent/CN113392197B/en active Active
Patent Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070073533A1 (en) * | 2005-09-23 | 2007-03-29 | Fuji Xerox Co., Ltd. | Systems and methods for structural indexing of natural language text |
US20210012217A1 (en) * | 2019-07-10 | 2021-01-14 | International Business Machines Corporation | Leveraging entity relations to discover answers using a knowledge graph |
CN110688486A (en) * | 2019-09-26 | 2020-01-14 | 北京明略软件系统有限公司 | Relation classification method and model |
CN110837550A (en) * | 2019-11-11 | 2020-02-25 | 中山大学 | Knowledge graph-based question and answer method and device, electronic equipment and storage medium |
CN110895561A (en) * | 2019-11-13 | 2020-03-20 | 中国科学院自动化研究所 | Medical question and answer retrieval method, system and device based on multi-mode knowledge perception |
CN111008272A (en) * | 2019-12-04 | 2020-04-14 | 深圳市新国都金服技术有限公司 | Knowledge graph-based question and answer method and device, computer equipment and storage medium |
CN111708873A (en) * | 2020-06-15 | 2020-09-25 | 腾讯科技(深圳)有限公司 | Intelligent question answering method and device, computer equipment and storage medium |
CN112182179A (en) * | 2020-09-27 | 2021-01-05 | 北京字节跳动网络技术有限公司 | Entity question-answer processing method and device, electronic equipment and storage medium |
CN112650840A (en) * | 2020-12-04 | 2021-04-13 | 天津泰凡科技有限公司 | Intelligent medical question-answering processing method and system based on knowledge graph reasoning |
CN112507061A (en) * | 2020-12-15 | 2021-03-16 | 康键信息技术(深圳)有限公司 | Multi-relation medical knowledge extraction method, device, equipment and storage medium |
CN112487827A (en) * | 2020-12-28 | 2021-03-12 | 科大讯飞华南人工智能研究院(广州)有限公司 | Question answering method, electronic equipment and storage device |
CN112784590A (en) * | 2021-02-01 | 2021-05-11 | 北京金山数字娱乐科技有限公司 | Text processing method and device |
CN112785347A (en) * | 2021-02-08 | 2021-05-11 | 苏宁金融科技(南京)有限公司 | Intelligent customer service question and answer recommendation method and system based on knowledge graph |
Non-Patent Citations (2)
Title |
---|
杨霞: "基于知识图谱的事实型问答算法研究", 《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》 * |
杨霞: "基于知识图谱的事实型问答算法研究", 《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》, no. 01, 15 January 2022 (2022-01-15), pages 138 - 3338 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114817512A (en) * | 2022-06-28 | 2022-07-29 | 清华大学 | Question-answer reasoning method and device |
CN114817512B (en) * | 2022-06-28 | 2023-03-14 | 清华大学 | Question-answer reasoning method and device |
CN116226478A (en) * | 2022-12-27 | 2023-06-06 | 北京百度网讯科技有限公司 | Information processing method, model training method, device, equipment and storage medium |
CN116226478B (en) * | 2022-12-27 | 2024-03-19 | 北京百度网讯科技有限公司 | Information processing method, model training method, device, equipment and storage medium |
CN116955560A (en) * | 2023-07-21 | 2023-10-27 | 广州拓尔思大数据有限公司 | Data processing method and system based on thinking chain and knowledge graph |
CN116955560B (en) * | 2023-07-21 | 2024-01-05 | 广州拓尔思大数据有限公司 | Data processing method and system based on thinking chain and knowledge graph |
Also Published As
Publication number | Publication date |
---|---|
CN113392197B (en) | 2023-08-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111897941B (en) | Dialogue generation method, network training method, device, storage medium and equipment | |
CN110490213B (en) | Image recognition method, device and storage medium | |
JP2022153441A (en) | Method and device for pre-training models, method and device for generating text, electronic device, storage medium, and computer program | |
CN113392197B (en) | Question-answering reasoning method and device, storage medium and electronic equipment | |
JP2021182430A (en) | Method for training semantic analysis model, device, electronic apparatus, and storage medium | |
CN113127624B (en) | Question-answer model training method and device | |
CN110781413B (en) | Method and device for determining interest points, storage medium and electronic equipment | |
CN112015896B (en) | Emotion classification method and device based on artificial intelligence | |
CN110234018A (en) | Multimedia content description generation method, training method, device, equipment and medium | |
EP4113357A1 (en) | Method and apparatus for recognizing entity, electronic device and storage medium | |
CN111767394A (en) | Abstract extraction method and device based on artificial intelligence expert system | |
CN113421551B (en) | Speech recognition method, speech recognition device, computer readable medium and electronic equipment | |
CN114492661B (en) | Text data classification method and device, computer equipment and storage medium | |
CN117453925A (en) | Knowledge migration method, apparatus, device, readable storage medium and program product | |
CN115238045A (en) | Method, system and storage medium for extracting generation type event argument | |
JP2022106980A (en) | Generation method, device, electronic equipment, and storage medium for query sentence | |
CN117453898B (en) | Cross-modal question-answering processing method and device based on thinking chain | |
CN111931503B (en) | Information extraction method and device, equipment and computer readable storage medium | |
CN117494761A (en) | Information processing and model training method, device, equipment, medium and program product | |
US20230214688A1 (en) | Method, Apparatus for Determining Answer to Question, Device, Storage Medium and Program Product | |
CN113591472A (en) | Lyric generation method, lyric generation model training method and device and electronic equipment | |
CN109002498B (en) | Man-machine conversation method, device, equipment and storage medium | |
CN116610784A (en) | Insurance business scene question-answer recommendation method and related equipment thereof | |
CN112749553B (en) | Text information processing method and device for video file and server | |
CN114420075A (en) | Audio processing method and device, equipment and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |