Knowledge graph-based document retrieval method, system, terminal and storage medium

Through the literature search method based on knowledge graph, the use of entity and relationship extraction and word vector model matching to generate triplets is solved, and the problem of low accuracy of literature search in the prior art is achieved efficient and accurate retrieval of literature in the target field is achieved.

CN116881436BActive Publication Date: 2025-08-19HARBIN INSTITUTE OF TECHNOLOGY (SHENZHEN) (INSTITUTE OF SCIENCE AND TECHNOLOGY INNOVATION HARBIN INSTITUTE OF TECHNOLOGY SHENZHEN) +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311004772.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-09
Publication Date
2025-08-19
Estimated Expiration
2043-08-09

AI Technical Summary

Technical Problem

Among the existing literature search methods, keyword matching accuracy is low, making it difficult to accurately retrieve documents that meet the needs in massive medical literature, especially the search difficulties caused by differences in synonyms and translations in different contexts.

Method used

The literature search method based on knowledge graphs is used to establish a mapping relationship between the target field literature to the triple through entity and relationship extraction, word vector model matching and triple generation, and output the search results using correlation sorting.

Benefits of technology

It achieves accurate and efficient search of the target field literature, improves user search efficiency and accuracy, and can locate and expand search results from multiple angles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116881436B_ABST
    Figure CN116881436B_ABST
Patent Text Reader

Abstract

The knowledge graph-based document retrieval method, system, terminal, and storage medium provided by the present invention specifically relate to the field of medical big data processing technology. This solution extracts entities and relationships from query statements to construct entity sets and relationship sets; trains a word vector model and performs fuzzy matching on unregistered words to obtain candidate words in the query statement, and extracts the candidate words with the highest matching degree to add to the entity set; generates triples based on the entity set and relationship set; obtains document indexes corresponding to the triples based on the target domain knowledge graph and target domain documents; sorts the document indexes according to relevance, and outputs the retrieval results based on the sorted list. This solution locates and expands from multiple perspectives, including query entities, relationships, values, and unregistered words, and can screen out documents with the highest degree of relevance to the query statement, achieving accurate and efficient retrieval of target domain documents.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of medical big data processing technology, and in particular to a knowledge graph-based document retrieval method, system, terminal and storage medium. Background Art

[0002] With the rapid development of big data, the types and quantity of literature in various fields have increased dramatically. Therefore, how to accurately and quickly retrieve the required medical literature from massive medical literature has become a technical problem that needs to be solved urgently.

[0003] At present, most literature and book retrieval methods are based on the precise matching of key fields, and the key fields set are often the title, author, index number or field key fields of the document. If the searcher does not know the title, author, and index number corresponding to the queried content, then it is impossible to accurately retrieve the required document. In addition, due to the limited text corpus contained in the knowledge graph of the existing literature retrieval system, in this case, it is difficult to retrieve the document that meets the requirements by only using customized keywords, especially the situation where the same keyword may express different meanings in different contexts, or even the situation where the same keyword appears in the form of different keywords due to different translations. This results in low accuracy of literature retrieval and low effectiveness of retrieval methods based on factors such as word frequency, citation volume, and age. Summary of the Invention

