Document question and answer method and device based on hypergraph

By constructing a document hypergraph and searching for candidate node paths in it, the problem of insufficient quality and accuracy of Q&A caused by single search hierarchy in the prior art is solved, and more efficient information retrieval and Q&A effects are achieved.

CN120030103AActive Publication Date: 2025-05-23ZHUO SHI TECH (HAINAN) CO LTD

Patent Information

Application Number
CN202510508674.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2025-05-23
Estimated Expiration
2045-04-22

AI Technical Summary

Technical Problem

The existing search enhancement technology is single at the text segmentation and matching levels, resulting in insufficient similarity and precision of search results, which in turn affects the quality and accuracy of the question and answer.

Method used

By dividing the pending document into subparagraphs, extracting entities and entity relationships, building a document hypergraph, and searching the candidate node paths in the hypergraph in the order of global hyper edges, local hyper edges, and entity nodes to generate a target reply.

Benefits of technology

By building multi-level document hypergraphs, we can balance the overall and detailed information, search through layers of searches, accurately filter out content related to pending questions, and improve the quality and accuracy of question-and-answer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120030103A_ABST
    Figure CN120030103A_ABST
Patent Text Reader

Abstract

The invention provides a hypergraph-based document question and answer method and device, and relates to the technical field of artificial intelligence. The method comprises the steps of obtaining a to-be-processed document and a to-be-processed problem; extracting an entity and an entity relationship from each sub-paragraph in the to-be-processed document to construct a document hypergraph comprising three levels of global hyperedges, local hyperedges and entity nodes; in the document hypergraph, searching a plurality of candidate node paths matched with the to-be-processed problem according to a specified sequence; recording search process information of the candidate node paths in the process of searching the candidate node paths; and determining target search process information by using the sequence score and the search strategy information, and generating a target reply of the to-be-processed question according to the target search process information. According to the method, the overall and detailed information can be balanced by constructing the hypergraph structure of the global hyperedge and the local hyperedge and progressive layer by layer, and the content related to the to-be-processed question can be screened out by searching layer by layer in the hypergraph, so that the answering quality and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a document question-answering method and device based on a hypergraph. Background Art

[0002] Retrieval enhancement technology is a technical framework that combines information retrieval technology with language models. When the model needs to generate text or answer questions, it can retrieve relevant information from the document, and then use the retrieved information to guide text generation, so as to reduce model hallucinations and improve the quality and accuracy of the generated content.

[0003] Current search enhancement technology can mainly divide text into smaller text blocks, and then use keywords to perform single-level matching on the text blocks to extract key information and generate answers. This method has a single search level, which easily leads to insufficient similarity and precision of search results, and thus leads to low quality and accuracy of questions and answers. Summary of the invention

[0004] In view of the above problems, the purpose of the present invention is to provide a hypergraph-based document question and answer method and device, which can enrich the retrieval level and improve the quality and accuracy of question and answer.

[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0006] In one aspect, the present invention provides a hypergraph-based document question-answering method, comprising:

[0007] Get pending documents and issues;

[0008] Extracting entities and entity relationships from each subparagraph in the document to be processed to construct a document hypergraph, wherein the document hypergraph includes entity nodes representing entities, common edges representing entity relationships, local hyperedges representing entities belonging to the same subparagraph, and global hyperedges representing similar local hyperedges;

[0009] In the document hypergraph, multiple candidate node paths matching the problem to be processed are searched in a specified order, wherein the specified order is the order of global hyperedges, local hyperedges, and entity nodes;

[0010] In the process of searching the candidate node path, recording the search process information of the candidate node path, the search process information including the search sequence, sequence score and search strategy information;

[0011] Determining target search process information from the search process information of the candidate node path using the sequence score and the search strategy information;

[0012] Based on the target search process information, a target answer corresponding to the problem to be processed is generated.

[0013] On the other hand, the present invention also provides a document question-answering device based on a hypergraph, comprising:

[0014] The acquisition module is used to obtain documents and issues to be processed;

[0015] A construction module, used for extracting entities and entity relationships from each subparagraph in the document to be processed to construct a document hypergraph, wherein the document hypergraph includes entity nodes representing entities, common edges representing entity relationships, local hyperedges representing entities belonging to the same subparagraph, and global hyperedges representing similar local hyperedges;

[0016] A search module, used to search for multiple candidate node paths matching the problem to be processed in the document hypergraph in a specified order, wherein the specified order is the order of global hyperedges, local hyperedges, and entity nodes;

[0017] A recording module, used for recording the search process information of the candidate node path in the process of searching the candidate node path, wherein the search process information includes a search sequence, a sequence score and a search strategy information;

[0018] A screening module, configured to determine target search process information from the search process information of the candidate node paths by using the sequence score and the search strategy information;

[0019] The reply module is used to generate a target reply corresponding to the problem to be processed based on the target search process information.

[0020] On the other hand, the present invention also provides an electronic device, including a processor and a memory, wherein the memory stores multiple instructions; the processor loads instructions from the memory to execute the steps in any one of the hypergraph-based document question and answer methods provided by the present invention.

[0021] On the other hand, the present invention also provides a computer-readable storage medium, which stores multiple instructions, and the instructions are suitable for a processor to load to execute the steps of any hypergraph-based document question and answer method provided by the present invention.

[0022] On the other hand, an embodiment of the present invention further provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps of any hypergraph-based document question-and-answer method provided by the present invention.

[0023] The beneficial effects brought about by the technical solution provided by the present invention include at least:

[0024] In the embodiment of the present invention, after the document to be processed is divided into sub-paragraphs, entities and entity relationships are extracted according to the sub-paragraphs, so as to convert the document content into a document hypergraph, and the candidate node paths related to the problem to be processed are retrieved in the document hypergraph in a specified order, wherein the search process information corresponding to the candidate node path can be obtained in the process of searching the candidate node path; the sequence score and search strategy information in the search process information are used to screen out the target search process information, and the target answer to the problem to be processed is generated accordingly. By constructing a hypergraph structure of global hyperedges and local hyperedges, the overall and detailed information can be balanced, and the layer-by-layer progressive search in the hypergraph can accurately screen out the content related to the problem to be processed, thereby improving the quality and accuracy of the question and answer. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the 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 work.

[0026] Figure 1 Schematic diagram of an application scenario of a hypergraph-based document question-answering method provided by an embodiment of the present invention;

[0027] Figure 2 It is a flowchart of a hypergraph-based document question-answering method provided by an embodiment of the present invention;

[0028] Figure 3 is a schematic diagram of constructing a document hypergraph provided by an embodiment of the present invention;

[0029] Figure 4 It is a schematic diagram of searching for candidate node paths in a document hypergraph provided by an embodiment of the present invention;

[0030] Figure 5 is a schematic diagram of the structure of a hypergraph-based document question-answering device provided in an embodiment of the present invention;

[0031] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0033] It is understandable that in the specific implementation of the present invention, data related to user information, etc., needs to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0034] See also Figure 1 , shows a schematic diagram of an application scenario of a document question-answering method based on a hypergraph. The application scenario may include a terminal 101 and a server 102, and data may be exchanged between the terminal 101 and the server 102 via a network, and an application program related to question-answering may be installed on the terminal 101. The terminal 101 may be a mobile phone, a tablet computer, a smart Bluetooth device, a computer, a large screen device, a robot, etc.; the server 102 may be a single server or a server cluster consisting of multiple servers.

