CN113392197B - Question-answering reasoning method and device, storage medium and electronic equipment - Google Patents

Question-answering reasoning method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN113392197B
CN113392197B CN202110659490.6A CN202110659490A CN113392197B CN 113392197 B CN113392197 B CN 113392197B CN 202110659490 A CN202110659490 A CN 202110659490A CN 113392197 B CN113392197 B CN 113392197B
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.)
Active
Application number
CN202110659490.6A
Other languages
Chinese (zh)
Other versions
CN113392197A (en
Inventor
杨霞
常毅
田原
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jilin University
Original Assignee
Jilin University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Jilin University filed Critical Jilin University
Priority to CN202110659490.6A priority Critical patent/CN113392197B/en
Publication of CN113392197A publication Critical patent/CN113392197A/en
Application granted granted Critical
Publication of CN113392197B publication Critical patent/CN113392197B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models

Abstract

The application discloses a question and answer reasoning method, a question and answer reasoning device, a storage medium and electronic equipment, and belongs to the technical field of computers. The question-answering reasoning method comprises the following steps: acquiring a question entity, determining a reference entity corresponding to the question entity, acquiring 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 entity of the plurality of 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 plurality of 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. The method and the device can improve accuracy and calculation efficiency of question-answer reasoning.

Description

Question-answering reasoning method and device, storage medium and electronic equipment
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
The knowledge-based question-answering (Knowledge Base Question Answering, KBQA) refers to a process of obtaining an answer return by converting a user's question into a query sentence on a knowledge graph through understanding the user's question given the constructed knowledge graph, and executing the query sentence. Since current knowledge-graph is usually a fact-based graph, KBQA is often used to answer knowledge questions of the fact-type or encyclopedia class.
Most of the existing research works about multi-hop knowledge graph reasoning questions and answers assume a reasoning track as a linear chain, however, in practical application, problems can be associated with various structures in the knowledge graph, from simple linear chain to complex directed acyclic graph, and the prior art completely relies on a language model to perform linear chain reasoning, so that the calculation efficiency and accuracy are reduced.
Disclosure of Invention
The embodiment of the application provides a question and answer reasoning method, a question and answer reasoning device, a storage medium and electronic equipment, which can improve the accuracy and the calculation efficiency of question and answer reasoning. The technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a question-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 entity among the plurality of 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, and the plurality of 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 determining module is used for 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 entity among the plurality of 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, and the plurality of 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-described 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 technical scheme provided by some embodiments of the present application has the beneficial effects that at least includes:
according to the method, 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 a relation between any two entities, the reference entity is any one entity among the plurality of 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 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, the method and the device for determining the target answer entity by analyzing the question entity and the whole knowledge graph, the accuracy rate of question-answer reasoning and the calculation efficiency 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 that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of a network architecture of a question-answer reasoning system according to an embodiment of the present application;
FIG. 2 is an interaction schematic diagram of a question-answer reasoning method provided in an embodiment of the present application;
FIG. 3 is another interactive schematic diagram of a question-answer reasoning method provided in an embodiment of the present application;
FIG. 4 is a schematic diagram of obtaining a problem entity according to an embodiment of the present application;
FIG. 5 is a schematic diagram of candidate answer set generation provided in an embodiment of the present application;
FIG. 6 is another schematic diagram of candidate answer set generation provided by embodiments of the present application;
fig. 7 is a schematic structural diagram of a neural network according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a question-answering reasoning device according to 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 apparent, the following detailed description of the embodiments of the present application will be given with reference to the accompanying drawings.
In designing the drawings, the following description refers to the same or similar elements in different drawings unless indicated otherwise. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
In the description of the present application, it should 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 terms in this application will be understood by those of ordinary skill in the art in a specific context. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
The present application is 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, a system architecture 100 may include a user 101, an electronic device 102, and a network 103. The network 103 is used as a medium to provide a communication link 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 teacher, a student, a parent of the student, and other personnel, and the user 101 may be used to trigger a user operation on the electronic device 102, for example: the user 101 needs to know the name of the lecture professor of the third lesson, and the user 101 can trigger a user operation on the electronic device 102 to query for the name of the inferential lecture professor. The electronic device 102 may be, but is not limited to, configured to read various user operations triggered by the user 101, decode the user operations, and execute the user operations to complete the service triggered by the user 101. For example: the electronic device 102 may first receive the question sentence from the user 101, extract the 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, and answer the question of the user 101.
For example, in the course query process, 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 healthy lesson teacher") and then the electronic device 102 extracts a question entity (for example, but not limited to, "science and health" and "lesson teacher") from the question sentence, and the electronic device 102 may obtain a candidate answer set (for example, but not limited to, "Zhao Er", "Zhang San", and "Liqu") corresponding to the question entity by determining a reference entity (for example, but not limited to "Zhang Sano") corresponding to the question entity, and then the electronic device 102 may determine a target answer entity (for example, but not limited to "Zhang Sano") corresponding to the question entity from the candidate answer set.
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 smartphones, tablets, laptop and desktop computers, and the like. When the electronic device 102 is software, it may be implemented as a plurality of software or software modules (e.g., to provide distributed processing services), or as a single software or software module, which is not specifically limited herein.
The network 103 may include various types of wired or wireless communication links, and data interactions between the user 101 and the electronic device 102 may be through 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 used, as desired, and all support distributed clustered deployments.
In the following method embodiments, for convenience of explanation, only the execution subject of each step will be described as an electronic device.
The question-answer reasoning method provided in the embodiment of the present application will be described in detail with reference to fig. 2 to 3.
Referring to fig. 2, an interaction schematic diagram of a question-answer reasoning method is provided for an embodiment of the present application. The method may comprise the steps of:
s201, acquiring a problem entity.
In particular, a problem entity refers to an entity that appears in the problem, such as where is the birth place for the problem "Yao Ming? "the problem entity is judged to be < Yao Ming > by the character string of" Yao Ming ", and the problem entity is also the reasoning starting point in the subsequent reasoning flow. In theory, the number of the problem entities in one problem is not limited, and in the field of multi-hop question answering based on a knowledge graph, it is generally assumed that only one problem entity exists in one problem, and the number of the problem entities is not particularly limited in the application. An entity refers to something that is distinguishable and exists independently, such as a person, a city, a plant, etc., a commodity, etc. The world everything has specific things, such as "china", "united states", "japan", etc., the entities are the most basic elements in the knowledge graph, and different relationships exist between different entities. A Knowledge Graph (knowledgegraph) is a data structure that stores human Knowledge in a relational directed Graph form, each node in the Knowledge Graph represents an entity, and a directed edge between two nodes represents a relationship between them. For example: < Yao Ming > is an entity and < Shanghai > is also an entity, the relationship between them being < born >, such a triplet < Yao Ming, which occurs, represents a fact. The knowledge graph can comprise data such as entities, types, attributes, relationships, domains, values and the like, and is also used as a question-answering 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-answering system.
Question-and-answer (Question Answering) is an important area of research in natural language processing (Natural Language Processing) where researchers aim to build such a system: it can automatically give an answer to a question posed by a human in natural language. Research results in this area of question-answering have already popular everyone's lives, for example, when a user gets up in the morning to ask your intelligent voice assistant "how weather today" the user gets a similar answer: "today is a sunny day, temperature 15-22 ℃. Knowledge-graph questions (Question Answering over Knowledge Graphs) refer to questions and answers scenarios that use knowledge graphs as the primary data source, and for a given question, can be inferred based on knowledge graphs to arrive at an answer. This technology has been widely used by the industry in related smart search and recommendation services, the most well known of which are common search engine services, such as: for such a simpler question "where is the birth place of Yao Ming? The search engine obtains an answer entity of which the answer is < Shanghai > through the triplet < Yao Ming in the knowledge graph, which happens in Shanghai >. The answer to a theoretical question is not necessarily an entity, for example, "how many gold cards are obtained in the Beijing Olympic Games in China? "the answer is a number, in the field of knowledge-graph multi-hop questions and answers, it is generally assumed that the answer to a question is an entity in the knowledge graph, i.e. the answer entity.
The manner in which an electronic device obtains a problem entity is varied, for example: the electronic device can crawl text data uploaded by a user from the internet through a crawler technology to determine a problem statement, and then extract a problem entity from the problem statement. The electronic device may also directly receive the problem entity sent by other electronic devices, the electronic device a receives the problem entity "Yao Ming" sent by the electronic device b, and the electronic device may also collect the voice data of the user, and then obtain the problem entity through semantic analysis, for example: the electronic device may collect audio data of which persons the director of the movie is by a microphone, etc. the electronic device may identify the audio data as text data, and finally the electronic device may perform word segmentation processing on the text data by semantic analysis to obtain a plurality of words "adult", "director" and "movie", etc., and identify part of speech types of each word to determine a problem entity, for example: the electronic device recognizes "adult" as a noun, "director" as a verb, etc., and determines that the problem entity includes "adult", "movie", and "director", etc.
S202, 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.
Specifically, the knowledge graph at least comprises a plurality of entities and a relation between any two entities, the reference entity is any one entity among the plurality of 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 plurality of 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: the knowledge graph has 100 entities, and the electronic device first determines the problem entity and then may acquire a corresponding reference entity, where the reference entity is any one of the 100 entities, that is, the problem entity has a corresponding relationship with the reference entity, for example: problem entity "Yao Ming" and "height" correspond to reference entity "2 meters", problem entity "Qiao Busi" corresponds to reference entity "microsoft", etc. In this application, the number of the reference entities may be one or more, which is not limited herein, and the electronic device may obtain the corresponding reference entity through a preset correspondence.
After determining the reference entity corresponding to the question entity, the electronic device may determine a candidate answer set corresponding to the question entity based on the reference entity, for example: the electronic device determines that the reference entity is "2 meters", and then the electronic device may acquire, from the 100 entities of the knowledge graph, all entities of the same type (for example, but not limited to, the same number of types) such as "2.1 meters", "2.2 meters", and "2.26 meters" as candidate answer sets. For example: the electronic device determines that the reference entity is microsoft, and the electronic device may obtain entities of the same type (for example, but not limited to, the same company type) of "apple", "google", and "tesla" from among the 100 entities of the knowledge graph as the candidate answer set. The candidate answer set can be a collection formed by summarizing concrete or abstract entities with a certain specific property, and the candidate archive set can be in the form of a knowledge graph subgraph or a database for storage, is not particularly limited, and is helpful for the electronic equipment to store the candidate answer set quickly and accurately.
The electronic equipment can also determine the correlation between each entity and the reference entity in the knowledge graph, can judge the degree of correlation between each entity and the reference entity based on the magnitude of the correlation, and constructs a candidate answer set based on the entity with each correlation larger than a preset correlation threshold. The manner in which the electronic device determines the correlation is various and is not particularly limited.
In one possible embodiment, the manner in which the electronic device determines the correlation between each entity in the knowledge-graph and the reference entity may be that the acquiring source of each entity in the knowledge-graph is determined, and the correlation between each entity in the knowledge-graph and the reference entity is determined according to the correspondence between the acquiring source and the correlation, where the acquiring source may include an official database, an authenticated agency database or an unauthenticated agency database, if each entity in the knowledge-graph is acquired from the official database, the correlation is determined to be a first correlation value, if each entity in the knowledge-graph is acquired from the authentication agency database, the correlation is determined to be a second correlation value, if each entity in the knowledge-graph is acquired from the unauthenticated agency database, the correlation is determined to be a third correlation value, and the first correlation value is greater than the second correlation value, and the second correlation value is greater than the third correlation value, where the official database may be a database corresponding to data of government agency public, if each entity in the knowledge-graph is acquired from the official database, and the authenticated agency public database may be a database corresponding to an authenticated agency database of the authority public certificate authority, and the database may be a user public database. The above manner can 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 correlation size is 0.9 when the entity a is acquired from the official database, determines that the correlation size is 0.7 when the entity a is acquired from the authentication mechanism database, and can determine that the entity a is a candidate answer entity set when the correlation threshold is preset to be 0.8.
S203, determining a target answer entity corresponding to the question entity from the candidate answer set.
Specifically, after the electronic device obtains the candidate answer set corresponding to the question entity from the knowledge graph based on the reference entity, the target answer entity corresponding to the question entity can be determined from the candidate answer set. The electronic device may calculate a confidence level between each candidate answer entity and the question entity, and determine the target answer entity according to the confidence level, where the confidence level may refer to an accuracy degree 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 coefficient of each candidate answer entity and the question entity. For example: the electronic device determines that the common times of the candidate answer entity a and the question entity a in the same text information are 80 times, the first times of the candidate answer entity a in the associated data are 100 times, the confidence coefficient of the candidate answer entity a and the question entity a is 0.8, the common times of the candidate answer entity b and the question entity a in the same text information are 180 times, the first times of the candidate answer entity b in the associated data are 200 times, the confidence coefficient of the candidate answer entity b and the question entity a is 0.9, and the electronic device can determine that the candidate answer entity b is a target answer entity corresponding to the question entity a.
In a possible embodiment, the electronic device may further calculate a confidence coefficient between each candidate answer entity and the question entity through a trained neural network, and a manner of determining the target answer entity corresponding to the question entity by the electronic device is not limited specifically. Compared with the prior art that answers to questions are directly queried through a knowledge graph, the problems that the complexity and the reasoning efficiency of the questions are inevitably faced by the fact-based question-answering task based on the knowledge graph are discovered and researched, most of the prior art cannot solve the problems well, the method and the device for inquiring the answers of the questions in the knowledge graph are used for generating a concise candidate answer set (such as a knowledge graph sub-graph, a evidence graph and the like) with high semantic relevance and fact coverage, and the fact-based question entity and the evidence graph are used as inputs of a neural network, and the evidence graph is used for reasoning to predict a target answer entity of the questions, so that reasoning accuracy and calculation efficiency can be effectively improved.
As can be seen from the foregoing, 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 entity among 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, the method and the device for determining the target answer entity by analyzing the question entity and the whole knowledge graph, the accuracy rate of question-answer reasoning and the calculation efficiency can be improved.
Referring to fig. 3, another interactive schematic diagram of a question-answer reasoning method is provided for an embodiment of the present application. The question-answer reasoning method may include the steps of:
s301, acquiring a problem statement text, and extracting a problem entity in the problem statement text.
Specifically, the electronic device may collect a question sentence text, extract a question entity in the question sentence text, and the question sentence text may refer to a representation form of a written language about a question, for example: the question sentence text may be audio data, text language data, or the like. Problem entity refers to the entity that appears in the problem, such as where is the birth place for the problem "Yao Ming? "the problem entity is judged to be < Yao Ming > by the character string of" Yao Ming ", and the problem entity is also the reasoning starting point in the subsequent reasoning flow. In theory, the number of the problem entities in one problem is not limited, and in the field of multi-hop question answering based on a knowledge graph, it is generally assumed that only one problem entity exists in one problem, and the number of the problem entities is not particularly limited in the application.
The electronic device may collect the text of the question sentence in the form of the audio data of which persons the director of the movie is in the adult of the user's adult, through a microphone and other devices, then the electronic device may identify the audio data as the text of the question sentence in the form of text, and finally the electronic device may perform word segmentation processing on the text of the question sentence through semantic analysis to obtain a plurality of word segments of "adult", "director" and "movie", and determine the question entity by identifying the part of speech type of each word segment, for example: the electronic device recognizes "adult" as a noun, "director" as a verb, etc., and determines that the problem entity includes "adult", "movie", and "director", etc. As shown in fig. 4, the user can directly input specific question sentence text such as "Yao Ming height" through controls such as a virtual keyboard, and the user can generate a corresponding question reasoning instruction by clicking a corresponding "reasoning" button, and then the electronic device processes a corresponding question reasoning 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, the reference entity corresponding to the question entity may be determined, where the reference entity is any one entity of a plurality of entities included in the knowledge graph, and is used for the electronic device to obtain the candidate answer set, and the number of reference entities corresponding to the question entity may be one or may be multiple. The electronic device may determine the reference entity to which the problem entity corresponds by pre-training an extraction model, for example: in the training process of the extraction model, the electronic device may set a pair of the problem entity and the reference entity, where the reference entity belongs to a reference entity set, and the reference entity set may be a set formed by all reference entities, input the pair of the manually marked problem entity and the reference entity into the extraction model to train model parameters, and then input the problem entity into the extraction model trained in advance in the prediction process, and output the reference entity corresponding to the problem entity. For example: the input problem entities are "science and health courses" and "teacher in class", so 1 first reference entity is "Zhang Sanu", then the electronic device can obtain 5 teachers from other teacher types which are "Zhang Sanu" with the first reference entity as second reference entities, and finally the electronic device obtains 6 reference entities.
In the embodiment of the present application, after the electronic device determines the reference entity corresponding to the question entity, the manner of obtaining, based on the reference entity, the candidate answer set corresponding to the question entity from the knowledge graph is various, which is not specifically limited in the embodiment of the present application, and in a possible embodiment, the electronic device may determine the candidate answer set by means of step S303, or may determine the candidate answer set by means 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 directly associated with the reference entity in the candidate answer set, 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", then may acquire neighboring entities of the reference entity from the knowledge-graph as "united states", "uk", and "japan", etc., and the electronic device may generate a candidate answer set based on the neighboring entities of the reference entity as "united states", "uk", and "japan" and the relationship between the neighboring entities. 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 between the reference entities.
S304, determining a connection path between the problem entity and the reference entity from the knowledge graph, and generating a candidate answer set based on the entity on the connection path.
Specifically, after the electronic device determines the reference entity corresponding to the problem entity through the pre-trained extraction model, connection paths between the problem entity and the reference entity may be determined from the knowledge graph, and the number of the connection paths may be one or more. For example: the electronic device determines that the reference entity is "china", the problem entity is "Yao Ming", then the electronic device determines that a connection path between the problem entity and the reference entity includes entities such as "Jiangsu", "Beijing", and "Shanghai", and the electronic device can generate a candidate answer set based on the entities such as "Jiangsu", "Beijing", and "Shanghai" on the connection path and the relationship between 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 to generate 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 relation features refer to features corresponding to a relation between any two candidate answer entities. After the electronic equipment generates the candidate answer set, initializing the candidate answer set and the question entity through a language model BERT to generate candidate entity characteristics, whole question characteristics, question entity characteristics and relation characteristics. The language model BERT may refer to a fine-tuning based multi-layer bi-directional encoder, where the bi-directional encoder is identical to the original encoder, which is a mechanism of attention that learns the context between words (or sub-words) in text. The features may refer to characteristics such as data corresponding to the entities, and may be represented in the form of vectors or arrays, which are not specifically limited in this application. For example: the electronic equipment determines that the question entities are Yao Ming and a work place, the candidate answer entities are Shanghai and Xuehui, and the relation between the two candidate answer entities is belonging, so that the electronic equipment can initialize each question entity to the characteristics of the question entities such as vectors [1,2,3] and [4,5,6], initialize the two question entities to the integral characteristics of the questions such as vectors [7,8,9], initialize the candidate answer entities to the characteristics of the whole questions such as vectors [2,4,6] and [1,3,5], and initialize the relation between any two candidate answer entities to the relation characteristics such as vectors [9,8,7] through a trained language model BERT.
In the embodiment of the present application, after generating the candidate entity feature, the overall question feature, the question entity feature, and the relationship feature, the electronic device may 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, where the predicted answer entity is a plurality of candidate answer entities whose relevance with the question entity exceeds a preset threshold. For example: the electronic device may obtain the candidate entity feature by performing simple four-rule algorithm calculation on the overall question feature, the question entity feature and the relation feature, and then determine that the candidate entity feature is the predicted answer entity.
The manner in which the electronic device screens the predicted answer entity from the candidate answer set is various, which is not specifically limited in the embodiments of the present application, and in a possible embodiment, the electronic device may screen the predicted answer entity in a manner of step S306:
s306, updating the candidate entity characteristics through a formula, and analyzing the updated candidate entity characteristics to determine corresponding predicted answer entities.
Specifically, after the electronic device generates the candidate entity features, the overall problem features, the problem entity features and the relationship features, the candidate entity features can be updated through a pre-trained neural network. For example: the electronic device may update the candidate entity signature by the following formula:
wherein v is q Representing a question entity, r representing a relationship between the two candidate answer entities, v i Representing the candidate answer entity, X q Representing a set of problem entities,representing candidate entity characteristics of the first layer, l representing the current layer number of the pre-trained neural network FFN (), l being a positive integer greater than 1, +.>Representing candidate entity features of layer 1, +.>Representing the overall problem characteristics of layer I, f (l) () Representing the connection characteristics between the question entities, relations and candidate answer entities of the first layer, Σ represents the cumulative summation.
The electronic device may initialize the generated candidate entity feature, the overall problem feature, the problem entity feature and the relationship feature as layer 1 feature data of the neural network, then layer 2 feature data may be calculated by layer 1 feature data, layer 3 feature data may be calculated by layer 2 feature data, etc., and the neural network transfers the message from the problem entity to the candidate entity by combining a plurality of feature data, in this way, the feature data of the candidate entity in the last layer may fuse a plurality of sources of higher-order information, which is helpful for the neural network to update the candidate entity feature simply and accurately. 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 the calculation of the neural network.
After the electronic device updates the candidate entity features through a formula, the updated candidate entity features may be parsed to determine a corresponding predicted answer entity, for example: the electronic equipment initially determines candidate answer entities including entities such as China, england, U.S. and Japan, and obtains updated candidate entity characteristics of 1,2,3,4,5 and 6, and the electronic equipment can analyze the corresponding entities as China and U.S. through a trained language model BERT reverse application.
In one possible embodiment, the connection characteristics between the question entities, the relations and the candidate answer entities are updated by the following formula:
wherein f (l) () Representing the connection characteristics between the question entities, relations and candidate answer entities of the first layer, FFN () represents a pre-trained neural network,question entity feature representing layer I, +.>Representing the relational features of the first layer, +.>And represents the correlation coefficient of the first layer, i represents the current layer number of the pre-trained neural network FFN (), and i is a positive integer greater than 1. For example: the electronic device determines that the correlation coefficient of the layer 2 is [1,2,3]The problem entity is characterized by [4,5,6]The relation features are [3,4,5 ] ]Calculated by a neural network to obtainThe connection to layer 2 is characterized by [9,8,7 ]]Etc.
In one possible embodiment, the correlation coefficient is calculated by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,representing the correlation coefficient of the first layer, sigmoid () represents a logistic regression function, ++>Indicating the overall problematic character of layer i +.>Representing the relational characteristics of the first layer, l represents the current layer number of the pre-trained neural network FFN (), l being a positive integer greater than 1. For example: the electronic device determines that the overall problem of layer 2 is characterized by [1,7,3 ]]The relation is characterized by [3,8,3 ]]The correlation coefficient of the layer 2 is obtained as [1,2,3 after the logistic regression function calculation]Etc.
In one possible embodiment, the problem entity characteristics are updated by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,question entity feature representing layer I, +.>Representing the problematic entity characteristics of layer 1, < ->Represents the firstThe overall problem characteristics of the layers, FFN (), represents the pre-trained neural network, l represents the current number of layers of the pre-trained neural network FFN (), and l is a positive integer greater than 1. For example: the electronic device determines that the layer 1 problem entity is characterized by [6,7,2]The overall problem of layer 2 is characterized by [7,2,6 ] ]The problem entity characteristics of the layer 2 obtained after the calculation of the neural network are [4,5,6 ]]Etc.
In one possible embodiment, the overall problem signature is updated by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,indicating the overall problematic character of layer i +.>Representing the overall problem characteristics of layer l-1, FFN () represents a pre-trained neural network, l represents the current number of layers of the pre-trained neural network FFN (), l being a positive integer greater than 1. For example: the electronic device determines that the overall problem of layer 1 is characterized by [3,6,8]The overall problem of layer 2 obtained after the calculation of the neural network is characterized by [7,2,6 ]]Etc.
In one possible embodiment, the relationship features are updated by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,representing the relational features of the first layer, +.>Representing the relational features of layer 1, FFN () represents a pre-trained neural netAnd (3) the current layer number of the pre-trained neural network FFN (), wherein l is a positive integer greater than 1. For example: the electronic device determines that the layer 1 relationship feature is [8,5,9 ]]The relationship characteristic of the layer 2 is [3,8,3 ] obtained after the calculation of the neural network]Etc.
In the embodiment of the present application, after the electronic device filters the predicted answer entity from the candidate answer set, the electronic device may determine the target answer entity based on the predicted answer entity, for example: the electronic device determines that the screening predicted answer entities include "china" and "united states", and the question answer entity is "Yao Ming", and then the electronic device may determine that the target answer entity is "china" by determining that the correlation between the characteristic of each screening predicted answer entity and the characteristic of the question answer entity is 0.9 and 0.8, respectively.
The manner in which the electronic device determines the target answer entity based on the predicted answer entity is various, which is not specifically limited in the embodiments of the present application, and in a possible embodiment, the electronic device may determine the target answer entity in a manner of steps S307-S308:
s307, likelihood estimation corresponding to each predicted answer entity is calculated.
Specifically, after the electronic device screens the predicted answer entities from the candidate answer set, likelihood estimates corresponding to the predicted answer entities may be calculated by the following formula:
wherein L is A Representing v t A corresponding likelihood estimate is provided for the user,representing the target answer entity as v t The label corresponding to the time, y () represents a label function, and the label is 0 or 1, v t Represents the t-th predicted answer entity, n represents the number of the predicted answer entities, t and n are integers greater than 1, and X q Representing a set of problem entities, p () representing a probability function, log () representing a log functionSigma represents the cumulative sum. For example: the electronic device determines that the predicted answer entities include "china" and "united states", and calculates corresponding likelihood estimates to be 0.85 and 0.6 respectively through formulas.
S308, determining maximum likelihood estimation, and determining a target answer entity based on the maximum likelihood estimation.
Specifically, after calculating likelihood estimates corresponding to each predicted answer entity, the electronic device may determine a target answer entity, for example: the electronic device determines that the predicted answers are "china" and "united states", and the corresponding likelihood estimates are 0.85 and 0.6, respectively, and then the electronic device determines that 0.85 is the maximum likelihood estimate and determines "china" as the target answer entity. As shown in fig. 7, a schematic diagram of a neural network structure may be represented, where the corresponding neural network may first input an existing knowledge graph and natural text (for example, but not limited to, "which concepts are covered by a lesson of John Guttag and Jing furng 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, and then may obtain a target answer entity through an answer search process, and in particular, may calculate a recursive function through image reasoning.
When the scheme of the embodiment of the application is executed, a question entity is acquired, a reference entity corresponding to the question entity is determined, a candidate answer set corresponding to the question entity is acquired 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 entity in the plurality of 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 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, the method and the device for determining the target answer entity by analyzing the question entity and the whole knowledge graph, the accuracy rate of question-answer reasoning and the calculation efficiency can be improved.
The following are device embodiments of the present application, which may be used to perform method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
Referring to fig. 8, a schematic structural diagram of a question-answer inference apparatus provided in an exemplary embodiment of the present application is shown, and is hereinafter referred to as inference apparatus 8. The inference means 8 may be implemented as all or part of the terminal by software, hardware or a combination of both. Comprising 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, based on the reference entity, a candidate answer set corresponding to the question entity from a knowledge graph; the knowledge graph at least comprises a plurality of entities and a relation between any two entities, the reference entity is any one entity among the plurality of 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, and the plurality of candidate answer entities are entities associated with the reference entity;
a second determining module 803, configured to determine a target answer entity corresponding to the question entity from the candidate answer set.
In one possible embodiment, the obtaining module 801 includes:
the collecting unit is used for collecting the statement text of the problem and extracting the problem entity in the statement text of the problem.
In one possible embodiment, the first determining module 802 includes:
the first determining unit is used for determining a reference entity corresponding to the problem entity through a pre-trained extraction model;
the first acquisition unit is used for acquiring the adjacent entity of the reference entity from the knowledge graph; wherein the neighboring entity is an entity in the candidate answer set directly associated with the reference entity;
and the first generation unit is used for generating a candidate answer set based on the adjacent entity.
In one possible embodiment, the first determining module 802 includes:
the second determining unit is used for determining a reference entity corresponding to the problem entity through a pre-trained extraction model;
a third determining unit, configured to determine a connection path between the problem entity and the reference entity from the knowledge graph;
and the second generation unit is used for generating a candidate answer set based on the entity on the connection path.
In one possible embodiment, the second determining module 803 includes:
The third generating unit is used for initializing the candidate answer set and the question entity through a language model BERT to generate candidate entity characteristics, integral question characteristics, question entity characteristics and relation characteristics; the candidate entity features are features corresponding to the candidate answer entities, the overall question features are features corresponding to all question entities, the question entity features are features corresponding to each question entity, and the relation features are features corresponding to the relation between any two candidate answer entities;
a screening unit, configured to screen 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; the predicted answer entities are a plurality of candidate answer entities with the relevance to the question entity exceeding a preset threshold;
and a fourth determining unit, configured to determine 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 by the following formula:
Wherein v is q Representing a question entity, r representing a relationship between the two candidate answer entities, v i Representing the candidate answer entity, X q Representing a set of problem entities,representing candidate entity characteristics of the first layer, l representing the current layer number of the pre-trained neural network FFN (), l being a positive integer greater than 1, +.>Representing candidate entity features of layer 1, +.>Representing the overall problem characteristics of layer I, f (l) () Representing connection characteristics between the question entities, the relations and the candidate answer entities of the first layer, wherein sigma represents cumulative summation;
and the analysis subunit is used for analyzing the updated candidate entity characteristics to determine corresponding predicted answer entities.
In one possible embodiment, the connection characteristics between the question entities, the relations and the candidate answer entities are updated by the following formula:
wherein f (l) () Representing the connection characteristics between the question entities, relations and candidate answer entities of the first layer, FFN () represents a pre-trained neural network,question entity feature representing layer I, +.>Representing the relational features of the first layer, +.>And represents the correlation coefficient of the first layer, i represents the current layer number of the pre-trained neural network FFN (), and i is a positive integer greater than 1.
In one possible embodiment, the correlation coefficient is calculated by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,representing the correlation coefficient of the first layer, sigmoid () represents a logistic regression function, ++>Indicating the overall problematic character of layer i +.>Representing the relational characteristics of the first layer, l represents the current layer number of the pre-trained neural network FFN (), l being a positive integer greater than 1.
In one possible embodiment, the problem entity characteristics are updated by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,question entity feature representing layer I, +.>Representing the problematic entity characteristics of layer 1, < ->Representing the overall problem characteristics of the first layer, FFN () represents a pre-trained neural network, l represents the current number of layers of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In one possible embodiment, the overall problem signature is updated by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,indicating the overall problematic character of layer i +.>Representing the overall problem characteristics of layer l-1, FFN () represents a pre-trained neural network, l represents the current number of layers of the pre-trained neural network FFN (), l being a positive integer greater than 1.
In one possible embodiment, the relationship features are updated by the following formula:
Wherein, the liquid crystal display device comprises a liquid crystal display device,representing the relational features of the first layer, +.>Representing the relational characteristics of the first-1 layer, 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 determining unit comprises:
a calculating subunit, configured to calculate likelihood estimates 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 is A Representing v t A corresponding likelihood estimate is provided for the user,representing the target answer entity as v t The label corresponding to the time, y () represents a label function, and the label is 0 or 1, v t Represents the t-th predicted answer entity, n represents the number of the predicted answer entities, t and n are integers greater than 1, and X q Representing the set of problem entities, p () represents the probability function, log () represents the log function, and Σ represents the cumulative summation.
The embodiments of the present application and the embodiments of the methods of fig. 2 to 3 are based on the same concept, and the technical effects brought by the embodiments are the same, and the specific process may refer to the description of the embodiments of the methods of fig. 2 to 3, which is not repeated here.
The device 8 may be a field-programmable gate array (FPGA) for implementing relevant functions, an application specific integrated chip, a system on chip (SoC), a central processing unit (central processor unit, CPU), a network processor (network processor, NP), a digital signal processing circuit, a microcontroller (micro controller unit, MCU), a programmable controller (programmable logic device, PLD) or other integrated chips.
When the scheme of the embodiment of the application is executed, a question entity is acquired, a reference entity corresponding to the question entity is determined, a candidate answer set corresponding to the question entity is acquired 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 entity in the plurality of 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 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, the method and the device for determining the target answer entity by analyzing the question entity and the whole knowledge graph, the accuracy rate of question-answer reasoning and the calculation efficiency can be improved.
The 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 adapted to be loaded by a processor and execute the steps of the method as described above, and a specific implementation process may refer to a specific description of the embodiment shown in fig. 2 or fig. 3, which is not described herein.
The present application also provides a computer program product storing at least one instruction that is loaded and executed by the processor to implement the template control method as described in the above embodiments.
Referring to fig. 9, a schematic structural diagram of an electronic device is provided in 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 employed to facilitate a coupled communication between the components.
The user interface 903 may include a Display screen (Display) and a Camera (Camera), and the optional user interface 903 may further 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.
Processor 901 may include one or more processing cores, among other things. The processor 901 connects various parts within the overall electronic device 900 using various interfaces and lines, and performs various functions of the electronic device 900 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 905, and invoking data stored in the memory 905. Alternatively, the processor 901 may be implemented in hardware in at least one of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA). The processor 901 may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing the content required to be displayed by the display screen; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 901 and may be implemented by a single chip.
The Memory 905 may include a random access Memory (Random Access Memory, RAM) or a Read-Only Memory (Read-Only Memory). Optionally, the memory 905 includes a non-transitory computer readable medium (non-transitory computer-readable storage 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 stored program area and a stored data area, wherein the stored program 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 respective method embodiments, etc.; the storage data area may store data or the like referred to in the above respective method embodiments. The memory 905 may also optionally be at least one storage device located remotely from the processor 901. As shown in fig. 9, an operating system, a network communication module, a user interface module, and a question-and-answer reasoning application may be included in the memory 905, which is a computer storage medium.
In the electronic device 900 shown in fig. 9, the user interface 903 is mainly used for providing an input interface for a user, and acquiring data input by the user; and processor 901 may be operable to invoke a question and answer reasoning application stored in memory 905 and to 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 entity among the plurality of 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, and the plurality of 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 one possible embodiment, when the processor 901 executes the acquiring a problem entity, specific execution is performed:
and acquiring a problem statement text, and extracting a problem entity in the problem statement text.
In a possible embodiment, when the processor 901 executes the determining the reference entity corresponding to the question entity and obtains, based on the reference entity, the candidate answer set corresponding to the question entity from the knowledge graph, the specific implementation is that:
Determining a reference entity corresponding to the problem entity through a pre-trained extraction model;
acquiring adjacent entities of the reference entity from the knowledge graph; wherein the neighboring entity is an entity in the candidate answer set directly associated with the reference entity;
a set of candidate answers is generated based on the neighboring entities.
In a possible embodiment, when the processor 901 executes the determining the reference entity corresponding to the question entity and obtains, based on the reference entity, the candidate answer set corresponding to the question entity from the knowledge graph, the specific implementation is that:
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;
and generating a candidate answer set based on the entity on the connection path.
In a possible embodiment, when the processor 901 executes the determining, from the candidate answer set, the target answer entity corresponding to the question entity, the specific execution is:
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 are features corresponding to the candidate answer entities, the overall question features are features corresponding to all question entities, the question entity features are features corresponding to each question entity, and the relation features are features corresponding to the relation between any two candidate answer entities;
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; the predicted answer entities are a plurality of candidate answer entities with the relevance to the question entity exceeding a preset threshold;
and determining a target answer entity based on the predicted answer entity.
In a possible embodiment, when the processor 901 performs the filtering of the predicted answer entity from the candidate answer set based on the candidate entity feature, the overall question feature, the question entity feature, and the relation feature, the specific implementation is:
updating the candidate entity characteristics by the following formula:
wherein v is q Representing a question entity, r representing a relationship between the two candidate answer entities, v i Representing the candidate answer entity, X q Representing a set of problem entities,representing candidate entity characteristics of the first layer, l representing the current layer number of the pre-trained neural network FFN (), l being a positive integer greater than 1, +.>Representing candidate entity features of layer 1, +.>Representing the overall problem characteristics of layer I, f (l) () Representing connection characteristics between the question entities, the relations and the candidate answer entities of the first layer, wherein sigma represents cumulative summation;
And analyzing the updated candidate entity characteristics to determine corresponding predicted answer entities.
In one possible embodiment, the connection characteristics between the question entities, the relations and the candidate answer entities are updated by the following formula:
wherein f (l) () Representing the connection characteristics between the question entities, relations and candidate answer entities of the first layer, FFN () represents a pre-trained neural network,question entity feature representing layer I, +.>Representing the relationship of the first layerCharacteristic(s)>And represents the correlation coefficient of the first layer, i represents the current layer number of the pre-trained neural network FFN (), and i is a positive integer greater than 1.
In one possible embodiment, the correlation coefficient is calculated by the following formula:
/>
wherein, the liquid crystal display device comprises a liquid crystal display device,representing the correlation coefficient of the first layer, sigmoid () represents a logistic regression function, ++>Indicating the overall problematic character of layer i +.>Representing the relational characteristics of the first layer, l represents the current layer number of the pre-trained neural network FFN (), l being a positive integer greater than 1.
In one possible embodiment, the problem entity characteristics are updated by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,question entity feature representing layer I, +.>Representing the problematic entity characteristics of layer 1, < - >Representing the overall problem characteristics of the first layer, FFN () represents a pre-trained neural network, l represents the current number of layers of the pre-trained neural network FFN (), and l is a positive integer greater than 1.
In one possible embodiment, the overall problem signature is updated by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,indicating the overall problematic character of layer i +.>Representing the overall problem characteristics of layer l-1, FFN () represents a pre-trained neural network, l represents the current number of layers of the pre-trained neural network FFN (), l being a positive integer greater than 1.
In one possible embodiment, the relationship features are updated by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,representing the relational features of the first layer, +.>Representing the relational characteristics of the first-1 layer, 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 processor 901 performs the determining a target answer entity based on the predicted answer entity, including:
calculating likelihood estimates 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 is A Representing v t A corresponding likelihood estimate is provided for the user,representing the target answer entity as v t The label corresponding to the time, y () represents a label function, and the label is 0 or 1, v t Represents the t-th predicted answer entity, n represents the number of the predicted answer entities, t and n are integers greater than 1, and X q Representing the set of problem entities, p () represents the probability function, log () represents the log function, and Σ represents the cumulative summation.
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 repeated here.
In the embodiment of the application, a question entity is acquired, a reference entity corresponding to the question entity is determined, a candidate answer set corresponding to the question entity is acquired 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 entity among the plurality of 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 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, the method and the device for determining the target answer entity by analyzing the question entity and the whole knowledge graph, the accuracy rate of question-answer reasoning and the calculation efficiency can be improved.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory, a random access memory, or the like.
The foregoing disclosure is only illustrative of the preferred embodiments of the present application and is not intended to limit the scope of the claims herein, as the equivalent of the claims herein shall be construed to fall within the scope of the claims herein.

Claims (9)

1. A question-answering 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 entity among the plurality of entities included in the knowledge graph, the candidate answer set comprises a plurality of candidate answer entities corresponding to the question entity and the relation between any two candidate answer entities, and the plurality of candidate answer entities are entities associated with the reference entity; the problem entity has a corresponding relation with the reference entity;
Determining a target answer entity corresponding to the question entity from the candidate answer set;
the determining the target answer entity corresponding to the question entity from the candidate answer set includes:
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 are features corresponding to the candidate answer entities, the overall question features are features corresponding to all question entities, the question entity features are features corresponding to each question entity, and the relation features are features corresponding to the relation between any two candidate answer entities;
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; the predicted answer entities are a plurality of candidate answer entities with the relevance to the question entity exceeding a preset threshold;
and determining a target answer entity based on the predicted answer entity.
2. The method of claim 1, wherein the determining the reference entity corresponding to the question entity, and obtaining the candidate answer set corresponding to the question entity from the knowledge-graph based on the reference entity, comprises:
Determining a reference entity corresponding to the problem entity through a pre-trained extraction model;
acquiring adjacent entities of the reference entity from the knowledge graph; wherein the neighboring entity is an entity in the candidate answer set 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 the reference entity corresponding to the question entity, and obtaining the candidate answer set corresponding to the question entity from the 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;
and generating a candidate answer set based on the entity on the connection path.
4. The method of claim 1, wherein the 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 comprises:
updating the candidate entity characteristics by the following formula:
Wherein v is q Representing a question entity, r representing a relationship between the two candidate answer entities, v i Representing the candidate answer entity, X q Representing a set of problem entities,representing candidate entity characteristics of the first layer, l representing the current layer number of the pre-trained neural network FFN (), l being a positive integer greater than 1, +.>Representing candidate entity features of layer 1, +.>Representing the overall problem characteristics of layer I, f (l) () Representing connection characteristics between the question entities, the relations and the candidate answer entities of the first layer, wherein sigma represents cumulative summation;
and analyzing the updated candidate entity characteristics to determine corresponding predicted answer entities.
5. The method of claim 1, wherein the determining a target answer entity based on the predicted answer entity comprises:
calculating likelihood estimates corresponding to each predicted answer entity;
determining a maximum likelihood estimate, and determining a target answer entity based on the maximum likelihood estimate.
6. The method of claim 5, wherein the likelihood estimates are calculated by the formula:
wherein L is A Representing v t A corresponding likelihood estimate is provided for the user,representing the target answer entity as v t The label corresponding to the time, y () represents a label function, and the label is 0 or 1, v t Represents the t-th predicted answer entity, n represents the number of the predicted answer entities, t and n are integers greater than 1, and X q Representing the set of problem entities, p () represents the probability function, log () represents the log function, and Σ represents the cumulative summation.
7. A question-answering reasoning apparatus, comprising:
the acquisition module is used for acquiring the problem entity;
the first determining module is used for 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 entity among the plurality of entities included in the knowledge graph, the candidate answer set comprises a plurality of candidate answer entities corresponding to the question entity and the relation between any two candidate answer entities, and the plurality of candidate answer entities are entities associated with the reference entity; the problem entity has a corresponding relation with the reference entity;
the second determining module is used for determining a target answer entity corresponding to the question entity from the candidate answer set;
The second determining module includes:
the third generating unit is used for initializing the candidate answer set and the question entity through a language model BERT to generate candidate entity characteristics, integral question characteristics, question entity characteristics and relation characteristics; the candidate entity features are features corresponding to the candidate answer entities, the overall question features are features corresponding to all question entities, the question entity features are features corresponding to each question entity, and the relation features are features corresponding to the relation between any two candidate answer entities;
a screening unit, configured to screen 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; the predicted answer entities are a plurality of candidate answer entities with the relevance to the question entity exceeding a preset threshold;
and a fourth determining unit, configured to determine a target answer entity based on the predicted answer entity.
8. A computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the method steps of any one of claims 1 to 6.
9. 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-6.
CN202110659490.6A 2021-06-15 2021-06-15 Question-answering reasoning method and device, storage medium and electronic equipment Active CN113392197B (en)

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 CN113392197A (en) 2021-09-14
CN113392197B true 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)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114817512B (en) * 2022-06-28 2023-03-14 清华大学 Question-answer reasoning method and device
CN116226478B (en) * 2022-12-27 2024-03-19 北京百度网讯科技有限公司 Information processing method, model training method, device, equipment and storage medium
CN116955560B (en) * 2023-07-21 2024-01-05 广州拓尔思大数据有限公司 Data processing method and system based on thinking chain and knowledge graph

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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