[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide a document retrieval method, system, terminal and storage medium based on knowledge graph, aiming to solve the problem of low accuracy of document retrieval in the prior art.

[0005] In order to achieve the above objectives, the present invention provides a first aspect of a document retrieval method based on a knowledge graph, comprising the following steps:

[0006] Get the query statement entered by the user;

[0007] Scanning the query statement using a prefix dictionary to extract all entities and construct an entity set; generating a directed acyclic graph using the entities, and extracting all entity relationships based on the directed acyclic graph to construct a relationship set;

[0008] Using a preset word vector training model and a preset training corpus, training the word vector model and performing fuzzy matching on unregistered words to obtain matched word vectors, and forming a word vector group from the matched word vectors; obtaining candidate words in the query sentence, calculating the matching degree between the word vector group and the candidate words, and extracting the candidate word with the highest matching degree from the word vector group to add to the entity set;

[0009] Generate triples based on the entity set and the relationship set;

[0010] Extract all target domain entities from target domain documents and form target domain entity pairs, obtain all triples containing the target domain entity pairs from the target domain knowledge graph, and obtain a triple set; based on the triple set, obtain target domain documents that match each triple in the triple set, obtain a document and triple pair set, sort the documents and target domain documents in the triple pair set according to their relevance, and obtain a document index corresponding to the triple;

[0011] The document index is sorted according to the relevance, and the search results are obtained and output.

[0012] Furthermore, the generating of a directed acyclic graph using the entity, extracting all entity relationships based on the directed acyclic graph, and constructing a relationship set includes:

[0013] Generate a directed acyclic graph by taking each of the entities as an edge;

[0014] A dynamic programming algorithm is used to find the weight and maximum path of each point on the directed acyclic graph, and the entity relationship generated by the weight and maximum path is used as the extracted entity relationship;

[0015] A relationship set is constructed using the entity relationships of the extracted points on the directed acyclic graph.

[0016] Furthermore, obtaining the candidate words in the query statement includes:

[0017] Split each entity word, relation word, and value in the target domain knowledge graph into individual characters, and store each character in an inverted index to obtain index terms;

[0018] Perform inverted indexing on the words in the query statement to obtain all the index words associated with the words in the query statement, and obtain candidate words for the query statement.

[0019] Furthermore, the calculating of the matching degree between the word vector group and the candidate words, and extracting the candidate words with the highest matching degree to add to the entity set, includes:

[0020] Converting the candidate words and the words in the query into word vectors using a preset word vector training model to obtain word vectors for the candidate words and the words in the query;

[0021] The word vectors of the candidate words and the word vectors of the words in the query sentence are combined into a word vector pair, a word shift distance algorithm is used to calculate the matching degree of the word vector pair, and the candidate word with the highest matching degree is extracted and added to the entity set.

[0022] Furthermore, generating triples based on the entity set and the relationship set includes:

[0023] Based on the relationships between the entities in the entity set, an entity relationship set is generated, the relationship set is generated using the extracted relationships, and the relationships between the entities are classified into definite relationships, fuzzy relationships, single entities, and multiple entities based on the number and type of the relationship sets and the number of entities;

[0024] When the relationship set is not empty, matching the relationships in the entity relationship set with all the relationships in the relationship set using a preset relationship matching operation, and sorting them according to the matching values to obtain a sorted queue of extracted relationships; extracting several relationships in the sorted queue of extracted relationships as blocks, extracting all triples of entities corresponding to each relationship, and sorting the triples in each block according to the matching values to obtain a triple block of definite relationships or a triple block of fuzzy relationships;

[0025] When the relationship set is empty, all triples of entities in the relationship set are found from the target domain knowledge graph, and when the number of entities in the relationship set is greater than one, a path optimization algorithm is used to find all shortest paths between each of the entities, and all the triples are classified into blocks according to the relationship classification, and sorted according to the number of triplets in the relationship block to obtain single-entity triples or multi-entity triples.

[0026] Furthermore, the step of sorting the target field documents in the set of triple pairs according to their relevance to obtain a document index includes:

[0027] Based on the importance and relevance, annotating the target field document and triple pairs in the target field document and triple set to obtain a prediction model;

[0028] Based on the prediction model, correlation prediction is performed on the target field documents and triple pairs to obtain prediction results, and the prediction results are sorted to obtain document indexes corresponding to the triples.

[0029] Furthermore, the target field documents and triple pairs are annotated based on importance and relevance to obtain a prediction model, including:

[0030] Based on importance and relevance, machine feature annotations and manual annotations are added to the target field documents and triple pairs to obtain machine feature annotation data and manual annotation data;

[0031] Using the machine feature-annotated data to train a preset document mapping model to obtain a feature model;

[0032] The preset document mapping model is further trained using the manually annotated data and the feature model to obtain a prediction model.

[0033] The second aspect of the present invention provides a document retrieval system based on a knowledge graph, the system including an interaction unit and a retrieval unit, the interaction unit including an input module for receiving query statements and an output module for outputting document retrieval results, the retrieval unit including a query statement entity and relationship extraction module, an unregistered word fuzzy matching module, a matching triple module, a medical document triple index construction module, and an association module.

[0034] The query statement entity and relationship extraction module is used to extract entities and relationships based on the query statement input into the input module, scan the query statement using a prefix dictionary, extract all entities, and construct an entity set; generate a relationship graph using the entities, and extract all entity relationships based on the relationship graph, construct a relationship set, and output it to the matching triple module;

[0035] An unregistered word fuzzy matching module is used to perform fuzzy matching on unregistered words in the input module, using a preset word vector training model and a preset training corpus to train the preset word vector model and perform fuzzy matching on the unregistered words to obtain matched word vectors, and to form a word vector group from the matched word vectors; obtain candidate words in the query statement, calculate the matching degree between the word vector group and the candidate words, extract the candidate word with the highest matching degree, add it to the entity set in the received query statement entity and relationship extraction module, and output the entity set to the matching triple module;

[0036] A triple matching module is used to generate triples based on the received entity set and relationship set, and output them to the medical literature triple index construction module;

[0037] A medical literature triple index construction module is used to extract all target domain entities from target domain documents and form target domain entity pairs, obtain all the triplets containing the target domain entity pairs from the target domain knowledge graph, and obtain a triple set; based on the triple set, obtain target domain documents that match each triple in the triple set, obtain a document and triple pair set, sort the documents and target domain documents in the triple pair set according to the degree of association, obtain a document index, and output the document index to the association module;

[0038] The association module is used to sort the document index according to the association degree, obtain the search results and output them.

[0039] The third aspect of the present invention provides an intelligent terminal, which includes a memory, a processor, and a knowledge graph-based document retrieval program stored in the memory and runnable on the processor. When the knowledge graph-based document retrieval program is executed by the processor, it implements any one of the steps of the above-mentioned knowledge graph-based document retrieval method.

[0040] A fourth aspect of the present invention provides a computer-readable storage medium, on which a knowledge graph-based document retrieval program is stored. When the knowledge graph-based document retrieval program is executed by a processor, it implements any step of the above-mentioned knowledge graph-based document retrieval method.

[0041] Compared with the existing technology, the beneficial effects of this solution are as follows:

[0042] The present invention is based on the target domain knowledge graph and natural language processing technology, extracts entities and relationships from query statements, constructs entity sets and relationship sets, trains a word vector model and performs fuzzy matching on unregistered words, extracts the candidate words with the highest matching degree in the query statement and adds them to the entity set; then, based on the entity set and the relationship set, generates triples; and establishes a mapping relationship from target domain documents to triples to obtain a document index to screen out the documents with the highest degree of relevance to the query statement, thereby achieving accurate and efficient retrieval of target domain documents. The method locates and expands from multiple angles such as entities, relationships, values and unregistered words in the query statement, thereby improving the efficiency and accuracy of user document retrieval. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0044] Figure 1 This is a flow chart of the knowledge graph-based document retrieval method of the present invention;