[0035] The user can send the document to be processed and the question to be processed to the server 102 through the terminal 101, so that the server 102 can construct a document hypergraph based on the entities and entity relationships extracted from each sub-paragraph in the document to be processed. The document hypergraph may include entity nodes representing entities, common edges representing entity relationships, local hyperedges representing entities belonging to the same sub-paragraph, and global hyperedges representing similar local hyperedges. Then, the document hypergraph can continue to search for multiple candidate node paths matching the question to be processed in a specified order, and the specified order is the order of global hyperedges, local hyperedges, and entity nodes; and in the process of searching the candidate node path, the search process information of the candidate node path can be recorded, and the search process information may include search sequence, sequence score, and search strategy information; using the sequence score and search strategy information, the target search process information is determined from the search process information of the candidate node path; finally, the target answer to the question to be processed is generated based on the target search process information.

[0036] Then, the server 102 may send the generated target reply to the terminal 101 so as to display the target reply to the user through the terminal 101 .

[0037] In this embodiment, a document question answering method based on a hypergraph is provided. Figure 2 As shown, the specific process of the hypergraph-based document question answering method can be as follows:

[0038] S110, obtaining documents to be processed and issues to be processed.

[0039] The pending question refers to a question that needs to be answered. The pending question can be provided by the user. The pending document is the basis for answering the pending question, that is, answering the pending question requires understanding the content of the pending document. The pending document can be input by the user when inputting the pending question. The input form of the pending document is varied, for example, it can be directly uploading the corresponding document file, inputting it in the form of a picture, inputting it in the form of a document link, etc. It can be set according to actual needs and is not specifically limited here.

[0040] S120: extracting entities and entity relationships from each sub-paragraph in the document to be processed to construct a document hypergraph.

[0041] After obtaining the document to be processed, the document to be processed can be divided into multiple sub-paragraphs. For each sub-paragraph, entities and entity relationships can be extracted therefrom to construct a document hypergraph corresponding to the document to be processed.

[0042] The constructed document hypergraph may include multiple entity nodes and edges. The entity node may be used to represent the extracted specific entity, and one entity corresponds to one entity node. The edge may be used to represent the association relationship between nodes. Specifically, the edge in the document hypergraph may include a common edge, a local hyperedge, and a global hyperedge.

[0043] Among them, a common edge is an edge connecting two entity nodes, and the number of entity nodes that a hyperedge can connect is not limited to 2, but can be multiple. Among them, the extracted entity relationship can be represented by a common edge, while a local hyperedge can connect the entity nodes corresponding to the entities in the same subparagraph, and a global hyperedge can connect similar local hyperedges.

[0044] As an implementation method, when generating a document hypergraph, the document to be processed may be divided into multiple sub-paragraphs; for each sub-paragraph, entities and entity relationships are extracted from the sub-paragraph; a basic document graph is constructed with the entities as entity nodes and the entity relationships as common edges between entity nodes; in the basic document graph, local hyperedges are established for entity nodes belonging to the same sub-paragraph, and local descriptions corresponding to the local hyperedges are generated with the context of the sub-paragraph to obtain an intermediate document graph; in the intermediate document graph, global hyperedges and global descriptions are generated using all local descriptions to obtain a document hypergraph.

[0045] See also Figure 3, showing a schematic diagram of constructing a document hypergraph. The document to be processed can be divided into multiple sub-paragraphs. For example, the text in the document to be processed can be directly divided into sub-paragraphs according to natural paragraphs. In order to ensure the semantic coherence in the sub-paragraphs and improve the reliability of subsequent entity extraction, the semantic analysis capability of the large model can be used to further adjust the content initially divided into text blocks, so that the semantics of the sub-paragraphs are more compact and the theme is more unified.

[0046] Optionally, when dividing a document to be processed into multiple sub-paragraphs, the document to be processed may be segmented into multiple text blocks; for each text block, the text block is spliced ​​with a segmentation template to obtain segmentation prompt words, the segmentation template is a prompt word template for segmenting text blocks, and the segmentation prompt words include segmentation rules and summary rules; the segmentation prompt words are input into a segmentation model to guide the segmentation model to segment the text block into sub-texts according to the segmentation rules, and the sub-texts are summarized according to the summary rules to obtain sub-paragraphs.

[0047] The document to be processed is divided into multiple text blocks, and the segmentation method can be segmentation according to natural paragraphs or segmentation according to a fixed number of words. Among them, segmentation according to natural paragraphs refers to using line breaks, blank lines or other custom punctuation marks in the document as boundaries between paragraphs, and dividing the text into blocks according to the boundaries. In this way, the internal semantics of each text block obtained is coherent, which is suitable for situations where the structure is clear and the paragraphs are clear. Segmentation according to a fixed number of words is for when the document to be processed does not have clear paragraph marks, and it can be segmented according to a fixed number of characters or times. In the embodiment of the present invention, at least one of these two segmentation methods can be used to segment the document to be processed into multiple text blocks.

[0048] For each text block, the text block can be segmented and reorganized into multiple sub-paragraphs, and the content in each sub-paragraph has a unified theme. The segmentation template is a prompt word template used to segment the text block into sub-paragraphs, and the segmentation template can be set in advance according to actual needs. In an embodiment of the present invention, the segmentation template can be:

[0049] "You are a text processing expert. Your task is to perform semantic analysis on a given block of text, and then segment and reorganize the text block into multiple sub-segments based on the inherent semantic relationship of the content, so that the content within each sub-segment has a unified theme.

[0050] Carefully analyze the given text block, then merge sentences with similar topics into the same sub-segment, and generate a comprehensive and coherent summary description for each sub-segment to summarize the sub-segment. The final result is returned in JSON format.

[0051] Note:

[0052] 1. The summary description should retain the key information of the sub-paragraph content.

[0053] 2. The summary description needs to be objective and true. Remember not to add knowledge that does not exist in the sub-paragraphs.

[0054] 3. The summary description needs to briefly summarize the key entity relationships in the sub-paragraph.

[0055] Output format requirements:

[0056] ```json

[0057] {

[0058] "segments": [

[0059] {

[0060] "summary": "",

[0061] "content": ""

[0062] } ]

[0064] }

[0065] The input text block looks like this: {input_text}"

[0066] Filling the text block into {input_text} can realize the segmentation prompt words by splicing the text block and the segmentation template. Based on the aforementioned segmentation template, it can be known that the segmentation prompt words may include the segmentation rules and summary rules of the text, wherein the segmentation rules may be "carefully analyzing the given text block, and then merging sentences of similar topics into the same sub-paragraph", and the content in "Precautions" can be regarded as the summary rules. After the segmentation prompt words are input into the segmentation model, the segmentation model can be guided to segment the text block into sub-texts according to the segmentation rules, and after summarizing the sub-texts according to the summary rules, the sub-paragraphs are obtained. That is, the sub-paragraphs may include the sub-text and the summarized content.

[0067] For each sub-paragraph, entities and entity relationships can be extracted from the sub-paragraph to construct a document hypergraph. In order to accurately extract entities and entity relationships, a large language model and prompt words can be used for extraction. For example, preset entity types and sub-paragraphs can be filled into an extraction template to obtain extraction prompt words, wherein the extraction prompt words and the extraction template include multiple extraction steps, extraction examples, and output requirements; the multiple extraction steps are executed based on the extraction examples to extract entities and entity relationships from the sub-paragraphs; the entities and entity relationships are organized and output according to the output requirements.

[0068] The preset entity type can be set according to actual needs. The preset entity type refers to the possible type of entity that appears in the sub-paragraph, and multiple preset entity types can be set in advance. The extraction template is a prompt word template used for extracting entities and entity relationships, and can also be set according to actual needs. In an embodiment of the present invention, the extraction template can be:

[0069] "You are a text processing expert. Your task is to analyze a given block of text, identify all entities of these types and all relations between the identified entities from the given block of text, and summarize a comprehensive description for each entity and relation in the context.

[0070] Task flow:

[0071] 1. Identify all entities. For each identified entity, extract the following information:

[0072] entity_name: The name of the entity. If it is in English, it needs to be capitalized.

[0073] entity_type: The type of entity: one of the following: [{entity_types}]

[0074] entity_description: A comprehensive description of the entity's attributes and related activities

[0075] Format each entity as:

[0076] ("entity"{tuple_delimiter}<entity_name> {tuple_delimiter}<entity_type> {tuple_delimiter}<entity_description> )

[0077] 2. From the entities identified in step 1, find all pairs of relationships (source_entity, target_entity) that are “clearly related” to each other.

[0078] For each pair of related entities, extract the following information:

[0079] source_entity: The name of the source entity, as determined in step 1

[0080] target_entity: The target entity name determined in step 1

[0081] relation_description: Explain why you think the source and target entities are related to each other

[0082] relation_strength: A numerical value indicating the strength of the relationship between the source entity and the target entity

[0083] Format each relationship as:

[0084] ("relationship"{tuple_delimiter}<source_entity> {tuple_delimiter}<target_entity> {tuple_delimiter}<relationship_description> {tuple_delimiter}<relationship_strength> )

[0085] 3. Return the Chinese output, a single list of all entities and relations identified in steps 1 and 2. Use {record_delimiter} as a list separator.

[0086] 4. After completion, output {completion_delimiter}.

[0087] By filling the sub-paragraphs and the preset entity types into the extraction template, an extraction prompt word can be obtained. Based on the content in the aforementioned extraction template, it can be known that the extraction prompt word may include multiple extraction steps, extraction examples, and output requirements. The extraction prompt word is input into the extraction model, and the extraction model can fully understand the extraction steps and output requirements through the extraction examples, and execute multiple extraction steps to extract entities and entity relationships from the sub-paragraphs, and then output according to the output requirements.

[0088] It should be noted that after extracting entities and entity relationships from each sub-paragraph, the entity relationships can be deduplicated first, and similar entities can be merged to reduce redundancy. Then, the extracted entities can be used as entity nodes, and for the two entities in the entity relationship, edges can be established in the corresponding entity nodes as ordinary edges, so that a common graph is obtained, which is subsequently called the basic document graph.

[0089] In order to further enrich the relationships between entities and explore deeper associations between entities, hyperedges can be constructed based on basic documents. Hyperedges refer to edges that can connect any number of edges and can represent more complex relationships.

[0090] In an embodiment of the present invention, a local hyperedge can be established for entity nodes belonging to the same subparagraph in the basic document graph, and a local description corresponding to the local hyperedge can be generated with the context of the corresponding subparagraph. That is, for each subparagraph, all entity nodes in the subparagraph can be connected using a hyperedge as a local hyperedge. The context of the subparagraph can be understood as the corresponding summary description when the subparagraph is obtained, which is used as the local description corresponding to the local hyperedge to obtain the intermediate document graph.

[0091] Optionally, in the intermediate document graph, the frequency of occurrence of each entity node in the local hyperedge can also be recorded, and the weight of the corresponding entity node of the entity node that appears repeatedly in multiple local hyperedges can be increased to enhance its importance in the entire document to be processed.

[0092] In the intermediate document graph, a global hyperedge and a corresponding global description can be constructed based on the local hyperedges to obtain a document hypergraph. Optionally, all the local hyperedges can be clustered using the local descriptions to obtain multiple clusters; in the intermediate document graph, a global hyperedge is established for the local hyperedges belonging to the same cluster; for each global hyperedge, a global description corresponding to the global hyperedge is generated based on the local descriptions of all local hyperedges in the cluster to obtain a document hypergraph.

[0093] Local hyperedges are constructed in the aforementioned intermediate document graph, and each local hyperedge has a corresponding local description. For each local description, the mainstream embedding model can be used to convert the local description into a local description vector, and then all local hyperedges are clustered using the local description vector to obtain multiple clusters. For each cluster, a global hyperedge can be established for all local hyperedges in the cluster, that is, the global hyperedge contains similar local hyperedges.

[0094] The clustering process may adopt an existing clustering algorithm, such as K-means clustering, HDBSCAN clustering algorithm, etc., which may be set according to actual needs. In the embodiment of the present invention, the HDBSCAN clustering algorithm is used for clustering. During the clustering process, the minimum number of local hyperedges contained in the cluster may be set first, and then the algorithm may automatically determine the number of global hyperedges and the local hyperedges contained therein according to the density distribution of the local description vector.

[0095] After constructing the global hyperedge, a global description of the global hyperedge needs to be generated accordingly. As an implementation method, for each global hyperedge, local descriptions of all local hyperedges therein can be obtained, and the global description corresponding to the global hyperedge is generated using these local descriptions.

[0096] As an implementation method, for a global hyperedge, the local descriptions corresponding to all local hyperedges within the global hyperedge may be directly concatenated to obtain a global description.

[0097] As another implementation, these local descriptions can be summarized using a large language model and sample prompts to obtain a global description corresponding to the global hyperedge. For example, the local descriptions corresponding to all local hyperedges contained in the global hyperedge can be filled into the description template to generate description prompt words; the description prompt words are then input into the description model to generate the corresponding global description. The description template is a pre-set prompt word template for summarizing multiple local descriptions and can be set according to actual needs. In an embodiment of the present invention, the description template can specifically be:

[0098] “You are an experienced text analysis and processing expert. Your task is to summarize the descriptions of all local hyperedges in each global hyperedge and generate a global hyperedge description that accurately reflects the global theme and key information.

[0099] Note:

[0100] 1. The output global hyperedge description should contain the key information of all the provided local hyperedge descriptions

[0101] 2. You need to consider both the overall theme and the specific details

[0102] 3. Specific concepts or terms that appear in the local hyperedge description need to be fully preserved

[0103] 4. The language expression should be concise and clear, the logic should be clear, and the final result should be output in text form

[0104] The input format is as follows: [

[0106] "Local Hyperedge Description 1",

[0107] "Local Hyperedge Description 2", ... ]

[0110] <example>

[0111] Example 1:

[0112] Local hyperedge description: [

[0114] "Project A focuses on technological innovations that harness solar and wind energy.",

[0115] "Project B emphasizes the role of green energy in driving economic development." ]

[0117] Global hyperedge description:

[0118] "This global hyperfront focuses on green energy technology and its application and impact on economic development."

[0119] Example 2:

[0120] Local hyperedge description: [

[0122] "Part of the description discusses strategies for optimizing and allocating educational resources.",

[0123] "The other part focuses on measures to improve teaching quality and student capabilities." ]

[0125] Global hyperedge description:

[0126] "This global hyperedge embodies a comprehensive strategy for optimizing resources and improving teaching quality in education"

[0127] Actual query:

[0128] Local hyperedge description: [...]

[0129] Global hyperedge description:"

[0130] By filling the local descriptions corresponding to all local hyperedges in the global hyperedge into the description template, a description prompt word can be obtained, and the description prompt word can be input into the description model to guide the description model to generate a global description, and then the corresponding document hypergraph can be obtained. The description model can be a large language model.

[0131] The document hypergraph established in the above manner may include entity nodes, common edges between entity nodes, local hyperedges and corresponding local descriptions, and global hyperedges and corresponding global descriptions. Among them, local hyperedges can connect entity nodes belonging to the same subparagraph, and local descriptions can be considered as summary descriptions of a single subparagraph; global hyperedges can connect entity nodes in similar subparagraphs together, which is equivalent to grouping similar subparagraphs in the document together, and global descriptions are summary descriptions of similar subparagraphs.

[0132] S130. In the document hypergraph, multiple candidate node paths matching the problem to be processed are searched in a specified order, wherein the specified order is the order of global hyperedges, local hyperedges, and entity nodes.

[0133] According to the above processing, the document to be processed has been converted into a document hypergraph representation. In order to answer the problem to be processed, the problem to be processed can be used to search for its matching candidate node path in the document hypergraph in a specified order. From the above content, it can be seen that the document hypergraph contains three different levels of edges. The specified order refers to the order from large to small levels. In the embodiment of the present invention, the specified order can be the order of global hyperedges, local hyperedges and entity nodes.

[0134] The candidate node path refers to the node path formed by the entity nodes related to the problem to be processed in the document hypergraph. Figure 4 , which shows a schematic diagram of searching for candidate node paths in a document hypergraph.

[0135] Optionally, when determining the candidate node path, the document hypergraph may be searched in a specified order for the intermediate entity node corresponding to the problem to be processed; multiple intermediate node paths corresponding to the intermediate entity node are obtained; the path resource value of the intermediate node path is calculated based on the node resource value of each entity node in the intermediate node path and the number of nodes in the intermediate node path; and the candidate node path is determined from the intermediate node path using the path resource value.

[0136] Search the document hypergraph in the order of global hyperedges, local hyperedges, and entity nodes to retrieve the intermediate entity nodes corresponding to the problem to be processed, wherein the intermediate entity nodes are entity nodes related to the problem to be processed. As an implementation method, the problem to be processed and the global description of the global hyperedge are matched by similarity to screen out multiple candidate global hyperedges; in the local hyperedges corresponding to the candidate global hyperedges, the problem to be processed and the local description of the local hyperedge are matched by similarity to determine multiple candidate local hyperedges; for each entity node in the candidate local hyperedge, the problem to be processed and the entity node are matched by similarity to determine multiple intermediate entity nodes.

[0137] As another implementation method, in order to perform more accurate and detailed matching, when determining the intermediate entity node, global keywords and local keywords can be extracted from the problem to be processed; the global matching degree between the global keyword and each of the global hyperedges is calculated to determine the candidate global hyperedges; for each candidate global hyperedge, the local matching degree between the local keyword and each local hyperedge in the candidate global hyperedge is calculated to determine the candidate local hyperedges; for each candidate local hyperedge, the entity matching degree between the local keyword and each entity node in the candidate local hyperedge is calculated to determine the intermediate entity node.

[0138] Global keywords refer to words that represent the main subject and direction of the problem to be processed, usually conceptual, thematic, and broad intent keywords. Local keywords refer to words that represent specific details and specific information in the problem to be processed, usually specific entities, detailed information, or specific terms. These two levels of keywords can be extracted from the problem to be processed, so that the extracted global keywords and local keywords can be used to search in the document hypergraph later.

[0139] Among them, the extraction of global keywords and local keywords can rely on the large language model, that is, a prompt word template used for keyword extraction is pre-constructed and recorded as a preset template. The corresponding prompt words can be obtained by filling the problem to be processed into the preset template, and then the prompt words are input into the large language model so that the large language model can analyze and process the problem to be processed and extract global keywords and local keywords.

[0140] The preset template may be set according to actual conditions. In an embodiment of the present invention, the preset template may be as follows:

[0141] "You are an expert in text analysis and processing, and your task is to identify global and local keywords in user queries.

[0142] For a given query, list global and local keywords. Global keywords focus on overall concepts or themes, while local keywords focus on specific entities, details, or specific terms.

[0143] Note:

[0144] 1. Please input keywords in JSON format.

[0145] 2. The JSON should contain two keys:

[0146] "high_level_keywords": used for overall concepts or topics.

[0147] "low_level_keywords": used for specific entities or details.

[0148] 3. Each keyword needs to be given a confidence level of 0 to 1, indicating the credibility of the keyword match.

[0149] <example>

[0150] Example 1:

[0151] Query: "How to use green energy to promote economic development?"

[0152] Output:

[0153] {

[0154] "high_level_keywords": [

[0155] {"keyword": "green energy", "confidence": 0.95},

[0156] {"keyword": "economic development", "confidence": 0.90},

[0157] {"keyword": "sustainable development", "confidence": 0.85}

[0158] ],

[0159] "low_level_keywords": [

[0160] {"keyword": "solar energy", "confidence": 0.80},

[0161] {"keyword": "wind energy", "confidence": 0.80},

[0162] {"keyword": "motivation", "confidence": 0.75},

[0163] {"keyword": "investment cost", "confidence": 0.70} ]

[0165] }

[0166] Example 2:

[0167] Query: "What is the application prospect of artificial intelligence in the field of medical health?"

[0168] Output:

[0169] {

[0170] "high_level_keywords": [

[0171] {"keyword": "artificial intelligence", "confidence": 0.95},

[0172] {"keyword": "medical health", "confidence": 0.90},

[0173] {"keyword": "application prospects", "confidence": 0.85}

[0174] ],

[0175] "low_level_keywords": [

[0176] {"keyword": "diagnostic assistance", "confidence": 0.80},

[0177] {"keyword": "personalized medicine", "confidence": 0.80},

[0178] {"keyword": "data analysis", "confidence": 0.75},

[0179] {"keyword": "medical imaging", "confidence": 0.70} ]

[0181] }

[0182] Actual query:

[0183] Query: {query}

[0184] Output:"

[0185] According to this method, global keywords and local keywords can be extracted according to the problem to be processed, and the extracted global keywords and local keywords all have their corresponding confidence levels.

[0186] Among them, there are multiple global hyperedges, and there may also be multiple extracted global keywords, which can constitute a global keyword set. For each global hyperedge, all global keywords and the global description of the global hyperedge can be used to calculate the global matching degree of the global hyperedge; and the candidate global hyperedges are determined from the global hyperedges using the global matching degree. Optionally, for each global hyperedge, all global keywords and the global description of the global hyperedge can be used to calculate the global matching degree of the global hyperedge. For each global keyword, the cosine similarity between the global description of the global hyperedge and the global keyword can be calculated; the cosine similarity is multiplied by the confidence of the global keyword to obtain an intermediate global matching degree; the intermediate global matching degree corresponding to each global keyword is summed to obtain the global matching degree of the global hyperedge.

[0187] Among them, the global keywords and global descriptions can be converted into global keyword vectors and global description vectors through the embedding model, and then the cosine similarity between the two is calculated.

[0188] Optionally, the global matching degree of a global hyperedge can be calculated by the following formula:

[0189] ;

[0190] Among them, S global (e global ) represents the global matching degree corresponding to a global hyperedge; K High Represents a global keyword set; Characterizes the confidence of the global keyword H; sim(H,e global ) represents the cosine similarity between the global keyword H and the global description.

[0191] After calculating the global matching degree corresponding to each global hyperedge, the global hyperedges can be sorted in descending order according to the global matching degree, and then the first n1 global hyperedges with the highest ranking are determined as candidate global hyperedges, where n1 is a positive integer and can be set according to actual needs.

[0192] Similarly, a candidate global hyperedge may include multiple local hyperedges, and there may also be multiple local keywords extracted, which can constitute a local keyword set. For each local hyperedge in each candidate global hyperedge, all local keywords and the local description of the local hyperedge can be used to calculate the local matching degree of the local hyperedge; the candidate local hyperedge is determined from the local hyperedge using the local matching degree. Optionally, for each local hyperedge in the candidate global hyperedge, all local keywords and the local description of the local hyperedge can be used to calculate the global matching degree of the global hyperedge. For each local keyword, the cosine similarity between the local description of the local hyperedge and the local keyword can be calculated; the cosine similarity is multiplied by the confidence of the local keyword to obtain an intermediate local matching degree; the intermediate local matching degree corresponding to each local keyword is summed to obtain the local matching degree of the local hyperedge.

[0193] Among them, the local keywords and local descriptions can be converted into local keyword vectors and local description vectors through the embedding model, and then the cosine similarity between the two is calculated.

[0194] Optionally, the local matching degree of a local hyperedge can be calculated by the following formula:

[0195] ;

[0196] Among them, S local (e local ) represents the local matching degree corresponding to a local hyperedge; Representing a local keyword set; Characterizes the confidence of the local keyword L; sim(L,e local ) represents the cosine similarity between the local keyword L and the local description.

[0197] After calculating the local matching degree corresponding to each local hyperedge, the local hyperedges in the candidate global hyperedges can be sorted in descending order of the local matching degree, and then the first n2 local hyperedges with the highest sorting are determined as candidate local hyperedges, where n2 is a positive integer and can be set according to actual needs.

[0198] The candidate local hyperedge may include multiple entity nodes. For each entity node in each candidate local hyperedge, the entity matching degree of the entity node may be calculated using all local keywords and entity nodes; the intermediate entity node may be determined from the entity node using the entity matching degree. Optionally, when calculating the entity matching degree, the cosine similarity between the entity node and the local keyword may be calculated for each local keyword; the cosine similarity may be multiplied by the confidence of the local keyword to obtain the intermediate entity matching degree; and the intermediate entity matching degree corresponding to each local keyword may be summed to obtain the entity matching degree of the entity node.

[0199] Among them, the local keywords and entity nodes can be converted into local keyword vectors and entity vectors through the embedding model, and then the cosine similarity between the two is calculated.

[0200] Optionally, the entity matching degree of an entity node can be calculated by the following formula:

[0201] ;

[0202] Among them, S entity (ent) represents the entity matching degree corresponding to an entity node; Representing a local keyword set; Represents the confidence of the local keyword L; sim(L,ent) represents the cosine similarity between the local keyword L and the entity node.

[0203] In this way, the entity matching degree corresponding to each entity node in the candidate local hyperedge can be calculated, and then the entity matching degree can be compared with the entity threshold, and the entity node with an entity matching degree greater than the entity threshold is determined as an intermediate entity node. Among them, the entity threshold can be set according to actual needs, and is not specifically limited here. In an embodiment of the present invention, the entity threshold can be set to 0.6. It can be seen that the intermediate entity node is the entity node related to the query to be processed that is searched in a specified order, and the candidate node path can be determined based on the intermediate entity node later.

[0204] After calculating the intermediate entity nodes, multiple intermediate node paths can be determined from the document hypergraph based on the intermediate entities. The intermediate entity nodes can be combined in pairs to obtain multiple entity pairs; for each entity pair, all node paths connecting the entity pair are obtained to obtain multiple intermediate node paths. The entity pair contains two intermediate entity nodes, one of which can be recorded as the starting node ent start , and the other can be recorded as the end node ent end , between the starting node and the ending node, there may be multiple paths, which connect the starting node and the ending node, and use the paths existing in all node pairs as intermediate node paths.

[0205] These intermediate node paths are pruned to extract the key paths related to the problem to be processed. The path resource value of the intermediate node path can be calculated based on the node resource value of each entity node in the intermediate path and the number of nodes in the intermediate node path; the candidate node path is determined from the intermediate node path based on the path resource value, and the candidate node path is the extracted key path.

[0206] That is, firstly, the path resource value corresponding to each intermediate node path is calculated, and the calculation of the path resource value refers to the following steps: for each intermediate node path, an initial resource value is set for the entity node in the intermediate node path, and the inflow node and the outflow node of the entity node are obtained; for each entity node in the intermediate node path, based on the propagation of the initial resource value on the inflow node and the outflow node, the node resource value corresponding to the entity node is calculated; the path resource value of the intermediate node path is obtained by dividing the sum of the node resource values ​​of all entity nodes in the intermediate node path by the number of entity nodes in the intermediate node path.

[0207] According to the above content, the intermediate node path refers to the node path composed of the starting node to the end node. For each node in the intermediate node path, an initial resource value can be set for it to facilitate the subsequent calculation of the node resource value. Among them, the initial resource value of the starting node can be set to the first value, and the initial resource values ​​of other nodes in the intermediate node path except the starting node can be set to the second value. Among them, the first value can be set to 1, and the second value can be set to 0, which can be adjusted according to actual needs. The resource value of each entity node will be propagated to the surrounding nodes through the entity relationship network, and the surrounding nodes closer to the entity node can obtain higher resource values.

[0208] For each entity node in the intermediate node path, there is a corresponding inflow node and outflow node. If a certain entity node is called a central node, there are multiple entity nodes pointing to the central node, and these nodes are inflow nodes. At the same time, the central node may also point to multiple other entity nodes, which are outflow nodes. Both inflow nodes and outflow nodes can be obtained by analyzing the document hypergraph.

[0209] Therefore, for each entity node in the intermediate node path, its node resource value can be calculated according to the following formula:

[0210] ;

[0211] Among them, S(ent i ) represents the node resource value of the entity node; Represents the set of all nodes pointing to the entity node, i.e., the inflow node; Represents the set of all entity nodes pointed to by the entity node, i.e., the outflow node; Represents the number of nodes pointed to by the entity node; θ represents the attenuation rate of resource propagation.

[0212] in, When the resource is less than the specified threshold, the resource transfer is stopped. The specified threshold can be set according to actual needs. In the embodiment of the present invention, it can be set to 0.1. That is, when the average resource of an entity node is less than the specified threshold, the resource is no longer transferred to its neighboring nodes.

[0213] After calculating the node resource value of each entity node in the intermediate node path, the node resource values ​​of all entity nodes in the intermediate node path may be added together and then divided by the number of entity nodes in the intermediate node path to obtain the path resource value corresponding to the intermediate node path.

[0214] Specifically, the path resource value of the intermediate node path can be calculated according to the following formula:

[0215] ;

[0216] Among them, score path The path resource value that represents the intermediate node path; S(ent i ) represents the node resource value of the entity node in the intermediate node path; R path Characterize the intermediate node path; │R path │Represents the number of entity nodes in the intermediate node path.

[0217] After calculating the path resource value of each intermediate node path, multiple candidate node paths can be selected based on the path resource value. For example, multiple intermediate node paths can be sorted in descending order of path resource value, and the first n3 intermediate node paths with the highest sorting are used as candidate node paths. Where n3 is a positive integer and can be set according to actual needs.

[0218] S140. In the process of searching the candidate node path, record the search process information of the candidate node path.

[0219] In the process of searching the document hypergraph in the order of global hyperedges, local hyperedges, and entity nodes using the problem to be processed, and finally searching for the candidate node path, a series of search process information can be generated. This search process information can include search sequence, sequence score, and search strategy information.

[0220] The search sequence is the search path when searching the document hypergraph in a specified order. If the global hyperedges, local hyperedges, and entity nodes are regarded as different levels, it records the content selected at each level. The sequence score is the score corresponding to the search sequence, which can be obtained by the matching degree calculated at each level and the path resource value corresponding to the candidate node path. The search strategy information is the content selected and discarded at each level recorded during the search process, which can be used for backtracking.

[0221] Optionally, in the process of searching for candidate node paths, when recording the search process information of the candidate node paths, the global hyperedges, local hyperedges and intermediate entity nodes corresponding to the candidate node paths can be combined to obtain a search sequence; according to the search process, the global matching degree corresponding to the global hyperedge, the local matching degree corresponding to the local hyperedge and the path resource value corresponding to the candidate node path are superimposed according to the specified weight to obtain a sequence score; the selection information in the search process is obtained to obtain the search strategy information.

[0222] When searching for candidate node paths, the search is performed in the hierarchical order of global hyperedges, local hyperedges, and entity nodes. By calculating the global matching degree between the global keywords and the global description in the problem to be processed, the candidate global hyperedges can be screened. There are multiple candidate global hyperedges, and when searching, it is necessary to select a candidate global hyperedge from them and continue searching in the local hyperedges of the candidate global hyperedge.

[0223] The candidate global hyperedge selected at this time can be recorded as the global hyperedge , which can be used as a content in the search sequence, and its corresponding sequence score can be obtained at the same time. The sequence score at this time is the global hyperedge The corresponding global matching degree is multiplied by the global factor. Specifically, the search sequence at this time can be expressed as , the sequence score is ,in, is the global factor, S global (e i ) is a global hyperedge The global matching degree.

[0224] Since this global hyperedge There are multiple local hyperedges in the problem to be processed. The local matching degree can be calculated by using the local keywords in the problem to be processed and the local descriptions of these local hyperedges to screen out candidate local hyperedges. There are multiple candidate local hyperedges. You need to select one candidate local hyperedge from them and continue searching in the entity nodes of the candidate local hyperedge.

[0225] The candidate local hyperedge selected at this time can be recorded as the local hyperedge , which can be added to the search sequence, and the corresponding sequence score can be updated. The sequence score at this time is the previous one plus the local hyperedge The product of the corresponding local matching degree and the local factor. Specifically, the search sequence at this time can be expressed as , the sequence score is ,in, is the local factor, S local (e ij ) is a local hyperedge The local matching degree.

[0226] Since this local hyperedge contains multiple entity nodes, and the entity matching degree can be calculated by using the local keywords in the problem to be processed and these entity nodes to filter out the intermediate entity nodes. The intermediate entity node can be recorded as , it has been stated above that the intermediate node path will be determined from the intermediate entity node, and the path resource value of the intermediate node path will be calculated to screen the candidate node path. At this time, the intermediate entity node can be used to update the search sequence, and the sequence score can be updated by the product of the path resource value of the candidate node path determined by the intermediate entity node and the path factor.

[0227] Specifically, the search sequence at this time can be expressed as , the sequence score is ,in, is the path factor, and score is the path resource value of the candidate node path. Then, all entity nodes on the candidate node path corresponding to the largest score can be recorded as E P , and added to the search process information.

[0228] Among them, when calculating the sequence score, the global factor is introduced , local factor and path factors These factors can be set according to actual needs. , local factor and path factors The size of can make the final result tend to be an overall summary of the subject or a specific entity description. In the embodiment of the present invention, each factor can be set to: .

[0229] In the above-mentioned search process, the current selection and the discarded selection can be recorded each time, which can be used to trace back the search process. The content of the record can be called search strategy information. In summary, the search process information can include the sequence score S P , search sequence P, search strategy information B P And the matched entity node E P .

[0230] Thus, while searching for candidate node paths in the document hypergraph, the search process information corresponding to the candidate node paths can be obtained in the above manner.

[0231] S150: Determine target search process information from the search process information of the candidate node path by using the sequence score and the search strategy information.

[0232] By using the sequence score and search strategy information in the search process information, the target search process information can be determined from the search process information of the candidate node path, which is used to subsequently generate the target answer to the problem to be processed.

[0233] As an implementation method, when determining the target search process information, it can be possible to determine a similar information pair from the search process information of the candidate node path based on the search strategy information; replace the similar information pair with the search process information with the highest sequence score in the similar information pair to obtain intermediate search process information; and determine the target search process information from the intermediate search process information based on the sequence score in the intermediate search process information.

[0234] The search process information corresponding to each candidate node path is obtained; the search process information is combined in pairs to obtain multiple information pairs; for each information pair, the similarity between the two search process information in the information pair is calculated; and the information pair with a similarity greater than a specified similarity is determined as a similarity information pair. The specified similarity can be set according to actual needs and is not specifically limited here. In the embodiment of the present invention, the specified similarity can be set to 0.8.

[0235] The similarity may refer to the jaccard similarity, which may be specifically calculated according to the following formula:

[0236] ;

[0237] Among them, S Jaccard (B P1 ,B P2 ) represents the similarity of an information pair; B P1 Characterizes a search process information in the information pair; B P2 Characterizes the other search process information in the information pair.

[0238] For similar information pairs, the sequence scores of the two search process information can be obtained, and the similar information pair can be replaced with the search process information with the highest sequence score between the two. In other words, the search process information with the lowest sequence score between the two is deleted, and only the search process information with the higher sequence score is retained.

[0239] Then, the above steps of combining information pairs and calculating the similarity of information pairs may be continuously performed on the remaining search process information until the similarities of all information pairs are no greater than the specified similarity, thereby obtaining the intermediate search process information.

[0240] For the intermediate search process information, the sequence score in each intermediate search process information can be obtained, and the intermediate search process information with the highest sequence score is used as the target search process information.

[0241] S160. Based on the target search process information, generate a target answer corresponding to the problem to be processed.

[0242] Based on the target search process information, the search sequence contained therein can be obtained. For the search sequence, global hyperedges and local hyperedges are recorded therein. Based on the document hypergraph, the global description corresponding to the global hyperedges in the search sequence and the local description corresponding to the local hyperedges can be obtained. The above descriptions show that the search process information also records all entity nodes in the corresponding candidate node path, and the descriptions corresponding to the entity relationships between these entity nodes can be obtained based on the document hypergraph. After splicing the above information with the problem to be processed, the corresponding target prompt word can be obtained, and the target prompt word is input into the large language model, which combines this information to generate the target answer corresponding to the problem to be processed and outputs it.

[0243] The hypergraph-based document question-answering solution provided by the embodiment of the present invention can be applied to various scenarios of question-answering using documents. For example, taking the document question-answering scenario as an example, by establishing a hypergraph, the relationship between document contents at multiple levels can be mined, and when answering questions to be processed, the hypergraph is searched according to the levels to obtain corresponding search results, and then the search results are used to generate answers to improve the accuracy of the answers.

[0244] The method provided by the embodiment of the present invention can utilize a language model to reorganize text blocks into sub-paragraphs with a unified main body according to semantics, and then extract entities and entity relationships from the sub-paragraphs to construct a document hypergraph including entity nodes, local hyperedges, and global hyperedges. During search, global keywords and local keywords are extracted from the questions to be processed for precise matching at different levels, realizing progressive retrieval at each level, taking into account both the overall and the details, ensuring the accuracy of the retrieval results, and thereby improving the quality and accuracy of questions and answers.

[0245] In order to better implement the above method, the embodiment of the present invention also provides a hypergraph-based document question-answering device, which can be integrated in an electronic device, which can be a terminal, a server, etc. Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, a personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers.

[0246] For example, in this embodiment, the method of the embodiment of the present invention is described in detail by taking the example of a document question-and-answer device based on a hypergraph being specifically integrated in a server.

[0247] For example, Figure 5 As shown, the hypergraph-based document question-answering device 200 may include:

[0248] An acquisition module 210 is used to acquire documents to be processed and issues to be processed;

[0249] A construction module 220, configured to extract entities and entity relationships from each subparagraph in the document to be processed to construct a document hypergraph, wherein the document hypergraph includes entity nodes representing entities, common edges representing entity relationships, local hyperedges representing entities belonging to the same subparagraph, and global hyperedges representing similar local hyperedges;

[0250] A search module 230 is used to search for multiple candidate node paths matching the problem to be processed in the document hypergraph in a specified order, wherein the specified order is the order of global hyperedges, local hyperedges, and entity nodes;

[0251] A recording module 240, used for recording the search process information of the candidate node path during the process of searching the candidate node path, wherein the search process information includes a search sequence, a sequence score and a search strategy information;

[0252] A screening module 250, configured to determine target search process information from the search process information of the candidate node paths by using the sequence score and the search strategy information;

[0253] The reply module 260 is used to generate a target reply corresponding to the problem to be processed based on the target search process information.

[0254] In some embodiments, the construction module 220 is specifically used to:

[0255] Dividing the document to be processed into a plurality of sub-paragraphs;

[0256] For each of the sub-paragraphs, extract entities and entity relationships from the sub-paragraphs;

[0257] Constructing a basic document graph with the entities as entity nodes and the entity relationships as common edges between the entity nodes;

[0258] In the basic document graph, local hyperedges are established for entity nodes belonging to the same subparagraph, and local descriptions corresponding to the local hyperedges are generated with the context of the subparagraph to obtain an intermediate document graph;

[0259] In the intermediate document graph, global hyperedges and global descriptions are generated using all local descriptions to obtain a document hypergraph.

[0260] In some embodiments, the construction module 220 is specifically used to:

[0261] Dividing the document to be processed into multiple text blocks;

[0262] For each text block, the text block is spliced ​​with a segmentation template to obtain segmentation prompt words, wherein the segmentation template is a prompt word template for segmenting the text block, and the segmentation prompt words include segmentation rules and summary rules;

[0263] The segmentation prompt words are input into the segmentation model, the segmentation model is guided to segment the text block into sub-texts according to the segmentation rule, and the sub-texts are summarized according to the summary rule to obtain sub-paragraphs.

[0264] In some embodiments, the construction module 220 is specifically used to:

[0265] Using the local description, clustering is performed on all the local hyperedges to obtain a plurality of clusters;

[0266] In the intermediate document graph, establishing global hyperedges for local hyperedges belonging to the same cluster;

[0267] For each of the global hyperedges, a global description corresponding to the global hyperedge is generated based on the local descriptions of all the local hyperedges in the clusters to obtain a document hypergraph.

[0268] In some embodiments, the search module 230 is specifically used to:

[0269] Searching the document hypergraph for the intermediate entity node corresponding to the problem to be processed in a specified order;

[0270] Acquire multiple intermediate node paths corresponding to the intermediate entity node;

[0271] Calculating the path resource value of the intermediate node path according to the node resource value of each entity node in the intermediate node path and the number of nodes in the intermediate node path;

[0272] A candidate node path is determined from the intermediate node paths using the path resource value.

[0273] In some embodiments, the search module 230 is specifically used to:

[0274] Extracting global keywords and local keywords from the problem to be processed;

[0275] Calculating a global match between the global keyword and each of the global hyperedges to determine a candidate global hyperedge;

[0276] For each candidate global hyperedge, calculating a local matching degree between the local keyword and each local hyperedge in the candidate global hyperedge to determine a candidate local hyperedge;

[0277] For each candidate local hyperedge, the entity matching degree between the local keyword and each entity node in the candidate local hyperedge is calculated to determine the intermediate entity node.

[0278] In some embodiments, the search module 230 is specifically used to:

[0279] For each of the intermediate node paths, set an initial resource value for the entity node in the intermediate node path, and obtain an inflow node and an outflow node of the entity node;

[0280] For each entity node in the intermediate node path, the node resource value corresponding to the entity node is calculated based on the propagation of the initial resource value on the inflow node and the outflow node;

[0281] The path resource value of the intermediate node path is obtained by dividing the sum of the node resource values ​​of all entity nodes in the intermediate node path by the number of entity nodes in the intermediate node path.

[0282] In some embodiments, the recording module 240 is specifically used to:

[0283] Combining the global hyperedges, local hyperedges, and intermediate entity nodes corresponding to the candidate node paths to obtain a search sequence;

[0284] According to the search process, the global matching degree corresponding to the global hyperedge, the local matching degree corresponding to the local hyperedge, and the path resource value corresponding to the candidate node path are superimposed according to the specified weight to obtain a sequence score;

[0285] The selection information in the search process is obtained to obtain the search strategy information.

[0286] In some embodiments, the screening module 250 is specifically used to:

[0287] Based on the search strategy information, determining similar information pairs from the search process information of the candidate node paths;

[0288] Replacing the similar information pair with the search process information with the highest sequence score in the similar information pair to obtain intermediate search process information;

[0289] Target search process information is determined from the intermediate search process information according to the sequence score in the intermediate search process information.

[0290] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined and implemented as the same or several entities. The specific implementation of the above modules can be found in the previous method embodiments, which will not be repeated here.

[0291] As can be seen from the above, the hypergraph-based document question-answering device of this embodiment can extract entities and entity relationships after dividing the document to be processed into sub-paragraphs, so as to convert the document content into a document hypergraph, and retrieve the candidate node paths related to the problem to be processed in the document hypergraph in a specified order, wherein the search process information corresponding to the candidate node path can be obtained in the process of searching the candidate node path; the sequence score and search strategy information in the search process information are used to filter out the target search process information, and the target answer to the problem to be processed is generated accordingly. By constructing a hypergraph structure of global hyperedges and local hyperedges, the overall and detailed information can be balanced layer by layer, and the layer-by-layer search in the hypergraph can ensure that the content related to the problem to be processed is filtered out, thereby improving the quality and accuracy of the answer.

[0292] The embodiment of the present invention further provides an electronic device, which may be a terminal, a server, or the like. The terminal may be a mobile phone, a tablet computer, a smart Bluetooth device, a notebook computer, a personal computer, or the like; the server may be a single server or a server cluster composed of multiple servers, or the like.

[0293] In some embodiments, the hypergraph-based document question and answer device can also be integrated into multiple electronic devices. For example, the hypergraph-based document question and answer device can be integrated into multiple servers, and the hypergraph-based question and answer method of the present invention can be implemented by multiple servers.

[0294] In this embodiment, the electronic device of this embodiment is a server as an example for detailed description, for example, Figure 6 As shown, it shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present invention, specifically:

[0295] The electronic device may include components such as a processor 310 with one or more processing cores, a memory 320 with one or more computer-readable storage media, a power supply 330, an input module 340, and a communication module 350. Those skilled in the art will appreciate that Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0296] The processor 310 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 320, and calling data stored in the memory 320. In some embodiments, the processor 310 may include one or more processing cores; in some embodiments, the processor 310 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 310.

[0297] The memory 320 can be used to store software programs and modules. The processor 310 executes various functional applications and data processing by running the software programs and modules stored in the memory 320. The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 320 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 320 may also include a memory controller to provide the processor 310 with access to the memory 320.

[0298] The electronic device also includes a power supply 330 for supplying power to various components. In some embodiments, the power supply 330 can be logically connected to the processor 310 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 330 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0299] The electronic device may further include an input module 340, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0300] The electronic device may further include a communication module 350. In some embodiments, the communication module 350 may include a wireless module. The electronic device may perform short-range wireless transmission through the wireless module of the communication module 350, thereby providing the user with wireless broadband Internet access. For example, the communication module 350 may be used to help the user send and receive emails, browse web pages, and access streaming media.

[0301] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 310 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 320 according to the following instructions, and the processor 310 will run the application programs stored in the memory 320, thereby implementing the steps in the methods of the embodiments of the present invention.

[0302] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0303] As can be seen from the above, the electronic device provided by the embodiment of the present invention can extract entities and entity relationships according to the sub-paragraphs after dividing the document to be processed into sub-paragraphs, so as to convert the document content into a document hypergraph, and retrieve the candidate node paths related to the problem to be processed in the document hypergraph in a specified order, wherein the search process information corresponding to the candidate node path can be obtained in the process of searching the candidate node path; the sequence score and search strategy information in the search process information are used to filter out the target search process information, and the target answer to the problem to be processed is generated accordingly. By constructing a hypergraph structure of global hyperedges and local hyperedges, the overall and detailed information can be balanced, and the layer-by-layer progressive search in the hypergraph can accurately filter out the content related to the problem to be processed, thereby improving the quality and accuracy of the question and answer.

[0304] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0305] To this end, an embodiment of the present invention provides a computer-readable storage medium, in which multiple instructions are stored, and the instructions can be loaded by a processor to execute the steps of any hypergraph-based document question and answer method provided by the embodiment of the present invention.

[0306] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0307] According to one aspect of the present invention, a computer program product or computer program is provided, the computer program product or computer program including a computer program / instruction, the computer program / instruction being stored in a computer-readable storage medium. A processor of an electronic device reads the computer program / instruction from the computer-readable storage medium, and the processor executes the computer program / instruction, so that the electronic device executes the method provided in various optional implementations of the hypergraph construction aspect or the hypergraph-based document question-answering aspect provided in the above-mentioned embodiments.

[0308] Since the instructions stored in the storage medium can execute the steps of any hypergraph-based document question and answer method provided in the embodiments of the present invention, the beneficial effects that can be achieved by any hypergraph-based document question and answer method provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0309] The above is a detailed introduction to a hypergraph-based document question and answer method and device provided in an embodiment of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.< / example> < / example>

Claims

1. A document question answering method based on a hypergraph, characterized in that: The method comprises: Get pending documents and issues; Extracting entities and entity relationships from each subparagraph in the document to be processed to construct a document hypergraph, wherein the document hypergraph includes entity nodes representing entities, common edges representing entity relationships, local hyperedges representing entities belonging to the same subparagraph, and global hyperedges representing similar local hyperedges; In the document hypergraph, multiple candidate node paths matching the problem to be processed are searched in a specified order, wherein the specified order is the order of global hyperedges, local hyperedges, and entity nodes; In the process of searching the candidate node path, recording the search process information of the candidate node path, the search process information including the search sequence, sequence score and search strategy information; Determining target search process information from the search process information of the candidate node path using the sequence score and the search strategy information; Based on the target search process information, a target answer corresponding to the problem to be processed is generated.

2. The method according to claim 1, characterized in that The extracting entities and entity relationships from each sub-paragraph in the to-be-processed document to construct a document hypergraph includes: Dividing the document to be processed into a plurality of sub-paragraphs; For each of the sub-paragraphs, extract entities and entity relationships from the sub-paragraphs; Constructing a basic document graph with the entities as entity nodes and the entity relationships as common edges between the entity nodes; In the basic document graph, local hyperedges are established for entity nodes belonging to the same subparagraph, and local descriptions corresponding to the local hyperedges are generated with the context of the subparagraph to obtain an intermediate document graph; In the intermediate document graph, global hyperedges and global descriptions are generated using all local descriptions to obtain a document hypergraph.

3. The method according to claim 2, characterized in that The step of dividing the document to be processed into a plurality of sub-paragraphs includes: Dividing the document to be processed into multiple text blocks; For each text block, the text block is spliced ​​with a segmentation template to obtain segmentation prompt words, wherein the segmentation template is a prompt word template for segmenting the text block, and the segmentation prompt words include segmentation rules and summary rules; The segmentation prompt words are input into the segmentation model, the segmentation model is guided to segment the text block into sub-texts according to the segmentation rule, and the sub-texts are summarized according to the summary rule to obtain sub-paragraphs.

4. The method according to claim 2, characterized in that: In the intermediate document graph, all local descriptions are used to generate global hyperedges and global descriptions to obtain a document hypergraph, including: Using the local description, clustering is performed on all the local hyperedges to obtain a plurality of clusters; In the intermediate document graph, establishing global hyperedges for local hyperedges belonging to the same cluster; For each of the global hyperedges, a global description corresponding to the global hyperedge is generated based on the local descriptions of all the local hyperedges in the clusters to obtain a document hypergraph.

5. The method according to claim 1, characterized in that The step of searching for multiple candidate node paths matching the problem to be processed in the document hypergraph in a specified order includes: Searching the document hypergraph for the intermediate entity node corresponding to the problem to be processed in a specified order; Acquire multiple intermediate node paths corresponding to the intermediate entity node; Calculating the path resource value of the intermediate node path according to the node resource value of each entity node in the intermediate node path and the number of nodes in the intermediate node path; A candidate node path is determined from the intermediate node paths using the path resource value.

6. The method according to claim 5, characterized in that The step of searching the document hypergraph in a specified order for an intermediate entity node corresponding to the problem to be processed includes: Extracting global keywords and local keywords from the problem to be processed; Calculating a global match between the global keyword and each of the global hyperedges to determine a candidate global hyperedge; For each candidate global hyperedge, calculating a local matching degree between the local keyword and each local hyperedge in the candidate global hyperedge to determine a candidate local hyperedge; For each candidate local hyperedge, the entity matching degree between the local keyword and each entity node in the candidate local hyperedge is calculated to determine the intermediate entity node.

7. The method according to claim 5, characterized in that The calculating the path resource value of the intermediate node path according to the node resource value of each entity node in the intermediate node path and the number of nodes in the intermediate node path includes: For each of the intermediate node paths, set an initial resource value for the entity node in the intermediate node path, and obtain an inflow node and an outflow node of the entity node; For each entity node in the intermediate node path, the node resource value corresponding to the entity node is calculated based on the propagation of the initial resource value on the inflow node and the outflow node; The path resource value of the intermediate node path is obtained by dividing the sum of the node resource values ​​of all entity nodes in the intermediate node path by the number of entity nodes in the intermediate node path.

8. The method according to claim 6, characterized in that In the process of searching the candidate node path, recording the search process information of the candidate node path includes: Combining the global hyperedges, local hyperedges, and intermediate entity nodes corresponding to the candidate node paths to obtain a search sequence; According to the search process, the global matching degree corresponding to the global hyperedge, the local matching degree corresponding to the local hyperedge, and the path resource value corresponding to the candidate node path are superimposed according to the specified weight to obtain a sequence score; The selection information in the search process is obtained to obtain the search strategy information.

9. The method according to claim 1, characterized in that: Determining target search process information from the search process information of the candidate node path by using the sequence score and the search strategy information includes: Based on the search strategy information, determining similar information pairs from the search process information of the candidate node paths; Replacing the similar information pair with the search process information with the highest sequence score in the similar information pair to obtain intermediate search process information; Target search process information is determined from the intermediate search process information according to the sequence score in the intermediate search process information.

10. A document question-answering device based on a hypergraph, the device being used to implement the method according to any one of claims 1 to 9, characterized in that: The device comprises: The acquisition module is used to obtain documents and issues to be processed; A construction module, used for extracting entities and entity relationships from each subparagraph in the document to be processed to construct a document hypergraph, wherein the document hypergraph includes entity nodes representing entities, common edges representing entity relationships, local hyperedges representing entities belonging to the same subparagraph, and global hyperedges representing similar local hyperedges; A search module, used to search for multiple candidate node paths matching the problem to be processed in the document hypergraph in a specified order, wherein the specified order is the order of global hyperedges, local hyperedges, and entity nodes; A recording module, used for recording the search process information of the candidate node path in the process of searching the candidate node path, wherein the search process information includes a search sequence, a sequence score and a search strategy information; A screening module, configured to determine target search process information from the search process information of candidate node paths by using the sequence score and the search strategy information; The reply module is used to generate a target reply corresponding to the problem to be processed based on the target search process information.

Citation Information

Patent Citations

  • Multi-granularity time sequence knowledge graph question and answer method and device and storage medium

    CN118013003A

  • Financial question and answer retrieval enhancement generation method and system based on hypergraph

    CN119294526A

  • Construction method, system and equipment of power dispatching knowledge question-answering system and storage medium

    CN119311826A

Cited By

  • Table data feature mining method and system based on hypergraph neural network

    CN120849477A

  • Pedigree diagram construction method and device, electronic equipment and storage medium

    CN120973954A

  • Enhanced retrieval generation method and device, electronic equipment and storage medium

    CN121501854A