Family Cites Families (2)

* Cited by examiner, † Cited by third party
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
US11521078B2 (en) * 2019-07-10 2022-12-06 International Business Machines Corporation Leveraging entity relations to discover answers using a knowledge graph

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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 (1)

* Cited by examiner, † Cited by third party
Title
基于知识图谱的事实型问答算法研究;杨霞;《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》;20220115(第01期);I138-3338 *

Also Published As

Publication number Publication date
CN113392197A (en) 2021-09-14

Similar Documents

Publication Publication Date Title
CN110837550B (en) Knowledge graph-based question answering method and device, electronic equipment and storage medium
CN113392197B (en) Question-answering reasoning method and device, storage medium and electronic equipment
CN111209384B (en) Question-answer data processing method and device based on artificial intelligence and electronic equipment
US8909653B1 (en) Apparatus, systems and methods for interactive dissemination of knowledge
CN112966712A (en) Language model training method and device, electronic equipment and computer readable medium
CN112149400B (en) Data processing method, device, equipment and storage medium
US11687716B2 (en) Machine-learning techniques for augmenting electronic documents with data-verification indicators
CN109739995B (en) Information processing method and device
US20180102062A1 (en) Learning Map Methods and Systems
WO2020073533A1 (en) Automatic question answering method and device
CN111666416B (en) Method and device for generating semantic matching model
US20230080230A1 (en) Method for generating federated learning model
CN111738010B (en) Method and device for generating semantic matching model
CN113707299A (en) Auxiliary diagnosis method and device based on inquiry session and computer equipment
CN113628059A (en) Associated user identification method and device based on multilayer graph attention network
US20230013796A1 (en) Method and apparatus for acquiring pre-trained model, electronic device and storage medium
CN117149989A (en) Training method for large language model, text processing method and device
CN115114421A (en) Question-answer model training method
CN109858024B (en) Word2 vec-based room source word vector training method and device
CN110717019A (en) Question-answering processing method, question-answering system, electronic device and medium
CN116821373A (en) Map-based prompt recommendation method, device, equipment and medium
WO2023040516A1 (en) Event integration method and apparatus, and electronic device, computer-readable storage medium and computer program product
CN112861474B (en) Information labeling method, device, equipment and computer readable storage medium
CN113407806B (en) Network structure searching method, device, equipment and computer readable storage medium
JP2022088540A (en) Method for generating user interest image, device, electronic apparatus and 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