A question-answering interactive method and system based on knowledge graph
Convert unstructured text into structured text through syntax analysis, speech recognition and image recognition algorithms, build a knowledge graph, and use neural network models to find answers, which solves the problem of difficult unstructured document query in the existing technology and achieves Highly accurate question and answer interaction.
Patent Information
- Application Number
- CN202210072483.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-21
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2042-01-21
AI Technical Summary
Existing information query systems cannot effectively process and query information in unstructured documents, and due to the standardization requirements for question input forms, if questions deviate from the template, it will result in unrecognition or a serious reduction in answer accuracy.
Use syntax analysis algorithms to divide the sentence components of the input question, combine speech recognition and image recognition algorithms to convert unstructured text into structured text, extract RDF triples to build a knowledge graph, and use the trained neural network model to add data to the knowledge graph. Find the corresponding answer.
It realizes accurate information query and answer for unstructured documents, improves the accuracy of answers, and can effectively deal with the uncertainty, diversity and complexity of input questions.
Smart Images

Figure CN114461814B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence, and more specifically, relates to a question-answering interaction method and system based on knowledge graph. Background Art
[0002] As the whole society becomes more and more information-based, the ways of collecting information become more and more diversified, and the content and types of information become more and more abundant. The types of information mainly include structured files and unstructured files. Structured files can be stored in relational databases, while unstructured files cannot be stored in relational databases. Unstructured files mainly include audio files, picture files and video files.
[0003] As a simple and friendly interactive form, question-answering is gradually becoming a new trend in human-computer interaction. Existing information query systems that use question-answering are rare, and they are mainly based on structured data stored in relational databases, usually using template matching technology to decompose and match complex questions.
[0004] The information query systems in some industries need to query useful information in unstructured files, but the existing information query systems based on template matching technology cannot store unstructured files. In addition, because the question input format has a standard template, if questions deviate from the template, the question will not be recognized or the answer accuracy will be seriously reduced.
[0005] In order to facilitate the understanding of the present invention, the following explains relevant terms and related concepts:
[0006] Knowledge graph: a popular application for managing massive amounts of structured information and its ontological relationships, describing knowledge resources and their carriers, mining, analyzing, constructing, mapping and displaying knowledge and their interrelationships;
[0007] Speech recognition algorithm: commonly used algorithms for converting the vocabulary content in human speech into computer-readable input; commonly used speech recognition algorithms include: dynamic time warping algorithm (DTW), hidden Markov model algorithm (HMM), vector quantization algorithm (VQ) based on non-parametric model, SVM multi-class classification algorithm, etc.
[0008] Image recognition algorithm: an algorithm that processes and analyzes images in pictures or videos, ultimately identifies the target to be studied, and converts it into information that can be recognized by computers. Commonly used image recognition algorithms include: CNN+RNN algorithm based on CTC, CNN+RNN algorithm based on Attention;
[0009] Relation extraction algorithm: a commonly used algorithm for extracting entities and their relationships from natural language text; commonly used relationship extraction algorithms include pipeline relationship extraction algorithms;
[0010] Syntax analysis algorithm: an algorithm commonly used to identify the corresponding grammatical categories from the results of lexical analysis according to the grammatical rules of the source language and perform grammar checking at the same time; commonly used syntax analysis algorithms include the syntax analysis algorithms in the pyLtp algorithm library in the Python language;
[0011] RDF triples: entity, relationship, attribute triples; the RDF triples in the present invention include entity, relationship and attribute list;
[0012] Image file library: consists of multiple image files, each of which has a pre-set format;
[0013] Video file library: consists of multiple video files, and the duration of each video file is a preset duration;
[0014] Audio file library: consists of multiple audio files, each of which has a duration ranging from 40 seconds to 1 hour;
[0015] Structured text: text that can be represented by data or a unified structure; audio structured text, image structured text, and video structured text are all structured texts, and the text contents are different;
[0016] Neural network model: a simplified model commonly used to simulate the way the human brain processes information; the neural network model in the present invention is a 4-layer BP neural network model, including: hidden layer one (8 nodes); hidden layer two (3 nodes); hidden layer three (5 nodes); normalization layer (3 nodes); the input is divided into 6 dimensions, namely the subject, predicate, object, attributive, adverbial, and complement of the input question; the output is 3 dimensions, corresponding to the entity, relationship, and attribute list in the RFD triple;
[0017] Question: A Chinese sentence, which may contain punctuation marks;
[0018] Gradient descent method: the basic method for adjusting parameters of neural network models. Summary of the invention
[0019] In view of the defects of the prior art, the purpose of the present invention is to provide a question-answering interaction method and system based on knowledge graph, aiming to solve the problem of automatic question-answering interaction based on unstructured documents.
[0020] To achieve the above object, the present invention provides a question-answering interactive method based on knowledge graph, comprising the following steps:
[0021] (1) Keyword division steps:
[0022] Through the grammatical analysis algorithm, each input question is divided into sentence components, and any or all of the subject, predicate, object, attributive, adverbial and complement are obtained as keywords to form a word set;
[0023] (2) Question and answer interaction steps:
[0024] Inputting the word set into a trained neural network model;
[0025] The trained neural network model searches for and returns a corresponding RDF triple in the knowledge graph to obtain the correct answer to the corresponding input question;
[0026] The method for constructing the knowledge graph is as follows: extracting a number of RDF triples from each structured text in the structured text set by a relation extraction algorithm, and constructing a knowledge graph from them;
[0027] The structured text set consists of all audio structured texts, picture structured texts and video structured texts;
[0028] Each audio structured text is converted by a speech recognition algorithm from each audio file in the audio file library;
[0029] Each picture structured text is converted by using an image recognition algorithm to convert each picture file in the picture file library;
[0030] Each video structured text is converted by using an image recognition algorithm to transform each video file in the video file library.
[0031] Preferably, the process of constructing the knowledge graph is:
[0032] (1) Extract RDF:
[0033] By using a relation extraction algorithm, a plurality of RDF triples are extracted from each structured text in the structured text set;
[0034] (2) Generate storage unit:
[0035] Each structured text corresponds to a storage unit, and the storage unit contains the plurality of RDF triples;
[0036] (3) Generate knowledge graph:
[0037] The data in all storage units constitute the knowledge graph.
[0038] Preferably, the process of training the neural network model is:
[0039] (1) Using a grammatical analysis algorithm, each question in a preset question set is divided according to sentence components, and any or all of the subject, predicate, object, attributive, adverbial, and complement are obtained as keywords to form a keyword set; a keyword set and the correct answer to the corresponding question constitute a sample, and all samples constitute a training set; the correct answer is a preset RDF triple;
[0040] (2) inputting an untrained sample in the training set into the neural network model; the neural network model outputs a predicted answer; and calculating an error value based on the predicted answer and the correct answer in the sample;
[0041] (3) Determine whether the neural network model has reached a preset pass rate based on the error value. If so, the neural network model is considered to have been trained and the process ends. Otherwise, adjust the parameter weights using the gradient descent method and proceed to process (2).
[0042] Preferably, the pre-set question set and correct answers are set according to the structured text set.
[0043] The present invention provides a question-answering interactive system based on knowledge graph, comprising the following modules:
[0044] Structured text conversion module:
[0045] Used to convert each audio file in the audio file library, each picture file in the picture file library, and each video file in the video file library into an audio structured text, a picture structured text, and a video structured text, respectively;
[0046] The audio structured text is converted by a speech recognition algorithm; the picture structured text and the video structured text are both converted by an image recognition algorithm;
[0047] Knowledge graph building blocks:
[0048] Used to extract a number of RDF triples from each structured text in the structured text set by using a relation extraction algorithm; and construct a knowledge graph from them;
[0049] Keyword segmentation module:
[0050] Through the grammatical analysis algorithm, each input question is divided into sentence components, and any or all of the subject, predicate, object, attributive, adverbial and complement are obtained as keywords to form a word set;
[0051] Question and answer interactive module:
[0052] Inputting the word set into a trained neural network model;
[0053] The trained neural network model searches for and returns a corresponding RDF triple in the knowledge graph to obtain the correct answer to the corresponding input question.
[0054] Preferably, the knowledge graph construction module includes the following submodules:
[0055] RDF extraction submodule:
[0056] For extracting a plurality of RDF triples from each structured text in the structured text set by using a relation extraction algorithm;
[0057] Storage unit generation submodule:
[0058] Each structured text corresponds to a storage unit, and the storage unit contains the plurality of RDF triples;
[0059] Knowledge graph generation submodule:
[0060] Used to organize the data in all storage units into a knowledge graph.
[0061] Preferably, the operation of training the neural network model is:
[0062] (1) Using a grammatical analysis algorithm, each question in a preset question set is divided according to sentence components, and any or all of the subject, predicate, object, attributive, adverbial, and complement are obtained as keywords to form a keyword set; a keyword set and the correct answer to the corresponding question constitute a sample, and all samples constitute a training set; the correct answer is a preset RDF triple;
[0063] (2) inputting an untrained sample in the training set into the neural network model; the neural network model outputs a predicted answer; and calculating an error value based on the predicted answer and the correct answer in the sample;
[0064] (3) Determine whether the neural network model has reached a preset pass rate based on the error value. If so, the neural network model is considered to have been trained and the process ends. Otherwise, adjust the parameter weights using the gradient descent method and proceed to operation (2).
[0065] Preferably, the pre-set question set and correct answers are set according to the structured text set.
[0066] The present invention provides a question-answering interaction device based on a knowledge graph, comprising a memory and a processor; the memory is used to store a computer program; the processor is used to implement the question-answering interaction method based on the knowledge graph as described above when executing the computer program.
[0067] The present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the question-answering interaction method based on the knowledge graph as described above is implemented.
[0068] Compared with the prior art, the above technical solution conceived by the present invention converts unstructured text into structured text through speech recognition algorithm and image recognition algorithm, and extracts DF triples from it to construct knowledge graph, so that the unstructured text is stored in the form of knowledge graph; the present invention searches and returns the RDF triples corresponding to the input question in the knowledge graph through the trained neural network model, thereby ensuring the accuracy of the answer;
[0069] The present invention divides each question in the question set into subject, predicate, object, attributive, adverbial and complement through a grammatical analysis algorithm, and constructs a training set together with the answers corresponding to the questions, and uses the training set to train the neural network model; the training method enables the trained neural network model to be quickly mapped to the corresponding triples of the knowledge graph according to the input questions, and can effectively deal with the uncertainty, diversity and complexity of the input questions. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 It is a flowchart of a question-answering interaction method based on a knowledge graph provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0071] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0072] like Figure 1 As shown, this embodiment provides a question-answering interaction method based on a knowledge graph, comprising the following steps:
[0073] (1) Keyword division steps:
[0074] Through the grammatical analysis algorithm, each input question is divided into sentence components, and any or all of the subject, predicate, object, attributive, adverbial and complement are obtained as keywords to form a word set;
[0075] (2) Question and answer interaction steps:
[0076] Input the word set into the trained neural network model;
[0077] The trained neural network model searches for and returns a corresponding RDF triple in the knowledge graph to obtain the correct answer to the corresponding input question;
[0078] The method for constructing a knowledge graph is as follows: a number of RDF triples are extracted from each structured text in the structured text set through a relationship extraction algorithm, and a knowledge graph is constructed from them; the knowledge graph is stored in a Neo4j database.
[0079] The structured text set consists of all audio structured texts, image structured texts, and video structured texts;
[0080] Each audio structured text is converted by using a speech recognition algorithm to transform each audio file in the audio file library; wherein the speech recognition algorithm is a dynamic time warping algorithm (DTW);
[0081] Each image structured text is converted from each image file in the image file library through an image recognition algorithm; the image recognition algorithm is a CNN+RNN algorithm based on CTC;
[0082] Each video structured text is converted from each video file in the video file library through an image recognition algorithm. The image recognition algorithm is a CNN+RNN algorithm based on CTC;
[0083] The above conversion operation is the structural processing of unstructured files, that is, information structuring technology; it extracts key information through intelligent analysis of image files, audio files and video files, and performs semantic description of text. The structured text can show the most critical information of the original file and reduce the difficulty and capacity of orderly storage of unstructured files;
[0084] The audio file library, image file library, and video file library are stored in the MongoDB database.
[0085] This embodiment uses a trained neural network model to search and return RDF triples corresponding to the input question in the knowledge graph, thereby ensuring the accuracy of the answer.
[0086] The process of constructing a knowledge graph is as follows:
[0087] (1) Extract RDF:
[0088] Through the relation extraction algorithm, several RDF triples are extracted from each structured text in the structured text set;
[0089] (2) Generate storage unit:
[0090] Each structured text corresponds to a storage unit, which contains a number of RDF triples; it also includes the original file link corresponding to the structured text; each image file, video file or audio file in the image file library, video file library or audio file library corresponds to an original file link, and the original file link points to the corresponding image file, video file or audio file;
[0091] (3) Generate knowledge graph:
[0092] The data in all storage units constitute the knowledge graph.
[0093] This embodiment converts unstructured text into structured text through speech recognition algorithm and image recognition algorithm, and extracts RDF triples from it to construct a knowledge graph, so that the unstructured text is stored in the form of a knowledge graph.
[0094] The process of training a neural network model is:
[0095] (1) Each question in the pre-set question set is divided according to the sentence components, and any or all of the subject, predicate, object, attributive, adverbial and complement are obtained as keywords to form a keyword set; a keyword set and the correct answer to the corresponding question constitute a sample, and all samples constitute a training set; the correct answer is a pre-set RDF triple; wherein the syntax analysis algorithm is the syntax analysis algorithm in the pyLtp algorithm library in the Python language;
[0096] The total number of samples in the training set is 4,000; the pre-set question set and correct answers are set based on the structured text set.
[0097] (2) An untrained sample in the training set is input into the neural network model; the neural network model outputs a predicted answer; the error value is calculated based on the predicted answer and the correct answer in the sample;
[0098] (3) Determine whether the neural network model has reached the preset pass rate based on the error value. If yes, the neural network model is considered to have been trained and the process ends. Otherwise, adjust the parameter weights according to the gradient descent method, and adjust the step size to a small fixed step size. Go to process (2).
[0099] Among them, the pre-set qualified rate is 85%; each node of each layer of the neural network model has its own weight, and the parameter weight is all the weights.
[0100] Example: The input question is: Where did Wang Xiaoming's wife go on June 10, 2010?
[0101] The keywords in the keyword set are: 2010.06.10, Wang Xiaoming, wife, where to go;
[0102] Neural network output:
[0103]
【entity:
[0104] Entity name: Wang Xiaoming
[0105] relation:
[0106] Relationship: Wife
[0107] Attribute list:
[0108] (Time: 20100610
[0109] Location: Beijing) 】
[0111] This embodiment divides each question in the question set into subject, predicate, object, attributive, adverbial and complement through a grammatical analysis algorithm, and constructs a training set together with the answers corresponding to the questions, and uses the training set to train the neural network model; this training method enables the trained neural network model to be quickly mapped to the corresponding triples in the knowledge graph according to the input questions, and can effectively deal with the uncertainty, diversity and complexity of the input questions.
[0112] This embodiment provides a question-answering interactive system based on knowledge graph, including the following modules:
[0113] Structured text conversion module:
[0114] Used to convert each audio file in the audio file library, each picture file in the picture file library, and each video file in the video file library into an audio structured text, a picture structured text, and a video structured text, respectively;
[0115] Audio structured text is converted through speech recognition algorithm; picture structured text and video structured text are converted through image recognition algorithm;
[0116] Knowledge graph building blocks:
[0117] It is used to extract several RDF triples from each structured text in the structured text set through a relation extraction algorithm; and construct a knowledge graph from them;
[0118] This module includes the following submodules:
[0119] RDF extraction submodule:
[0120] It is used to extract several RDF triples from each structured text in the structured text set through the relation extraction algorithm;
[0121] Storage unit generation submodule:
[0122] Each structured text corresponds to a storage unit, which contains several RDF triples;
[0123] Knowledge graph generation submodule:
[0124] Used to organize all storage units into a knowledge graph.
[0125] Keyword segmentation module:
[0126] Through the grammatical analysis algorithm, each input question is divided into sentence components, and any or all of the subject, predicate, object, attributive, adverbial and complement are obtained as keywords to form a word set;
[0127] Question and answer interactive module:
[0128] Input the word set into the trained neural network model;
[0129] The trained neural network model searches for and returns a corresponding RDF triple in the knowledge graph to obtain the correct answer to the corresponding input question.
[0130] Among them, the operation of training the neural network model is:
[0131] (1) Through the grammatical analysis algorithm, each question in the pre-set question set is divided according to the sentence components, and any or all of the subject, predicate, object, attributive, adverbial and complement are obtained as keywords to form a keyword set; a keyword set and the correct answer to the corresponding question constitute a sample, and all samples constitute a training set; the correct answer is a pre-set RDF triple; the pre-set question set and the correct answer are set according to the structured text set;
[0132] (2) An untrained sample in the training set is input into the neural network model; the neural network model outputs a predicted answer; the error value is calculated based on the predicted answer and the correct answer in the sample;
[0133] (3) Determine whether the neural network model has reached a preset pass rate based on the error value. If so, the neural network model is considered to have been trained and the process ends. Otherwise, adjust the parameter weights using the gradient descent method and proceed to operation (2).
[0134] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A question-answering interactive method based on knowledge graph, characterized in that: The following steps are involved: (1) Keyword division steps: Through the grammatical analysis algorithm, each input question is divided into sentence components, and any or all of the subject, predicate, object, attributive, adverbial and complement are obtained as keywords to form a word set; (2) Question and answer interaction steps: Inputting the word set into a trained neural network model; The trained neural network model searches for and returns a corresponding RDF triple in the knowledge graph to obtain the correct answer to the corresponding input question; The method for constructing the knowledge graph is as follows: extracting a number of RDF triples from each structured text in the structured text set by a relation extraction algorithm, and constructing a knowledge graph from them; The structured text set consists of all audio structured texts, picture structured texts and video structured texts; Each audio structured text is converted by a speech recognition algorithm from each audio file in the audio file library; Each picture structured text is converted by using an image recognition algorithm to convert each picture file in the picture file library; Each video structured text is converted by using an image recognition algorithm to transform each video file in the video file library; The process of constructing the knowledge graph is as follows: Process 1, extracting RDF: By using a relation extraction algorithm, a plurality of RDF triples are extracted from each structured text in the structured text set; Process 2, generate storage unit: Each structured text corresponds to a storage unit, and the storage unit contains the plurality of RDF triples; Process 3, generate knowledge graph: The data in all storage units constitute the knowledge graph; The process of training the neural network model is: Step 4: By using a syntax analysis algorithm, each question in the preset question set is divided according to sentence components, and any or all of the subject, predicate, object, attributive, adverbial and complement are obtained as keywords to form a keyword set; a keyword set and the correct answer to the corresponding question constitute a sample, and all samples constitute a training set; the correct answer is a preset RDF triple; Process 5, inputting an untrained sample in the training set into the neural network model; the neural network model outputs a predicted answer; and calculating an error value based on the predicted answer and the correct answer in the sample; Process 6, judging whether the neural network model reaches the preset pass rate according to the error value, if yes, it is judged that the neural network model has been trained and ends; otherwise, the parameter weights are adjusted according to the gradient descent method and the process is turned to process 5.
2. The question-answering interactive method based on knowledge graph according to claim 1, characterized in that: The pre-set question set and correct answers are set according to the structured text set.
3. A question-answering interactive system based on knowledge graph, characterized in that: Includes the following modules: Structured text conversion module: Used to convert each audio file in the audio file library, each picture file in the picture file library, and each video file in the video file library into an audio structured text, a picture structured text, and a video structured text, respectively; The audio structured text is converted by a speech recognition algorithm; the picture structured text and the video structured text are both converted by an image recognition algorithm; Knowledge graph building blocks: Used to extract a number of RDF triples from each structured text in the structured text set by using a relation extraction algorithm; and construct a knowledge graph from them; Keyword segmentation module: Through the grammatical analysis algorithm, each input question is divided into sentence components, and any or all of the subject, predicate, object, attributive, adverbial and complement are obtained as keywords to form a word set; Question and answer interactive module: Inputting the word set into a trained neural network model; The trained neural network model searches for and returns a corresponding RDF triple in the knowledge graph to obtain the correct answer to the corresponding input question; The knowledge graph construction module includes the following sub-modules: RDF extraction submodule: For extracting a plurality of RDF triples from each structured text in the structured text set by using a relation extraction algorithm; Storage unit generation submodule: Each structured text corresponds to a storage unit, and the storage unit contains the plurality of RDF triples; Knowledge graph generation submodule: Used to form a knowledge graph from the data in all storage units; The operations for training the neural network model are: (1) Using a grammatical analysis algorithm, each question in a preset question set is divided according to sentence components, and any or all of the subject, predicate, object, attributive, adverbial, and complement are obtained as keywords to form a keyword set; a keyword set and the correct answer to the corresponding question constitute a sample, and all samples constitute a training set; the correct answer is a preset RDF triple; (2) inputting an untrained sample in the training set into the neural network model; the neural network model outputs a predicted answer; and calculating an error value based on the predicted answer and the correct answer in the sample; (3) Determine whether the neural network model has reached a preset pass rate based on the error value. If so, the neural network model is considered to have been trained and the process ends. Otherwise, adjust the parameter weights using the gradient descent method and proceed to operation (2).
4. The question-answering interactive system based on knowledge graph according to claim 3, characterized in that: The pre-set question set and correct answers are set according to the structured text set.
5. A question-answering interactive device based on knowledge graph, characterized in that: It comprises a memory and a processor; the memory is used to store a computer program; the processor is used to implement the question-answering interaction method based on the knowledge graph as described in any one of claims 1-2 when executing the computer program.
6. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the question-and-answer interaction method based on the knowledge graph as described in any one of claims 1-2 is implemented.
Citation Information
Patent Citations
Mixed automatic question-answer method based on education knowledge graphs and texts
CN110147436A
Knowledge graph common sense question and answer method and system based on staged query
CN112989005A
Power failure intelligent question answering method and device based on knowledge graph
CN113051382A
Construction method of ship berthing and leaving knowledge question and answer query system based on knowledge graph
CN113468304A
Question-answer service system and method based on RDF search
US20110258230A1