[0045] Figure 2 This is a flowchart of query statement entity and relationship extraction of the present invention;

[0046] Figure 3 This is a flow chart of fuzzy matching of unregistered words of the present invention;

[0047] Figure 4 This is an example flow chart of fuzzy matching of unregistered words in the present invention;

[0048] Figure 5 This is a triple matching flow chart of the present invention;

[0049] Figure 6 This is an example flow chart of triple matching of the present invention;

[0050] Figure 7 Constructing a flow chart for the medical literature triple index of the present invention;

[0051] Figure 8 Generate an example flow chart for the document and triple pairs of the present invention;

[0052] Figure 9 A flowchart of sorting search results of the present invention;

[0053] Figure 10 A schematic diagram of a process for constructing a document numbering sequence of the present invention;

[0054] Figure 11 A flowchart of machine feature annotation in data annotation of the present invention;

[0055] Figure 12 This is a flowchart of manual feature annotation in data annotation of the present invention;

[0056] Figure 13 Schematic diagram of the structure of the document retrieval system based on knowledge graph of the present invention;

[0057] Figure 14 Schematic diagram of the intelligent terminal structure for document retrieval based on knowledge graph of the present invention. DETAILED DESCRIPTION

[0058] In the following description, specific details such as particular system structures and techniques are provided for purposes of illustration, not limitation, to facilitate a thorough understanding of the embodiments of the present invention. However, it will be apparent to those skilled in the art that the present invention may be practiced in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.

[0059] It will be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0060] It should also be understood that the terms used in the present specification are only for the purpose of describing particular embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0061] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0062] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0063] The following is a clear and complete description of the technical solutions in the embodiments of the present invention, in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0064] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0065] Knowledge graphs are a key research method in the field of artificial intelligence and a multifaceted academic research area encompassing research areas such as data mining, entity extraction, relationship extraction, and information processing. They also touch upon fields such as medicine and finance, with knowledge graphs differing across different fields. Knowledge graphs are structured knowledge extracted from large amounts of textual information and typically require evaluation and organization by experts in the field. They are often considered reliable foundational knowledge, providing a foundation for intelligent retrieval, intelligent question-and-answering, and intelligent analysis. In recent years, knowledge graph construction technology has matured alongside advancements in natural language models. Knowledge acquisition has evolved from manual organization to machine-based recognition, making knowledge graphs more widely used.

[0066] In view of the breakthroughs in large language models and the emergence of various professional knowledge graphs in recent years, as well as the existing literature retrieval algorithms based on keyword indexes or multi-factor weighing calculation models such as word frequency, citation volume, and age, there are problems in the accuracy of literature retrieval caused by factors such as low effectiveness, single functions, and poor understanding of user query content in professional field literature retrieval. The present invention proposes a literature retrieval method based on knowledge graphs, which utilizes knowledge graphs and natural language processing technology, and combines knowledge mapping to achieve efficient retrieval of target field literature. In the process of target field literature retrieval, it can effectively improve retrieval efficiency and screen out the literature with the highest degree of relevance to the query statement. This method first establishes a mapping relationship between target domain documents and triples, and creates an index; when the user enters a query statement, the method extracts entities and relationships from the query statement, and performs definite matching or fuzzy matching according to the actual situation to obtain the triple block corresponding to the query statement; then the triples matched to the query statement are indexed through the document triples, and the target document is output according to the matching degree with the query statement; this method can locate and expand from multiple angles of user queries, improve the efficiency of user document retrieval, and the knowledge structure contained in the retrieval results also helps users understand the retrieval results, which has certain research significance and practical value.

[0067] Exemplary Methods

[0068] The embodiment of the present invention provides a document retrieval method based on knowledge graph, which is deployed on electronic devices such as computers and servers, and involves research directions such as data mining, entity extraction, relationship extraction, and information processing in multiple fields such as medicine, finance, science and technology. The application scenario is the retrieval of documents, which is aimed at the situation where there are fewer text corpora in a specific field. Specifically, this embodiment takes medical document retrieval as an example to elaborate on the process of the document retrieval method based on knowledge graph of this application. It should be stated that the application field of this method includes but is not limited to the medical field. The flow chart of this method is as follows: Figure 1 As shown, the main steps include:

[0069] Step S1000: Obtain the query statement input by the user.

[0070] Specifically, the user inputs a natural language query statement according to their own needs, which can be a word, phrase or sentence, or any combination of one or more words, phrases or sentences. The natural language query statement input by the user is referred to as a query statement hereinafter.

[0071] Step S2000: Scan the query statement using a prefix dictionary to extract all entities and construct an entity set; generate a directed acyclic graph using the entities, and extract all entity relationships based on the directed acyclic graph to construct a relationship set.

[0072] Specifically, query statement entity and relationship extraction uses a prefix dictionary to quickly scan the text of the input query statement and extract all possible extraction words. Then, a directed acyclic graph is generated based on all possible word formation situations, and a dynamic programming algorithm is used to find an optimal path for extraction.

[0073] like Figure 2 As shown in the figure, the query statement entity and relationship extraction includes the following steps:

