A document question answering method and apparatus based on topology graph structure
By extracting triplet information from documents and optimizing the topology graph structure, a knowledge graph is constructed. Combined with a large model for document question answering, the problems of low retrieval accuracy and increased computation time in traditional methods are solved, achieving efficient, comprehensive and accurate document retrieval and question answering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 广州极点三维信息科技有限公司
- Filing Date
- 2025-06-18
- Publication Date
- 2026-04-21
AI Technical Summary
Traditional document retrieval methods rely on manual keyword retrieval and large-scale semantic representation, resulting in low retrieval accuracy, increased computation time, lack of interpretability, and inconsistent information recall due to different large-scale models having different semantic representations of the same term.
By extracting triplet information from target documents, constructing a knowledge graph with a topological structure, performing similarity matching and topological search, and combining this with a large model for information extraction, comprehensive and efficient document question answering is achieved.
It improves the comprehensiveness and efficiency of document retrieval and question answering, reduces the consumption of computing resources, avoids recall loss caused by improper keyword settings and confusion in large model matching, and achieves deep understanding and accurate answers to complex documents.
Smart Images

Figure CN120804245B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data analysis technology, and in particular to a document question-answering method and apparatus based on a topological graph structure. Background Technology
[0002] In traditional knowledge retrieval methods, data is stored in isolated databases. When retrieving specific content, search keywords must be designed, and the relevance of each document is calculated based on the keyword's proportion of the total text, thus retrieving relevant documents. This not only places high demands on user queries but also relies on the quality of the retrieved data to the knowledge quality of the database. In the era of big data and artificial intelligence, data is segmented into blocks using predefined methods. Each block is embedded and vectorized, then stored in a vector database. During retrieval, the search content is also represented using embedding vectors, and relevance is scored by comparing it with vectors in the database to retrieve relevant documents. However, traditional methods rely heavily on human intervention, requiring the questioner to have prior understanding of the document for accurate keyword retrieval. Vector retrieval, on the other hand, depends heavily on the semantic representation capabilities of large models and the questioning methods used. Different large models may interpret the same term differently, lacking interpretability. Furthermore, even the same large model may retrieve different information based on different questioning methods for the same event or product, resulting in low accuracy and confusion. Moreover, the computation time for large models to perform vector representation increases significantly with the increase in input. Summary of the Invention
[0003] In view of this, the main objective of the embodiments of the present invention is to provide a document question-answering method and apparatus based on a topological graph structure, in order to solve at least one of the problems of the prior art. The present invention can improve the comprehensiveness and efficiency of document retrieval and question answering.
[0004] To achieve the above objectives, one aspect of the present invention provides a document question-answering method based on a topological graph structure, the method comprising:
[0005] Perform triplet information extraction on the target document to obtain the first relation triplet;
[0006] Construct the target knowledge graph based on the first relation triple;
[0007] Perform triplet information extraction on the input statement to obtain the second relation triplet;
[0008] Based on the second relation triple, similarity matching is performed on the target knowledge graph to obtain the first recall node;
[0009] Based on the first recall node, a topological search is performed on the target knowledge graph to obtain the second recall node;
[0010] Information extraction operations are performed on the first recall node and the second recall node to obtain relevant node information;
[0011] The input statement and the relevant node information are input into the large model to obtain the target answer.
[0012] In some embodiments, the triple information extraction operation on the target document to obtain the first relation triple includes the following steps:
[0013] The target document is parsed to obtain the text portion, image portion, and table portion;
[0014] By using a named entity recognition model, triplet information is extracted from the text portion to obtain the third relation triplet;
[0015] Obtain the image number, caption text information, and image link of the image portion to obtain the fourth relation triple;
[0016] Obtain the table number, table name, and table content of the table portion to obtain the fifth relation triple;
[0017] The first relation triplet is obtained based on the third relation triplet, the fourth relation triplet, and the fifth relation triplet.
[0018] In some embodiments, constructing the target knowledge graph based on the first relation triples includes the following steps:
[0019] Based on the subject element and object element in the first relation triple, establish entity nodes;
[0020] Based on the relation elements in the first relation triplet, establish a relation edge between the subject element and the object element;
[0021] Based on the entity nodes and the relation edges, an initial knowledge graph is obtained;
[0022] The initial knowledge graph is topologically optimized to obtain the target knowledge graph.
[0023] In some embodiments, performing topology optimization on the initial knowledge graph to obtain the target knowledge graph includes the following steps:
[0024] All subject elements and all object elements are represented by embedding vectorization.
[0025] Embedding vectorization representation is performed on relation elements in a first relation triplet having the same subject element and the same object element;
[0026] Obtain the first cosine similarity between the embedding vectors corresponding to the relation edges;
[0027] Merge the relation edges corresponding to the first cosine similarity being greater than the first threshold;
[0028] Obtain the second cosine similarity between the Embedding vectors corresponding to the entity nodes;
[0029] Merge the entity nodes whose second cosine similarity is greater than the second threshold.
[0030] In some embodiments, the process of extracting triplet information from the input statement to obtain a second relation triplet includes the following steps:
[0031] The input statement is processed by a named entity recognition model to extract triple information, thereby obtaining the second relation triple.
[0032] In some embodiments, the step of performing similarity matching on the target knowledge graph based on the second relation triples to obtain the first recall node includes the following steps:
[0033] Based on the subject element, object element, and relation element in the second relation triplet, similarity matching is performed on the subject element, object element, and relation element in the target knowledge graph to obtain the first recall node.
[0034] In some embodiments, the step of performing a topological search on the target knowledge graph based on the first recall node to obtain a second recall node includes the following steps:
[0035] Set the probability of the first node in the target knowledge graph that does not belong to the first recall node to 0.
[0036] Set the sum of the probabilities of each second node corresponding to each of the first recall nodes to 1, and make the probabilities of each second node equal;
[0037] Based on the first node probability and the second node probability, the initial probability distribution is obtained;
[0038] Based on the initial probability distribution, obtain the transition matrix;
[0039] Based on the initial probability distribution and the transition matrix, a random walk search is performed on the target knowledge graph to obtain the second recall node.
[0040] To achieve the above objectives, another aspect of the present invention provides a document question-answering device based on a topological graph structure, the device comprising:
[0041] The first module is used to perform triple information extraction on the target document to obtain the first relation triple;
[0042] The second module is used to construct the target knowledge graph based on the first relation triples;
[0043] The third module is used to extract triplet information from the input statement to obtain the second relation triplet.
[0044] The fourth module is used to perform similarity matching on the target knowledge graph based on the second relation triplet to obtain the first recall node;
[0045] The fifth module is used to perform a topological search on the target knowledge graph based on the first recall node to obtain the second recall node;
[0046] The sixth module is used to perform information extraction operations on the first recall node and the second recall node to obtain relevant node information;
[0047] The seventh module is used to input the input statement and the relevant node information into the large model to obtain the target answer.
[0048] To achieve the above objectives, another aspect of the present invention provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the document question-answering method based on a topology graph structure described above.
[0049] To achieve the above objectives, another aspect of the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the document question-answering method based on a topology graph structure described above.
[0050] To achieve the above objectives, another aspect of the present invention provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned document question-answering method based on a topology graph structure.
[0051] The embodiments of the present invention include at least the following beneficial effects: The present invention provides a document question-answering method and apparatus based on a topological graph structure. This scheme extracts triplet information from a target document to obtain a first relation triplet; constructs a target knowledge graph based on the first relation triplet; extracts triplet information from an input statement to obtain a second relation triplet; performs similarity matching on the target knowledge graph based on the second relation triplet to obtain a first recall node; performs a topological search on the target knowledge graph based on the first recall node to obtain a second recall node; extracts information from the first and second recall nodes to obtain relevant node information; and inputs the input statement and the relevant node information into a large model to obtain the target answer, enabling more comprehensive and faster retrieval and question-answering of document content. Attached Figure Description
[0052] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0053] Figure 1 This is a flowchart of a document question-answering method based on a topology graph structure provided in an embodiment of the present invention;
[0054] Figure 2 This is a schematic diagram of the topology provided in an embodiment of the present invention;
[0055] Figure 3 This is a schematic diagram of a question-and-answer process for a document based on a topology graph structure, provided in an embodiment of the present invention.
[0056] Figure 4 This is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this invention; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this invention as detailed in the appended claims.
[0058] It should be noted that although functional modules are divided in the system diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first / S100" and "second / S200" in the specification, claims, and the foregoing drawings may be used herein to describe various concepts, but unless specifically stated otherwise, these concepts are not limited by these terms. These terms are used only to distinguish one concept from another. For example, first information may also be referred to as second information without departing from the scope of the embodiments of the invention, and similarly, second information may also be referred to as first information. Depending on the context, the words "if" or "when" as used herein may be interpreted as "when," "in response to a determination," or "in the event of a determination."
[0059] The terms “at least one,” “multiple,” “each,” “any,” etc., used in this invention, “at least one” includes one, two, or more than two; “multiple” includes two or more than two; “each” refers to each of the corresponding multiple; and “any” refers to any one of the multiple.
[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to limit the invention.
[0061] Before providing a detailed description of the embodiments of the present invention, some of the nouns and terms involved in the embodiments of the present invention will be explained first. The nouns and terms involved in the embodiments of the present invention are subject to the following interpretations.
[0062] Named Entity Recognition (NER) is a natural language processing (NLP) technique used to identify entities with specific meanings from text, such as names of people, places, organizations, dates, and times.
[0063] Embedding vectorization is a technique that converts data (such as text, images, etc.) into vector representations, and it is widely used in machine learning and natural language processing.
[0064] like Figure 1 As shown, this embodiment of the invention provides a document question-answering method based on a topological graph structure, which may include, but is not limited to, steps S100 to S700:
[0065] Step S100: Perform triplet information extraction on the target document to obtain the first relation triplet;
[0066] Step S200: Construct the target knowledge graph based on the first relation triples;
[0067] Step S300: Perform triplet information extraction operation on the input statement to obtain the second relation triplet;
[0068] Step S400: Based on the second relation triple, perform similarity matching on the target knowledge graph to obtain the first recall node;
[0069] Step S500: Based on the first recall node, perform a topological search on the target knowledge graph to obtain the second recall node;
[0070] Step S600: Perform information extraction operations on the first recall node and the second recall node to obtain relevant node information;
[0071] Step S700: Input the input statement and the relevant node information into the large model to obtain the target answer.
[0072] In step S100 of some embodiments, a triplet information extraction operation is performed on the target document input by the user. Optionally, the "subject-relationship-object" triplet relationship is extracted by a professional domain entity recognition (NER) mini-model.
[0073] In some embodiments, step S100 may include, but is not limited to, steps S110 to S150:
[0074] Step S110: Parse the target document to obtain the text portion, image portion, and table portion;
[0075] Step S120: Using a named entity recognition model, extract triplet information from the text portion to obtain a third relation triplet.
[0076] Step S130: Obtain the image number, caption text information, and image link of the image portion to obtain the fourth relation triple;
[0077] Step S140: Obtain the table number, table name, and table content of the table portion to obtain the fifth relation triple;
[0078] Step S150: Obtain the first relation triplet based on the third relation triplet, the fourth relation triplet, and the fifth relation triplet.
[0079] In steps S110 to S150 of some embodiments, the target document input by the user is first parsed. The target document may include text, images, and tables. For the text, a domain-specific entity recognition (NER) mini-model is directly used to extract the "subject-relation-object" triplet relationship, resulting in a third relation triplet. The "subject," "relation," and "object" elements are all extracted from the text by the NER mini-model. For the image, the image number is used as the "subject" element of the fourth relation triplet, the image caption text is used as the "relation" element, and the image link is used as the "object." For the table, the table number is set as the "subject" element of the fifth relation triplet, the table name is set as the "relation" element, and the entire table content is set as the "object" element. The first relation triplet is obtained by combining the third, fourth, and fifth relation triplets, thus realizing the extraction of entity triplet information from the target document.
[0080] In some embodiments, step S200 may include, but is not limited to, steps S210 to S240:
[0081] Step S210: Establish entity nodes based on the subject element and object element in the first relation triplet;
[0082] Step S220: Based on the relation elements in the first relation triplet, establish a relation edge between the subject element and the object element;
[0083] Step S230: Obtain the initial knowledge graph based on the entity nodes and the relation edges;
[0084] Step S240: Perform topology optimization on the initial knowledge graph to obtain the target knowledge graph.
[0085] In steps S210 to S240 of some embodiments, topology optimization is performed based on the extracted first relation triplet relationships to obtain the target knowledge graph. For example, entity nodes are established based on the names of the "subject" and "object" elements in the extracted first relation triplets. Relationship edges between the subject and object elements are established through the "relationships" in the first relation triplets, i.e., bidirectional edges from subject to object (subject -> object) and from object to subject (object -> subject), thus establishing bidirectional semantic links between related entities. Based on the established entity nodes and bidirectional semantic links, an initial knowledge graph can be obtained. Further topology optimization of the initial knowledge graph yields the target knowledge graph.
[0086] In some embodiments, step S240 may include, but is not limited to, steps S241 to S246:
[0087] Step S241: Embedding vectorization representation is performed on all the subject elements and all the object elements;
[0088] Step S242: Embedding vectorization representation is performed on the relation elements in the first relation triplet that have the same subject element and the same object element;
[0089] Step S243: Obtain the first cosine similarity between the Embedding vectors corresponding to the relation edges;
[0090] Step S244: Merge the relation edges corresponding to the first cosine similarity being greater than the first threshold;
[0091] Step S245: Obtain the second cosine similarity between the Embedding vectors corresponding to the entity nodes;
[0092] Step S246: Merge the entity nodes corresponding to the second cosine similarity being greater than the second threshold.
[0093] In steps S241 to S242 of some embodiments, the extracted first relation triples are traversed, and the names of all “subject” elements and “object” elements, as well as the “relation” of triples with the same “subject” and “object”, are represented by embedding vectorization. Optionally, a semantic representation model such as BERT is used to perform embedding vectorization representation.
[0094] In steps S243 to S246 of some embodiments, a first cosine similarity is calculated between embedding vectors for relation edges, and redundant or similar relations with a first cosine similarity higher than a threshold of 90% are merged. A second cosine similarity is then calculated between embedding vectors for entity nodes, and entity nodes with a second cosine similarity exceeding 90% are merged. Through embedding vectorization, similarity calculation, merging of redundant or similar relations, and merging of similar entity nodes, the graph structure can be simplified, redundant data removed, and the topological information density of the knowledge graph enhanced.
[0095] In some embodiments, after constructing the target knowledge graph, the target knowledge graph can be stored, the complete topology structure can be persisted using a graph-native database (Neo4j), and new entity nodes and connections between nodes can be dynamically added in real time.
[0096] In step S300 of some embodiments, in response to the query statement input by the user, triple information is extracted from the input statement. Optionally, the triple "entity-relationship-object" is extracted by a domain-specific NER entity recognition mini-model, which can obtain a second relation triple containing the entity name and relation name in the user query statement.
[0097] In step S400 of some embodiments, similarity matching is performed in the target knowledge graph based on the names of the "subject" element, the "object" element, and the "relation" element in the second relation triplet to find the relevant entity nodes and associations in the graph and obtain the first recall node of similarity matching.
[0098] In some embodiments, step S500 may include, but is not limited to, steps S510 to S550:
[0099] Step S510: Set the probability of the first node in the target knowledge graph that does not belong to the first recall node to 0.
[0100] Step S520: Set the sum of the probabilities of each second node corresponding to each first recall node to 1, and make the probabilities of each second node equal.
[0101] Step S530: Obtain the initial probability distribution based on the first node probability and the second node probability;
[0102] Step S540: Obtain the transition matrix based on the initial probability distribution;
[0103] Step S550: Based on the initial probability distribution and the transition matrix, perform a random walk search on the target knowledge graph to obtain the second recall node.
[0104] In steps S510 to S530 of some embodiments, in the topological graph structure of the target knowledge graph, the importance weights (i.e., node probabilities) of nodes in the topological structure are initialized based on the first recalled nodes found according to similarity search. The sum of the node probabilities of the first recalled nodes is set to 1, and the node probabilities of each first recalled node are equal. The importance weights of entity nodes in the target knowledge graph that do not belong to the first recalled nodes, i.e., nodes that are not recalled, are all set to 0. Based on the node probabilities set for each entity node, an initial probability distribution can be obtained. For example, as shown... Figure 2 As shown, the topology diagram includes five entity nodes: "product, weight, volume, process, and color". If only three entity nodes, "product, weight, and volume", are recalled, then the initial probability distribution V = [product: 1 / 3, volume: 1 / 3, weight: 1 / 3, process: 0, color: 0].
[0105] In step S540 of some embodiments, the adjacency matrix A and the transition matrix M are calculated based on the obtained initial probability distribution V. For example, the adjacency matrix is defined as follows: if there is a relational edge between entity node i and entity node j, the element at the corresponding position in the adjacency matrix has a value of 1; otherwise, it has a value of 0. The formula for calculating the transition matrix M is as follows:
[0106]
[0107] In the formula, M ij The values in the transition matrix; A ij represents the value in the adjacency matrix; K is the total number of entity nodes; Let i be the total number of outgoing edges of entity node i.
[0108] In step S550 of some embodiments, a topological search is performed using the obtained initial probability distribution V and transition matrix M, i.e., a random walk search is performed on the target knowledge graph. For example, the iterative formula for the random walk search is as follows:
[0109] r k+1 = (1-α)V+αM T r k
[0110] In the formula, r k Let r represent the probability score of each entity node after the k-th iteration, where r 0 =V;r k+1 Let represent the probability score of each entity node after the (k+1)th iteration; (·) T α represents the transpose operation; α represents the random walk probability, that is, in each iteration there is an α probability of continuing to walk along the topology, and the (1-α) probability is randomly transferred to a node in the initial distribution. Optionally, α can be 0.5.
[0111] In some embodiments, the probability score of each entity node reached during a random walk increases. The random walk process terminates when the probability score approaches stability, i.e., the change in node probability distribution between two iterations is less than a set threshold ε. If the termination condition is not met, a topological search of the target knowledge graph continues. Optionally, ε is set to 10. -6 The formula for setting the threshold ε is as follows:
[0112] ||r k+1 -r k ||<ε
[0113] In step S600 of some embodiments, entity node information extraction and missed node recall are performed. Optionally, the probability scores of entity nodes are sorted in descending order, with higher scores ranked higher. The top k relevant node information is extracted by using a pre-set node extraction hyperparameter topk. The entity node objects from which relevant node information is extracted include both the first recalled nodes found through similarity search and the second recalled nodes found through topology search, thus achieving supplementary recall of missed nodes. For example, after terminating the random walk on the target knowledge graph, the probability scores of entity nodes in the target knowledge graph are obtained. Based on the probability scores, the entity nodes are sorted in descending order, with higher scores ranked higher. Then, the relevant node information of the first few entity nodes is extracted. The extracted entity node objects include the first and second recalled nodes.
[0114] In step S700 of some embodiments, the user-inputted question and the relevant node information extracted from the target knowledge graph are input into a large model for reasoning and analysis, and the large model infers and returns the answer to the input question.
[0115] like Figure 3 As shown, the question-and-answer process for documents based on a topology graph structure provided in the embodiments of the invention may include the following steps:
[0116] First, a small entity recognition (NER) model from the relevant domain is used to extract the "subject-relation-object" triple relationships from the user-input document. This identifies the entities appearing in the document and their corresponding relationships. A topological graph is generated based on the entity nodes and the relationships between them. Topological optimization is then performed on the graph, merging nodes and edges with high similarity, before the graph is stored.
[0117] Secondly, a similarity search is performed on the question input by the user to recall the most similar nodes. Then, based on the recalled nodes and edges, a topological search is performed on the graph to recall any missed nodes.
[0118] Finally, the user's questions and all node information retrieved by the topology search are summarized, and answers are given through the summarization and reasoning capabilities of the large model, thus completing a deep understanding of the document and question answering.
[0119] This invention also provides a document question-answering device based on a topology graph structure, which can implement the above-described document question-answering method based on a topology graph structure. The device includes:
[0120] The first module is used to perform triple information extraction on the target document to obtain the first relation triple;
[0121] The second module is used to construct the target knowledge graph based on the first relation triples;
[0122] The third module is used to extract triplet information from the input statement to obtain the second relation triplet.
[0123] The fourth module is used to perform similarity matching on the target knowledge graph based on the second relation triplet to obtain the first recall node;
[0124] The fifth module is used to perform a topological search on the target knowledge graph based on the first recall node to obtain the second recall node;
[0125] The sixth module is used to perform information extraction operations on the first recall node and the second recall node to obtain relevant node information;
[0126] The seventh module is used to input the input statement and the relevant node information into the large model to obtain the target answer.
[0127] It is understood that the content of the above method embodiments is applicable to the present device embodiments. The specific functions implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0128] This invention also provides an electronic device, which includes a processor and a memory. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned document question-answering method based on a topology graph structure. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0129] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0130] refer to Figure 4 , Figure 4 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:
[0131] The processor 801 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention.
[0132] The memory 802 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 802 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 802 and is called and executed by the processor 801 using the document question-answering method based on the topology graph structure of this invention.
[0133] The 803 input / output interface is used to implement information input and output.
[0134] The communication interface 804 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0135] Bus 805 transmits information between various components of the device (e.g., processor 801, memory 802, input / output interface 803, and communication interface 804);
[0136] The processor 801, memory 802, input / output interface 803, and communication interface 804 are connected to each other within the device via bus 805.
[0137] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described document question-answering method based on a topology graph structure.
[0138] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0139] This invention also provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned document question-answering method based on a topology graph structure.
[0140] In summary, the document question-answering method and apparatus based on topological graph structure of the present invention have the following advantages:
[0141] 1. The embodiments of the present invention combine the topological graph structuring and recall capabilities with the reasoning and analysis capabilities of large models to comprehensively connect and recall information related to user questions, thereby achieving a deep and comprehensive understanding of complex documents and providing comprehensive, fast, and accurate answers to document questions.
[0142] 2. The data retrieval method based on the topology graph structure in this embodiment of the invention can make the retrieval results more accurate, comprehensive and controllable. This method has significant advantages in complex relationship modeling and dynamic scene adaptation.
[0143] 3. The embodiments of the present invention also integrate topological structure and graph database storage methods. Unlike traditional keyword retrieval and vectorized retrieval methods after full-text block division, the embodiments of the present invention utilize the topological structure in the graph database to retrieve entities, optimize and expand the data through the relationship edges between entities, thereby performing comprehensive retrieval and recall of data and achieving accurate answers to document queries.
[0144] 4. This invention optimizes and completes knowledge through a dedicated entity recognition small model and graph topology, making retrieval results more accurate, comprehensive, and controllable. It also reduces the computational and time resources consumed by large models in the knowledge understanding stage, improving retrieval efficiency. Furthermore, it avoids the recall loss problem caused by improper keyword settings in traditional database extraction. This invention also avoids the confusion and poor interpretability issues during large model matching searches through graph topology optimization.
[0145] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is altered and sub-operations described as part of a larger operation are executed independently.
[0146] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the described functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.
[0147] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0148] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0149] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0150] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0151] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0152] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
[0153] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.
Claims
1. A document question-answering method based on a topological graph structure, characterized in that, Includes the following steps: Perform triplet information extraction on the target document to obtain the first relation triplet; Construct the target knowledge graph based on the first relation triple; Perform triplet information extraction on the input statement to obtain the second relation triplet; Based on the second relation triple, similarity matching is performed on the target knowledge graph to obtain the first recall node; Based on the first recall node, a topological search is performed on the target knowledge graph to obtain a second recall node, including: The probability of the first node of an entity node in the target knowledge graph that does not belong to the first recall node is set to 0; the sum of the probabilities of the second nodes corresponding to each of the first recall nodes is set to 1, and the probabilities of each of the second nodes are equal; an initial probability distribution is obtained based on the probabilities of the first nodes and the second nodes; a transition matrix is obtained based on the initial probability distribution; a random walk search is performed on the target knowledge graph based on the initial probability distribution and the transition matrix to obtain the second recall nodes; the iterative formula for the random walk search is as follows: ; In the formula, Indicates the first The probability score of each entity node after one iteration; Indicates the first The probability score of each entity node after one iteration; Indicates the initial probability distribution; Represents the transition matrix; Indicates the transpose operation; Represents the probability of a random walk; Information extraction operations are performed on the first recall node and the second recall node to obtain relevant node information; The input statement and the relevant node information are input into the large model to obtain the target answer.
2. The document question-answering method based on topological graph structure according to claim 1, characterized in that, The process of extracting triplet information from the target document to obtain the first relation triplet includes the following steps: The target document is parsed to obtain the text portion, image portion, and table portion; By using a named entity recognition model, triplet information is extracted from the text portion to obtain the third relation triplet; Obtain the image number, caption text information, and image link of the image portion to obtain the fourth relation triple; Obtain the table number, table name, and table content of the table portion to obtain the fifth relation triple; The first relation triplet is obtained based on the third relation triplet, the fourth relation triplet, and the fifth relation triplet.
3. The document question-answering method based on topological graph structure according to claim 1, characterized in that, The construction of the target knowledge graph based on the first relation triplet includes the following steps: Based on the subject element and object element in the first relation triple, establish entity nodes; Based on the relation elements in the first relation triplet, establish a relation edge between the subject element and the object element; Based on the entity nodes and the relation edges, an initial knowledge graph is obtained; The initial knowledge graph is topologically optimized to obtain the target knowledge graph.
4. The document question-answering method based on topological graph structure according to claim 3, characterized in that, The process of performing topology optimization on the initial knowledge graph to obtain the target knowledge graph includes the following steps: All subject elements and all object elements are represented by embedding vectorization. Embedding vectorization representation is performed on relation elements in a first relation triplet having the same subject element and the same object element; Obtain the first cosine similarity between the embedding vectors corresponding to the relation edges; Merge the relation edges corresponding to the first cosine similarity being greater than the first threshold; Obtain the second cosine similarity between the Embedding vectors corresponding to the entity nodes; Merge the entity nodes whose second cosine similarity is greater than the second threshold.
5. The document question-answering method based on topological graph structure according to claim 1, characterized in that, The process of extracting triplet information from the input statement to obtain the second relation triplet includes the following steps: The input statement is processed by a named entity recognition model to extract triple information, thereby obtaining the second relation triple.
6. The document question-answering method based on topological graph structure according to claim 1, characterized in that, The step of performing similarity matching on the target knowledge graph based on the second relation triplet to obtain the first recall node includes the following steps: Based on the subject element, object element, and relation element in the second relation triplet, similarity matching is performed on the subject element, object element, and relation element in the target knowledge graph to obtain the first recall node.
7. A document question-answering device based on a topological graph structure, characterized in that, include: The first module is used to perform triple information extraction on the target document to obtain the first relation triple; The second module is used to construct the target knowledge graph based on the first relation triples; The third module is used to extract triplet information from the input statement to obtain the second relation triplet. The fourth module is used to perform similarity matching on the target knowledge graph based on the second relation triplet to obtain the first recall node; The fifth module is used to perform a topological search on the target knowledge graph based on the first recall node to obtain a second recall node; the fifth module is specifically used for: The probability of the first node of an entity node in the target knowledge graph that does not belong to the first recall node is set to 0; the sum of the probabilities of the second nodes corresponding to each of the first recall nodes is set to 1, and the probabilities of each of the second nodes are equal; an initial probability distribution is obtained based on the probabilities of the first nodes and the second nodes; a transition matrix is obtained based on the initial probability distribution; a random walk search is performed on the target knowledge graph based on the initial probability distribution and the transition matrix to obtain the second recall nodes; the iterative formula for the random walk search is as follows: ; In the formula, Indicates the first The probability score of each entity node after one iteration; Indicates the first The probability score of each entity node after one iteration; Indicates the initial probability distribution; Represents the transition matrix; Indicates the transpose operation; Represents the probability of a random walk; The sixth module is used to perform information extraction operations on the first recall node and the second recall node to obtain relevant node information; The seventh module is used to input the input statement and the relevant node information into the large model to obtain the target answer.
8. An electronic device, characterized in that, Including the processor and memory; The memory is used to store programs; The processor executes the program to implement the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The storage medium stores a program that is executed by a processor to implement the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Question and answer knowledge retrieval method, device and equipment based on graph embedding
CN113947084A
Large model document question answering method and system based on graph structure
CN119377361A