CN112989005B - Knowledge graph common sense question-answering method and system based on staged query - Google Patents

Knowledge graph common sense question-answering method and system based on staged query Download PDF

Info

Publication number
CN112989005B
CN112989005B CN202110410370.2A CN202110410370A CN112989005B CN 112989005 B CN112989005 B CN 112989005B CN 202110410370 A CN202110410370 A CN 202110410370A CN 112989005 B CN112989005 B CN 112989005B
Authority
CN
China
Prior art keywords
question
model
node
knowledge
data
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.)
Expired - Fee Related
Application number
CN202110410370.2A
Other languages
Chinese (zh)
Other versions
CN112989005A (en
Inventor
唐昌伦
赵�卓
田侃
张殊
张晨
吴涛
张浩然
王宇轩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing University of Post and Telecommunications
Three Gorges Museum
Original Assignee
Chongqing University of Post and Telecommunications
Three Gorges Museum
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing University of Post and Telecommunications, Three Gorges Museum filed Critical Chongqing University of Post and Telecommunications
Priority to CN202110410370.2A priority Critical patent/CN112989005B/en
Publication of CN112989005A publication Critical patent/CN112989005A/en
Application granted granted Critical
Publication of CN112989005B publication Critical patent/CN112989005B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/14Tree-structured documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/247Thesauruses; Synonyms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • G06F40/295Named entity recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Mathematical Physics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Molecular Biology (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Human Computer Interaction (AREA)
  • Animal Behavior & Ethology (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention belongs to the field of knowledge graph automatic question answering, and particularly relates to a knowledge graph common sense question answering method and system based on staged query, which comprises the following steps: obtaining question sentences, preprocessing the question sentences and converting the preprocessed question sentences into question sentence sequences; inputting the question sequence into a trained improved question-answer model to obtain a question-answer result; the improved question-answering model comprises an entity recognition model, a constraint language recognition model and a question structure classification model; the invention converts complex problems or simple problems into a question semantic structure tree based on a statement structure, and searches answers to the problems step by updating the nodes to be determined, so that the searching process is simplified from complexity to simplicity.

Description

Knowledge graph common sense question-answering method and system based on staged query
Technical Field
The invention belongs to the field of knowledge graph automatic question answering, and particularly relates to a knowledge graph common sense question answering method and system based on staged query.
Background
In recent years, with the rapid development of artificial intelligence, the most representative intelligent question and answer frequently appears in the visual field of people. This is not clear from the development of the field of knowledge engineering represented by the knowledge graph, which stores data in the form of triples. The knowledge graph stores a triple of 'head entity-relation-tail entity', wherein the entity is a node, the relation is used as an edge, and a network structure diagram with node and connection edge information is presented. The knowledge map can be applied to a plurality of fields, such as medical treatment, military affairs, WeChat, finance, construction and the like, and is an indispensable important technology in the modern society. With the introduction of knowledge graphs, knowledge graph-based question-answering techniques have been developed, and more industries have no way to provide automatic question-answering techniques supported by natural language processing and knowledge graphs. The knowledge base established based on the knowledge map is applied to a common sense automatic question-answering system, can effectively meet the intelligent development of various industries at present, and is concerned widely.
Most of the existing knowledge graph-based question-answering technologies solve simple problems, the simple problems only need to be processed through simple natural languages, then entities and predicates in question sentences are identified, and answers can be found in the knowledge graphs after the entities and predicates are converted into query languages. Knowledge-graph question-answering techniques that solve simple problems cannot solve complex problems. In addition to solving a simple question-answering system, few searching technologies like query graph-based can solve complex problems, but the technology has the problems of large calculation amount, difficulty in accurately pruning and the like in the process.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a knowledge graph common sense question-answering method based on staged query, which comprises the following steps: obtaining question sentences, preprocessing the question sentences and converting the preprocessed question sentences into question sentence sequences; inputting the question sequence into a trained improved question-answer model to obtain a question-answer result; the improved question-answering model comprises an entity recognition model, a constraint language recognition model and a question structure classification model;
the process of training and building the improved question-answering model comprises the following steps:
s1: acquiring an original question data set, and preprocessing data in the data set to obtain a training set;
s2: inputting the data in the training set into the trained entity recognition model to obtain data of marked entities;
s3: inputting the data of the marked entity into a trained constraint language recognition model to obtain the data of the marked entity and the constraint condition;
s4: inputting the data marked with the entities and the constraint conditions into a problem structure classification model for classification, and classifying the data according to question classification results; establishing a problem classification list and a semantic structure tree template list according to the classification result;
s5: processing the subject, the number of the constraint words and the hierarchical structure of the constraint words in each problem sentence in the problem classification list by adopting a semantic structure tree template list to obtain the semantic structure trees of various problem templates;
s6: respectively inquiring and updating each node in the answer searching module by adopting a knowledge graph; inputting semantic structure trees of various question templates into an updated answer searching module, and when a node to be determined is detected to be a leaf node, determining the node to be determined to be an answer to the question;
s7: and after all the undetermined nodes are updated, the updated explanation of each undetermined node is used as a question answering step and returned together with the answer of the question, and the explanation is used as the answer of the input question, so that the training of the model is completed.
Preferably, the process of preprocessing the question statement includes: and removing special characters in the original question data set, deleting repeated question data, and performing word segmentation operation on the question to obtain a training set.
Preferably, the entity recognition model comprises a BERT model, a two-way long-short memory neural network model and a conditional random field; the process of training the entity recognition model comprises the following steps: acquiring text sequence data, and performing word segmentation processing on the text sequence to obtain a word segmentation text sequence; inputting the word segmentation text sequence into a BERT model for semantic feature learning to obtain a corresponding word vector; inputting the word vectors into a bidirectional long and short memory neural network model (BilSTM), processing context information of each word vector in a forward direction and a backward direction by the LSTM, and combining output information at the same time to obtain sequence information; decoding the sequence information of the BilSTM module by adopting a CRF module to obtain a prediction labeling sequence; extracting entities of the prediction labeling sequence, and classifying the extracted entities; and calculating the accuracy of entity classification, comparing the calculated accuracy with the set accuracy, finishing the training of the entity model if the calculated accuracy is greater than the set accuracy, otherwise, adjusting the parameters of the model, and re-training the model until the calculated accuracy is greater than the set accuracy.
Further, the method for calculating the accuracy of entity classification comprises the following steps: inputting the test set into the entity model to obtain the accuracy of the entity identified by the current entity model; the formula for calculating the entity classification accuracy is as follows:
Figure BDA0003023902710000031
wherein, TP is the correct matching number, FP is incorrect, FN is the number which does not find the correct match, and TN is the correct non-matching number.
Preferably, the constraint language recognition model comprises an attention mechanism, a bidirectional long and short memory neural network model and a conditional random field; the process of processing the input question sequence by adopting the constraint language recognition model comprises the following steps: obtaining the dependency relationship inside the sentence through a bidirectional recurrent neural network; selecting and extracting vector features from the dependence relationship in the sentence by adopting an attention mechanism; returning the extracted vector features to a maximized labeling path through a CRF layer to complete the extraction of question constraint words.
Preferably, the problem structure classification model comprises an input layer, a hidden layer and an output layer; inputting the data marked with the entities and the constraint conditions into an input layer to be converted into vector representation; inputting the data converted into vector representation into a hidden layer to calculate semantic structure characteristics to obtain question sequences with the same or similar classification structures; and finally, outputting the probability of the category to which each question sequence belongs through a fully-connected softmax layer, and classifying according to the score with the maximum probability to which the question sequence belongs.
Preferably, the process of obtaining the question semantic structure tree includes: establishing a semantic structure tree according to the subject and the constraint words of various question templates, wherein the established rule is as follows:
(1) the information contained in the root node of the semantic structure tree is a subject;
(2) the number of the nodes to be determined is equal to the number of the nodes of the constraint words;
(3) one constraint language node and one corresponding undetermined node are brother nodes, and the father nodes of the two nodes are the undetermined nodes or root nodes on the upper layer;
(4) if the constraint language node is the last node in the problem module, the node to be determined at the same layer as the constraint language node is a leaf node.
Preferably, the process of searching the answer of the node to be determined of the semantic structure tree according to the knowledge graph includes: searching a node D to be determinediAccording to its parent node, constraint term node ViAnd object information into a triplet [ E ]1/Di-1,Vi,m]Wherein m represents target information; converting the triple into an SPARQL statement; using father node as positioning search point, adopting knowledge graph to restrain language node ViMatching to obtain the connection relation between the constraint word nodes and the positioning search points; searching and constraining language node V according to connection relationiIs expressed synonymously, and returns the found and ViAnd related node information, wherein the information is an answer obtained by one query.
A knowledge-graph common sense question-answering system based on staged query, the system comprising: the system comprises a knowledge map building module, a user interaction module, a knowledge base module, a question classification list module, a question template list module and a question-answering model module;
the knowledge base construction module is used for constructing a knowledge graph, and the construction of the knowledge graph is completed through operations such as data collection, data preprocessing, named entity identification, relation extraction, data cleaning, data fusion and the like;
the user interaction module is used for receiving questions input by a user and returning answers and explanations of the corresponding questions;
the knowledge base module is used for storing data of the knowledge map as a data source of the answer to the question;
the problem classification list and the problem template list module are respectively used for storing various problem lists classified based on a neural network model and problem templates based on various problems;
the question-answer model module is used for analyzing question sentences, inputting original question sentences and inputting answers based on a knowledge base.
The invention has the following advantages: the method is characterized in that a complex problem or a simple problem is converted into a question semantic structure tree based on a statement structure, answers to the problem are searched step by updating nodes to be determined, and the searching process is simplified from complexity to simplicity. The method can also simultaneously process complex problems and simple problems, and has more comprehensive functionality.
Drawings
FIG. 1 is a flow chart of a knowledge-graph common sense question-answering method based on staged query, which is disclosed by the invention;
FIG. 2 is a schematic diagram of a semantic tree of a question in a knowledge-graph common sense question-and-answer method based on staged query, according to the present invention;
fig. 3 is a schematic structural diagram of a knowledge-graph general knowledge question-answering device based on staged query, which is disclosed by the invention.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings, and the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without inventive effort based on the embodiments of the present invention, are within the scope of the present invention.
A knowledge graph common sense question-answering method based on staged query comprises the following steps: obtaining question sentences, preprocessing the question sentences and converting the preprocessed question sentences into question sentence sequences; inputting the question sequence into a trained improved question-answer model to obtain a question-answer result; the improved question-answering model comprises an entity recognition model, a constraint language recognition model and a question structure classification model.
A specific embodiment of a knowledge-graph general-sense question-answering method based on staged query is shown in fig. 1, and the method obtains an answer to a question by analyzing the question and combining knowledge-graph contents, and comprises the following steps: acquiring an input problem, and performing simple natural language processing; inputting the question sequence into the entity recognition model to recognize the subject in the question; inputting the question sequence of the identified subject into a constraint language identification model, and searching for a constraint language in the question and predicting corresponding synonyms and synonymous expressions of the constraint language; training a problem structure classification model, and finding a corresponding problem template for the target problem statement; obtaining a problem semantic tree through a semantic tree construction module by using a problem template; the problem semantic tree input node searching module searches the answers of each layer of nodes to be determined from top to bottom in the knowledge graph, and the nodes to be determined are updated into the searched and returned answers until the last node to be determined is searched and updated; and inputting the problem semantic tree with all the undetermined nodes updated into a problem answer returning module, and returning the updated explanation of each undetermined node as a problem answer step together with the answer of the problem as the answer of the input problem.
A specific embodiment for training and building an improved question-answering model comprises the following steps:
s1: acquiring an original question data set, and preprocessing data in the data set to obtain a training set;
s2: inputting the data in the training set into the trained entity recognition model to obtain data of marked entities;
s3: inputting the data of the marked entity into a trained constraint language recognition model to obtain the data of the marked entity and the constraint condition;
s4: inputting the data marked with the entities and the constraint conditions into a problem structure classification model for classification, and classifying the data according to question classification results; establishing a problem classification list and a semantic structure tree template list according to the classification result;
s5: processing the subject, the number of the constraint words and the hierarchical structure of the constraint words in each problem sentence in the problem classification list by adopting a semantic structure tree template list to obtain the semantic structure trees of various problem templates;
s6: respectively inquiring and updating each node in the answer searching module by adopting a knowledge graph; inputting semantic structure trees of various question templates into an updated answer searching module, and when a node to be determined is detected to be a leaf node, determining the node to be determined to be an answer to the question;
s7: and after all the undetermined nodes are updated, the updated explanation of each undetermined node is used as a question answering step and returned together with the answer of the question, and the explanation is used as the answer of the input question, so that the training of the model is completed.
Preprocessing the data in the dataset includes simple natural language processing of the data; the process of performing simple natural language processing includes: and removing the special characters and performing word segmentation operation processing. Specifically, special characters such as #, "%" and the like in the question sentence are removed, and word segmentation operation is carried out through a word segmentation mechanism, so that a word segmentation text sequence of the question sentence is obtained. The word segmentation mechanism used can be a jieba word segmentation tool or the like.
The entity recognition model comprises a BERT model, a bidirectional long and short memory neural network model (BilSTM) and a Conditional Random Field (CRF). The process of training the solid model comprises the following steps: acquiring text sequence data, and performing word segmentation processing on the text sequence to obtain a word segmentation text sequence; inputting the word segmentation text sequence into a BERT model for semantic feature learning to obtain a corresponding word vector; inputting the word vectors into a bidirectional long and short memory neural network model (BilSTM), processing context information of each word vector in a forward direction and a backward direction by the LSTM, and combining output information at the same time to obtain sequence information; calculating the score of each label of the output sequence information of the BilSTM module by adopting a CRF module, and taking the label sequence with the highest score as output to obtain a prediction labeling sequence; extracting entities of the prediction labeling sequence, and classifying the extracted entities; and calculating the accuracy of entity classification, comparing the calculated accuracy with the set accuracy, finishing the training of the entity model if the calculated accuracy is greater than the set accuracy, otherwise, adjusting the parameters of the model, and re-training the model until the calculated accuracy is greater than the set accuracy.
The specific process of inputting the text sequence into the BERT model for semantic feature learning comprises the following steps: and inputting the word segmentation text sequence into a BERT model, and outputting a corresponding word vector. Specifically, firstly, carrying out whole-word Mask on a text sequence; acquiring Embedding of each word of the sequence through word Embedding; inputting the sequence vector into a bidirectional Transformer structure with an Attention mechanism to perform feature extraction; an Attention mechanism in a transform structure adjusts a weight coefficient matrix through the association degree between words in the same sentence to obtain the representation of the words, and finally obtains a sequence vector containing rich semantic features.
The bidirectional long and short memory neural network model consists of a forgetting gate, an input gate, an output gate and a Cell structure. Processing the sequence vector containing rich semantic features by adopting a bidirectional long-short memory neural network model, wherein the specific process of acquiring sequence information comprises the steps of processing the sequence vector by adopting an input gate and a forgetting gate of a BilSTM, discarding useless sequence information and reserving useful information; in the process of processing the sequence by adopting the bidirectional long-short memory neural network model, the context information of each word vector is processed by the forward LSTM and the backward LSTM, and the output information at the same time is merged to obtain the sequence information.
The specific process of decoding the output result of the BilSTM module by adopting the CRF module comprises the step of obtaining an optimal prediction sequence through the relation of adjacent labels, and the defect that the BilSTM cannot obtain the dependency relation of the adjacent labels can be overcome through the prediction sequence.
Setting the accuracy of the model in the process of classifying the extracted entities; in the process of training the entity recognition model, when a preset accuracy rate is reached, the model training is completed. In the process of training an entity recognition model, a data set of about 10 ten thousand question sentences in a related field is required to be prepared and divided into a training set and a test set according to the proportion of 8:2, after data in the training set is input into the model for training, the test set is required to be used for verifying the performance of the entity recognition model, and when the accuracy reaches a preset accuracy, the trained model is used as a question entity recognition model; if the effect of the trained model does not reach the preset value, the parameters of the model are adjusted to optimize the model until the preset accuracy is reached.
The method for calculating the accuracy of entity classification comprises the following steps: inputting the test set into the entity model to obtain the accuracy of the entity identified by the current entity model; the formula for calculating the entity classification accuracy is as follows:
Figure BDA0003023902710000071
where TP indicates the number of correct matches, FP indicates incorrect matches, FN indicates the number of incorrect matches found, and TN indicates the number of correct non-matches.
Preferably, the set accuracy is 90%.
The constraint language recognition model consists of an Attention mechanism (Attention mechanism), a bidirectional long and short memory neural network model (BilSTM) and a Conditional Random Field (CRF). Obtaining the dependency relationship inside the sentence through a bidirectional recurrent neural network, then selecting abstract features by using an attention mechanism, and finally returning a maximized labeling path through a CRF layer. Similar to the entity recognition model, question sentences in related fields are divided into a training set and a test set according to the proportion (8:2) and input into the model for training, and the training can be used after the training reaches a preset accuracy rate.
The process of specifically training the constraint speech recognition model comprises the following steps: taking question sentences as input, processing by using a word embedding technology, and inputting the processed question sentences into the BiTSTM; for a sentence containing n words, the question sentence is input into the forward LSTM model, which outputs a forward hidden state sequence of (h)1,h2,…,hn) (ii) a The question sentence is input into the backward LSTM model, and the output reverse hidden state sequence is (h)1′,h2′,…,hn') hidden states output at the corresponding positions and concatenated by position hi=[hi,hi′]∈RmObtaining the complete hidden state sequence (h)1,h2,…,hn)∈Rn×m(ii) a Wherein h isiAnd hi' Single tag, R, representing the sequence of hidden states output by the forward and backward LSTMs at the corresponding position i, respectivelymDenotes a list of m numbers obtained by merging the same positions, Rn×mTo representAn n m matrix.
Setting an Attention mechanism to obtain a focus word in a sequence, inputting the focus word consisting of query, key and value, performing dot product calculation, executing an Attention function in parallel to generate a dv-dimensional output value, repeating the process for h times, and finally splicing the results together and inputting the results into the next layer to generate a final value; where query represents an element, key represents an address, value represents a value, and dv represents the dimension of the output.
The CRF layer needs to input the prediction score of each label in the labeling sequence, and calculates the maximized output path by using a dynamic programming algorithm through a label probability transition matrix.
Aiming at a knowledge graph system in a field, a high-quality synonym or synonym phrase list aiming at a constraint phrase is established in advance, and the constraint phrases expressing the same meaning are classified into one class by utilizing a neural network model. After the constraint words of the question are identified, the synonymy expression can be used for candidate relation words of the triple search answers by searching the synonymy expression in the synonymy list.
The problem structure classification model comprises an input layer, a hidden layer and an output layer; inputting the data marked with the entities and the constraint conditions into an input layer to be converted into vector representation; inputting the data converted into vector representation into a hidden layer to calculate semantic structure characteristics to obtain question sequences with the same or similar classification structures; and finally, outputting the probability of the category to which each question sequence belongs through a fully-connected softmax layer, and classifying according to the score with the maximum probability to which each question sequence belongs.
Training a problem structure classification model, wherein the process of finding a corresponding problem template for a target problem statement comprises the following steps:
step 1: and establishing a problem structure classification model built by a neural network. Training a problem structure classification model by using a data set in an entity recognition model, marking out entities and constraint words in problem sentences by using the trained entity recognition model and constraint word recognition model before inputting into a neural network, and only paying attention to the construction of the problem sentence structure during training classification. The problem result classification model is composed of an input layer, a hidden layer and an output layer, input training set data is used as a model for training, the accuracy of the model is verified by using a test set during training, if the accuracy of the model is not increased for a certain period of time, the current model is stored or the model with the highest accuracy is selected as a problem classification model until the training is completed.
Step 2: and establishing all question templates based on the question sentences in advance. Based on the question sentences, a template containing all question types needs to be constructed, such as "is the word number of the author of poetry" the three gorges "? ", the module of this problem is Q (E)1+V1+V2) In which EiStands for subject, VjRepresenting a constraint word. The problem module is formulated according to the problem structure and the constraint word priority.
And during classification, the number of the subject and the constraint words and the structure of each question are mainly considered, the question sentences of the same class are classified into one class, and a template capable of expressing the question sentence structure and the number of the subject and the constraint words is constructed.
The specific process of obtaining the problem semantic tree through the semantic tree construction module by using the problem template comprises the following steps:
step 1, building a semantic tree corresponding to each question structure classification in advance, if the question template is Q (E) as described above1+V1+V2) The semantic structure tree diagram is shown in fig. 2. Because the structure of each question statement is different from the constraint words, a semantic structure tree can be built. In the problem module, the sequence numbers of the subject and the constraint words are determined, and a semantic structure tree is built through the sequence numbers. The construction rules are as follows:
(1) the information contained in the root node of the semantic structure tree is a subject;
(2) the number of the nodes to be determined is equal to the number of the nodes of the constraint words;
(3) one constraint language node and one corresponding undetermined node are brother nodes, and the father node of the constraint language node and the corresponding undetermined node is a last layer of undetermined node or a root node;
(4) if the constraint language node is the last node in the problem module, the undetermined node on the same layer as the constraint language node has no child node and is a leaf node.
And 2, after the problem semantic structure tree is matched, generating the semantic structure tree of the problem statement only by updating the information of the subject nodes and the constraint language nodes of the semantic structure tree. The structure of a semantic structure tree already exists, and then the information of a root node is updated to be subject, and each layer of constraint language node is updated to be constraint language information.
The process of searching the answer of the undetermined node of the semantic structure tree by the known graph spectrum comprises the following steps: searching a node D to be determinediAccording to its parent node, constraint term node ViAnd object information into a triplet [ E ]1/Di-1,Vi,m]Wherein m represents target information; converting the triple into an SPARQL statement; using father node as positioning search point, adopting knowledge graph to restrain language node ViMatching to obtain the connection relation between the constraint word nodes and the positioning search points; searching and constraining language node V according to connection relationiAnd returns the found and ViAnd related node information, wherein the information is an answer obtained by one query. Inputting the question semantic tree into a node searching module, wherein the process of searching the answer of each layer of undetermined nodes from top to bottom in the knowledge graph comprises the following steps:
step 1, searching a node D to be determinediAccording to its parent node (subject E)1Or a node D to be determinedi-1) Constraint term node ViAnd the target information m form a triplet [ E ]1/Di-1,Vi,m]。
And 2, converting the triples into SPARQL sentences after the triples are obtained. E1/Di-1Locating a search point, ViMatching the relation of knowledge graph with search point connection, combining ViIs expressed synonymously with ViThe relevant node information is the answer to one query.
A knowledge-graph common sense question-answering system based on staged query, as shown in fig. 3, the system comprising: the system comprises a knowledge map building module, a user interaction module, a knowledge base module, a question classification list and question template list module and a question-answering model module;
the knowledge base construction module is used for constructing a knowledge graph, and the construction of the knowledge graph is completed through operations of data collection, data preprocessing, named entity identification, relation extraction, data cleaning, data fusion and the like;
the user interaction module is used for receiving the questions input by the user and returning answers and explanations of the corresponding questions;
the knowledge base module is used for storing data of the knowledge map as a data source of the answer to the question;
the problem classification list and the problem template list module are respectively used for storing various problem lists classified based on a neural network model and problem templates based on various problems;
the question-answer model module is used for analyzing question sentences, inputting original question sentences and inputting answers based on a knowledge base.
The embodiments of the system of the present invention are similar to the embodiments of the method of the present invention.
The above-mentioned embodiments, which further illustrate the objects, technical solutions and advantages of the present invention, should be understood that the above-mentioned embodiments are only preferred embodiments of the present invention, and should not be construed as limiting the present invention, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (6)

1. A knowledge graph common sense question-answering method based on staged query is characterized by comprising the following steps: obtaining question sentences, preprocessing the question sentences and converting the preprocessed question sentences into question sentence sequences; inputting the question sequence into a trained improved question-answer model to obtain a question-answer result; the improved question-answering model comprises an entity recognition model, a constraint language recognition model and a question structure classification model;
the process of training and building the improved question-answering model comprises the following steps:
s1: acquiring an original question data set, and preprocessing data in the data set to obtain a training set;
s2: inputting the data in the training set into the trained entity recognition model to obtain data of marked entities;
s3: inputting the data of the marked entity into a trained constraint language recognition model to obtain the data of the marked entity and the constraint condition;
s4: inputting the data marked with the entities and the constraint conditions into a problem structure classification model for classification, and classifying the data according to question classification results; establishing a problem classification list and a semantic structure tree template list according to the classification result;
s5: processing the subject, the number of the constraint words and the hierarchical structure of the constraint words in each problem sentence in the problem classification list by adopting a semantic structure tree template list to obtain the semantic structure trees of various problem templates; the rule for constructing the semantic structure tree is as follows: a. the information contained in the root node of the semantic structure tree is a subject; b. the number of the nodes to be determined is equal to the number of the nodes of the constraint words; c. one constraint language node and one corresponding undetermined node are brother nodes, and the father nodes of the two nodes are the undetermined nodes or root nodes on the upper layer; d. if the constraint language node is the last node in the problem module, the undetermined node on the same layer as the constraint language node is a leaf node;
s6: respectively inquiring and updating each node in the semantic structure tree of each problem template by using a knowledge graph, and when detecting that the node to be determined is a leaf node, determining the node to be determined as an answer to the problem;
the process of searching the answer of the undetermined node of the semantic structure tree according to the knowledge graph comprises the following steps: searching a node D to be determinediAccording to its parent node, constraint term node ViAnd object information into a triplet [ E ]1/Di-1,Vi,m]Wherein m represents target information; converting the triple into a SPARQL statement; using father node as positioning search point, adopting knowledge graph to restrain language node ViMatching to obtain the connection relation between the constraint word nodes and the positioning search points; searching and constraining language node V according to connection relationiAnd returns the found and ViRelated node information, the informationAn answer obtained for a query;
s7: after all the nodes to be determined are updated, the updated explanation of each node to be determined is used as a question answering step and returned together with the answer of the question as the answer of the input question, and the model training is completed.
2. The knowledge-graph common-sense question-answering method based on staged query according to claim 1, characterized in that the entity recognition model comprises a BERT model, a two-way long-short memory neural network model and a conditional random field; the process of training the entity recognition model comprises the following steps: acquiring text sequence data, and performing word segmentation processing on the text sequence to obtain a word segmentation text sequence; inputting the word segmentation text sequence into a BERT model for semantic feature learning to obtain a corresponding word vector; inputting the word vectors into a bidirectional long and short memory neural network model BilTM, processing context information of each word vector in a forward direction and a backward direction with the LSTM, and combining output information at the same moment to obtain sequence information; calculating the score of each label of the output sequence information of the BilSTM module by adopting a CRF module, and taking the label sequence with the highest score as output to obtain a prediction labeling sequence; extracting entities of the prediction labeling sequence, and classifying the extracted entities; and calculating the accuracy of entity classification, comparing the calculated accuracy with the set accuracy, finishing the training of the entity model if the calculated accuracy is greater than the set accuracy, otherwise, adjusting the parameters of the model, and re-training the model until the calculated accuracy is greater than the set accuracy.
3. The knowledge-graph common sense question-answering method based on staged query according to claim 2, wherein the method for calculating the accuracy of entity classification comprises: inputting the test set into the entity model to obtain the accuracy of the entity identified by the current entity model; the formula for calculating the entity classification accuracy is as follows:
Figure FDA0003659468340000021
where TP indicates the number of correct matches, FP indicates incorrect matches, FN indicates the number of incorrect matches found, and TN indicates the number of correct non-matches.
4. The knowledge-graph common-sense question-answering method based on staged query according to claim 1, wherein the constraint language identification model comprises an attention mechanism, a two-way long-short memory neural network model and a conditional random field; the process of processing the input question sequence by adopting the constraint language recognition model comprises the following steps: obtaining the dependency relationship inside the sentence through a bidirectional recurrent neural network; selecting and extracting vector features from the dependence relationship in the sentence by adopting an attention mechanism; returning the extracted vector features to a maximized labeling path through a CRF layer to complete the extraction of question constraint words.
5. The knowledge-graph common sense question-answering method based on staged query according to claim 1, wherein the question structure classification model comprises an input layer, a hidden layer and an output layer; inputting the data marked with the entities and the constraint conditions into an input layer to be converted into vector representation; inputting the data converted into vector representation into a hidden layer to calculate semantic structure characteristics to obtain question sequences with the same or similar classification structures; and finally, outputting the probability of the category to which each question sequence belongs through a fully-connected softmax layer, and classifying according to the score with the maximum probability to which the question sequence belongs.
6. A knowledge-graph general-knowledge question-answering system based on staged query is used for executing the knowledge-graph general-knowledge question-answering method based on staged query according to claim 1, and is characterized by comprising a knowledge-graph building module, a user interaction module, a knowledge base module, a question classification list module, a question template list module and a question-answering model module;
the knowledge base construction module is used for constructing a knowledge graph, and the construction of the knowledge graph is completed through data collection, data preprocessing, named entity identification, relation extraction, data cleaning and data fusion operation;
the user interaction module is used for receiving questions input by a user and returning answers and explanations of the corresponding questions;
the knowledge base module is used for storing data of the knowledge map as a data source of the answer to the question;
the problem classification list and the problem template list module are respectively used for storing various problem lists classified based on a neural network model and problem templates based on various problems;
the question-answer model module is used for analyzing question sentences, inputting original question sentences and inputting answers based on a knowledge base.
CN202110410370.2A 2021-04-16 2021-04-16 Knowledge graph common sense question-answering method and system based on staged query Expired - Fee Related CN112989005B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110410370.2A CN112989005B (en) 2021-04-16 2021-04-16 Knowledge graph common sense question-answering method and system based on staged query

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110410370.2A CN112989005B (en) 2021-04-16 2021-04-16 Knowledge graph common sense question-answering method and system based on staged query

Publications (2)

Publication Number Publication Date
CN112989005A CN112989005A (en) 2021-06-18
CN112989005B true CN112989005B (en) 2022-07-12

Family

ID=76340766

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110410370.2A Expired - Fee Related CN112989005B (en) 2021-04-16 2021-04-16 Knowledge graph common sense question-answering method and system based on staged query

Country Status (1)

Country Link
CN (1) CN112989005B (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113449117B (en) * 2021-06-24 2023-09-26 武汉工程大学 Bi-LSTM and Chinese knowledge graph based compound question-answering method
CN113468304A (en) * 2021-06-28 2021-10-01 哈尔滨工程大学 Construction method of ship berthing knowledge question-answering query system based on knowledge graph
CN113449038B (en) * 2021-06-29 2024-04-26 东北大学 Mine intelligent question-answering system and method based on self-encoder
CN113722452B (en) * 2021-07-16 2024-01-19 上海通办信息服务有限公司 Semantic-based rapid knowledge hit method and device in question-answering system
CN113742447B (en) * 2021-07-19 2024-04-02 暨南大学 Knowledge graph question-answering method, medium and equipment based on query path generation
CN113468311B (en) * 2021-07-20 2023-09-19 四川启睿克科技有限公司 Knowledge graph-based complex question and answer method, device and storage medium
CN113626574B (en) * 2021-08-19 2023-08-29 成都数联云算科技有限公司 Information query method, system and device and medium
CN113779220B (en) * 2021-09-13 2023-06-23 内蒙古工业大学 Mongolian multi-hop question-answering method based on three-channel cognitive map and graph annotating semantic network
CN113918694B (en) * 2021-10-08 2024-04-16 武汉科技大学 Question analysis method for medical knowledge graph questions and answers
CN114490928B (en) * 2021-12-31 2023-03-24 广州探迹科技有限公司 Implementation method, system, computer equipment and storage medium of semantic search
CN115033657B (en) * 2022-08-10 2023-01-31 广东美的暖通设备有限公司 Inquiry method, device and equipment based on knowledge graph and storage medium
CN115577124B (en) * 2022-11-10 2023-04-07 上海朝阳永续信息技术股份有限公司 Method, apparatus and medium for interacting financial data
CN115858760A (en) * 2023-03-02 2023-03-28 广州嘉为科技有限公司 Knowledge graph question-answer reasoning method, device and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109271506A (en) * 2018-11-29 2019-01-25 武汉大学 A kind of construction method of the field of power communication knowledge mapping question answering system based on deep learning
CN109284363A (en) * 2018-12-03 2019-01-29 北京羽扇智信息科技有限公司 A kind of answering method, device, electronic equipment and storage medium
CN109492077A (en) * 2018-09-29 2019-03-19 北明智通(北京)科技有限公司 The petrochemical field answering method and system of knowledge based map
CN109992658A (en) * 2019-04-09 2019-07-09 智言科技(深圳)有限公司 A kind of SPARQL inquiring structuring method of Knowledge driving
CN110555153A (en) * 2019-08-20 2019-12-10 暨南大学 Question-answering system based on domain knowledge graph and construction method thereof
CN111339269A (en) * 2020-02-20 2020-06-26 来康科技有限责任公司 Knowledge graph question-answer training and application service system with automatically generated template
CN112328766A (en) * 2020-11-10 2021-02-05 四川长虹电器股份有限公司 Knowledge graph question-answering method and device based on path search
WO2021054514A1 (en) * 2019-09-18 2021-03-25 주식회사 솔트룩스 User-customized question-answering system based on knowledge graph

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109492077A (en) * 2018-09-29 2019-03-19 北明智通(北京)科技有限公司 The petrochemical field answering method and system of knowledge based map
CN109271506A (en) * 2018-11-29 2019-01-25 武汉大学 A kind of construction method of the field of power communication knowledge mapping question answering system based on deep learning
CN109284363A (en) * 2018-12-03 2019-01-29 北京羽扇智信息科技有限公司 A kind of answering method, device, electronic equipment and storage medium
CN109992658A (en) * 2019-04-09 2019-07-09 智言科技(深圳)有限公司 A kind of SPARQL inquiring structuring method of Knowledge driving
CN110555153A (en) * 2019-08-20 2019-12-10 暨南大学 Question-answering system based on domain knowledge graph and construction method thereof
WO2021054514A1 (en) * 2019-09-18 2021-03-25 주식회사 솔트룩스 User-customized question-answering system based on knowledge graph
CN111339269A (en) * 2020-02-20 2020-06-26 来康科技有限责任公司 Knowledge graph question-answer training and application service system with automatically generated template
CN112328766A (en) * 2020-11-10 2021-02-05 四川长虹电器股份有限公司 Knowledge graph question-answering method and device based on path search

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
"Complex Sequential Question Answering: Towards Learning to Converse Over Linked Question Answer Pairs with a Knowledge Graph";Amrita Saha 等;《Proceedings of the AAAI Conference on Artificial Intelligence》;20180425;第32卷(第1期);705-713 *
"基于语义模板的问答系统研究";梁正平 等;《深圳大学学报(理工版)》;20070731(第03期);281-285 *
"针对复杂问题优化的知识图谱问答系统的研究和实现";童培豪;《中国优秀硕士学位论文全文数据库 信息科技辑》;20190915(第09期);I138-1290 *
"针对复杂问题的知识图谱问答KBQA最新进展调研";阿里云小蜜开发者社区;《https://developer.aliyun.com/article/775683》;20201014;1-23 *
"面向通信领域术语的命名实体识别";张晨;《中国优秀硕士学位论文全文数据库 信息科技辑》;20200215(第02期);I136-210 *

Also Published As

Publication number Publication date
CN112989005A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
CN112989005B (en) Knowledge graph common sense question-answering method and system based on staged query
CN111639171B (en) Knowledge graph question-answering method and device
CN111931506B (en) Entity relationship extraction method based on graph information enhancement
CN109460459B (en) Log learning-based dialogue system automatic optimization method
CN113010693A (en) Intelligent knowledge graph question-answering method fusing pointer to generate network
CN112541356B (en) Method and system for recognizing biomedical named entities
CN111914556B (en) Emotion guiding method and system based on emotion semantic transfer pattern
CN113505200B (en) Sentence-level Chinese event detection method combined with document key information
CN114943230B (en) Method for linking entities in Chinese specific field by fusing common sense knowledge
CN110782892B (en) Voice text error correction method
CN111339269A (en) Knowledge graph question-answer training and application service system with automatically generated template
CN113505209A (en) Intelligent question-answering system for automobile field
CN112328800A (en) System and method for automatically generating programming specification question answers
CN111858896B (en) Knowledge base question-answering method based on deep learning
CN115599902B (en) Oil-gas encyclopedia question-answering method and system based on knowledge graph
CN115599899B (en) Intelligent question-answering method, system, equipment and medium based on aircraft knowledge graph
CN109872775B (en) Document labeling method, device, equipment and computer readable medium
CN112364132A (en) Similarity calculation model and system based on dependency syntax and method for building system
CN113821605A (en) Event extraction method
CN110968708A (en) Method and system for labeling education information resource attributes
CN113971394A (en) Text repeat rewriting system
CN111666374A (en) Method for integrating additional knowledge information into deep language model
CN114579705A (en) Learning auxiliary method and system for education of sustainable development
CN117648429A (en) Question-answering method and system based on multi-mode self-adaptive search type enhanced large model
CN113065324A (en) Text generation method and device based on structured triples and anchor templates

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20220712