[0074] Step 2100: Prefix dictionary construction: Use the CMeKG (Chinese Medical Knowledge Graph) knowledge graph to construct a prefix dictionary. All entities (denoted as E), relationships (denoted as R), and values (denoted as V) of the knowledge graph are placed in the prefix dictionary. A hash table is used to speed up text scanning. Different types of labels are set for entities, relationships, values, and stop words, where 1 is the entity class label, 2 is the relationship class label, 3 is the value class label, and 4 is the stop word class label. In addition, the prefixes of all words are denoted by 0, such as {flow: 0}, {runny nose: 0}, and {runny nose: 1}.

[0075] In this embodiment, the CMeKG knowledge graph is selected for prefix dictionary construction. It is a Chinese medical knowledge graph developed in a human-computer integrated manner based on large-scale medical text data using natural language processing and text mining technologies. As other preferred implementation methods, the UMLS semantic network, Wikidata, Schema.org, cnSchema or OMAHA knowledge base and other knowledge graphs can also be flexibly selected to construct the prefix dictionary according to actual application conditions.

[0076] Step 2200: Use the prefix dictionary to perform text scanning: Scan the query statement word by word. If the word in the current queue is not in the prefix word list, it means that no new word starting with the first word in the current queue will be generated. In this case, the first word is removed from the queue, and the remaining words in the queue are scanned word by word. If the word in the queue appears in the prefix word list, it is further determined whether the prefix word is a valid word such as an entity or relationship. If so, it is retained, and the next word is read and scanned again.

[0077] Step 2300: Construct a directed acyclic graph: Generate an initial directed acyclic graph (DAG) by treating each character in the text as an edge. Each node is connected to one or more subsequent nodes, and the edges are connected based on the valid words extracted in the previous step. Each edge is a feasible path and also represents a phrase form. Each path in the DAG will produce a different entity relationship extraction result.

[0078] Step 2400: Determine the optimal combination using dynamic programming: Define the weight of each word based on word frequency, word length, and priority. This weight can be mapped to the weight of an edge in a directed acyclic graph. The state is defined as the sum of the weights of points on the directed acyclic graph from the starting point to a certain point. The optimal state of each point in the directed graph is the sum of all states that can reach the current point plus the transfer cost (i.e., the weight of the directed edge), i.e., the maximum sum of weights.

[0079] The weight formula is:

[0080]

[0081] Among them, typeWeight word Indicates the weight priority of a word, where the weight priority is sorted from high to low as follows: relationship > entity > value > stop word, frequency word Indicates the word frequency of the word, length word Indicates the length of the word.

[0082] The specific steps of the dynamic programming algorithm are as follows:

[0083] 1) Based on the nodes of the directed acyclic graph, construct the weight matrix W and position matrix pre with an initial value of 0, and obtain the adjacency matrix P of the directed acyclic graph, where P ij represents the adjacency relationship between node i and node j, P ij If it is not 0, it means that there is a path from node i to node j, and the value of P indicates the category label to which the word belongs.

[0084] 2) Traverse all rows of P starting from the first row, based on P in row i ij If the value is not 0, update the weight matrix W. The update formula is as follows:

[0085] W j =max{W j ,[(-+1)*(P ij )+W i ]}

[0086] Where ty(·) represents the class label weight. For example, the entity class label weight is set to 1, the relationship class label weight is set to 1.1, the stop word class label weight is set to 0.2, and the value class label weight is set to 0.55. j Represents the jth value in the W array, W i Represents the i-th value in the W array. When W is updated, the position matrix pre is updated at the same time.

[0087] 3) After W is updated, start reading from the last number of the position matrix pre, and continue reading the read value as the index value until the index reaches the class label 0. For each path, read the corresponding fragment through the text, and use the prefix dictionary to identify the extracted type.

[0088] Step 3000: Using a preset word vector training model and a preset training corpus, train the word vector model and perform fuzzy matching on unregistered words to obtain matched word vectors, and form a word vector group from the matched word vectors; obtain candidate words in the query statement, and calculate the matching degree between the word vector group and the candidate words, and extract the candidate word with the highest matching degree from the word vector group and add it to the entity set.

[0089] Specifically, for fuzzy matching of unregistered words, the continuous bag of words (CBOW) model is used to train word vectors. Candidate words are obtained through the inverted index of the words in the query statement. Then, the word mover's distance (WMD) algorithm is used to calculate the matching degree between the input word vector group and the candidate words. The candidate word with the highest matching degree is the matching result.

[0090] The word training model used in this embodiment is the continuous bag of words (CBOW) model in word2vec. As other preferred implementations, the skip-gram model in word2vec, glove, fastText, ELMO, GPT or BERT, xlnet and other models can be flexibly selected to train word vectors based on system configuration, data volume, accuracy and / or efficiency.

[0091] like Figure 3 As shown, the fuzzy matching of unregistered words includes the following steps:

[0092] Step 3100: training word vectors: using a continuous bag-of-words model to train word vectors, concatenate the abstracts of all medical documents in the target database as training corpus for the word vector model, and then separate each word in the text of the training corpus to form training samples of character sequences;

[0093] Step 3200: Inverted index of words: Split each entity word, relation word, and value in the knowledge graph into individual words, store each word in the inverted index, and generate an index from each word to the words containing it. Use the inverted index to find all entities related to each word.

[0094] Step 3300: Obtain fuzzy words: remove the accurately matched words and stop words, and concatenate the unmarked words to obtain fuzzy words.

