CN113157875A - Knowledge graph question-answering system, method and device - Google Patents
Knowledge graph question-answering system, method and device Download PDFInfo
- Publication number
- CN113157875A CN113157875A CN202110270515.3A CN202110270515A CN113157875A CN 113157875 A CN113157875 A CN 113157875A CN 202110270515 A CN202110270515 A CN 202110270515A CN 113157875 A CN113157875 A CN 113157875A
- Authority
- CN
- China
- Prior art keywords
- word
- node
- concept
- type
- dictionary
- 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
- 238000000034 method Methods 0.000 title claims abstract description 36
- 238000004458 analytical method Methods 0.000 claims abstract description 32
- 230000011218 segmentation Effects 0.000 claims abstract description 17
- 238000013138 pruning Methods 0.000 claims abstract description 12
- 238000012545 processing Methods 0.000 claims abstract description 11
- 238000004590 computer program Methods 0.000 claims description 6
- 238000002372 labelling Methods 0.000 claims description 5
- 238000004806 packaging method and process Methods 0.000 claims description 4
- 230000001502 supplementing effect Effects 0.000 claims description 3
- 239000003921 oil Substances 0.000 description 26
- 238000004519 manufacturing process Methods 0.000 description 15
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 10
- 239000000243 solution Substances 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 230000032696 parturition Effects 0.000 description 6
- 238000013461 design Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 239000010779 crude oil Substances 0.000 description 2
- 238000005538 encapsulation Methods 0.000 description 2
- 238000002347 injection Methods 0.000 description 2
- 239000007924 injection Substances 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000010606 normalization Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 239000010729 system oil Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation or dialogue systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/3332—Query translation
- G06F16/3334—Selection or weighting of terms from queries, including natural language queries
-
- 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/3331—Query processing
- G06F16/334—Query execution
- G06F16/3344—Query execution using natural language analysis
-
- 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
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- Mathematical Physics (AREA)
- Human Computer Interaction (AREA)
- Life Sciences & Earth Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Machine Translation (AREA)
Abstract
The invention discloses a knowledge graph question-answering system, a knowledge graph question-answering method and a knowledge graph question-answering device, wherein the knowledge graph question-answering system comprises: the data layer is used for storing a concept map and an example map; the model layer is used for storing a dictionary required for semantic analysis of the question of the user; the processing layer is used for performing word segmentation and syntactic dependency analysis on a user question to obtain a dependency relationship tree, performing node classification and pruning on the dependency relationship tree to obtain a pruned and type-labeled dependency relationship tree, outputting a corresponding relationship between a word list and a node object constraint path aiming at the pruned and type-labeled dependency relationship tree on the basis of a dictionary and a knowledge graph, acquiring a target node on the basis of the corresponding relationship, and inquiring an example graph according to the target node and the node object constraint path to acquire an example point of the target node; and the application layer is used for receiving the user question input by the user and displaying the returned example points to the user.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a knowledge graph question-answering system, a knowledge graph question-answering method and a knowledge graph question-answering device.
Background
In the current intelligent wave, the internet + becomes an important strategic direction for intelligent transformation and upgrading in many fields, wherein an intelligent question-answering system is one of the most urgent requirements for optimizing a service flow and improving service efficiency transformation.
The knowledge graph has the characteristics of strong expression capability, good expandability, flexible operation and the like, and the effect of the question-answering system is improved by constructing the knowledge graph and fusing the knowledge graph in the question-answering system in the vertical field. The system for asking and answering about knowledge maps at home and abroad is generally a task type, and manually defines the task type which can be answered in advance, the slot position which needs to be filled under each task type and the logic of a search graph database to obtain the final answer; or on the basis of a retrieval type question-answering system architecture, triple information of entities and relations in a knowledge graph is fused to realize more accurate reply.
Limitations of both of the above methods include:
(1) the types of questions that can be answered are limited; the task-type question-answering system needs to be defined artificially, and the retrieval-type question-answering system is limited by the types of questions in the question bank.
(2) Limited by the design of the knowledge-graph conceptual graph in the vertical field; in the task-based question-answering system, the search logic of the same question type in different concept graph designs is different, so the structure of the concept graph needs to be clear in advance.
(3) In the retrieval type question-answering system, the integration of the knowledge graph is only for improving the accuracy of similarity calculation between the user question and the question in the question-answering base, and the reasoning capability of the knowledge graph is not fully utilized.
Disclosure of Invention
The invention aims to provide a knowledge-graph question-answering system, a knowledge-graph question-answering method and a knowledge-graph question-answering device, and aims to solve the problems in the prior art.
The invention provides a knowledge-graph question-answering system, which comprises:
the data layer is used for storing a concept graph and an example graph, wherein the concept graph is used for describing types of concept nodes, attribute information of the concept nodes of each type and relations among the concept nodes of different types, and the example graph is used for storing example information corresponding to the concept graph;
the model layer is used for storing a dictionary required for semantic analysis of the question of the user;
the processing layer is used for performing word segmentation and syntactic dependency analysis on a user question to obtain a dependency relationship tree, performing node classification and pruning on the dependency relationship tree to obtain a pruned and type-labeled dependency relationship tree, outputting a corresponding relationship between a word list and a node object constraint path aiming at the pruned and type-labeled dependency relationship tree on the basis of a dictionary and a knowledge graph, acquiring a target node on the basis of the corresponding relationship, and inquiring an example graph according to the target node and the node object constraint path to acquire an example point of the target node;
and the application layer is used for receiving the user question input by the user and displaying the returned example points to the user.
The invention provides a knowledge graph question-answering method, which comprises the following steps:
the method comprises the steps of preserving a concept graph and an example graph in advance, wherein the concept graph is used for describing types of concept nodes, attribute information of the concept nodes of each type and relations among the concept nodes of different types, and the example graph is used for preserving example information corresponding to the concept graph;
pre-storing a dictionary required for semantic analysis of a question of a user;
receiving a user question input by a user, performing word segmentation and syntactic dependency analysis on the user question to obtain a dependency relationship tree, performing node classification and pruning on the dependency relationship tree to obtain a pruned and type-marked dependency relationship tree, outputting a corresponding relationship between a word list and a node object constraint path aiming at the pruned and type-marked dependency relationship tree, acquiring a target node based on the corresponding relationship, inquiring an example map according to the target node and the node object constraint path, acquiring an example point of the target node, and displaying the returned example point to the user.
The embodiment of the invention also provides a knowledge graph question-answering device, which comprises: the system comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the computer program realizes the steps of the knowledge-graph question-answering method when being executed by the processor.
The embodiment of the invention also provides a computer readable storage medium, wherein an implementation program for information transmission is stored on the computer readable storage medium, and the steps of the knowledge-graph question-answering method are implemented when the program is executed by a processor.
By adopting the embodiment of the invention, the natural language technology is utilized to carry out semantic analysis at a word level and a sentence level on the question of the user, the analysis result of the natural language technology and the sentence level and the knowledge graph data are integrated, and the object and the query path corresponding to the node in the knowledge graph are analyzed from the question of the user, so that the defects that the types of the questions which can be answered in the traditional graph-based question-answering system are limited and are limited by the design of the knowledge graph can be solved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
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, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic diagram of a knowledge-graph question-answering system in accordance with an embodiment of the present invention;
FIG. 2 is a detailed schematic diagram of a knowledge-graph question-answering system in accordance with an embodiment of the present invention;
FIGS. 3a-3d are schematic diagrams of a question processing procedure according to an embodiment of the present invention;
FIG. 4 is a flow chart of a knowledge-graph question-answering method of an embodiment of the present invention;
FIG. 5 is a schematic diagram of a knowledge-graph question answering apparatus in accordance with an embodiment of the present invention.
Detailed Description
In order to solve the above problems in the prior art, embodiments of the present invention provide a method and a system for knowledge graph question-answering based on dictionary and syntactic dependency analysis: and performing semantic analysis on the user question at a word level and a sentence level by utilizing a natural language technology, integrating the analysis results of the user question and the sentence level and knowledge map data, and analyzing an object and a query path corresponding to a node in a knowledge map from the user question. The specific operation is that the semantic analysis of word level is carried out by utilizing dictionary matching aiming at a user question, key word information such as concept, entity, attribute and the like is extracted, then the syntactic structure in the question is determined by utilizing syntactic dependency analysis, and the dependency logic relationship between key words in the sentence is obtained; and packaging key words describing node information in the knowledge graph into a node object by combining triple information in the knowledge graph, namely analyzing the semantics of the question of the user into one or more node objects, obtaining a constraint path and a target node between the node objects according to the result of dependency analysis, and finally querying in the example graph to obtain a final result and returning the final result. Through the operation, semantic information of word levels and sentence levels in the sentence is synthesized, and the intention of the question can be analyzed to the maximum extent; and when the key words are packaged into node objects, the node objects can be flexibly configured according to the real data of the knowledge graph, and manual change of the knowledge graph does not need to be determined in advance.
The technical solutions of the present invention will be described clearly and completely with reference to the following embodiments, and it should be understood that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it is to be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", and the like, indicate orientations and positional relationships based on those shown in the drawings, and are used only for convenience of description and simplicity of description, and do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be considered as limiting the present invention.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the described features. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise. Furthermore, the terms "mounted," "connected," and "connected" are to be construed broadly and may, for example, be fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
System embodiment
According to an embodiment of the present invention, a knowledge-graph question-answering system is provided, fig. 1 is a schematic diagram of the knowledge-graph question-answering system according to the embodiment of the present invention, as shown in fig. 1, the knowledge-graph question-answering system according to the embodiment of the present invention specifically includes:
a data layer 10 for storing a concept graph for describing types of concept nodes, attribute information of the concept nodes of each type, and relationships between the concept nodes of different types, and an instance graph for storing instance information corresponding to the concept graph;
the model layer 12 is used for storing a dictionary required for semantic analysis of the question of the user;
the processing layer 14 is used for performing word segmentation and syntactic dependency analysis on a user question to obtain a dependency relationship tree, performing node classification and pruning on the dependency relationship tree to obtain a pruned and type-labeled dependency relationship tree, outputting a corresponding relationship between a word list and a node object constraint path for the pruned and type-labeled dependency relationship tree based on a dictionary and a knowledge graph, acquiring a target node based on the corresponding relationship, and querying a graph instance according to the target node and the node object constraint path to acquire an instance point of the target node;
and the application layer 16 is used for receiving the user question input by the user and displaying the returned example points to the user.
The above-described modules according to the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
As shown in fig. 2, the whole knowledge-graph question-answering system based on dictionary and syntactic dependency analysis is divided into 4 levels, including: data layer 10, model layer 12, process layer 14, and application layer 16. The data layer 10 is used for managing knowledge graph data; the model layer 12 is responsible for managing dictionaries required by semantic parsing of question sentences of users; the processing layer 14 is responsible for processing the question of the user; the application layer 16 is responsible for the reception of user questions and the presentation of the final result. The data layer 10, the model layer 12, and the processing layer 14 of the system will be described in detail below.
The data layer 10 includes a concept graph and an instance graph, which may also be referred to as a model layer and an instance layer, and the concept graph describes types of nodes, attribute information of each type of node, and relationships between different types of concept nodes, and the instance graph stores real instance information and is an instantiation of the concept graph.
The model layer 12 includes 6 dictionaries, namely, a concept synonym dictionary, an attribute synonym dictionary, an instance synonym dictionary, an attribute-concept dictionary, an instance-concept dictionary, and a preposition dictionary, and the concept synonym dictionary maintains all possible descriptions of each concept in the concept graph, and the details are shown in table 1:
TABLE 1
Concept spoken word | Concept standard words |
Shaft | Shaft |
Well | Shaft |
Oil and gas field | Oil and gas field |
Oil field | Oil and gas field |
Block | Block |
Parturition plan | Parturition plan |
The attribute synonym dictionary maintains all possible descriptions of attributes in the concept graph, the details of which are shown in Table 2:
TABLE 2
Attribute spoken word | Attribute standard word |
Depth of well | Depth of well |
Depth of well | Depth of well |
Daily oil production capacity | Daily oil yield |
Daily oil yield | Daily oil yield |
Rate of rise of water cut | Rate of rise of water cut |
Rate of rise of water content | Rate of rise of water cut |
Annual oil production | Annual oil production |
Annual oil production | Annual oil production |
Strength of water injection | Strength of water injection |
Error of crude oil metering system | Error of crude oil metering system |
Oil production rate | Oil production rate |
The example synonyms maintain all possible descriptions of each example in the example graph, the details of which are shown in Table 3:
TABLE 3
Example spoken words | Example Standard words |
Zone a of the column | Tower A block |
Block of tower a | Tower A block |
Zone A of the column | Tower A block |
Zone b of the column | Tower B block |
Block of tower b | Tower B block |
Zone B of the column | Tower B block |
TK001 well | TK001 shaft |
TK001 shaft | TK001 shaft |
tk001 | TK001 shaft |
The attribute-concept dictionary maintains concepts corresponding to each standard attribute (i.e., the attributes present in the graph), the details of which are shown in table 4:
TABLE 4
Attribute standard word | Concept of |
Annual oil production | Parturition plan |
Daily oil yield | Parturition plan |
Comprehensive water-containing well | Shaft |
Comprehensive water content | Block |
Rate of rise of water cut | Block |
Rate of rise of water content | Block |
Example-concept dictionary maintains the concepts to which each canonical example (i.e., the example present in the example graph) belongs, the details of which are shown in table 5:
TABLE 5
Example Standard words | Concept of |
Tower A block | Block |
Tower B block | Block |
TK001 shaft | Shaft |
Central oil field | Oil and gas field |
Northwest oil field | Oil and gas field |
Eight regions | Block |
The preposition dictionary maintains spoken words with part of speech as prepositions, and the details are shown in table 6:
TABLE 6
Preposition word |
What is what |
What is |
How much |
It should be noted that, in the embodiment of the present invention, 4 dictionaries, namely a concept synonym dictionary, an attribute synonym dictionary, an instance synonym dictionary, and a preposition dictionary, need to be manually maintained and added; the attribute-concept dictionary is automatically generated according to concept map data without manual maintenance; the example-concept dictionary is automatically generated according to example map data, and manual maintenance is not needed.
The processing layer 14 includes five modules, which are a module 1 (corresponding to the first sub-module) for word segmentation and dependency analysis, a module 2 (corresponding to the second sub-module) for classification and pruning of the dependency tree nodes, a module 3 (corresponding to the third sub-module) for encapsulation of the node objects and acquisition of the node constraint paths, where the node objects are shown in table 7, a module 4 (corresponding to the fourth sub-module) for acquisition of the target nodes, and a module 5 (corresponding to the fifth sub-module) for query of the graph database. The specific operation of the five modules is described in detail below.
TABLE 7
Key | Value type |
Concept standard words | String |
Example Standard words | String |
List of attribute standard words | List<String> |
The module 1 is a word segmentation and dependency analysis module, and is used for performing word segmentation and syntax dependency analysis on a question of a user. When the words are segmented for the question, a dictionary-based word segmentation method such as MMSEG is adopted. Wherein the entries of the dictionary include common words and professional words in the vertical field, the professional words include entries in 4 dictionaries of concept synonyms, attribute synonyms and example synonyms, dependency syntax analysis is performed on the participled question, dependency logic relationship between each word in the sentence, i.e., dependency relationship tree, is output, and fig. 3a-d are how much annual oil production is respectively given for the question "tower a region allocation plan and tower B region allocation plan? "schematic diagram of processing procedure", wherein fig. 3a is dependency tree after question dependency analysis, fig. 3b is dependency tree after pruning and type marking, fig. 3c is dependency tree after correction for "parallel" and fig. 3d is node constraint path. As shown in fig. 3a, each node of the relation tree is a word, and words in the nodes are spliced together from left to right to form a question of the user. The line segment with the arrow indicates the relation of words in two nodes, the starting point is a father node, the end point is a root node, and the number of the father nodes of each node in the dependency relationship tree is less than or equal to 1.
The module 2 is used for classifying and pruning the nodes of the dependency relationship tree, and specifically, the nodes in the dependency relationship tree output by the module 1 are classified into six types, namely, an example word, a concept word, an attribute word, a preposition auxiliary word, other auxiliary words and a useless word, and the nodes corresponding to the useless words are removed, namely, the dependency relationship tree is pruned without information, and the dependency relationship tree with each node type is output and labeled, as shown in fig. 3 b. Wherein the specific operation of classification in each node in the dependency tree is:
2-1, firstly, judging whether the words in the nodes are entries in a concept synonym dictionary, an attribute synonym dictionary, an example synonym dictionary and a preposition dictionary; if the vocabulary entry is in the concept synonym dictionary, the node type is a concept word, if the vocabulary entry is in the attribute synonym dictionary, the node type is an attribute word, if the vocabulary entry is in the example synonym dictionary, the node type is an example word, and if the vocabulary entry is in the preposition dictionary, the node type is a preposition auxiliary word; and if the entries do not belong to the five classes of dictionaries, performing 2-2.
2-2, judging whether the node is a leaf node, if so, the node type is a useless word, and if not, the node type is other auxiliary words.
The module 3 is used for encapsulating the node object and acquiring the node constraint path; for the pruned and typed dependency relationship tree output by the module 2, the keyword describing one node of the graph is packaged into one object by combining the triple information of the knowledge graph, and the corresponding relationship between the output word list and the node object, namely the word list, the node object and the node object constraint path (node object 1) (node object 2) … (node object z), is output. The specific operation of the node object encapsulation is as follows:
the purpose of the 3-1 dependency tree modification is to modify the parent of the node pointed to by the "parallel" edge, as shown in FIG. 3 c. For the pruned and type-marked dependency relationship tree output by the module 2, sequentially traversing each node, if the current node is "parallel" to the parent node n0, acquiring the parent node n1 and the relationship e1 of the parent node, deleting the relationship between the current node and the parent node n0, changing the parent node of the current node to the node n1, and changing the relationship to e 1.
And 3-2, acquiring an initial constraint path of the word, outputting a plurality of < word constraint paths and direction types > for each question, and continuing 3-3 operations.
3-2-1 for the modified dependency relationship tree output by the module 3-1, starting from each leaf node, naming the leaf node as the current node, and constraining the path as the current node information (word and node type): the word 1/type 1, let the direction type of the constraint path be-1, and proceed 3-2-2 for each < constraint path, direction type >.
3-2-2, acquiring that the last node of the current constraint path is a current node (current node information: word 1 and node type 1) and the direction type of the constraint path is a current direction type, finding a father node of the current node along a relation line segment with an arrow, and directly outputting the current constraint path if no father node exists; if the subscript of the father node word in the question is larger than the subscript of the word of the current node, setting the direction type a as 0, if the subscript of the father node word in the question is smaller than the subscript of the word of the current node, setting the direction type a as 1, if the current direction type is-1 or the same as a, splicing father node information (word 2 and node type 2) behind the current constraint path: the current constraint path (word 2/type 2) and the corresponding direction type are set as a, and a new constraint path is obtained to continue 3-2-2 operation; if the current direction type is not-1 and is different from a, outputting the current constraint path, and setting a new constraint path as follows: word 2/type 2, corresponding direction type is set to-1, and continue 3-2-2 operation.
And 3-3, acquiring a word constraint path, traversing each of a plurality of word constraint paths and direction types output by 3-2, if the last node of one word constraint path is the same as the first node in the rest of the word constraint paths and direction types, and the direction types are respectively 0, 1 or 1 and 0, splicing the word constraint path with the direction type 1 to the back with the direction type 0 for output in a reverse order, otherwise, directly outputting the word constraint path.
3-4 normalization of word constraint paths, for each word constraint path (word 1/type 1) output by 3-3, (word 2/type 2) … (word m/type m) (where m > ═ 1), traversing from left to right each word i/type i (where i > ═ 1 and i < ═ m) type i continues skipping if it is "other auxiliary words" or "preposition auxiliary words"; if the word is the concept word, searching a concept standard word corresponding to the word i based on the concept synonym dictionary, and enabling the standard word i to be the concept standard word and the concept i to be the concept standard word; if the word is 'example word', searching an example standard word corresponding to the word i based on the example synonym dictionary, searching a concept standard word corresponding to the example standard word based on the example-concept dictionary, and enabling the standard word i to be the example standard word, wherein the concept i is the concept standard word; if the word is the 'attribute word', searching an attribute standard word corresponding to the word i based on the attribute synonym dictionary, searching a concept standard word corresponding to the attribute standard word based on the attribute-concept dictionary, and enabling the standard word i to be the attribute standard word and the concept i to be the concept standard word. Output (word 1/standard 1, type 1, concept 1) (word 2/standard 2, type 2, concept 2) … (word n/standard n, type n, concept n) (where n < ═ m).
For example, after the operation of 3-2 and 3-3 is performed on the dependency relationship tree after the modification of fig. 3c, two constraint paths are obtained, which are (tower a area/example word) · (parturition plan/concept word) · (annual oil production/attribute word) · (respectively/other auxiliary words) · (yes/other auxiliary words) · (how many/preposition auxiliary words), and (tower B area/example word) · (parturition plan/concept word) · (annual oil production/attribute word) · (respectively/other auxiliary words) · (yes/preposition auxiliary words) · (how many/preposition auxiliary words); after 3-4 operations, two standardized constraint paths are obtained, namely (tower A area/tower A area, example word, block) · (allocation plan/allocation plan, concept word, allocation plan) · (annual oil production/annual oil production, attribute word, allocation plan), (tower B area/tower B area, example word, block) · (allocation plan/allocation plan, concept word, allocation plan) · (annual oil production/annual oil production, attribute word, allocation plan).
3-5 initializing the node object; for each normalized word constraint path (word 1/standard word 1, type 1, concept 1) · (word 2/standard word 2, type 2, concept 2) … (word n/standard word n, type n, concept n), encapsulating concepts identical from left to right into node objects, outputting a correspondence relationship between a word list and a node object < word list i, word list i/node object i > and a node object constraint path (word list 1, node object 1) · (word list 2, node object 2) … (word list z, node object z) (where z < ═ n), and feeding to 3-6 to continue operation.
3-6, perfecting the node object;
perfecting a node object corresponding to the 3-6-1 word list; aiming at a plurality of input < word lists i, word lists i '/node objects i' > are compared pairwise, if a word list i 'corresponding to the word list i contains a word list j' (condition 1) corresponding to the word list j, the union of the word list i 'and the list i' is named as a word list k ', fields in the node objects i' corresponding to the word list i and the node objects j 'corresponding to the word list j are complemented and perfected to form nodes k', further the word list i, the word list i '/node objects i' > are changed into < word lists i, the list k '/node objects k' >, < word lists j, the word list j '/node objects j' > are changed into < word lists j, the list k '/node objects k' >, the word lists i '/node objects i' >, and the word lists i, the node objects are continuously fed to 3-6-1 to complete the node objects until the word lists i exist, and 3-6-2 is carried out when the condition 1 is not met in each word list i '/node object i' >.
3-6-2 modifies each node object i to a new node i ' corresponding to the word list i for the plurality of node object constraint paths output in 3-5, and correspondingly outputs a node object constraint path (node object 1 ') (node object 2 ') … (node object z '), where z ' < ═ n, as shown in fig. 3d, and the correspondence relationship between the word list and the node object < word list i ', node object i ' >.
Obtaining a target node by a module 4; and aiming at the modified pruned dependency relationship tree output by the module 3-1 and labeling the dependency relationship tree of each node type, calculating the node type as the node which is closest to the preposed auxiliary word in the concept word, the attribute word or the example word and the node type, acquiring a word k corresponding to the node, and if the word list comprises the word k in the corresponding relationship < word list, node object > of one or more word lists output by the module 3 and the node, labeling the node object corresponding to the word list as a target node for output.
Module 5 query of graph database; and inquiring the instance graph aiming at the plurality of node constraint paths output by the module 3 and the target node output by the module 4 to obtain the instance point return of the target node.
In summary, according to the embodiments of the present invention, the natural language technology is used to perform semantic parsing on the user question at a word level and a sentence level, and the results of the semantic parsing and the sentence level are combined to parse the object and the query path corresponding to the node in the knowledge graph from the user question, so as to solve the problem that the traditional graph-based question-answering system has limited types of recoverable questions and is limited by the knowledge graph design.
Method embodiment
According to an embodiment of the present invention, a method for knowledge-graph question-answering is provided, fig. 4 is a flowchart of the method for knowledge-graph question-answering according to the embodiment of the present invention, as shown in fig. 4, the method for knowledge-graph question-answering according to the embodiment of the present invention specifically includes:
step 401, pre-storing a concept graph and an instance graph, wherein the concept graph is used for describing types of concept nodes, attribute information of the concept nodes of each type and relations among the concept nodes of different types, and the instance graph is used for storing instance information corresponding to the concept graph;
step 402, pre-storing a dictionary required for semantic analysis of a question of a user; the dictionary specifically includes: the system comprises a concept synonym dictionary, an attribute synonym dictionary, an example synonym dictionary, an attribute-concept dictionary, an example-concept dictionary and a preposition dictionary, wherein the concept synonym dictionary is used for maintaining all possible descriptions of each concept in a concept map, the attribute synonym dictionary is used for maintaining all possible descriptions of attributes in the concept map, the example synonym dictionary is used for maintaining all possible descriptions of each example in the example map, the attribute-concept dictionary is used for maintaining concepts corresponding to each standard attribute, the example-concept dictionary is used for maintaining concepts to which each standard example belongs, and the preposition dictionary is used for maintaining spoken words with the part of speech being prepositions.
Step 403, receiving a user question input by a user, performing word segmentation and syntactic dependency analysis on the user question to obtain a dependency relationship tree, performing node classification and pruning on the dependency relationship tree to obtain a pruned and type-labeled dependency relationship tree, outputting a corresponding relationship between a word list and a node object constraint path for the pruned and type-labeled dependency relationship tree based on a dictionary and a knowledge graph, obtaining a target node based on the corresponding relationship, querying an instance graph according to the target node and the node object constraint path, obtaining an instance point of the target node, and displaying the returned instance point to the user.
Step 403 specifically includes:
performing word segmentation on a user question by adopting a word segmentation method based on a dictionary, performing dependency syntax analysis on the word-segmented question, and outputting a dependency relationship tree representing the dependency logic relationship between each word in the sentence;
dividing the nodes in the dependency relationship tree into six types of example words, concept words, attribute words, preposition auxiliary words, other auxiliary words and useless words, removing the nodes corresponding to the useless words in the dependency relationship tree, and outputting a dependency relationship tree with branches and labeling each node type; the method specifically comprises the following steps: firstly, judging whether words in nodes in the dependency relationship tree are entries in a concept synonym dictionary, an attribute synonym dictionary, an instance synonym dictionary and a preposition dictionary; if the vocabulary entry is in the concept synonym dictionary, determining that the node type is a concept word, if the vocabulary entry is in the attribute synonym dictionary, determining that the node type is an attribute word, if the vocabulary entry is in the example synonym dictionary, determining that the node type is an example word, and if the vocabulary entry is in the preposition dictionary, determining that the node type is a preposition auxiliary word; if the entries do not belong to the five classes of dictionaries, further judging whether the node is a leaf node, if so, determining that the node type is a useless word, and if not, determining that the node type is other auxiliary words;
modifying the dependency relationship tree which is pruned and labeled with each node type, packaging a keyword for describing one node of the knowledge graph into one node object by combining the triple information of the knowledge graph, and outputting the corresponding relationship between a word list and the node object, namely the word list, the node object and the constraint path of each node object; the method specifically comprises the following steps: for the dependency relationship tree which is pruned and labeled with each node type, sequentially traversing each node, if the relationship between the current node and the father node n0 is parallel, acquiring the father node n1 and the relationship between the current node and the father node e1 of the father node, deleting the relationship between the current node and the father node n0, changing the father node of the current node into the node n1, changing the relationship between the current node and the father node into e1, and outputting a modified dependency relationship tree; for the modified dependency relationship tree, starting from each leaf node, naming the leaf node as a current node, and taking a constraint path as current node information: 1/type 1, and setting the direction type of the constraint path as-1; aiming at each < constraint path, direction type >, the last node of the current constraint path is obtained as the current node and the direction type of the constraint path is the current direction type, the father node of the current node is searched, if no father node exists, the current constraint path is directly output; if the subscript of the father node word in the question is larger than the subscript of the word of the current node, setting the direction type a as 0, if the subscript of the father node word in the question is smaller than the subscript of the word of the current node, setting the direction type a as 1, if the current direction type is-1 or is the same as a, splicing father node information, namely word 2 and node type 2, behind the current constraint path, and setting the corresponding direction type as a to obtain a new constraint path; if the current direction type is not-1 and is different from a, outputting the current constraint path, and setting a new constraint path as follows: 2/type 2, the corresponding direction type is set as-1, and a plurality of < word constraint paths, direction types > are output aiming at each question; traversing each of a plurality of word constraint paths and direction types, if the last node of one word constraint path is the same as the first node in the rest of the word constraint paths and the direction types are respectively 0, 1 or 1 and 0, splicing the word constraint path with the direction type of 1 to the back with the direction type of 0 for output in a reverse order, otherwise, directly outputting the word constraint path; for each output word constraint path (word 1/type 1) (word 2/type 2) … (word m/type m) where m > ═ 1, traversing each word i/type i from left to right, where i > ═ 1 and i < ═ m, type i skipping continues if it is "other assist words" or "preposition assist words"; if the word is the concept word, searching a concept standard word corresponding to the word i based on the concept synonym dictionary, and enabling the standard word i to be the concept standard word and the concept i to be the concept standard word; if the word is 'example word', searching an example standard word corresponding to the word i based on the example synonym dictionary, searching a concept standard word corresponding to the example standard word based on the example-concept dictionary, and enabling the standard word i to be the example standard word, wherein the concept i is the concept standard word; if the word is the 'attribute word', searching an attribute standard word corresponding to the word i based on the attribute synonym dictionary, searching a concept standard word corresponding to the attribute standard word based on the attribute-concept dictionary, and enabling the standard word i to be the attribute standard word and the concept i to be the concept standard word, and outputting a standardized word constraint path (word 1/standard word 1, type 1, concept 1) (word 2/standard word 2, type 2, concept 2) … (word n/standard word n, type n, concept n), wherein n < ═ m. For each normalized word constraint path (word 1/standard word 1, type 1, concept 1) · (word 2/standard word 2, type 2, concept 2) … (word n/standard word n, type n, concept n), encapsulating concepts identical from left to right into node objects, outputting a correspondence relationship between a word list and a node object < word list i, word list i/node object i > and a node object constraint path (word list 1, node object 1) · (word list 2, node object 2) … (word list z, node object z), where z < ═ n; comparing every two of a plurality of word lists i, i '/node objects i' > in pairs, if a condition 1 exists, namely a word list i 'corresponding to the word list i comprises a word list j' corresponding to a word list j, naming a union of the word list i 'and the list i' as a word list k ', mutually supplementing and perfecting fields in a node object i' corresponding to the word list i and a node object j 'corresponding to the word list j to form a node k', further changing the word list i, i '/node object i' > into a word list i, k '/node object k' >, < word list j, j '/node object j' > into a word list j, k '/node object k' >, continuing to perfect the node objects until the word list i, i '/node object i' > do not satisfy the condition 1 in pairs, for multiple node object constraint paths, modifying each node object i into a new node i ' corresponding to a word list i, and correspondingly outputting a node object constraint path (node object 1 ') (node object 2 ') … (node object z '), wherein z ' < ═ n, and the corresponding relationship between the word list and the node object < word list i ', node object i ' >;
based on the modified dependency relationship tree, calculating a node with a node type being a concept word, an attribute word or a node with a closest distance to a preposed auxiliary word with a node type being a preposed auxiliary word in an example word, acquiring a word k corresponding to the node, judging whether the word lists in one or more word lists and the corresponding relationship < the word lists and the node objects > contain the word k, and if so, marking the node objects corresponding to the word lists as target nodes for outputting;
and acquiring and feeding back the instance points of the target node according to the multiple node constraint paths and the target node query instance graph.
The embodiment of the present invention is a method embodiment corresponding to the system embodiment described above, and specific operations of each step may be understood with reference to the description of the system embodiment, which is not described herein again.
Apparatus embodiment one
An embodiment of the present invention provides a knowledge-graph question-answering device, as shown in fig. 5, including: a memory 50, a processor 52 and a computer program stored on the memory 50 and executable on the processor 52, which computer program, when executed by the processor 52, performs the steps as described in the method embodiments.
Device embodiment II
An embodiment of the present invention provides a computer-readable storage medium, on which an implementation program for information transmission is stored, and when the program is executed by the processor 52, the steps described in the method embodiment are implemented.
The computer-readable storage medium of this embodiment includes, but is not limited to: ROM, RAM, magnetic or optical disks, and the like.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (10)
1. A knowledge-graph question-answering system, comprising:
the data layer is used for storing a concept graph and an example graph, wherein the concept graph is used for describing types of concept nodes, attribute information of the concept nodes of each type and relations among the concept nodes of different types, and the example graph is used for storing example information corresponding to the concept graph;
the model layer is used for storing a dictionary required for semantic analysis of the question of the user;
the processing layer is used for performing word segmentation and syntactic dependency analysis on a user question to obtain a dependency relationship tree, performing node classification and pruning on the dependency relationship tree to obtain a pruned and type-labeled dependency relationship tree, outputting a corresponding relationship between a word list and a node object constraint path aiming at the pruned and type-labeled dependency relationship tree on the basis of a dictionary and a knowledge graph, acquiring a target node on the basis of the corresponding relationship, and inquiring an instance graph according to the target node and the node object constraint path to acquire an instance point of the target node;
and the application layer is used for receiving the user question input by the user and displaying the returned example points to the user.
2. The system according to claim 1, wherein the dictionary specifically comprises: the system comprises a concept synonym dictionary, an attribute synonym dictionary, an example synonym dictionary, an attribute-concept dictionary, an example-concept dictionary and a preposition dictionary, wherein the concept synonym dictionary is used for maintaining all possible descriptions of each concept in a concept map, the attribute synonym dictionary is used for maintaining all possible descriptions of attributes in the concept map, the example synonym dictionary is used for maintaining all possible descriptions of each example in the example map, the attribute-concept dictionary is used for maintaining concepts corresponding to each standard attribute, the example-concept dictionary is used for maintaining concepts to which each standard example belongs, and the preposition dictionary is used for maintaining spoken words with the part of speech being prepositions.
3. The system according to claim 1, characterized in that the processing layer comprises in particular:
the first submodule is used for segmenting words of a user question by adopting a word segmentation method based on a dictionary, carrying out dependency syntax analysis on the segmented question and outputting a dependency relationship tree representing the dependency logic relationship between each word in a sentence;
the second sub-module is used for dividing the nodes in the dependency relationship tree into six types of example words, concept words, attribute words, preposition auxiliary words, other auxiliary words and useless words, removing the nodes corresponding to the useless words in the dependency relationship tree, and outputting the dependency relationship tree with pruning and labeling each node type;
the third sub-module is used for correcting the dependency relationship tree which is pruned and labeled with each node type, packaging a keyword for describing one node of the knowledge graph into a node object by combining the triple information of the knowledge graph, and outputting the corresponding relationship between a word list and the node object, namely the word list, the node object and the constraint path of each node object;
a fourth sub-module, configured to calculate, based on the modified dependency relationship tree, a node whose node type is the closest node to an auxiliary word whose node type is a preposition in a concept word, an attribute word, or an instance word, obtain a word k corresponding to the node, determine whether the word list in one or more word lists and the corresponding relationship < word list, node object > contains the word k, and if yes, mark the node object corresponding to the word list as a target node and output the target node;
and the fifth sub-module is used for acquiring the instance points of the target node according to the plurality of node constraint paths and the target node query instance graph and feeding back the instance points to the application layer.
4. The system of claim 1, wherein the second submodule is specifically configured to:
firstly, judging whether words in nodes in the dependency relationship tree are entries in a concept synonym dictionary, an attribute synonym dictionary, an instance synonym dictionary and a preposition dictionary; if the vocabulary entry is in the concept synonym dictionary, determining that the node type is a concept word, if the vocabulary entry is in the attribute synonym dictionary, determining that the node type is an attribute word, if the vocabulary entry is in the example synonym dictionary, determining that the node type is an example word, and if the vocabulary entry is in the preposition dictionary, determining that the node type is a preposition auxiliary word; if the entries do not belong to the five classes of dictionaries, whether the node is a leaf node is further judged, if the node is the leaf node, the node type is determined to be a useless word, and if not, the node type is other auxiliary words.
5. The system of claim 1, wherein the third submodule is specifically configured to:
aiming at the dependency relationship tree which is pruned and labeled with each node type, sequentially traversing each node, if the relationship between the current node and the father node n0 is parallel, acquiring the father node n1 and the relationship between the current node and the father node e1 of the father node, deleting the relationship between the current node and the father node n0, changing the father node of the current node into the node n1, changing the relationship between the current node and the father node into e1, and outputting a modified dependency relationship tree;
for the modified dependency relationship tree, starting from each leaf node, naming the leaf node as a current node, and taking a constraint path as current node information: 1/type 1, and setting the direction type of the constraint path as-1;
aiming at each < constraint path, direction type >, the last node of the current constraint path is obtained as the current node and the direction type of the constraint path is the current direction type, the father node of the current node is searched, if no father node exists, the current constraint path is directly output; if the subscript of the father node word in the question is larger than the subscript of the word of the current node, setting the direction type a as 0, if the subscript of the father node word in the question is smaller than the subscript of the word of the current node, setting the direction type a as 1, if the current direction type is-1 or is the same as a, splicing father node information, namely word 2 and node type 2, behind the current constraint path, and setting the corresponding direction type as a to obtain a new constraint path; if the current direction type is not-1 and is different from a, outputting the current constraint path, and setting a new constraint path as follows: 2/type 2, the corresponding direction type is set as-1, and a plurality of < word constraint paths, direction types > are output aiming at each question;
traversing each of a plurality of word constraint paths and direction types, if the last node of one word constraint path is the same as the first node in the rest of the word constraint paths and the direction types are respectively 0, 1 or 1 and 0, splicing the word constraint path with the direction type of 1 to the back with the direction type of 0 for output in a reverse order, otherwise, directly outputting the word constraint path;
for each output word constraint path (word 1/type 1) (word 2/type 2) … (word m/type m) where m > ═ 1, traversing each word i/type i from left to right, where i > ═ 1 and i < ═ m, type i skipping continues if it is "other assist words" or "preposition assist words"; if the word is the concept word, searching a concept standard word corresponding to the word i based on the concept synonym dictionary, and enabling the standard word i to be the concept standard word and the concept i to be the concept standard word; if the word is 'example word', searching an example standard word corresponding to the word i based on the example synonym dictionary, searching a concept standard word corresponding to the example standard word based on the example-concept dictionary, and enabling the standard word i to be the example standard word, wherein the concept i is the concept standard word; if the word is the 'attribute word', searching an attribute standard word corresponding to the word i based on the attribute synonym dictionary, searching a concept standard word corresponding to the attribute standard word based on the attribute-concept dictionary, and enabling the standard word i to be the attribute standard word and the concept i to be the concept standard word, and outputting a standardized word constraint path (word 1/standard word 1, type 1, concept 1) (word 2/standard word 2, type 2, concept 2) … (word n/standard word n, type n, concept n), wherein n < ═ m.
For each normalized word constraint path (word 1/standard word 1, type 1, concept 1) · (word 2/standard word 2, type 2, concept 2) … (word n/standard word n, type n, concept n), encapsulating concepts identical from left to right into node objects, outputting a correspondence relationship between a word list and a node object < word list i, word list i/node object i > and a node object constraint path (word list 1, node object 1) · (word list 2, node object 2) … (word list z, node object z), where z < ═ n;
comparing every two of a plurality of word lists i, i '/node objects i' > in pairs, if a condition 1 exists, namely a word list i 'corresponding to the word list i comprises a word list j' corresponding to a word list j, naming a union of the word list i 'and the list i' as a word list k ', mutually supplementing and perfecting fields in a node object i' corresponding to the word list i and a node object j 'corresponding to the word list j to form a node k', further changing the word list i, i '/node object i' > into a word list i, k '/node object k' >, < word list j, j '/node object j' > into a word list j, k '/node object k' >, continuing to perfect the node objects until the word list i, i '/node object i' > do not satisfy the condition 1 in pairs, and for the multiple node object constraint paths, modifying the node object i into a new node i ' corresponding to the word list i, and correspondingly outputting a node object constraint path (node object 1 ') (node object 2 ') … (node object z '), wherein z ' < ═ n, and the corresponding relation between the word list and the node object < word list i ', node object i ' >, wherein the multiple node object constraint paths are complete.
6. A knowledge-graph question-answering method is characterized by comprising the following steps:
the method comprises the steps of preserving a concept graph and an example graph in advance, wherein the concept graph is used for describing types of concept nodes, attribute information of the concept nodes of each type and relations among the concept nodes of different types, and the example graph is used for preserving example information corresponding to the concept graph;
pre-storing a dictionary required for semantic analysis of a question of a user;
receiving a user question input by a user, performing word segmentation and syntactic dependency analysis on the user question to obtain a dependency relationship tree, performing node classification and pruning on the dependency relationship tree to obtain a pruned and type-marked dependency relationship tree, outputting a corresponding relationship between a word list and a node object constraint path aiming at the pruned and type-marked dependency relationship tree, acquiring a target node based on a concept graph, inquiring an example graph according to the target node and the node object constraint path, acquiring an example point of the target node, and displaying the returned example point to the user.
7. The method according to claim 6, wherein the dictionary specifically comprises: the system comprises a concept synonym dictionary, an attribute synonym dictionary, an example synonym dictionary, an attribute-concept dictionary, an example-concept dictionary and a preposition dictionary, wherein the concept synonym dictionary is used for maintaining all possible descriptions of each concept in a concept map, the attribute synonym dictionary is used for maintaining all possible descriptions of attributes in the concept map, the example synonym dictionary is used for maintaining all possible descriptions of each example in the example map, the attribute-concept dictionary is used for maintaining concepts corresponding to each standard attribute, the example-concept dictionary is used for maintaining concepts to which each standard example belongs, and the preposition dictionary is used for maintaining spoken words with the part of speech being prepositions.
8. The method according to claim 6, wherein performing word segmentation and syntactic dependency analysis on the user question based on the dictionary to obtain a dependency relationship tree, performing node classification and pruning on the dependency relationship tree to obtain a pruned and typed dependency relationship tree, outputting a correspondence between a word list and a node object constraint path for the pruned and typed dependency relationship tree based on the dictionary and a knowledge graph, obtaining a target node based on the correspondence, and querying an instance graph according to the target node and the node object constraint path to obtain an instance point of the target node specifically comprises:
performing word segmentation on a user question by adopting a word segmentation method based on a dictionary, performing dependency syntax analysis on the word-segmented question, and outputting a dependency relationship tree representing the dependency logic relationship between each word in the sentence;
dividing the nodes in the dependency relationship tree into six types of example words, concept words, attribute words, preposition auxiliary words, other auxiliary words and useless words, removing the nodes corresponding to the useless words in the dependency relationship tree, and outputting a dependency relationship tree with branches and labeling each node type; the method specifically comprises the following steps: firstly, judging whether words in nodes in the dependency relationship tree are entries in a concept synonym dictionary, an attribute synonym dictionary, an instance synonym dictionary and a preposition dictionary; if the vocabulary entry is in the concept synonym dictionary, determining that the node type is a concept word, if the vocabulary entry is in the attribute synonym dictionary, determining that the node type is an attribute word, if the vocabulary entry is in the example synonym dictionary, determining that the node type is an example word, and if the vocabulary entry is in the preposition dictionary, determining that the node type is a preposition auxiliary word; if the entries do not belong to the five classes of dictionaries, further judging whether the node is a leaf node, if so, determining that the node type is a useless word, and if not, determining that the node type is other auxiliary words;
modifying the dependency relationship tree which is pruned and labeled with each node type, packaging a keyword for describing one node of the knowledge graph into one node object by combining the triple information of the knowledge graph, and outputting the corresponding relationship between a word list and the node object, namely the word list, the node object and the constraint path of each node object; the method specifically comprises the following steps: for the dependency relationship tree which is pruned and labeled with each node type, sequentially traversing each node, if the relationship between the current node and the father node n0 is parallel, acquiring the father node n1 and the relationship between the current node and the father node e1 of the father node, deleting the relationship between the current node and the father node n0, changing the father node of the current node into the node n1, changing the relationship between the current node and the father node into e1, and outputting a modified dependency relationship tree; for the modified dependency relationship tree, starting from each leaf node, naming the leaf node as a current node, and taking a constraint path as current node information: 1/type 1, and setting the direction type of the constraint path as-1; aiming at each < constraint path, direction type >, the last node of the current constraint path is obtained as the current node and the direction type of the constraint path is the current direction type, the father node of the current node is searched, if no father node exists, the current constraint path is directly output; if the subscript of the father node word in the question is larger than the subscript of the word of the current node, setting the direction type a as 0, if the subscript of the father node word in the question is smaller than the subscript of the word of the current node, setting the direction type a as 1, if the current direction type is-1 or is the same as a, splicing father node information, namely word 2 and node type 2, behind the current constraint path, and setting the corresponding direction type as a to obtain a new constraint path; if the current direction type is not-1 and is different from a, outputting the current constraint path, and setting a new constraint path as follows: 2/type 2, the corresponding direction type is set as-1, and a plurality of < word constraint paths, direction types > are output aiming at each question; traversing each of a plurality of word constraint paths and direction types, if the last node of one word constraint path is the same as the first node in the rest of the word constraint paths and the direction types are respectively 0, 1 or 1 and 0, splicing the word constraint path with the direction type of 1 to the back with the direction type of 0 for output in a reverse order, otherwise, directly outputting the word constraint path; for each output word constraint path (word 1/type 1) (word 2/type 2) … (word m/type m) where m > ═ 1, traversing each word i/type i from left to right, where i > ═ 1 and i < ═ m, type i skipping continues if it is "other assist words" or "preposition assist words"; if the word is the concept word, searching a concept standard word corresponding to the word i based on the concept synonym dictionary, and enabling the standard word i to be the concept standard word and the concept i to be the concept standard word; if the word is 'example word', searching an example standard word corresponding to the word i based on the example synonym dictionary, searching a concept standard word corresponding to the example standard word based on the example-concept dictionary, and enabling the standard word i to be the example standard word, wherein the concept i is the concept standard word; if the word is the 'attribute word', searching an attribute standard word corresponding to the word i based on the attribute synonym dictionary, searching a concept standard word corresponding to the attribute standard word based on the attribute-concept dictionary, and enabling the standard word i to be the attribute standard word and the concept i to be the concept standard word, and outputting a standardized word constraint path (word 1/standard word 1, type 1, concept 1) (word 2/standard word 2, type 2, concept 2) … (word n/standard word n, type n, concept n), wherein n < ═ m. For each normalized word constraint path (word 1/standard word 1, type 1, concept 1) · (word 2/standard word 2, type 2, concept 2) … (word n/standard word n, type n, concept n), encapsulating concepts identical from left to right into node objects, outputting a correspondence relationship between a word list and a node object < word list i, word list i/node object i > and a node object constraint path (word list 1, node object 1) · (word list 2, node object 2) … (word list z, node object z), where z < ═ n; comparing every two of a plurality of word lists i, i '/node objects i' > in pairs, if a condition 1 exists, namely a word list i 'corresponding to the word list i comprises a word list j' corresponding to a word list j, naming a union of the word list i 'and the list i' as a word list k ', mutually supplementing and perfecting fields in a node object i' corresponding to the word list i and a node object j 'corresponding to the word list j to form a node k', further changing the word list i, i '/node object i' > into a word list i, k '/node object k' >, < word list j, j '/node object j' > into a word list j, k '/node object k' >, continuing to perfect the node objects until the word list i, i '/node object i' > do not satisfy the condition 1 in pairs, for multiple node object constraint paths, modifying each node object i into a new node i ' corresponding to a word list i, and correspondingly outputting a node object constraint path (node object 1 ') (node object 2 ') … (node object z '), wherein z ' < ═ n, and the corresponding relationship between the word list and the node object < word list i ', node object i ' >;
based on the modified dependency relationship tree, calculating a node with a node type being a concept word, an attribute word or a node with a closest distance to a preposed auxiliary word with a node type being a preposed auxiliary word in an example word, acquiring a word k corresponding to the node, judging whether the word lists in one or more word lists and the corresponding relationship < the word lists and the node objects > contain the word k, and if so, marking the node objects corresponding to the word lists as target nodes for outputting;
and acquiring and feeding back the instance points of the target node according to the multiple node constraint paths and the target node query instance graph.
9. A knowledge-graph question-answering apparatus, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method of knowledge-graph question-answering according to any one of claims 6 to 8.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon an implementation program of information transfer, which when executed by a processor implements the steps of the knowledge-graph question-answering method according to any one of claims 6 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110270515.3A CN113157875A (en) | 2021-03-12 | 2021-03-12 | Knowledge graph question-answering system, method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110270515.3A CN113157875A (en) | 2021-03-12 | 2021-03-12 | Knowledge graph question-answering system, method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113157875A true CN113157875A (en) | 2021-07-23 |
Family
ID=76886867
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110270515.3A Pending CN113157875A (en) | 2021-03-12 | 2021-03-12 | Knowledge graph question-answering system, method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113157875A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114186689A (en) * | 2022-02-14 | 2022-03-15 | 支付宝(杭州)信息技术有限公司 | Methods, systems, apparatus, and media for path discovery in a knowledge graph |
CN115170917A (en) * | 2022-06-20 | 2022-10-11 | 美的集团(上海)有限公司 | Image processing method, electronic device, and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013084136A (en) * | 2011-10-11 | 2013-05-09 | Nippon Hoso Kyokai <Nhk> | Semantic analysis device and program thereof |
CN111708874A (en) * | 2020-08-24 | 2020-09-25 | 湖南大学 | Man-machine interaction question-answering method and system based on intelligent complex intention recognition |
-
2021
- 2021-03-12 CN CN202110270515.3A patent/CN113157875A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013084136A (en) * | 2011-10-11 | 2013-05-09 | Nippon Hoso Kyokai <Nhk> | Semantic analysis device and program thereof |
CN111708874A (en) * | 2020-08-24 | 2020-09-25 | 湖南大学 | Man-machine interaction question-answering method and system based on intelligent complex intention recognition |
Non-Patent Citations (2)
Title |
---|
JUNWEI BAO 等: "Constraint-based question answering with knowledge graph", 《PROCEEDINGS OF COLING 2016, THE 26TH INTERNATIONAL CONFERENCE ON COMPUTATIONAL LINGUISTICS: TECHNICAL PAPERS》, 31 December 2016 (2016-12-31), pages 2503 * |
宋巍: "基于句法特征的代词消解方法研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 15 July 2012 (2012-07-15), pages 138 - 2788 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114186689A (en) * | 2022-02-14 | 2022-03-15 | 支付宝(杭州)信息技术有限公司 | Methods, systems, apparatus, and media for path discovery in a knowledge graph |
CN114186689B (en) * | 2022-02-14 | 2022-05-20 | 支付宝(杭州)信息技术有限公司 | Methods, systems, apparatus, and media for path discovery in a knowledge graph |
CN115170917A (en) * | 2022-06-20 | 2022-10-11 | 美的集团(上海)有限公司 | Image processing method, electronic device, and storage medium |
CN115170917B (en) * | 2022-06-20 | 2023-11-07 | 美的集团(上海)有限公司 | Image processing method, electronic device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112069298B (en) | Man-machine interaction method, device and medium based on semantic web and intention recognition | |
CN109684448B (en) | Intelligent question and answer method | |
CN109800284B (en) | Task-oriented unstructured information intelligent question-answering system construction method | |
US9773053B2 (en) | Method and apparatus for processing electronic data | |
CN110750649A (en) | Knowledge graph construction and intelligent response method, device, equipment and storage medium | |
US20160275196A1 (en) | Semantic search apparatus and method using mobile terminal | |
CN104657439A (en) | Generation system and method for structured query sentence used for precise retrieval of natural language | |
CN102402561B (en) | Searching method and device | |
CN116991869A (en) | Method for automatically generating database query statement based on NLP language model | |
CN107885786A (en) | Towards the Natural Language Query Interface implementation method of big data | |
CN113590784B (en) | Triplet information extraction method and device, electronic equipment and storage medium | |
CN115809345A (en) | Knowledge graph-based multi-source data difference traceability retrieval method | |
CN104657440A (en) | Structured query statement generating system and method | |
CN114218472A (en) | Intelligent search system based on knowledge graph | |
CN109783806A (en) | A kind of text matching technique using semantic analytic structure | |
CN113157875A (en) | Knowledge graph question-answering system, method and device | |
CN110532358A (en) | A kind of template automatic generation method towards knowledge base question and answer | |
CN114625748A (en) | SQL query statement generation method and device, electronic equipment and readable storage medium | |
CN114495143A (en) | Text object identification method and device, electronic equipment and storage medium | |
CN115600593A (en) | Method and device for acquiring key content of literature | |
CN113377739A (en) | Knowledge graph application method, knowledge graph application platform, electronic equipment and storage medium | |
CN112732743A (en) | Data analysis method and device based on Chinese natural language | |
CN117473054A (en) | Knowledge graph-based general intelligent question-answering method and device | |
CN116501834A (en) | Address information processing method and device, mobile terminal and storage medium | |
CN113128224A (en) | Chinese error correction method, device and equipment and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |