Global Context Analysis Method and System for Complex Documents
By performing layout analysis of documents, picture-text associations and knowledge graph construction, and using graph attention network model to extract global relationships, the problem of inefficient information utilization in traditional document processing methods is solved, and efficient management and value improvement of document information is achieved.
Patent Information
- Application Number
- CN202510486491.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2045-04-18
AI Technical Summary
Traditional document processing methods cannot deeply explore the inherent semantic structure and knowledge relationships of documents, resulting in inefficient information utilization.
By performing layout analysis on the target document to generate a catalog, identify the picture text and establish the association relationship between the picture and the text, build a basic knowledge graph, extract global relationships using the knowledge graph embedding and graph attention network model, build a global context chain, and update the knowledge graph relationship.
It significantly improves the consistency between the knowledge graph and the global context of the document, reduces the user management burden, and improves the efficiency and value of document information utilization.
Smart Images

Figure CN120012759B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and specifically relates to a global context analysis method and system for complex documents. Background Art
[0002] With the rapid development of information technology, electronic documents have become an essential tool for people to access information and exchange ideas. However, faced with massive amounts of document data, efficiently extracting, organizing, and utilizing the information within them has become a pressing challenge. Traditional document processing methods are often limited to simple text extraction and keyword retrieval, failing to deeply explore the inherent semantic structure and knowledge relationships within documents, thus limiting the effective use of information.
[0003] Building a knowledge graph for documents has emerged as a cutting-edge document analysis strategy. It not only helps generate concise summaries but also enables efficient content retrieval. However, it is worth noting that the process of extracting entities and relationships from documents to build a knowledge graph often faces the challenge of complex and easily confused entity relationships. Summary of the Invention
[0004] In view of the above-mentioned deficiencies in the prior art, the present invention provides a global context analysis method and system for complex documents to solve the above-mentioned technical problems.
[0005] In a first aspect, the present invention provides a method for global context analysis of complex documents, comprising:
[0006] Generate a directory for the target document by performing layout analysis on the target document;
[0007] Identify text information of images in target documents, and establish an association relationship between images and text content by performing semantic analysis on the text information and adjacent text content;
[0008] Building a basic knowledge graph based on the titles of the catalog, and gradually performing semantic analysis on the paragraphs corresponding to the titles, adding entities and relationships to the basic knowledge graph to obtain a global knowledge graph;
[0009] The knowledge graph embedding method is used to map entities and relationships in the global knowledge graph into low-dimensional vectors, and the graph attention network model is used to extract global relationships from the embedded global knowledge graph;
[0010] A global context chain is constructed based on the global relationship, and the relationship of the global knowledge graph is updated based on the global context chain.
[0011] In an optional embodiment, generating a directory for the target document by performing layout analysis on the target document includes:
[0012] Analyzing layout features of the target document using a layout analysis model, wherein the layout features include paragraph distribution, title format parameters, title content, and paragraph format parameters;
[0013] Using a rule algorithm, constructing a title hierarchy system based on the layout features;
[0014] Constructing a correspondence between titles and paragraphs based on the title hierarchy system, and generating a table of contents based on the correspondence;
[0015] Monitor updated content of the target document, and synchronously update the directory based on the updated content.
[0016] In an optional embodiment, identifying text information of an image in a target document and establishing an association between the image and text content by performing semantic analysis on the text information and adjacent text content includes:
[0017] Use optical character recognition technology to extract text information from images;
[0018] Extracting text paragraphs adjacent to the image based on the position of the image in the target document;
[0019] Using keyword matching technology to filter out a target paragraph that matches the text information from adjacent text paragraphs, and setting an associated tag for the image and the target paragraph;
[0020] Performing semantic analysis on the text information and the target paragraph, and selecting one or more sentences from the target paragraph that have semantic matching with the text information;
[0021] Adding an independent identifier to the text information and the sentence with semantic matching, wherein the independent identifier is used to indicate that the text information and the sentence with semantic matching are an indivisible integrated content body;
[0022] When generating the document hierarchy, the specific hierarchical position of the image relative to its associated text is determined so that the image and text content are displayed together as a hierarchical unit.
[0023] In an optional embodiment, a basic knowledge graph is constructed based on the titles of the catalog, and semantic analysis is gradually performed on the paragraphs corresponding to the titles, and entities and relationships are added to the basic knowledge graph to obtain a global knowledge graph, including:
[0024] Extract entities and entity relationships from the catalog titles and build a basic knowledge graph based on the extracted entities and entity relationships;
[0025] Obtain the lowest-level title in the directory, and obtain a local knowledge graph corresponding to the lowest-level title, wherein the local knowledge graph contains an entity corresponding to the lowest-level title;
[0026] Obtaining a target paragraph corresponding to the lowest-level title based on the directory, extracting entities and relationships from the target paragraph, and updating the local knowledge graph based on the extracted entities and relationships;
[0027] Traverse all the lowest-level titles to obtain the global knowledge graph.
[0028] In an optional embodiment, a knowledge graph embedding method is used to map entities and relationships in the global knowledge graph into low-dimensional vectors, and a graph attention network model is used to extract global relationships from the embedded global knowledge graph, including:
[0029] A translation model is used to map entities and relationships in the global knowledge graph into low-dimensional vectors, and the loss function of the translation model is set to negative log-likelihood loss;
[0030] The low-dimensional vectors of entities and relations are used as input to the graph attention network model, which extracts the relationships between entities in the global knowledge graph by calculating the attention coefficients between entities and aggregating the information of neighboring nodes;
[0031] Use the graph attention network model to calculate the similarity of entities in different local knowledge graphs, and build the association relationship between entities in different local knowledge graphs based on the calculation results;
[0032] The relationships between entities in the global knowledge graph and the association relationships between entities in different local knowledge graphs are integrated into global relationships.
[0033] In an optional embodiment, the training method of the graph attention network model includes:
[0034] Extract semantically similar or related sentences and paragraphs from the document to form positive sample pairs, and select semantically unrelated sentences or paragraphs from the document to form negative sample pairs;
[0035] Use the pre-trained hierarchical attention network model to encode sentences or paragraphs in positive and negative sample pairs to generate high-dimensional semantic vectors;
[0036] A contrastive loss function is used to make the model closer to the positive pairs and farther away from the negative pairs in the semantic space.
[0037] The encoded positive and negative sample pairs are used to train the graph attention network model.
[0038] In an optional embodiment, a global context chain is constructed based on the global relationship, and the relationship of the global knowledge graph is updated based on the global context chain, including:
[0039] constructing a global context chain based on the global relationship using a graph wheel algorithm;
[0040] The entities and relationships involved in the global context chain are matched with the global knowledge graph to complete the missing entity relationships for the global knowledge graph based on the matching results.
[0041] In a second aspect, the present invention provides a global context analysis system for complex documents, comprising:
[0042] A directory generation module, configured to generate a directory for a target document by performing layout analysis on the target document;
[0043] An image association module is used to identify text information of images in a target document and establish an association relationship between the image and text content by performing semantic analysis on the text information and adjacent text content;
[0044] A graph construction module is used to construct a basic knowledge graph based on the titles of the catalog, and gradually perform semantic analysis on the paragraphs corresponding to the titles, add entities and relationships to the basic knowledge graph, and obtain a global knowledge graph;
[0045] The global analysis module is used to map entities and relationships in the global knowledge graph into low-dimensional vectors using the knowledge graph embedding method, and to extract global relationships from the embedded global knowledge graph using the graph attention network model;
[0046] The context enhancement module is used to construct a global context chain based on the global relationship and update the relationship of the global knowledge graph based on the global context chain.
[0047] The beneficial effect of this invention lies in the fact that the global context analysis method and system for complex documents provided by this invention significantly improves the consistency between the knowledge graph and the global context of the document by integrating technical means such as automated catalog generation, image and text association, knowledge graph construction and relationship extraction, and global context chain and relationship update. This not only reduces the burden on users in document management, but also improves the utilization efficiency and value of document information.
[0048] In addition, the present invention has a reliable design principle, a simple structure and a very broad application prospect. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0050] Figure 1is a schematic flow chart of a method according to an embodiment of the present invention.
[0051] Figure 2 FIG. 4 is a schematic block diagram of a system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to enable those skilled in the art to better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0054] The global context analysis method for complex documents provided by the embodiment of the present invention is executed by a computer device. Accordingly, the global context analysis system for complex documents runs in the computer device.
[0055] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention. Figure 1 The execution subject can be a global context analysis system for complex documents. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
[0056] like Figure 1 As shown, the method includes:
[0057] S1. Generate a directory for the target document by performing layout analysis on the target document.
[0058] A detailed layout analysis step is performed on the target document. This involves identifying the document's layout structure, such as titles, paragraphs, headers, and footers, to accurately segment the document's content. Based on the recognition results, a table of contents is automatically generated for the target document, containing indexes of each level of titles and their corresponding paragraphs. This table of contents not only allows users to quickly navigate the document structure but also provides a convenient indexing framework for subsequent information retrieval and processing.
[0059] S2. Identify the text information of the image in the target document, and establish an association relationship between the image and the text content by performing semantic analysis on the text information and adjacent text content.
[0060] Leveraging advanced OCR (Optical Character Recognition) technology, we identify text within images embedded within target documents. We then conduct in-depth semantic analysis based on nearby or related text. Through strategies like comparison and association, we establish relationships between the image and surrounding text, helping us better understand the image's meaning and role within the document.
[0061] S3. Construct a basic knowledge graph based on the titles of the directory, and gradually perform semantic analysis on the paragraphs corresponding to the titles, add entities and relationships to the basic knowledge graph, and obtain a global knowledge graph.
[0062] Based on the generated table of contents, we first construct an initial framework for the basic knowledge graph, using each level of headings as nodes. Subsequently, we perform semantic analysis on each paragraph in the index order of the table of contents. This process, which includes entity recognition and relationship extraction, aims to transform key information within each paragraph into entities and relationships within the graph, thereby gradually enriching and improving the basic knowledge graph and ultimately forming a global knowledge graph. The global knowledge graph not only covers the core content of the document but also reveals the inherent connections between information.
[0063] S4. Use the knowledge graph embedding method to map the entities and relationships in the global knowledge graph into low-dimensional vectors, and use the graph attention network model to extract global relationships from the embedded global knowledge graph.
[0064] To more effectively utilize the information in the global knowledge graph, knowledge graph embedding technology is used to map entities and relationships into a low-dimensional vector space. This step reduces the complexity of data processing while preserving the key structural and semantic information in the graph. Subsequently, a Graph Attention Network (GAN) model is used to extract global relationships from the embedded global knowledge graph. The GAN model can focus on the importance of different nodes and relationships in the graph, thereby more accurately capturing global association patterns.
[0065] S5. Construct a global context chain based on the global relationship, and update the relationship of the global knowledge graph based on the global context chain.
[0066] Based on the extracted global relationships, a global context chain is constructed. This chain not only reflects the flow of information within the document but also reveals the deeper connections between information. On this basis, the relationships in the global knowledge graph are re-examined and updated to ensure that every relationship in the graph conforms to the logic of the global context chain, further improving the accuracy and practicality of the knowledge graph. Through this series of steps, the final result is a global knowledge graph that comprehensively and accurately reflects the content of the target document.
[0067] In an embodiment of the present invention, based on step S1, a possible embodiment will be given below to illustrate its specific implementation scheme in a non-limiting manner.
[0068] S101. Layout Feature Analysis: First, the target document is deeply analyzed using the trained LayoutLMv3 layout analysis model to extract its layout features. These features encompass not only intuitive paragraph distribution but also more detailed information about title formatting (such as font size, bolding, and center alignment), title content (specific text information), and paragraph formatting (such as paragraph indentation and line spacing). This process forms the foundation for all subsequent steps, ensuring that subsequent processing accurately reflects the original document structure and content.
[0069] S102. Construction of a Title Hierarchy: After obtaining detailed layout features, we then utilize a carefully designed set of rule-based algorithms to construct a title hierarchy based on these features. This system aims to clearly reflect the hierarchical relationships between headings at all levels within the document, such as main title, subtitle, and section headings. This step is crucial for understanding the document's structure, content hierarchy, and logical relationships.
[0070] The following is a simplified example of a rule algorithm to illustrate the basic principles and steps of this process:
[0071] 1. Input data preparation
[0072] Layout feature data: including paragraph distribution, title format parameters (such as font size, bold, color, center alignment, etc.), title content, paragraph format parameters, etc.
[0073] Document content: The complete document text, including all headings and body content.
[0074] 2. Title identification
[0075] Title recognition based on format parameters: First, all possible titles are identified based on preset format parameter thresholds (such as font size thresholds, bold marks, etc.).
[0076] Content analysis aids identification: For titles with unclear formatting features, content analysis (such as keyword matching and sentence structure analysis) can be used to assist in identification.
[0077] 3. Determine the hierarchical relationship
[0078] Title level judgment: Determine the level of each title based on the title’s format parameters (such as the decreasing pattern of font size, boldness, etc.) and content importance (such as the level of keywords contained in the title).
[0079] Hierarchical relationship construction: Through logical analysis, determine the hierarchical relationship between titles at all levels, such as main title and subtitle, subtitle and section title, etc.
[0080] 4. Error handling and verification
[0081] Conflict detection: Detects whether there is a hierarchical conflict (for example, a title is identified as a title at two different levels at the same time).
[0082] Correction and adjustment: Detected conflicts are corrected through manual intervention or automatic adjustment algorithms.
[0083] Consistency check: Ensure that the heading hierarchy of the entire document is logically consistent.
[0084] 5. Output title hierarchy system
[0085] Structured output: Output the constructed title hierarchy system in a structured manner, such as a tree structure, list structure, etc.
[0086] Assume there is a simple document with the following heading hierarchy:
[0087] Main Title: The main title of the document
[0088] Subtitle 1: The first subtitle under the main title
[0089] Section heading 1: The first section heading under subheading 1
[0090] Section heading 2: The second section heading under subheading 1
[0091] Subtitle 2: The second subtitle under the main title
[0092] Section heading 3: The first section heading under subheading 2
[0093] According to the above rule algorithm, such a title hierarchy system can be automatically identified and constructed.
[0094] S103. Establishing Correspondence Between Titles and Paragraphs and Generating a Table of Contents: Based on the established title hierarchy, further correspondence between titles and paragraphs is established. Subsequently, based on these correspondences, a comprehensive table of contents is automatically generated. This table of contents not only lists the titles at each level but also provides the corresponding page numbers or paragraph locations, greatly facilitating document browsing and retrieval.
[0095] Catalog generation methods include:
[0096] After identifying the hierarchical relationship of the headings, use the table of contents generation tool to automatically generate a table of contents. The table of contents can include information such as the names of the headings at each level, page numbers, or paragraph positions.
[0097] S104. Catalog Synchronization Update Mechanism: Considering that target documents may be continuously updated over time, a monitoring and synchronization update mechanism has been designed to ensure the accuracy and timeliness of the catalog. This mechanism monitors document updates in real time, including but not limited to newly added paragraphs, modified titles or paragraph content, and so on. Once an update is detected, the mechanism automatically triggers a synchronization update of the catalog, ensuring that the catalog remains consistent with the document content.
[0098] In an embodiment of the present invention, based on step S2, a possible embodiment will be given below to illustrate its specific implementation scheme in a non-limiting manner.
[0099] S201. Extracting text from images using optical character recognition technology
[0100] Technical Details: First, high-precision optical character recognition (OCR) technology scans the document image pixel by pixel to identify and extract the text embedded or attached within the image. This process requires ensuring the accuracy and robustness of the OCR technology to handle images with text in different fonts, sizes, and backgrounds.
[0101] S202. Extracting adjacent text paragraphs of the image based on the position of the image in the target document
[0102] 1. Document format recognition
[0103] PDF parsing: If the document is in PDF format, use a PDF parsing library (such as PyMuPDF, PDFMiner, etc.) to read the document's page content, font, size, position and other detailed information.
[0104] Word document parsing: For Word documents, you can use libraries such as python-docx to parse the position and attributes of document elements such as paragraphs, tables, and pictures.
[0105] 2. Extraction of adjacent text paragraphs
[0106] Position-based proximity search: After determining the image's location, use the document's layout information to perform a proximity search above, below, or on the left and right sides of the image to find text paragraphs adjacent to the image.
[0107] S203. Using keyword matching technology to filter out target paragraphs that match the text information from adjacent text paragraphs, and setting associated tags for the image and the target paragraph.
[0108] Keyword matching: Extracted image text information is matched against adjacent text paragraphs for keywords to find paragraphs containing relevant or similar information. Matching algorithms can be based on strategies such as word frequency, TF-IDF weight, and semantic similarity.
[0109] Association tag: Once a matching target paragraph is found, a unique association tag is set for the image and the target paragraph to identify their association relationship in subsequent processing.
[0110] S204. Performing semantic analysis on the text information and the target paragraph, and selecting one or more sentences from the target paragraph that have semantic matches with the text information.
[0111] Semantic Analysis: Using natural language processing (NLP) technology, we conduct in-depth semantic analysis on the extracted text and target paragraphs to identify the semantic connections between them. This may involve advanced NLP tasks such as syntactic analysis, entity recognition, and semantic role labeling.
[0112] Sentence selection: Based on the results of semantic analysis, one or more sentences are selected from the target paragraph that best match the semantics of the image and text. These sentences should accurately reflect the relationship between the image and text.
[0113] S205. Adding an independent identifier for the text information and the semantically matching sentence, the independent identifier is used to indicate that the text information and the semantically matching sentence are an inseparable integrated content body.
[0114] Independent identification: Add unique identifiers or tags to the filtered semantically matching sentences and text information. These identifiers should be unique in the document and are used to identify them as an indivisible comprehensive content body.
[0115] Content integration: After adding independent identifiers, you can further integrate text information and semantically matching sentences into a comprehensive content unit for easy subsequent processing and display.
[0116] S206. When generating a document hierarchy, determine the specific hierarchical position of the image relative to its associated text so that the image and text are displayed together as a hierarchical unit.
[0117] Hierarchical structure generation: When constructing the hierarchical structure of a document, a specific hierarchical position is determined for the image based on the logical relationship between the image and its associated text (including semantically matching sentences).
[0118] Integrated presentation of images and text: Ensure that images and their associated text are presented as a cohesive hierarchical unit in the final document, demonstrating their close connection. This may require adjusting the document's layout and format to accommodate the integration of images and text.
[0119] The associated image and text information is structured with the corresponding text content in the document to facilitate subsequent data management and information extraction. Specific operations include: Image and text labeling: adding label information to each image, including image number, title, associated text paragraph, etc., for traceability. Synchronization of associated paragraphs: Synchronize the text content recognized by OCR with the corresponding paragraphs in the document to ensure that the image information is integrated as part of the document structure. Hierarchical storage: The system stores the structured image and text data in the hierarchical structure of the document, and specifies the hierarchical position of the image content in the document structure to ensure the integrity of the document structure.
[0120] By matching the text information of the image twice, namely paragraph matching based on keywords and sentence matching based on semantic analysis, the related text content of the image can be accurately screened out, and the data processing volume is reduced compared to direct semantic analysis. In addition, by setting independent tags for the image and the related text content, the image and text content are bound together, ensuring that the image and text content are not separated in subsequent analysis, avoiding serious deviations in subsequent semantic analysis.
[0121] In an embodiment of the present invention, based on step S3, a possible embodiment will be given below to illustrate its specific implementation scheme in a non-limiting manner.
[0122] S301. Extract entities and entity relationships from the catalog titles and build a basic knowledge graph based on the extracted entities and entity relationships
[0123] Entity and relationship extraction: First, we conduct a detailed analysis of the titles at all levels in the catalog. Using natural language processing (NLP) techniques, such as named entity recognition (NER) and relationship extraction algorithms, we identify key entities (such as names of people, places, and organizations) and the potential relationships between these entities (such as hierarchical relationships, inclusion relationships, etc.) from the title text.
[0124] Basic knowledge graph construction: Based on the extracted entities and relationships, a knowledge graph containing basic entities and relationships is constructed using graph construction technologies, such as graph databases such as Neo4j. This graph will serve as the basic framework for subsequent local knowledge graph construction and global knowledge graph integration.
[0125] S302. Get the lowest level title in the directory and the local knowledge graph corresponding to the lowest level title, which contains the entity corresponding to the lowest level title.
[0126] Identify the lowest-level headings: Based on the directory's hierarchical structure, identify the lowest-level headings, which usually correspond to the most specific and detailed content in the document.
[0127] Local knowledge graph generation: For each bottom-level title, a local knowledge graph containing the entities corresponding to that title is generated based on its position and related entities in the basic knowledge graph. This local graph will focus on displaying entities and relationships that are closely related to the content of the bottom-level title.
[0128] S303. Obtain the target paragraph corresponding to the lowest-level title based on the directory, extract entities and relationships from the target paragraph, and update the local knowledge graph based on the extracted entities and relationships
[0129] Get the target paragraph: Use the directory to quickly locate the target paragraph corresponding to each bottom-level heading.
[0130] Paragraph content analysis: Perform detailed text analysis on the target paragraph and use NLP technology to extract entities and relationships in the paragraph.
[0131] Local knowledge graph update: Compare and integrate the extracted entities and relationships with the existing local knowledge graph, update the information in the graph, and ensure the accuracy and completeness of the graph.
[0132] S304. Traverse all the lowest-level titles to obtain the global knowledge graph
[0133] Traversal process: Traverse all the lowest-level titles in the order of the directory, execute steps S302 and S303 for each title, and update the local knowledge graph.
[0134] Global knowledge graph integration: During the traversal process, entities and relationships in each local knowledge graph are gradually integrated into the global knowledge graph. Through graph merging technology, the entities and relationships in the global graph are ensured to remain consistent, forming a complete and coherent knowledge system.
[0135] Verification and optimization: Finally, the global knowledge graph is verified and optimized to check whether the entities and relationships in the graph are correct and ensure the quality and usability of the graph.
[0136] Through the above steps, we extract entities and relationships from the document's directory, build a basic knowledge graph, generate and update local knowledge graphs based on the lowest-level titles, and ultimately integrate them into a global knowledge graph. This process not only improves the efficiency of understanding and analyzing document content, but also provides strong support for subsequent knowledge mining and application.
[0137] In an embodiment of the present invention, based on step S4, a possible embodiment will be given below to illustrate its specific implementation scheme in a non-limiting manner.
[0138] S401. Use a translation model to map entities and relationships in the global knowledge graph into low-dimensional vectors, and set the loss function of the translation model to negative log-likelihood loss.
[0139] Step Description: First, use a translation model (such as TransE, TransR, etc.) to embed entities and relations in the global knowledge graph into a low-dimensional vector space. These low-dimensional vectors can capture the semantic information between entities and relations and facilitate subsequent processing by the graph attention network model.
[0140] Loss function setting: To optimize the parameters of the translation model, the loss function is set to Negative Log Likelihood Loss, which aims to minimize the difference between the scores of positive samples and negative samples, thereby ensuring the accuracy and robustness of the embedding vector.
[0141] S402. The low-dimensional vectors of entities and relationships are used as input to a graph attention network model. The graph attention network model extracts relationships between entities in the global knowledge graph by calculating attention coefficients between entities and aggregating information from neighboring nodes.
[0142] The graph attention network model includes:
[0143] Input layer: The initial embedding vectors of the entities are used as input to the GAT model. These vectors will serve as feature representations of the nodes.
[0144] Attention mechanism layer: Construct a GAT layer where each node aggregates information about its neighboring nodes through an attention mechanism. The attention coefficient is determined by the similarity or correlation between nodes and can be calculated using dot products, bilinear transformations, or neural networks.
[0145] Multi-head attention: To enhance the model's stability and expressiveness, a multi-head attention mechanism can be introduced. This means that each GAT layer will contain multiple independent attention heads, each of which independently calculates attention coefficients and aggregates neighbor information. Finally, the outputs of these heads are concatenated or averaged to form the final node representation.
[0146] Multi-layer GAT: To capture global context, multiple GAT layers can be stacked. Each layer updates the node representation based on the output of the previous layer. As the number of layers increases, nodes are able to aggregate information from more distant neighbors, thereby enabling the propagation and integration of semantic information across entities and relationships.
[0147] The training methods of the graph attention network model include:
[0148] 1. Data preparation stage
[0149] Document preprocessing: First, the input document is preprocessed, including removing stop words and punctuation, performing stemming or lemmatization, etc., to reduce noise and standardize text data.
[0150] Positive pair construction: Using semantic or syntactic analysis techniques, we extract semantically similar or related sentences and paragraphs from preprocessed documents and form them into positive pairs. The sentences or paragraphs in a positive pair should have high similarity or relevance in terms of content, theme, or sentiment.
[0151] Negative sample pair construction: Similarly, semantically unrelated sentences or paragraphs are randomly selected from the document or based on a certain strategy (such as random selection, irrelevant topics, etc.) to form negative sample pairs. The sentences or paragraphs in the negative sample pairs should have significant differences in content.
[0152] 2. Feature extraction stage
[0153] Application of pre-trained hierarchical attention network models: Use pre-trained hierarchical attention network models to encode sentences or paragraphs in positive and negative sample pairs. Hierarchical attention network models can capture attention information within and between sentences, thereby generating high-dimensional, semantically rich vector representations.
[0154] Vector representation optimization: During the encoding process, the generated vector representation may need to be further optimized, such as by using dimensionality reduction techniques (such as PCA and t-SNE) to reduce redundant information, or by performing normalization to ensure comparability between vectors.
[0155] 3. Model training phase
[0156] Contrastive loss function design: We use the NT-Xent contrastive loss function, which aims to measure the distance between positive and negative pairs in semantic space. For positive pairs, the loss function should encourage the model to close the distance between them; for negative pairs, the loss function should encourage the model to close the distance between them.
[0157] Model parameter optimization: Using optimization algorithms such as gradient descent, combined with a contrastive loss function, the parameters of the graph attention network model are iteratively updated. In each iteration, the loss value of the model under the current parameters needs to be calculated, and the parameters are updated based on the gradient of the loss value.
[0158] Early stopping and validation: During training, use a validation set to monitor model performance. When performance on the validation set stops improving, use early stopping to prevent overfitting. You can also use the validation set to adjust model hyperparameters (such as learning rate and batch size).
[0159] 4. Model Evaluation and Optimization
[0160] Performance evaluation: After training is complete, the test set is used to evaluate the performance of the model. Evaluation metrics can include accuracy, recall, F1 score, etc. These metrics can reflect the model's ability to handle semantic similarity and relevance tasks.
[0161] Model optimization: Based on the evaluation results, further optimize the model. This may include adjusting the model structure, adding attention mechanisms, introducing external knowledge, etc.
[0162] S403. Calculate similarities between entities in different local knowledge graphs using the graph attention network model, and construct association relationships between entities in different local knowledge graphs based on the calculation results;
[0163] After obtaining the embedding vector of the global knowledge graph, the trained graph attention network model is used to calculate the similarity of entities in different local knowledge graphs. By calculating indicators such as cosine similarity or Euclidean distance between entities, the similarity and relevance between entities can be evaluated.
[0164] Relationship construction: Based on the similarity calculation results, the relationship between entities in different local knowledge graphs is constructed. These relationships can be represented as edges or links between entities for subsequent global relationship integration.
[0165] S404. Integrate the relationships between entities in the global knowledge graph and the association relationships between entities in different local knowledge graphs into global relationships.
[0166] Integrate the relationships between entities in the global knowledge graph and the associations between entities in different local knowledge graphs to form a more complete and comprehensive global knowledge graph. This global knowledge graph will include direct relationships in the global knowledge graph and indirect relationships in local knowledge graphs obtained through similarity calculations.
[0167] Integration methods can use graph merging or fusion algorithms to merge and integrate relationships from different sources. At the same time, different weights are set for direct and indirect relationships to ensure the accuracy and reliability of the integrated global knowledge graph.
[0168] In an embodiment of the present invention, based on step S5, a possible embodiment will be given below to illustrate its specific implementation scheme in a non-limiting manner.
[0169] S501. Utilize the graph wheel algorithm to construct a global context chain based on the global relationship.
[0170] After obtaining the integrated global knowledge graph, the Graph Wheel algorithm is further used to construct global context chains. The Graph Wheel algorithm is a graph-based algorithm that analyzes the nodes (entities) and edges (relationships) in the graph to construct a series of interconnected, logically ordered context chains. These context chains can capture the complex relationships between entities and reveal their dynamic changes in the global context.
[0171] Specific implementation:
[0172] Node selection and sorting: First, a set of core nodes is selected from the global knowledge graph as a starting point. These core nodes can be key entities in the global knowledge graph or representative entities in the local knowledge graph obtained through similarity calculations. The nodes are then sorted based on the associations and weights between entities to form a logically coherent contextual chain.
[0173] Relationship Linking: Based on the node sorting, these nodes are connected using relationship links in the global relationship. These relationship links can be direct relationships in the global knowledge graph or indirect relationships obtained through similarity calculations in the local knowledge graph. Through relationship links, a complete context chain is constructed, which can reflect the complex relationships and dynamic changes between entities.
[0174] Context Chain Optimization: To improve the accuracy and reliability of the context chain, the constructed context chain is optimized. This includes removing redundant nodes and relationships, adjusting the order of nodes, and merging similar context chains. Through optimization, a more concise and clear global context chain is obtained.
[0175] S502. Match the entities and relationships involved in the global context chain with the global knowledge graph to complete the missing entity relationships for the global knowledge graph based on the matching results.
[0176] Matching algorithm selection: First, select an appropriate matching algorithm to match the global context chain with the global knowledge graph. These algorithms can be similarity-based, rule-based, or machine learning-based. By selecting the appropriate matching algorithm, you can improve matching accuracy and efficiency.
[0177] Matching process: During the matching process, the entities and relationships in the global context chain are compared one by one with those in the global knowledge graph. Matching entities and relationships are skipped. Mismatched entities and relationships require analysis and are considered for completion. For example, if an entity relationship in the global context chain doesn't exist in the global knowledge graph, the corresponding entity relationship is added to the global knowledge graph.
[0178] Completing missing relationships: After matching is complete, missing entity relationships are completed for the global knowledge graph based on the matching results. This includes adding new entity relationships and updating existing entity relationships. By completing missing relationships, we can further improve the structure and content of the global knowledge graph, enhancing its effectiveness and value in practical applications.
[0179] Verification and Optimization: Finally, the completed global knowledge graph needs to be verified and optimized. This includes checking the accuracy and rationality of completed relationships, adjusting relationship weights and importance, and more. Verification and optimization ensure the accuracy and reliability of the global knowledge graph and provide strong support for its subsequent applications.
[0180] Through the above steps, the graph wheel algorithm is used to construct global context chains. The entities and relationships in these chains are then matched with the global knowledge graph to complete missing entity relationships and establish relationships across paragraph content. This helps further improve the structure and content of the global knowledge graph, enhancing its effectiveness and value in practical applications.
[0181] After completing global context tracking and semantic enhancement, the system enters the content summarization and information extraction phase. This step aims to extract and summarize multi-level key information from the document, providing users with a concise and accurate content summary.
[0182] The specific implementation process is as follows:
[0183] Hierarchical structure recognition: Using the previously established document hierarchy and knowledge graph, the system identifies different levels of content in the document, such as problems, requirements, goals, tasks, solutions, etc.
[0184] Key content location: Through semantic representation and entity relationships, the system accurately locates key content at each level. In the knowledge graph, nodes represent entities (such as questions and requirements) and edges represent relationships (such as "leads to," "satisfies," and "achieves"), thus clarifying the semantic location of content at each level.
[0185] Summarization model application: Pre-trained summary generation models (such as the Transformer-based text summarization model) are used to generate concise summaries for each level of content. Contextual information fusion: When generating summaries, global contextual information is incorporated to ensure that the summary content is consistent with the overall semantics of the document. The model considers context and related content when generating summaries to avoid one-sided or distorted information.
[0186] Hierarchical content organization: Extracted content is organized hierarchically, forming a structure from high to low levels. For example, this can progress from questions to requirements and then to tasks, building a clear content architecture. Structured data storage: The summarized content is stored in a structured format for easy retrieval and analysis. Data formats such as JSON and XML can be used to reflect the content hierarchy and relationships.
[0187] Logical Chain Construction: Based on the knowledge graph and global context tracking, the system constructs a logical chain between different levels of content. For example, a problem leads to which requirements, and these requirements correspond to which tasks and solutions. Relationship Display: When presenting content, the connections between different levels of content are highlighted to help users understand the logical relationships between the content. The interrelationships between different levels of content are displayed through visual methods such as flowcharts or tree diagrams.
[0188] Redundancy Detection: We use semantic similarity calculations to identify redundant information within content and avoid duplication. The system merges semantically similar or duplicate content. Information Integration: We integrate similar or related content to create a more comprehensive and unified presentation, ensuring information integrity and consistency.
[0189] Visual presentation: The summarized content is presented intuitively through charts, tree structures, etc., showing the hierarchy and relationships of the content. Users can quickly browse and locate the content of interest through the interactive interface.
[0190] Language Fluency: When generating summaries and summaries, natural language generation technology is used to ensure that the output text is clear, fluent, and easy to understand.
[0191] User customization: Allows users to set parameters such as summary length and level of detail to generate content that meets their needs. Users can select the level or topic of interest to receive a personalized summary.
[0192] Content quality assessment: The system conducts quality assessment on the generated summaries and summaries, testing the information completeness, accuracy, and language quality to ensure the high quality of the output content.
[0193] This embodiment provides a method for global context analysis of complex documents, including the following process:
[0194] 1. Generate document directory
[0195] The layout analysis model analyzes the document's layout features and generates a table of contents by constructing a title hierarchy through a rule-based algorithm. The layout analysis model, based on machine learning algorithms, learns and classifies features such as paragraph distribution and title format parameters.
[0196] process:
[0197] Assume that the document layout feature vector is x=(x1,x2,⋯,x n ), where x i Represents the i-th layout feature, such as paragraph spacing, title font size, etc.
[0198] Use layout analysis models (such as support vector machines) to classify feature vectors and obtain preliminary classification results of titles. The decision function of the support vector machine is: Among them, α i is the Lagrange multiplier, y i is the sample label, K(x i ,x) is a kernel function (such as the radial basis kernel function K(x i ,x)=exp(−γ∥x i −x∥2)), b is the bias term.
[0199] According to the classification results, a rule-based algorithm (such as a hierarchical relationship rule based on titles) is used to construct a title hierarchy system. i The level is l i , determined by the following rules:
[0200]
[0201] Build the correspondence between titles and paragraphs based on the title hierarchy system and generate a table of contents.
[0202] 2. Establish a relationship between images and text content
[0203] Optical character recognition (OCR) technology is used to extract text information from images, and the association between images and adjacent text content is established through keyword matching and semantic analysis.
[0204] Use OCR technology to extract text information from images image .
[0205] According to the position of the image in the document, extract the adjacent text paragraph P adjacent .
[0206] Use keyword matching technology (such as TF-IDF algorithm) to calculate the matching degree between text information and adjacent text paragraphs. Let t be a keyword, W image The word frequency of t in the sentence is tf t,image , the inverse document frequency of t in the document is idf t , then t is in W image The TF-IDF value in is: Similarly, we can get t in P adjacent TF-IDF value in tf−idf t,adjacent Then W image With P adjacentThe matching degree S match Defined as:
[0207] Perform semantic analysis on the text information and the target paragraph (e.g. using cosine similarity of word vectors). Let W image and P adjacent The word vectors are v image and v adjacent , then their semantic similarity S semantic for:
[0208] Filter out target paragraphs based on matching and similarity, and set associated tags for the images and target paragraphs.
[0209] 3. Build a global knowledge graph
[0210] Extract entities and relationships from the directory titles to build a basic knowledge graph, gradually perform semantic analysis on the paragraphs corresponding to the titles, add entities and relationships, and obtain a global knowledge graph.
[0211] Extract entities and entity relationships from the title of the directory. Let the extracted entity set be E={e1,e2,⋯,e m}, the relation set is R={r1,r2,⋯,r n The basic knowledge graph is represented as a triple set G0={(e i ,r j ,e k )|e i ,e k ∈E,rj∈R}.
[0212] Get the lowest level title in the directory and the local knowledge graph G corresponding to the lowest level title local .
[0213] Based on the catalog, obtain the target paragraph corresponding to the lowest-level title, extract entities and relationships from the target paragraph, and set the newly extracted entity set as E' and the relationship set as R'. Update the local knowledge graph: G local =G local ∪{(e i ,r j ,e k )|e i ,e k ∈E∪E′,r j ∈R∪R′}
[0214] Traverse all the lowest-level titles and integrate all local knowledge graphs into the global knowledge graph G global .
[0215] 4. Global Relation Extraction
[0216] The knowledge graph embedding method is used to map entities and relationships in the global knowledge graph into low-dimensional vectors, and the graph attention network model is used to extract global relationships.
[0217] A translation model (such as TransE) is used to map entities and relations in the global knowledge graph into low-dimensional vectors. Let the vector of entity e be denoted as e, and the vector of relation r be denoted as r. For a triple (e i ,r,e j ), TransE's goal is to make e i +r≈e j The loss function is the negative log-likelihood loss:
[0218] Where σ is the sigmoid function, , is the set of negative samples.
[0219] The low-dimensional vectors of entities and relations are used as the input of the graph attention network model. Let the feature vector of node i be h i , the graph attention network calculates the attention coefficient α of node i to node j ij for: Among them, W is the learnable weight matrix, a is the attention vector, N i is the set of neighbor nodes of node i.
[0220] Aggregate the information of neighboring nodes to obtain the updated feature h of node i i ′:
[0221] The graph attention network model is used to calculate the similarity of entities in different local knowledge graphs. Let entity e i and e j The eigenvectors of ei and h ej , then their similarity S entity for:
[0222] The association relationships between entities in different local knowledge graphs are constructed based on similarity, and the relationships between entities in the global knowledge graph and the association relationships between entities in different local knowledge graphs are integrated into global relationships.
[0223] 5. Training the Graph Attention Network Model
[0224] The graph attention network model is trained through positive and negative sample pairs, enabling it to distinguish relevant and irrelevant content in the semantic space.
[0225] Extract semantically similar or related sentences and paragraphs from the document to form positive sample pairs (p1 + ,p2 + ), select semantically irrelevant sentences or paragraphs from the document to form negative sample pairs (p1 − ,p2 − ).
[0226] Use the pre-trained hierarchical attention network model to encode the sentences or paragraphs in the positive and negative sample pairs to generate a high-dimensional semantic vector v1 + ,v2 + ,v1 − ,v2 − .
[0227] Using contrast loss function (such as Triplet Loss): Here, m is the margin parameter.
[0228] The encoded positive and negative sample pairs are used to train the graph attention network model, and the model parameters are updated by minimizing the loss function.
[0229] 6. Update global knowledge graph relationships
[0230] Build a global context chain based on global relationships, and complete missing entity relationships by matching the global context chain with the global knowledge graph.
[0231] The graph wheel algorithm is used to construct the global context chain C based on the global relationship.
[0232] Match the entities and relationships involved in the global context chain with the global knowledge graph. Let the set of triples in the global knowledge graph be G global , the set of triples in the global context chain is C, then the updated global knowledge graph G updated for:
[0233] The Graph Wheel Algorithm is an algorithm for constructing cyclic association paths in graph structures. Its core approach is to discover multi-hop associations between entities through a wheel-like structure (a closed loop consisting of a central node and multiple spoke nodes). This algorithm has important applications in scenarios such as knowledge graph completion and relational reasoning. A knowledge graph is represented as a directed graph G = (V, E), where:
[0234] V={v1,v2,...,v n} is a collection of entity nodes;
[0235] E={(v i ,v j ,rij )} is the edge set, r ij Represents entity v i to v j The relationship type.
[0236] The graph wheel algorithm constructs a wheel-like structure through the following steps:
[0237] Center node selection: select a core entity c as the axle;
[0238] Spoke node screening: Screen entities s1, s2, ..., s directly connected to c k as spokes;
[0239] Closed loop formation: Spoke nodes are connected through multi-hop paths to form a wheel-shaped loop path centered on c.
[0240] The process of path weight calculation includes: the weight of each path is dynamically adjusted based on the relationship confidence and path length:
[0241] Where m is the path length; αri is the confidence of relation ri; β∈(0,1) is the path attenuation coefficient.
[0242] In some embodiments, the global context analysis system for complex documents may include multiple functional modules composed of computer program segments. The computer programs of the various program segments in the global context analysis system for complex documents may be stored in a memory of a computer device and executed by at least one processor to perform (see Figure 1 Description) Function of global context analysis of complex documents.
[0243] In this embodiment, the global context analysis system for complex documents can be divided into multiple functional modules according to the functions it performs, such as Figure 2 As shown. The functional modules of system 200 may include: a catalog generation module 210, an image association module 220, a graph construction module 230, a global analysis module 240, and a context enhancement module 250. As used herein, a module refers to a series of computer program segments that can be executed by at least one processor and perform fixed functions, and are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
[0244] A directory generation module, configured to generate a directory for a target document by performing layout analysis on the target document;
[0245] An image association module is used to identify text information of images in a target document and establish an association relationship between the image and text content by performing semantic analysis on the text information and adjacent text content;
[0246] A graph construction module is used to construct a basic knowledge graph based on the titles of the catalog, and gradually perform semantic analysis on the paragraphs corresponding to the titles, add entities and relationships to the basic knowledge graph, and obtain a global knowledge graph;
[0247] The global analysis module is used to map entities and relationships in the global knowledge graph into low-dimensional vectors using the knowledge graph embedding method, and to extract global relationships from the embedded global knowledge graph using the graph attention network model;
[0248] The context enhancement module is used to construct a global context chain based on the global relationship and update the relationship of the global knowledge graph based on the global context chain.
[0249] Optionally, as an embodiment of the present invention, the directory generation module includes:
[0250] a layout analysis unit, configured to analyze layout features of the target document using a layout analysis model, wherein the layout features include paragraph distribution, title format parameters, title content, and paragraph format parameters;
[0251] A system construction unit, configured to construct a title hierarchy system based on the layout features using a rule algorithm;
[0252] A directory generating unit, configured to establish a correspondence between titles and paragraphs based on the title hierarchy system, and generate a directory based on the correspondence;
[0253] The directory updating unit is used to monitor the updated content of the target document and synchronously update the directory based on the updated content.
[0254] Optionally, as an embodiment of the present invention, the picture association module includes:
[0255] A text extraction unit, used to extract text information from the image using optical character recognition technology;
[0256] A paragraph extraction unit, configured to extract text paragraphs adjacent to the image based on the position of the image in the target document;
[0257] a tag association unit, configured to select a target paragraph matching the text information from adjacent text paragraphs using a keyword matching technique, and to set an association tag for the image and the target paragraph;
[0258] a semantic matching unit, configured to perform semantic analysis on the text information and the target paragraph, and select one or more sentences from the target paragraph that have semantic matching with the text information;
[0259] a sentence marking unit, configured to add an independent identifier to the sentence in which the text information and the semantics match, wherein the independent identifier is used to indicate that the text information and the sentence in which the semantics match are matched are an indivisible integrated content body;
[0260] The position determination unit is used to determine the specific hierarchical position of the image relative to its associated text when generating a document hierarchy, so that the image and text contents are displayed together as a hierarchical unit.
[0261] Optionally, as an embodiment of the present invention, a basic knowledge graph is constructed based on the titles of the catalog, and semantic analysis is gradually performed on the paragraphs corresponding to the titles, and entities and relationships are added to the basic knowledge graph to obtain a global knowledge graph, including:
[0262] Extract entities and entity relationships from the catalog titles and build a basic knowledge graph based on the extracted entities and entity relationships;
[0263] Obtain the lowest-level title in the directory, and obtain a local knowledge graph corresponding to the lowest-level title, wherein the local knowledge graph contains an entity corresponding to the lowest-level title;
[0264] Obtaining a target paragraph corresponding to the lowest-level title based on the directory, extracting entities and relationships from the target paragraph, and updating the local knowledge graph based on the extracted entities and relationships;
[0265] Traverse all the lowest-level titles to obtain the global knowledge graph.
[0266] Optionally, as an embodiment of the present invention, a knowledge graph embedding method is used to map entities and relationships in a global knowledge graph into low-dimensional vectors, and a graph attention network model is used to perform global relationship extraction on the embedded global knowledge graph, including:
[0267] A translation model is used to map entities and relationships in the global knowledge graph into low-dimensional vectors, and the loss function of the translation model is set to negative log-likelihood loss;
[0268] The low-dimensional vectors of entities and relations are used as input to the graph attention network model, which extracts the relationships between entities in the global knowledge graph by calculating the attention coefficients between entities and aggregating the information of neighboring nodes;
[0269] Use the graph attention network model to calculate the similarity of entities in different local knowledge graphs, and build the association relationship between entities in different local knowledge graphs based on the calculation results;
[0270] The relationships between entities in the global knowledge graph and the association relationships between entities in different local knowledge graphs are integrated into global relationships.
[0271] Optionally, as an embodiment of the present invention, the training method of the graph attention network model includes:
[0272] Extract semantically similar or related sentences and paragraphs from the document to form positive sample pairs, and select semantically unrelated sentences or paragraphs from the document to form negative sample pairs;
[0273] Use the pre-trained hierarchical attention network model to encode sentences or paragraphs in positive and negative sample pairs to generate high-dimensional semantic vectors;
[0274] A contrastive loss function is used to make the model closer to the positive pairs and farther away from the negative pairs in the semantic space.
[0275] The encoded positive and negative sample pairs are used to train the graph attention network model.
[0276] Optionally, as an embodiment of the present invention, a global context chain is constructed based on the global relationship, and the relationship of the global knowledge graph is updated based on the global context chain, including:
[0277] constructing a global context chain based on the global relationship using a graph wheel algorithm;
[0278] The entities and relationships involved in the global context chain are matched with the global knowledge graph to complete the missing entity relationships for the global knowledge graph based on the matching results.
[0279] Although the present invention has been described in detail with reference to the accompanying drawings and in conjunction with preferred embodiments, the present invention is not limited thereto. Without departing from the spirit and essence of the present invention, persons of ordinary skill in the art may make various equivalent modifications or substitutions to the embodiments of the present invention, and such modifications or substitutions shall be within the scope of the present invention. Any changes or substitutions that can be easily conceived by persons skilled in the art within the technical scope disclosed in the present invention shall be within the scope of protection of the present invention.
Claims
1. A global context analysis method for complex documents, characterized by: include: Generate a directory for the target document by performing layout analysis on the target document; Identify text information of images in target documents, and establish an association relationship between images and text content by performing semantic analysis on the text information and adjacent text content; Building a basic knowledge graph based on the titles of the catalog, and gradually performing semantic analysis on the paragraphs corresponding to the titles, adding entities and relationships to the basic knowledge graph to obtain a global knowledge graph; The knowledge graph embedding method is used to map entities and relationships in the global knowledge graph into low-dimensional vectors, and the graph attention network model is used to extract global relationships from the embedded global knowledge graph; Building a global context chain based on the global relationship, and updating the relationship of the global knowledge graph based on the global context chain; The knowledge graph embedding method is used to map entities and relationships in the global knowledge graph into low-dimensional vectors, and the graph attention network model is used to extract global relationships from the embedded global knowledge graph, including: A translation model is used to map entities and relationships in the global knowledge graph into low-dimensional vectors, and the loss function of the translation model is set to negative log-likelihood loss; The low-dimensional vectors of entities and relations are used as input to the graph attention network model, which extracts the relationships between entities in the global knowledge graph by calculating the attention coefficients between entities and aggregating the information of neighboring nodes; Use the graph attention network model to calculate the similarity of entities in different local knowledge graphs, and build the association relationship between entities in different local knowledge graphs based on the calculation results; Integrate the relationships between entities in the global knowledge graph and the association relationships between entities in different local knowledge graphs into global relationships; Building a global context chain based on the global relationship, and updating the relationship of the global knowledge graph based on the global context chain, including: constructing a global context chain based on the global relationship using a graph wheel algorithm; The entities and relationships involved in the global context chain are matched with the global knowledge graph to complete the missing entity relationships for the global knowledge graph based on the matching results.
2. The method according to claim 1, characterized in that By performing layout analysis on the target document, a directory is generated for the target document, including: Analyzing layout features of the target document using a layout analysis model, wherein the layout features include paragraph distribution, title format parameters, title content, and paragraph format parameters; Using a rule algorithm, constructing a title hierarchy system based on the layout features; Constructing a correspondence between titles and paragraphs based on the title hierarchy system, and generating a table of contents based on the correspondence; Monitor updated content of the target document, and synchronously update the directory based on the updated content.
3. The method according to claim 1, characterized in that Identify the text information of the image in the target document and establish an association relationship between the image and the text content by performing semantic analysis on the text information and adjacent text content, including: Use optical character recognition technology to extract text information from images; Extracting text paragraphs adjacent to the image based on the position of the image in the target document; Using keyword matching technology to filter out a target paragraph that matches the text information from adjacent text paragraphs, and setting an associated tag for the image and the target paragraph; Performing semantic analysis on the text information and the target paragraph, and selecting one or more sentences from the target paragraph that have semantic matching with the text information; Adding an independent identifier to the text information and the sentence with semantic matching, wherein the independent identifier is used to indicate that the text information and the sentence with semantic matching are an indivisible integrated content body; When generating the document hierarchy, the specific hierarchical position of the image relative to its associated text is determined so that the image and text content are displayed together as a hierarchical unit.
4. The method according to claim 1, wherein A basic knowledge graph is constructed based on the titles of the catalog, and semantic analysis is gradually performed on the paragraphs corresponding to the titles. Entities and relationships are added to the basic knowledge graph to obtain a global knowledge graph, including: Extract entities and entity relationships from the catalog titles and build a basic knowledge graph based on the extracted entities and entity relationships; Obtain the lowest-level title in the directory, and obtain a local knowledge graph corresponding to the lowest-level title, wherein the local knowledge graph contains an entity corresponding to the lowest-level title; Obtaining a target paragraph corresponding to the lowest-level title based on the directory, extracting entities and relationships from the target paragraph, and updating the local knowledge graph based on the extracted entities and relationships; Traverse all the lowest-level titles to obtain the global knowledge graph.
5. The method according to claim 4, characterized in that The training method of the graph attention network model includes: Extract semantically similar or related sentences and paragraphs from the document to form positive sample pairs, and select semantically unrelated sentences or paragraphs from the document to form negative sample pairs; Use the pre-trained hierarchical attention network model to encode sentences or paragraphs in positive and negative sample pairs to generate high-dimensional semantic vectors; A contrastive loss function is used to make the model closer to the positive pairs and farther away from the negative pairs in the semantic space. The encoded positive and negative sample pairs are used to train the graph attention network model.
6. A global context analysis system for complex documents, characterized by: include: A directory generation module, configured to generate a directory for a target document by performing layout analysis on the target document; An image association module is used to identify text information of images in a target document and establish an association relationship between the image and text content by performing semantic analysis on the text information and adjacent text content; A graph construction module is used to construct a basic knowledge graph based on the titles of the catalog, and gradually perform semantic analysis on the paragraphs corresponding to the titles, add entities and relationships to the basic knowledge graph, and obtain a global knowledge graph; The global analysis module is used to map entities and relationships in the global knowledge graph into low-dimensional vectors using the knowledge graph embedding method, and to extract global relationships from the embedded global knowledge graph using the graph attention network model; A context enhancement module, configured to construct a global context chain based on the global relationship, and update the relationship of the global knowledge graph based on the global context chain; The knowledge graph embedding method is used to map entities and relationships in the global knowledge graph into low-dimensional vectors, and the graph attention network model is used to extract global relationships from the embedded global knowledge graph, including: A translation model is used to map entities and relationships in the global knowledge graph into low-dimensional vectors, and the loss function of the translation model is set to negative log-likelihood loss; The low-dimensional vectors of entities and relations are used as input to the graph attention network model, which extracts the relationships between entities in the global knowledge graph by calculating the attention coefficients between entities and aggregating the information of neighboring nodes; Use the graph attention network model to calculate the similarity of entities in different local knowledge graphs, and build the association relationship between entities in different local knowledge graphs based on the calculation results; Integrate the relationships between entities in the global knowledge graph and the association relationships between entities in different local knowledge graphs into global relationships; Building a global context chain based on the global relationship, and updating the relationship of the global knowledge graph based on the global context chain, including: constructing a global context chain based on the global relationship using a graph wheel algorithm; The entities and relationships involved in the global context chain are matched with the global knowledge graph to complete the missing entity relationships for the global knowledge graph based on the matching results.
7. The system according to claim 6, characterized in that The directory generation module includes: a layout analysis unit, configured to analyze layout features of the target document using a layout analysis model, wherein the layout features include paragraph distribution, title format parameters, title content, and paragraph format parameters; A system construction unit, configured to construct a title hierarchy system based on the layout features using a rule algorithm; A directory generating unit, configured to establish a correspondence between titles and paragraphs based on the title hierarchy system, and generate a directory based on the correspondence; The directory updating unit is used to monitor the updated content of the target document and synchronously update the directory based on the updated content.
8. The system according to claim 6, wherein: The picture association module includes: A text extraction unit, used to extract text information from the image using optical character recognition technology; A paragraph extraction unit, configured to extract text paragraphs adjacent to the image based on the position of the image in the target document; a tag association unit, configured to select a target paragraph matching the text information from adjacent text paragraphs using a keyword matching technique, and to set an association tag for the image and the target paragraph; a semantic matching unit, configured to perform semantic analysis on the text information and the target paragraph, and select one or more sentences from the target paragraph that have semantic matching with the text information; a sentence marking unit, configured to add an independent identifier to the sentence in which the text information and the semantics match, wherein the independent identifier is used to indicate that the text information and the sentence in which the semantics match are matched are an indivisible integrated content body; The position determination unit is used to determine the specific hierarchical position of the image relative to its associated text when generating a document hierarchy, so that the image and text contents are displayed together as a hierarchical unit.
Citation Information
Patent Citations
Cross-language knowledge graph link prediction method based on graph attention mechanism
CN114564596A
Named entity recognition method based on comparative learning and multi-modal semantic interaction
CN117574904A