[0095] Let's take an example to illustrate the process of fuzzy matching of unregistered words, such as Figure 4As shown in the figure, assuming that the input word is "children's typhoid", the word vector is trained through the continuous bag-of-words model, and candidate words such as Xiaoer's typhoid, children's cold or children's fever are obtained through the inverted index of the words in the query sentence. Then, the word vector is trained using the character sequence of the article abstract in the medical literature and the continuous bag-of-words model to obtain the word vector. The word shift distance algorithm is used to calculate the matching degree between each word vector in the word vector group and the candidate word. For example, the matching degrees of the word vector of children's typhoid with Xiaoer's typhoid, children's cold and children's fever are 0.88, 0.82 and 0.66 respectively. It can be seen that the candidate word with the highest matching degree is Xiaoer's typhoid, so Xiaoer's typhoid is the matching result to be retrieved last.

[0096] Step 4000: Generate triples based on the entity set and the relationship set.

[0097] Specifically, after performing entity and relationship extraction on the query statement, an entity set, a relationship set and a value set are obtained. Triples are generated based on the obtained entity set, relationship set and value set, and the triples are divided into definite relations, fuzzy relations, single entities and multiple entities.

[0098] like Figure 5 and Figure 6 As shown, triple matching includes the following steps:

[0099] Step 4100: Determine relationship processing: Generate an entity relationship set R' using the various relationships between the entities in the entity set, and generate a relationship set R using the extracted relationships. When the relationship set is not empty and is not a fuzzy relationship, use the TransE relationship matching operation to match the relationships in R' with all relationships in R, and sort the relationships in R' according to the matching values with all relationships in R to obtain a sorted queue of R'; take the first n relationships in the queue as a block, and extract all triples of entities corresponding to each relationship; perform TransE entity matching on the tail entity of the triples in each block, as well as the words in the entity and value other than the head entity; sort the triples in each block according to the matching values based on the calculation results to generate a triple block of determined relationships;

[0100] Step 4200: Fuzzy relationship processing: When the relationship set is not empty and is a fuzzy relationship, perform fuzzy matching on the relationship in R' and the fuzzy relationship using the word shift distance algorithm, sort them according to the matching value of R', obtain the sorted queue of R', take the first n relationships as a block, extract all triples of entities corresponding to each relationship, perform TransE entity matching on the tail entity of the triples in each block, and the words in the entity and value except the head entity, and sort the triples in each block according to the matching value based on the calculation results to generate triple blocks of fuzzy relationships;

[0101] Step 4300: No-relationship, single-entity processing: When the relationship set is empty and there is only one entity, find all triples of the entity from the knowledge graph, classify all triples into blocks according to the relationship, sort them by the number of triples in the relationship blocks, and take the first n relationship blocks as single-entity triples;

[0102] Step 4400: No-relationship, multi-entity processing: When the relationship set is empty and there are multiple entities, use the path optimization algorithm to find all the shortest paths between entities in the entity set, classify all the triples of all the paths into relationship blocks according to the relationship classification, sort them according to the number of triples in the relationship blocks, and take out the first n relationship blocks as multi-entity triples.

[0103] Step 5000: Extract all target domain entities from target domain documents and form target domain entity pairs, obtain all triples containing target domain entity pairs from the target domain knowledge graph, and obtain a triple set; based on the triple set, obtain target domain documents that match each triple in the triple set, obtain a set of documents and triple pairs, sort the documents and target domain documents in the set of triple pairs according to the degree of association, and obtain the document index corresponding to the triple.

[0104] Specifically, all entities in the medical literature are extracted and formed into entity pairs. Triples containing these entity pairs are obtained from the medical knowledge graph and fine-tuned in the BERT pre-trained model to make the output more consistent with the expected output in the medical field. The literature mapping model is obtained through weakly supervised training, and the output weak class label probability results are sorted to obtain triples and literature indexes.

[0105] like Figure 7 As shown in Figure 1, the construction of the medical literature triple index includes the following steps:

[0106] Step 5100: Construct document and triple pairs: Document and triple pairs are used for data annotation and indexing. First, the abstracts and titles of medical documents are extracted from the medical document database and combined. All entities in the abstracts and titles are extracted using the entity relationship extraction model, and each pair is combined to generate entity pairs. All triples corresponding to each entity pair are found from the knowledge graph and combined into a triple set for this medical document database. The triple set is then combined with each matching medical document ID to form a document and triple pair set.

[0107] Step 5200: Data annotation: Based on the generated document and triple pairs, data is annotated using the two indicators of importance and relevance to add a correlation class label. Importance indicates whether the two entities in the triple are the main description objects of the document or appear in important places in the document. Relevance indicates whether the relationship between the triples is reflected in the semantics of the document or whether it is the content described in the document. Data annotation is divided into machine feature annotation and manual annotation. This embodiment fine-tunes the BERT pre-trained model through the annotated data to achieve better performance in triple extraction and mapping of documents.

[0108] Step 5300: Model training and prediction: First, use the machine-labeled data to train the document mapping model to obtain a feature model. Although the feature model can learn the machine-labeled features, its understanding of the relational semantics is not accurate enough. Therefore, use the manually labeled data and the feature model to continue training the document mapping model to obtain a prediction model; use the prediction model to predict the major category labels of the document and triple pairs, and obtain the index of the triples and documents by sorting the prediction probability results.

[0109] The model used in this embodiment for constructing document triples is a weakly supervised learning-to-rank model. It uses a self-attention mechanism to convert the abstract and title of a document into a text vector representation, performs an association calculation with the embedded sequence of the triple, and finally connects a fully connected layer and a softmax layer to perform weak class label classification. The association degree is sorted by the probability value of the weak class label. The model is constructed by fine-tuning the pre-trained model of BERT (Bidirectional Encoder Representation from Transformers) and uses the NSP (Next Sentence Prediction) mechanism to understand the association relationship between documents and triples. A fully connected classification layer is added after the last transformer of BERT for weakly supervised classification.

