CN111930906A - Knowledge graph question-answering method and device based on semantic block - Google Patents
Knowledge graph question-answering method and device based on semantic block Download PDFInfo
- Publication number
- CN111930906A CN111930906A CN202010745796.9A CN202010745796A CN111930906A CN 111930906 A CN111930906 A CN 111930906A CN 202010745796 A CN202010745796 A CN 202010745796A CN 111930906 A CN111930906 A CN 111930906A
- Authority
- CN
- China
- Prior art keywords
- semantic
- question
- graph
- knowledge
- generating
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation or dialogue systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
- G06F16/367—Ontology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/237—Lexical tools
- G06F40/242—Dictionaries
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- Artificial Intelligence (AREA)
- Databases & Information Systems (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Data Mining & Analysis (AREA)
- General Health & Medical Sciences (AREA)
- Mathematical Physics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Human Computer Interaction (AREA)
- Machine Translation (AREA)
Abstract
The invention relates to a knowledge graph question-answering method and a knowledge graph question-answering device based on semantic blocks, wherein a question sentence is obtained, and a context dictionary is generated through a preset knowledge graph; inputting the context dictionary into a pre-trained graph neural network model, generating a semantic block sequence, and constructing a semantic query graph according to the semantic block sequence; and analyzing the semantic query graph according to the knowledge graph, and outputting a result. The invention effectively solves the challenges of implicit entities and relations and improves the semantic analysis effect by constructing the context dictionary of the question sentence and attaching the context dictionary to the graph neural network. The logical form of the question is generated through the constructed semantic query graph, and the answer can be quickly searched in the knowledge base. By combining the accuracy based on rules and the coverage based on deep learning and improving the constraint conditions and the multi-intention combination in the question through constructing the form of the semantic block, the analysis of the question semantic block is independent of the logical form of question and answer output, and the method has strong adaptability.
Description
Technical Field
The invention belongs to the technical field of languages, and particularly relates to a knowledge graph question-answering method and device based on semantic blocks.
Background
The semantic analysis has the function of enabling a computer to solve semantic information in natural language and is used for matching corresponding semantic types in a knowledge base. In the study of natural language question answering based on knowledge graph, semantic parsing is a very important step, and more accurate semantic understanding enables a computer to identify the intention of a question and return corresponding answers. With the widespread use of neural networks and knowledge graphs, natural language questions and answers based on knowledge graphs have been studied in depth.
The knowledge-graph question-answering needs to calculate the semantic information of the mechanism solution natural language, and the core of the knowledge-graph question-answering lies in the comprehension and similarity calculation of question semantics and knowledge semantics. In recent years, with the rapid development of deep learning in the field of natural language processing and the good performance of deep learning on the question-answering task, the improvement of knowledge map-oriented question answering by using a deep neural network becomes a main direction of research. Most of the current question and answer scenes are established according to the field, and compared with the general question and answer scenes, the accuracy of the question and answer can be improved by focusing on the field.
Domain knowledge graph questions and answers are generally performed around domain related questions, and the understanding of the questions can be divided into three subtasks: entity links, relationship recognition, and logical and numerical operation related constraint identification. There are also several analytical problems in the existing knowledge-graph questions and answers:
1. implicit entities and relations, the field question-answering scene is relatively fixed, some entities and relations can be omitted when the question-answering is carried out, and the default is that the entities and relations are context information in the field.
2. The constraint conditions, namely a great amount of time, sequencing, aggregation and other constraint conditions exist in the knowledge graph, and difficulty is caused to semantic understanding of the question.
3. The problem is generally formed by combining a plurality of intentions, each intention represents a limitation on an expected result, question and answer intentions in a specific field are concentrated, complex problem intentions are realized by different combination modes, and how to realize semantic analysis by splitting intentions is also a big problem.
Disclosure of Invention
In view of the above, the present invention provides a knowledge-graph question-answering method and apparatus based on semantic blocks to solve the problem of semantic parsing in the prior art.
In order to achieve the purpose, the invention adopts the following technical scheme: a knowledge graph question-answering method based on semantic blocks comprises the following steps:
acquiring a question and generating a context dictionary through a preset knowledge graph;
inputting the context dictionary into a pre-trained graph neural network model to generate a semantic block sequence, and constructing a semantic query graph according to the semantic block sequence;
and analyzing the semantic query graph according to the knowledge graph and outputting a result.
Further, the generating the context dictionary through the preset knowledge graph further includes: preprocessing the question;
the method for preprocessing the question sentence comprises the following steps:
converting all words in the question into corresponding semantic words by adopting WordNet;
based on an entity linking method, obtaining a candidate entity category set in the question and acquiring an entity;
processing the entity to obtain the relationship among the elements in the candidate entity category;
a set of relationships between elements in the candidate entity category is established.
Further, the generating the context dictionary through the preset knowledge graph includes:
obtaining candidate entity categories associated with the question through the question;
and obtaining a relation set between the relation set and elements in the candidate entity category through a knowledge graph to obtain a problem representation with context information.
Further, encoding the input context dictionary into vector representation by using a graph encoder;
and generating the vector representation into a semantic block sequence by adopting a sequence decoder.
Further, the picture encoder includes:
a node embedding layer for generating a node vector; wherein the node comprises: a dictionary formed by words in the question and a candidate entity category dictionary;
and the graph embedding layer is used for generating the vector representation of the question graph in a max-posing mode.
Further, the sequence decoder employs:
the bidirectional RNN model generates a semantic block every time of iteration and finally forms a semantic block sequence.
Further, the sequence decoder includes:
and the semantic block decoding controller is used for predicting the content of each semantic block in the semantic block sequence, wherein each semantic block comprises a name, an entity type and an input parameter, matching the parameter types in the generated semantic blocks with the output types of the obtained semantic blocks by adopting Beam search to obtain the semantic blocks which can be matched to determine the output of the sequence at the current moment.
Further, the semantic block includes the following patterns:
entity schema, relationship schema, attribute schema, sort schema, aggregation schema, collection schema.
The embodiment of the application provides a knowledge-graph question-answering device based on semantic blocks, which comprises:
the acquisition module is used for acquiring the question and generating a context dictionary through a preset knowledge graph;
the generating module is used for inputting the context dictionary into a pre-trained graph neural network model, generating a semantic block sequence and constructing a semantic query graph according to the semantic block sequence;
and the output module is used for analyzing the semantic query graph according to the knowledge graph and outputting a result.
Further, the generating the context dictionary through the preset knowledge graph further includes:
the preprocessing module is used for preprocessing the question;
the method for preprocessing the question sentence comprises the following steps:
converting all words in the question into corresponding semantic words by adopting WordNet;
based on an entity linking method, obtaining a candidate entity category set in the question and acquiring an entity;
processing the entity to obtain the relationship among the elements in the candidate entity category;
a set of relationships between elements in the candidate entity category is established.
By adopting the technical scheme, the invention can achieve the following beneficial effects:
the invention provides a knowledge graph question-answering method based on semantic blocks, which comprises the steps of obtaining a question and generating a context dictionary through a preset knowledge graph; inputting the context dictionary into a pre-trained graph neural network model, generating a semantic block sequence, and constructing a semantic query graph according to the semantic block sequence; and analyzing the semantic query graph according to the knowledge graph, and outputting a result. The invention is suitable for natural language question answering and retrieval in natural language processing. Compared with the traditional semantic method, the method and the device have the advantages that semantic parsing of the question is modeled into a coder-decoder task from a graph to a sequence, constraint conditions and multi-purpose combinations in the question are improved by constructing a semantic block form, so that parsing of the question semantic block is independent of a logical form of question and answer output, and the method and the device have strong adaptability.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram of the steps of the semantic block-based knowledge-graph question-answering method of the present invention;
FIG. 2 is a schematic flow chart of the knowledge-graph question-answering method based on semantic blocks according to the present invention;
FIG. 3 is another schematic flow chart of the semantic block-based knowledge-graph question-answering method according to the present invention;
FIG. 4 is another schematic flow chart diagram of the knowledge-graph question-answering method based on semantic blocks according to the present invention;
FIG. 5 is a schematic structural diagram of a knowledge-graph question-answering device based on semantic blocks according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
A specific knowledge-graph question-answering method based on semantic blocks provided in the embodiments of the present application is described below with reference to the accompanying drawings.
As shown in fig. 1, the method for knowledge-graph question-answering based on semantic blocks provided in the embodiment of the present application includes:
s101, obtaining a question and generating a context dictionary through a preset knowledge graph;
firstly, a knowledge map is preset, a question is obtained, the question can be Chinese or English, and a context dictionary of the question is generated by means of the knowledge map.
S102, inputting the context dictionary into a pre-trained graph neural network model, generating a semantic block sequence, and constructing a semantic query graph according to the semantic block sequence;
and inputting the context dictionary into the graph neural network as additional information, and obtaining the output of the network to generate a semantic block sequence representing the problem intention so as to construct a semantic query graph.
S103, analyzing the semantic query graph according to the knowledge graph, and outputting a result.
And analyzing the semantic query graph according to the content in the knowledge graph to obtain answers of the question and output the answers.
The working principle of the knowledge-graph question-answering method based on the semantic block is as follows: the semantic parsing of the question is completed through semantic fast sequence generation. First, the complex semantics in the problem are split into sequences consisting of a number of semantic blocks representing the smallest semantics, each semantic block corresponding to a single-step query or inference on the knowledge-graph, for example, in the problem "how many topics do rhode island have? "comprises three semantic blocks: the method comprises the following steps that firstly, the count of the global is positioned at the global of a certain state, and the id is the state of the rhode island, three semantic blocks respectively describe the part of the problem intention, and the complex problem is generally described by a sequence formed by a plurality of semantic blocks. Then, the semantic blocks are assembled based on the structural information of the generated semantic blocks to form the complete intention of the problem, so that the result of semantic analysis is obtained. For example, the state in the semantic block (II) can be replaced by the entity set represented by (III), and then replaced to the global of (I), so as to obtain the result of analysis. The invention provides six semantic block modes for guiding the analysis of problem semantic blocks, and simultaneously trains an end-to-end graph neural network model for realizing the process from inputting a problem to generating a semantic block sequence.
Referring to FIG. 2, for the problem "what are the major cities in the small state in the US? The natural language question sentence generates a context dictionary based on a knowledge graph, then is input into a neural network model to generate a semantic block sequence, and then a semantic query graph is constructed. The semantic query graph analyzes the answers of the question through the knowledge graph.
In some embodiments, the semantic block comprises the following patterns:
entity schema, relationship schema, attribute schema, sort schema, aggregation schema, collection schema.
The method defines the following semantic block mode for tableProblem representation intention (wherein PtRepresenting a schema P of type t, t being the element type in the entity set represented by the semantic block for this schema):
entity mode: representing a set of entities of a specified type, e.g., (city) representing all cities, (country, id, 'us') representing country with id us;
entity={(t,attr,value):t∈T,attr∈Rl}
relation mode: denotes the slave type as t2The right entities of (1) are a left entity set with the type t obtained by reasoning the relation r, for example, (state, loc, { country }) indicates that there is a loc relation with a specified county, and the like:
relationt={(t,p,e:e∈t2):p∈Re,(t1,t2)∈T}
attribute mode: represents the result of calculating the entity attribute whose Object is of the live type in the SPO triple, e.g., (len, { river });
literalt={(p,{e:e∈t}):p∈Rl,t∈T}
sequencing mode: the entity that is ordered to obtain the designated location, for example, (highest, { place }, (larget, { city }):
ordinalt={(ord,{e:e∈t}):ord∈{max,min},t∈T}
polymerization mode: a single value representing the number of computations on the set of entities specified by the input, e.g. (count, { city }):
aggrn,n∈R={(aggr,{e:e∈t}:name∈{count,average},t∈T)}
an aggregation mode: representing the two or more entity sets input, calculating the specified operation of the sets such as intersection and union entity sets:
jointJOIN ∈ { interaction, unity, exception }, and T ∈ T } as shown in FIG. 3, circles represent answers, rounded rectangles represent entity types in the knowledge-graph, solid arrows represent relationships between entities, and diamonds represent constraints applied to entities. Given a question, the generation of its query can be seen as identifying one by oneThe semantic blocks are spliced to the existing semantic graph. The dashed rectangle in FIG. two demonstrates the process of forming a semantic representation of a problem by semantic blocks.
In some embodiments, the generating the context dictionary through the preset knowledge graph further includes: preprocessing the question;
the method for preprocessing the question sentence comprises the following steps:
converting all words in the question into corresponding semantic words by adopting WordNet;
based on an entity linking method, obtaining a candidate entity category set in the question and acquiring an entity;
processing the entity to obtain the relationship among the elements in the candidate entity category;
a set of relationships between elements in the candidate entity category is established.
Specifically, the problem preprocessing comprises the following four parts for constructing the context of the problem:
problem this semantics: all words in the question X are converted into corresponding semantic words by using WordNet, so that words of various forms can correspond to the same semantic meaning, for example, city and cities are converted and output to citi.
Candidate categories: through the entity linking tool, given an input X, a set T of its relevant categories in a particular domain can be derivedinAnd identifying the entity therein to perform the following processing: knowledge graph entities: for entities that can be linked to a knowledge-graph, the entities are replaced with types in the corresponding knowledge-graph, while at RinAn element is added to identify the isA relationship between them; II, knowledge map type: adding identified knowledge-graph types directly to TinAnd establishing an isA relationship.
Candidate relationship: based on the candidate entity category T obtained in the last stepinFinding out possible relations among categories in the knowledge graph, and establishing a relation set RinAnd simultaneously, the relationship established in the previous step is kept.
The problem with context is converted into a graph: pressing the word in XSequentially creating an unlabeled edge with subsequent words, adding to RinAnd forming a graph form after preprocessing as the input of a graph neural network.
In some embodiments, the generating the context dictionary through the preset knowledge graph includes:
obtaining candidate entity categories associated with the question through the question;
and obtaining a relation set between the relation set and elements in the candidate entity category through a knowledge graph to obtain a problem representation with context information.
The semantic analysis framework of the application is based on the domain knowledge map, and learns the semantic analysis model according to the input natural language question and the corresponding semantic query graph to complete question intention analysis. Given a question X, generating a context dictionary X ^ C of the question by means of a knowledge graph $ G and inputting the context dictionary X ^ C into a pre-trained graph neural network model to obtain a corresponding semantic block sequence Y, namely a semantic query graph corresponding to the question, and using Y, an answer can be obtained by directly matching on the knowledge graph, and the answer can also be obtained by converting the Y into a corresponding logical form for reasoning. Therefore, semantic parsing of the problem is mainly divided into two steps: problem context dictionary construction and semantic block sequence generation.
Problem context dictionary construction: using X and G, the class Tin of the candidate entity associated with X can be obtained, and based on G, the relationship Rin between elements in Tq can be obtained, so that the problem representation Xc ═ { X, Tin, Rin } with context information is obtained as the input of the G2S model.
In some embodiments, a graph encoder is employed to encode an input context dictionary into a vector representation;
and generating the vector representation into a semantic block sequence by adopting a sequence decoder.
Specifically, the semantic block sequence is generated: using an encoder-decoder network, an input problem X can be mappedCResolving into a sequence Y of semantic blocks, we need: a graph encoder for inputting XCEncoding into a vector representation; ② a decoder for generating Y under the condition of coding vector.
In some embodiments, the graph encoder comprises:
a node embedding layer for generating a node vector; wherein the node comprises: a dictionary formed by words in the question and a candidate entity category dictionary;
and the graph embedding layer is used for generating the vector representation of the question graph in a max-posing mode.
Specifically, the node vector: the nodes include two classes, one is a dictionary V composed of words appearing in the questionqThe method uses random vector initialization. The other is a candidate entity category dictionary T connected by question sentencesinThis dictionary consists of elements in the category $ T $ in the knowledge base, initialized with random vectors.
And (3) edge vector: the edges after question embedding are of two types, one type is provided with labels, the labels of the edges correspond to R in the knowledge graph, the other type is the edges without labels, and the method initializes the edges by using a random vector shared by the R.
Node embedding layer: the method adopts the method that the vector representation of the node is generated in the node embedding generation process, and the vector representation h of the nodej vInformation composition including K-th order neighbor node, one is the neighbor node h to which the node pointsj v1-Another class is to point to the neighbor node h of the nodej v-1。
hj v=[hj v-1,hj v1-]
Graph embedding layer: and forming a vector representation of the whole problem map by adopting a map embedding mode based on Polling, wherein the method adopts a max-posing mode.
In some embodiments, the sequence decoder employs:
the bidirectional RNN model generates a semantic block every time of iteration and finally forms a semantic block sequence.
The sequence decoder includes:
and the semantic block decoding controller is used for predicting the content of each semantic block in the semantic block sequence, wherein each semantic block comprises a name, an entity type and an input parameter, matching the parameter types in the generated semantic blocks with the output types of the obtained semantic blocks by adopting Beam search to obtain the semantic blocks which can be matched to determine the output of the sequence at the current moment.
The method adopts a standard sequence decoder to decode the semantic block sequence. The decoder is a bidirectional RNN model, generates a semantic block in each iteration, and finally forms a sequence Y of the semantic block. In step j, the hidden state S according to this stepjY for this stepjAt the same time, updating S of the current stepjAnd y of the prediction outputjFor input, the hidden state S of the next step is updatedj+1。
Wherein c isjFor the attention context, [ phi ]y(yj) Is the embedding of semantic blocks.
Embedding semantic blocks: the decoding process requires the embedding of each semantic block described in the semantic block pattern. The semantic block is composed of two parts of name and parameter: the name represents and the type is the structure of the semantic block, and other parameters represent the semantics of the semantic block, for example, the structure information of the semantic block relation (city, loc: state) is relation (city), and the semantic information thereof is (loc: state). And respectively embedding the structure and semantic information of the semantic block to simplify parameter information, so that the structure or semantic part information of the parameter can be shared among different semantic block modes. Except that the entity mode is related to the instances E and I, other semantic blocks are only related to the type T and the relationship type R of the entity, a semantic block space is obtained based on a knowledge graph, and a random vector is used for representing the structure and the semantic part of each semantic block.
Semantic block decoding controller: and predicting the content of each semantic block in the semantic block sequence Y, wherein each semantic block comprises three parts, namely a name p, an entity type t and an input parameter i. When Beam searching is used, the parameter types i which can be accepted in the generated semantic blocks are combined, and the output types t of the semantic blocks obtained at the time are matched in a time line mode to obtain the semantic blocks which can be matched to determine the output of the sequence at the current time.
A node attention mechanism is also employed in this application to context CiIn relation to all node representations in the graph, the calculation formula is as follows:
eij=a(si-1,hj);
the network architecture diagram is shown in fig. 4.
As shown in fig. 5, the present application provides a knowledge-graph question-answering device based on semantic blocks, comprising:
an obtaining module 501, configured to obtain a question and generate a context dictionary through a preset knowledge graph;
a generating module 502, configured to input the context dictionary into a pre-trained graph neural network model, generate a semantic block sequence, and construct a semantic query graph according to the semantic block sequence;
and the output module 503 is configured to analyze the semantic query graph according to the knowledge graph, and output a result.
The working principle of the knowledge-graph question-answering device based on the semantic block is that the acquisition module acquires a question and generates a context dictionary through a preset knowledge graph; the generation module inputs the context dictionary into a pre-trained graph neural network model to generate a semantic block sequence, and a semantic query graph is constructed according to the semantic block sequence; and the output module analyzes the semantic query graph according to the knowledge graph and outputs a result.
In some embodiments, the generating the context dictionary through the preset knowledge graph further includes:
the preprocessing module is used for preprocessing the question;
the method for preprocessing the question sentence comprises the following steps:
converting all words in the question into corresponding semantic words by adopting WordNet;
based on an entity linking method, obtaining a candidate entity category set in the question and acquiring an entity;
processing the entity to obtain the relationship among the elements in the candidate entity category;
a set of relationships between elements in the candidate entity category is established.
The embodiment of the application provides computer equipment, which comprises a processor and a memory connected with the processor;
the memory is used for storing a computer program, and the computer program is used for executing the knowledge-graph question-answering method based on the semantic block provided by any one of the embodiments;
the processor is used to call and execute the computer program in the memory.
In summary, the present invention provides a knowledge graph question-answering method and apparatus based on semantic blocks, including obtaining a question, and generating a context dictionary through a preset knowledge graph; inputting the context dictionary into a pre-trained graph neural network model, generating a semantic block sequence, and constructing a semantic query graph according to the semantic block sequence; and analyzing the semantic query graph according to the knowledge graph, and outputting a result. The invention effectively solves the challenges of implicit entities and relations and improves the semantic analysis effect by constructing the context dictionary of the question sentence and attaching the context dictionary to the graph neural network. The logical form of the question is generated through the constructed semantic query graph, and the answer can be quickly searched in the knowledge base. By combining the accuracy based on rules and the coverage based on deep learning and improving the constraint conditions and the multi-intention combination in the question through constructing the form of the semantic block, the analysis of the question semantic block is independent of the logical form of question and answer output, and the method has strong adaptability.
It is to be understood that the embodiments of the method provided above correspond to the embodiments of the apparatus described above, and the corresponding specific contents may be referred to each other, which is not described herein again.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.
Claims (10)
1. A knowledge graph question-answering method based on semantic blocks is characterized by comprising the following steps:
acquiring a question and generating a context dictionary through a preset knowledge graph;
inputting the context dictionary into a pre-trained graph neural network model to generate a semantic block sequence, and constructing a semantic query graph according to the semantic block sequence;
and analyzing the semantic query graph according to the knowledge graph and outputting a result.
2. The method of claim 1, wherein generating the context dictionary from the predetermined knowledge-graph further comprises: preprocessing the question;
the method for preprocessing the question sentence comprises the following steps:
converting all words in the question into corresponding semantic words by adopting WordNet;
based on an entity linking method, obtaining a candidate entity category set in the question and acquiring an entity;
processing the entity to obtain the relationship among the elements in the candidate entity category;
a set of relationships between elements in the candidate entity category is established.
3. The method of claim 2, wherein generating the context dictionary from the predetermined knowledge-graph comprises:
obtaining candidate entity categories associated with the question through the question;
and obtaining a relation set between the relation set and elements in the candidate entity category through a knowledge graph to obtain a problem representation with context information.
4. The method of claim 3,
encoding an input context dictionary into a vector representation using a graph encoder;
and generating the vector representation into a semantic block sequence by adopting a sequence decoder.
5. The method of claim 4, wherein the graph encoder comprises:
a node embedding layer for generating a node vector; wherein the node comprises: a dictionary formed by words in the question and a candidate entity category dictionary;
and the graph embedding layer is used for generating the vector representation of the question graph in a max-posing mode.
6. The method of claim 4, wherein the sequence decoder employs:
the bidirectional RNN model generates a semantic block every time of iteration and finally forms a semantic block sequence.
7. The method of claim 4, wherein the sequence decoder comprises:
and the semantic block decoding controller is used for predicting the content of each semantic block in the semantic block sequence, wherein each semantic block comprises a name, an entity type and an input parameter, matching the parameter types in the generated semantic blocks with the output types of the obtained semantic blocks by adopting Beam search to obtain the semantic blocks which can be matched to determine the output of the sequence at the current moment.
8. The method according to any one of claims 1 to 7, wherein the semantic block comprises the following patterns:
entity schema, relationship schema, attribute schema, sort schema, aggregation schema, collection schema.
9. A knowledge-graph question-answering device based on semantic blocks is characterized by comprising the following components:
the acquisition module is used for acquiring the question and generating a context dictionary through a preset knowledge graph;
the generating module is used for inputting the context dictionary into a pre-trained graph neural network model, generating a semantic block sequence and constructing a semantic query graph according to the semantic block sequence;
and the output module is used for analyzing the semantic query graph according to the knowledge graph and outputting a result.
10. The apparatus of claim 9, wherein the generating a context dictionary from a preset knowledge graph further comprises:
the preprocessing module is used for preprocessing the question;
the method for preprocessing the question sentence comprises the following steps:
converting all words in the question into corresponding semantic words by adopting WordNet;
based on an entity linking method, obtaining a candidate entity category set in the question and acquiring an entity;
processing the entity to obtain the relationship among the elements in the candidate entity category;
a set of relationships between elements in the candidate entity category is established.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010745796.9A CN111930906A (en) | 2020-07-29 | 2020-07-29 | Knowledge graph question-answering method and device based on semantic block |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010745796.9A CN111930906A (en) | 2020-07-29 | 2020-07-29 | Knowledge graph question-answering method and device based on semantic block |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111930906A true CN111930906A (en) | 2020-11-13 |
Family
ID=73315138
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010745796.9A Pending CN111930906A (en) | 2020-07-29 | 2020-07-29 | Knowledge graph question-answering method and device based on semantic block |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111930906A (en) |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112650846A (en) * | 2021-01-13 | 2021-04-13 | 北京智通云联科技有限公司 | Question-answer intention knowledge base construction system and method based on question frame |
CN112765312A (en) * | 2020-12-31 | 2021-05-07 | 湖南大学 | Knowledge graph question-answering method and system based on graph neural network embedding matching |
CN112784590A (en) * | 2021-02-01 | 2021-05-11 | 北京金山数字娱乐科技有限公司 | Text processing method and device |
CN112800778A (en) * | 2021-02-07 | 2021-05-14 | 北京智通云联科技有限公司 | Intention identification method and system based on word string length and storage medium |
CN112989004A (en) * | 2021-04-09 | 2021-06-18 | 苏州爱语认知智能科技有限公司 | Query graph ordering method and system for knowledge graph question answering |
CN113268574A (en) * | 2021-05-25 | 2021-08-17 | 山东交通学院 | Graph volume network knowledge base question-answering method and system based on dependency structure |
CN113779360A (en) * | 2021-08-18 | 2021-12-10 | 深圳技术大学 | Multi-head question-answering model-based question solving method, device, equipment and storage medium |
CN113947084A (en) * | 2021-09-24 | 2022-01-18 | 盛景智能科技(嘉兴)有限公司 | Question-answer knowledge retrieval method, device and equipment based on graph embedding |
CN114065770A (en) * | 2022-01-17 | 2022-02-18 | 江苏联著实业股份有限公司 | Method and system for constructing semantic knowledge base based on graph neural network |
CN114077692A (en) * | 2021-11-04 | 2022-02-22 | 北京工业大学 | Fine-grained tool recommendation method and device based on interaction task knowledge graph |
CN114281959A (en) * | 2021-10-27 | 2022-04-05 | 腾讯科技(深圳)有限公司 | Statement processing method, statement processing device, statement processing equipment, statement processing medium and computer program product |
CN114547273A (en) * | 2022-03-18 | 2022-05-27 | 科大讯飞(苏州)科技有限公司 | Question answering method and related device, electronic equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160379120A1 (en) * | 2015-06-25 | 2016-12-29 | International Business Machines Corporation | Knowledge Canvassing Using a Knowledge Graph and a Question and Answer System |
CN108447534A (en) * | 2018-05-18 | 2018-08-24 | 灵玖中科软件(北京)有限公司 | A kind of electronic health record data quality management method based on NLP |
US20190179917A1 (en) * | 2017-12-08 | 2019-06-13 | Apple Inc. | Geographical knowledge graph |
CN110162637A (en) * | 2019-02-14 | 2019-08-23 | 腾讯科技(深圳)有限公司 | Information Atlas construction method, device and equipment |
CN110377715A (en) * | 2019-07-23 | 2019-10-25 | 天津汇智星源信息技术有限公司 | Reasoning type accurate intelligent answering method based on legal knowledge map |
-
2020
- 2020-07-29 CN CN202010745796.9A patent/CN111930906A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160379120A1 (en) * | 2015-06-25 | 2016-12-29 | International Business Machines Corporation | Knowledge Canvassing Using a Knowledge Graph and a Question and Answer System |
US20190179917A1 (en) * | 2017-12-08 | 2019-06-13 | Apple Inc. | Geographical knowledge graph |
CN108447534A (en) * | 2018-05-18 | 2018-08-24 | 灵玖中科软件(北京)有限公司 | A kind of electronic health record data quality management method based on NLP |
CN110162637A (en) * | 2019-02-14 | 2019-08-23 | 腾讯科技(深圳)有限公司 | Information Atlas construction method, device and equipment |
CN110377715A (en) * | 2019-07-23 | 2019-10-25 | 天津汇智星源信息技术有限公司 | Reasoning type accurate intelligent answering method based on legal knowledge map |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112765312A (en) * | 2020-12-31 | 2021-05-07 | 湖南大学 | Knowledge graph question-answering method and system based on graph neural network embedding matching |
CN112650846A (en) * | 2021-01-13 | 2021-04-13 | 北京智通云联科技有限公司 | Question-answer intention knowledge base construction system and method based on question frame |
CN112784590A (en) * | 2021-02-01 | 2021-05-11 | 北京金山数字娱乐科技有限公司 | Text processing method and device |
CN112800778B (en) * | 2021-02-07 | 2023-07-18 | 北京智通云联科技有限公司 | Intent recognition method, system and storage medium based on word string length |
CN112800778A (en) * | 2021-02-07 | 2021-05-14 | 北京智通云联科技有限公司 | Intention identification method and system based on word string length and storage medium |
CN112989004A (en) * | 2021-04-09 | 2021-06-18 | 苏州爱语认知智能科技有限公司 | Query graph ordering method and system for knowledge graph question answering |
CN113268574A (en) * | 2021-05-25 | 2021-08-17 | 山东交通学院 | Graph volume network knowledge base question-answering method and system based on dependency structure |
CN113779360A (en) * | 2021-08-18 | 2021-12-10 | 深圳技术大学 | Multi-head question-answering model-based question solving method, device, equipment and storage medium |
CN113947084A (en) * | 2021-09-24 | 2022-01-18 | 盛景智能科技(嘉兴)有限公司 | Question-answer knowledge retrieval method, device and equipment based on graph embedding |
CN114281959A (en) * | 2021-10-27 | 2022-04-05 | 腾讯科技(深圳)有限公司 | Statement processing method, statement processing device, statement processing equipment, statement processing medium and computer program product |
CN114281959B (en) * | 2021-10-27 | 2024-03-19 | 腾讯科技(深圳)有限公司 | Statement processing method, device, equipment, medium and computer program product |
CN114077692A (en) * | 2021-11-04 | 2022-02-22 | 北京工业大学 | Fine-grained tool recommendation method and device based on interaction task knowledge graph |
CN114065770A (en) * | 2022-01-17 | 2022-02-18 | 江苏联著实业股份有限公司 | Method and system for constructing semantic knowledge base based on graph neural network |
CN114547273A (en) * | 2022-03-18 | 2022-05-27 | 科大讯飞(苏州)科技有限公司 | Question answering method and related device, electronic equipment and storage medium |
CN114547273B (en) * | 2022-03-18 | 2022-08-16 | 科大讯飞(苏州)科技有限公司 | Question answering method and related device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111930906A (en) | Knowledge graph question-answering method and device based on semantic block | |
CN112613303B (en) | Knowledge distillation-based cross-modal image aesthetic quality evaluation method | |
CN109325040B (en) | FAQ question-answer library generalization method, device and equipment | |
Lin et al. | Deep structured scene parsing by learning with image descriptions | |
CN113779220B (en) | Mongolian multi-hop question-answering method based on three-channel cognitive map and graph annotating semantic network | |
CN118170894B (en) | Knowledge graph question-answering method, knowledge graph question-answering device and storage medium | |
CN116661805B (en) | Code representation generation method and device, storage medium and electronic equipment | |
CN112364132A (en) | Similarity calculation model and system based on dependency syntax and method for building system | |
CN112632250A (en) | Question and answer method and system under multi-document scene | |
CN116258147A (en) | Multimode comment emotion analysis method and system based on heterogram convolution | |
CN115543437A (en) | Code annotation generation method and system | |
CN117349311A (en) | Database natural language query method based on improved RetNet | |
CN115658846A (en) | Intelligent search method and device suitable for open-source software supply chain | |
CN114138989A (en) | Relevance prediction model training method and device and relevance prediction method | |
KR102269606B1 (en) | Method, apparatus and computer program for analyzing new contents for solving cold start | |
CN110377753B (en) | Relation extraction method and device based on relation trigger word and GRU model | |
CN116680407A (en) | Knowledge graph construction method and device | |
CN116383357A (en) | Knowledge graph-oriented query graph generation method and system | |
CN114091464B (en) | High-universality many-to-many relation triple extraction method fusing five-dimensional features | |
CN116028888A (en) | Automatic problem solving method for plane geometry mathematics problem | |
CN115658845A (en) | Intelligent question-answering method and device suitable for open-source software supply chain | |
Sun et al. | An Intelligent Question-Answering System for Myopia Prevention and Control based on Knowledge Graph | |
CN110929265B (en) | Multi-angle answer verification method for reading, understanding, asking and answering | |
Zong et al. | Context-based Python Code Recommendation | |
Zhang et al. | GS-SQL: Modeling Spatial Semantics in Spatial Text-to-SQL |
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 |