[0110] An example is given to illustrate the process of generating documents and triples, such as Figure 8 As shown, first, based on the medical literature database, the title and abstract of each medical literature are read, and entities are extracted from the preset entity relationship extraction model based on the title and abstract to obtain an entity set; then the entities in the entity set are combined into entity pairs, and all triples containing these two entities are matched in the medical knowledge graph to form a triple set; then, the prediction model obtained by training the literature mapping model is used to match the literature and triple pairs to generate a set of literature and triple pairs.

[0111] Step 6000: Sort the document index according to the relevance, obtain the search results and output them.

[0112] Specifically, if Figure 9 As shown, the search result sorting includes the following steps:

[0113] Step 6100: Obtain document blocks: Sort the triple pairs obtained in step 4000 by correlation to form triple blocks, and according to step 5000, obtain the document ID number sequence corresponding to each triple and sort them by correlation to obtain the document block;

[0114] Step 6200: Horizontal window sorting: define a horizontal window, the width of the window represents the number of documents with the highest priority corresponding to the triples taken out each time; based on the set document window, cut the documents with the highest relevance ranking in each document sequence, and arrange the cut document IDs in a column horizontally according to the window; and so on, until all document IDs are cut and arranged in a column according to the relevance.

[0115] An example is given to illustrate how to construct a document number sequence, such as Figure 10 As shown, first, based on the set of document and triple pairs, the triples are arranged into a triple sequence in order of matching degree from high to low. For multiple documents corresponding to each triple, they are arranged into a document sequence in order of correlation degree of the document ID number from high to low, that is, the triple sequence includes multiple triplets, and each triple corresponds to a document sequence; then, based on the set document window, the documents with a high correlation ranking position in each document sequence are cut, and the cut document IDs are arranged in a column horizontally according to the window; and so on, based on the set document window, the documents with a high correlation ranking position in the cut document sequence are cut, and the cut document IDs are arranged in a column horizontally according to the window, and spliced behind the column where the document ID of the first cut is located, until all document IDs are arranged in a column according to the correlation degree.

[0116] Adding machine feature annotations and manual annotations to the data in step 5200 includes the following steps:

[0117] Step 5210: Machine feature annotation in data annotation;

[0118] like Figure 11 As shown, the machine feature annotation in data annotation includes the following steps:

[0119] Step 5211: Importance Labeling: Importance is divided into three categories, as shown in Table 1. They are used to measure the characteristics of entity coverage and the distribution of important areas. Important areas here refer to the core areas of the document, such as the title, purpose, and conclusion. Abstracts of Chinese medical documents generally have the structure of purpose, methods, results, and conclusions.

[0120] Table 1

[0121]

[0122] Step 5212: Relevance labeling: The relevance classification is divided into three categories, as shown in Table 2, which are used to measure whether the head and tail entities appear in the same sentence, whether words related to the relationship appear in the sentence, etc.

[0123] Table 2

[0124]

[0125] Step 5213: Integrate the major category labels: Based on the type of importance category label and the type of relevance category label, integrate the importance and relevance labels into a unified major category label, which is divided into five categories, as shown in Table 3, where the slash in the table represents "or". Major category label 1 indicates that the triple has the highest relevance to the document, and major category label 5 indicates that the triple has the lowest relevance to the document. For example, when the importance category label is 1 and the relevance category label is 1, the major category label is set to 1; when the importance category label is 1 and the relevance category label is 2, the major category label is set to 3.

[0126] Table 3

[0127]

[0128] Step 5220: Manual feature annotation in data annotation,

[0129] like Figure 12 As shown in Figure 1, the manual feature annotation in data annotation includes the following steps:

[0130] Step 5221: Manual understanding: Manually understand the main content and triple relationships of the document;

[0131] Step 5222: Manual relevance labeling: It is divided into five categories, as shown in Table 4. It mainly measures the importance of the two entities in the triple in the document, the consistency of the triple relationship with the document, and the relevance of the triple knowledge in the document. Category 1 indicates that the triple has the highest degree of relevance to the document.

[0132] Table 4

[0133]

[0134] Exemplary Systems

[0135] like Figure 13 As shown, corresponding to the above-mentioned document retrieval method based on knowledge graph, an embodiment of the present invention also provides a document retrieval system based on knowledge graph, which includes an interaction unit 1 and a retrieval unit 2. The interaction unit includes an input module 11 for receiving query statements and an output module 12 for outputting document retrieval results. The retrieval unit includes a query statement entity and relationship extraction module 21, an unregistered word fuzzy matching module 22, a matching triple module 23, a medical document triple index construction module 24, and an association module 25.

[0136] The query statement entity and relationship extraction module 21 is used to extract entities and relationships based on the query statement input in the input module 11, use the prefix dictionary to scan the query statement, extract all entities, and construct an entity set; use the entities to generate a directed acyclic graph, and extract all entity relationships based on the directed acyclic graph to construct a relationship set, and output it to the matching triple module 23;

[0137] The unregistered word fuzzy matching module 22 is used to perform fuzzy matching on the unregistered words in the input module 11, using a preset word vector training model and a preset training corpus to train the preset word vector model and perform fuzzy matching on the unregistered words to obtain matched word vectors, and form a word vector group from the matched word vectors; obtain candidate words in the query statement, calculate the matching degree between the word vector group and the candidate words, extract the candidate word with the highest matching degree from the word vector group, add it to the entity set in the received query statement entity and relationship extraction module 21, and output the entity set to the matching triple module 23;

[0138] A triple matching module 23 is used to generate triples based on the received entity set and relationship set, and output them to the medical literature triple index construction module 24;

[0139] The medical literature triple index construction module 24 is used to extract all target domain entities from the target domain documents and form target domain entity pairs, obtain all triples containing target domain entity pairs from the target domain knowledge graph, and obtain a triple set; based on the triple set, obtain the target domain documents that match each triple in the triple set, obtain a document and triple pair set, sort the documents and the target domain documents in the triple pair set according to the degree of association, obtain the document index corresponding to the triple, and output the document index to the association module 25;

[0140] The association module 25 is used to sort the document index according to the association degree, obtain the search results and output them.

[0141] The specific working process of the system in this embodiment is as follows:

[0142] The query statement entity and relationship extraction module 21 extracts entities and relationships based on the query statement input in the input module 11; the unregistered word fuzzy matching module 22 mainly performs fuzzy matching on the unregistered words in the input module 11; the matching triple module 23 mainly matches the extracted relationships and entities with the triples in the knowledge graph; the medical literature triple index construction module 24 mainly extracts entities and relationships from medical literature, and matches them with the triples in the knowledge graph, and then establishes a literature index; the association module 25 mainly associates the triples obtained by the matching triple module 23 with the literature triples obtained by the medical literature triple index construction module 24, and searches for the corresponding literature through the index, and then sends the search results to the output module 12, and the output module outputs the search results to the interactive interface in a horizontal window sorting manner.

[0143] Specifically, in this embodiment, the specific functions of the above-mentioned knowledge graph-based document retrieval system can also refer to the corresponding description in the above-mentioned knowledge graph-based document retrieval method, and will not be repeated here.

[0144] Based on the above embodiment, the present invention also provides an intelligent terminal, whose principle block diagram can be shown as follows: Figure 14 As shown. The above-mentioned intelligent terminal includes a processor, a memory, a network interface and a display screen connected through a system bus. Among them, the processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a document retrieval program based on a knowledge graph. The internal memory provides an environment for the operation of the operating system and the document retrieval program based on the knowledge graph in the non-volatile storage medium. The network interface of the intelligent terminal is used to communicate with an external terminal through a network connection. When the document retrieval program based on the knowledge graph is executed by the processor, the steps of any one of the above-mentioned document retrieval methods based on the knowledge graph are implemented. The display screen of the intelligent terminal can be a liquid crystal display or an electronic ink display.

[0145] Those skilled in the art will understand that Figure 14 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the solution of the present invention and does not constitute a limitation on the smart terminal to which the solution of the present invention is applied. The specific smart terminal may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0146] In one embodiment, a smart terminal is provided, which includes a memory, a processor, and a knowledge graph-based document retrieval program stored on the memory and executable on the processor. When the knowledge graph-based document retrieval program is executed by the processor, the steps of any one of the knowledge graph-based document retrieval methods provided in an embodiment of the present invention are implemented.

[0147] An embodiment of the present invention also provides a computer-readable storage medium, on which a knowledge graph-based document retrieval program is stored. When the knowledge graph-based document retrieval program is executed by a processor, the steps of any one of the knowledge graph-based document retrieval methods provided in an embodiment of the present invention are implemented.

[0148] It should be understood that the sequence numbers of the steps in the above embodiments do not imply a specific order of execution; the order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0149] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be combined into one processing unit, or each unit can exist physically alone, or two or more units can be combined into one unit. The above-mentioned combined unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0150] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0151] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0152] In the embodiments provided by the present invention, it should be understood that the disclosed apparatus / terminal device and method can be implemented in other ways. For example, the apparatus / terminal device embodiments described above are merely illustrative. For example, the division of the modules or units described above is merely a logical functional division. In actual implementation, other division methods may be used. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not implemented.

[0153] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those skilled in the art that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the scope of protection of the present invention.

Claims

1. A document retrieval method based on knowledge graph, characterized in that: The following steps are involved: Get the query statement entered by the user; Scanning the query statement using a prefix dictionary to extract all entities and construct an entity set; generating a directed acyclic graph using the entities, and extracting all entity relationships based on the directed acyclic graph to construct a relationship set; Using a preset word vector training model and a preset training corpus, training the preset word vector model and performing fuzzy matching on unregistered words to obtain matched word vectors, and forming a word vector group from the matched word vectors; obtaining candidate words in the query sentence, calculating the matching degree between the word vector group and the candidate words, and extracting the candidate word with the highest matching degree to add to the entity set; Generate triples based on the entity set and the relationship set; Extract all target domain entities from target domain documents and form target domain entity pairs, obtain all triples containing the target domain entity pairs from the target domain knowledge graph, and obtain a triple set; based on the triple set, obtain target domain documents that match each triple in the triple set, obtain a document and triple pair set, sort the documents and the target domain documents in the triple pair set according to their relevance, and obtain a document index; The document index is sorted according to the relevance, and the search results are obtained and output.

2. The document retrieval method based on knowledge graph according to claim 1, characterized in that: The step of generating a directed acyclic graph using the entity, extracting all entity relationships based on the directed acyclic graph, and constructing a relationship set includes: Generate a directed acyclic graph by taking each of the entities as an edge; A dynamic programming algorithm is used to find the weight and maximum path of each point on the directed acyclic graph, and the entity relationship generated on the weight and the maximum path is used as the extracted entity relationship; A relationship set is constructed using the entity relationships of the extracted points on the directed acyclic graph.

3. The document retrieval method based on knowledge graph according to claim 1, characterized in that: The obtaining of candidate words in the query statement includes: Split each entity word, relation word, and value in the target domain knowledge graph into individual characters, and store each character in an inverted index to obtain index terms; Perform inverted indexing on the words in the query statement to obtain all the index words associated with the words in the query statement, and obtain candidate words for the query statement.

4. The document retrieval method based on knowledge graph according to claim 3, characterized in that: The calculating the matching degree between the word vector group and the candidate words, and extracting the candidate words with the highest matching degree to add to the entity set, includes: Converting the candidate words and the words in the query into word vectors using a preset word vector training model to obtain word vectors for the candidate words and the words in the query; The word vectors of the candidate words and the word vectors of the words in the query sentence are combined into a word vector pair, a word shift distance algorithm is used to calculate the matching degree of the word vector pair, and the candidate word with the highest matching degree is extracted and added to the entity set.

5. The document retrieval method based on knowledge graph according to claim 1, characterized in that: Generating triples based on the entity set and the relationship set includes: Based on the relationships between the entities in the entity set, an entity relationship set is generated, the relationship set is generated using the extracted relationships, and the relationships between the entities are classified into definite relationships, fuzzy relationships, single entities, and multiple entities based on the number and type of the relationship sets and the number of entities; When the relationship set is not empty, matching the relationships in the entity relationship set with all the relationships in the relationship set using a preset relationship matching operation, and sorting them according to the matching values to obtain a sorted queue of extracted relationships; extracting several relationships in the sorted queue of extracted relationships as blocks, extracting all triples of entities corresponding to each relationship, and sorting the triples in each block according to the matching values to obtain a triple block of definite relationships or a triple block of fuzzy relationships; When the relationship set is empty, all triples of entities in the relationship set are found from the target domain knowledge graph, and when the number of entities in the relationship set is greater than one, a path optimization algorithm is used to find all shortest paths between each of the entities, and all the triples are classified into blocks according to the relationship classification, and sorted according to the number of triplets in the relationship block to obtain single-entity triples or multi-entity triples.

6. The document retrieval method based on knowledge graph according to claim 1, characterized in that: The step of sorting the target field documents in the document triple pair set according to the relevance to obtain a document index includes: Based on the importance and relevance, annotating the target field document and triple pairs in the target field document and triple set to obtain a prediction model; Based on the prediction model, correlation prediction is performed on the target field documents and triple pairs to obtain prediction results, and the prediction results are sorted to obtain document indexes corresponding to the triples.

7. The document retrieval method based on knowledge graph according to claim 6, characterized in that: The method of adding annotations to the target field documents and triple pairs based on importance and relevance to obtain a prediction model includes: Based on importance and relevance, machine feature annotations and manual annotations are added to the target field documents and triple pairs to obtain machine feature annotation data and manual annotation data; Using the machine feature-annotated data to train a preset document mapping model to obtain a feature model; The preset document mapping model is further trained using the manually annotated data and the feature model to obtain a prediction model.

8. The document retrieval system based on knowledge graph is characterized by: The system includes an interaction unit and a retrieval unit. The interaction unit includes an input module for receiving a query statement and an output module for outputting a document retrieval result. The retrieval unit includes a query statement entity and relationship extraction module, an unregistered word fuzzy matching module, a matching triple module, a medical document triple index construction module, and an association module. A query statement entity and relationship extraction module is used to extract entities and relationships based on the query statement input into the input module, using a prefix dictionary to scan the query statement, extract all entities, and construct an entity set; generate a directed acyclic graph using the entities, and extract all entity relationships based on the directed acyclic graph to construct a relationship set; An unregistered word fuzzy matching module is used to perform fuzzy matching on unregistered words in the input module, using a preset word vector training model and a preset training corpus to train the preset word vector model and perform fuzzy matching on the unregistered words to obtain matched word vectors, and the matched word vectors form a word vector group; Obtain candidate words in the query statement, calculate the matching degree between the word vector group and the candidate words, extract the candidate words with the highest matching degree, add them to the entity set in the received query statement entity and relationship extraction module, and output the entity set to the matching triple module; A triple matching module is used to generate triples based on the received entity set and relationship set, and output them to the medical literature triple index construction module; A medical literature triple index construction module is used to extract all target domain entities from target domain documents and form target domain entity pairs, obtain all the triplets containing the target domain entity pairs from the target domain knowledge graph, and obtain a triple set; based on the triple set, obtain target domain documents that match each triple in the triple set, obtain a document and triple pair set, sort the documents and target domain documents in the triple pair set according to the degree of association, obtain a document index, and output the document index to the association module; The association module is used to sort the document index according to the association degree, obtain the search results and output them.

9. Intelligent terminal, characterized in that: The intelligent terminal includes a memory, a processor, and a knowledge graph-based document retrieval program stored in the memory and runnable on the processor. When the knowledge graph-based document retrieval program is executed by the processor, the steps of the knowledge graph-based document retrieval method as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a knowledge graph-based document retrieval program, which, when executed by a processor, implements the steps of the knowledge graph-based document retrieval method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Medical literature retrieval method and device, electronic equipment and storage medium

    CN112885478A

  • Document book semantic retrieval system based on knowledge graph

    CN115563313A