Intelligent matching and quick switching method of multi-dimensional document template
By combining semantic segmentation networks and multimodal feature fusion technology with multi-core processors and knowledge graphs, intelligent matching and rapid switching of document templates are achieved, solving the problems of decreased recognition rate and manual intervention in traditional methods, and improving the efficiency and adaptability of document processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-17
- Publication Date
- 2026-03-17
AI Technical Summary
Traditional document template matching methods lack the ability to understand the semantics of documents, cannot automatically identify changes between different templates, require manual intervention, are isolated from the database, lack intelligent interaction methods, and are difficult to meet high-performance requirements.
Semantic segmentation networks and multimodal feature fusion technology are used to identify the logical regions of documents. Combined with parallel processing of multi-core central processing units and knowledge graph queries, document templates are automatically matched and switched, knowledge graphs and template databases are optimized, and hot template prediction and task priority evaluation mechanisms are established.
It improves the accuracy and processing speed of document information recognition, enhances the system's flexibility and adaptability, ensures that historical documents match the correct templates, and meets high-performance requirements.
Smart Images

Figure CN121354136B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent office technology, specifically to a method for intelligent matching and rapid switching of multi-dimensional document templates. Background Technology
[0002] In the operation of modern enterprises, document processing is an important part of daily business, such as invoices, orders, bills of lading, and contracts.
[0003] Traditional document template matching and switching methods can typically only recognize documents with fixed templates, lacking the ability to understand the semantics of the documents. Once the layout changes, the recognition rate drops sharply. Secondly, switching between different document templates requires manual intervention and cannot automatically recommend or switch to the most suitable processing flow based on the document content. Furthermore, the document processing system is isolated from the enterprise's internal database and big data resource services, making it impossible to utilize existing business knowledge to assist in document understanding and decision-making. In addition, the lack of intelligent interactive means such as natural language query and machine question answering prevents users from flexibly querying document information or issuing instructions, making it difficult to meet high-performance requirements.
[0004] Therefore, to address the shortcomings of existing methods, a method for intelligent matching and rapid switching of multi-dimensional document templates is proposed. Summary of the Invention
[0005] The purpose of this invention is to provide an intelligent matching and rapid switching method for multi-dimensional document templates. Through semantic segmentation networks and multimodal feature fusion technology, textual information is accurately associated with corresponding semantic regions, ensuring correct filling of document information. A multi-core CPU efficiently processes a large number of documents, and a task priority evaluation mechanism ensures rapid processing of high-priority documents. Hotspot template prediction effectively improves the response speed of the processing method. Based on a timeliness matching mechanism and template versioning management, it ensures that historical documents can accurately match the current template version, solving the problem of historical data processing caused by policy or format changes, and addressing the issues raised in the background.
[0006] To achieve the above objectives, the present invention provides the following technical solution:
[0007] The intelligent matching and quick switching method for multi-dimensional document templates includes the following steps:
[0008] We utilize big data resources to collect various document samples, and use character recognition technology to perform character recognition, word segmentation, and grammatical analysis on the text content in the documents to extract the original text information.
[0009] A semantic segmentation network is used to segment the input document image into regions and assign a corresponding semantic label to each pixel region to identify different logical regions.
[0010] Based on the segmentation results, the location and contour of each semantic region are extracted, and the identified original text information is associated with the corresponding semantic region;
[0011] Semantic analysis models are used to perform semantic recognition and classification on raw text information to generate structured semantic data;
[0012] Structured semantic data is semantically fused with a pre-built knowledge graph. Based on the fused semantic information, multiple candidate document templates are matched from a pre-set template database using a decision tree model.
[0013] When a new document is input, the template matching task is decomposed into feature extraction, decision tree screening, deep semantic matching, knowledge graph association query, and result fusion and sorting based on a multi-core central processing unit; and then distributed to different core clusters for parallel processing to determine the corresponding document template.
[0014] Based on the matching results, automatically switch to the corresponding document template and fill the key information from the document into the corresponding positions in the template;
[0015] Obtain feedback information on matching results, introduce timestamps to manage the matching accuracy of each template, and optimize the knowledge graph and template database based on feedback information and matching accuracy.
[0016] Furthermore, a semantic segmentation network is used to segment the input document image into regions, and a corresponding semantic label is assigned to each pixel region, including:
[0017] The document image is input into the visual encoder of the semantic segmentation network to generate a multi-scale visual feature map;
[0018] Character recognition is performed on the same document image, and the recognized text sequence is input into a text encoder to generate text features;
[0019] At each spatial location of the visual feature map, calculate its co-attention weight with the text features;
[0020] Based on the common attention weights, the semantic information of the text is fused into the visual features to generate a text-enhanced visual feature map;
[0021] Multiple feature layers of different depths and resolutions are preserved in the visual feature map of text enhancement. The top feature map is subjected to dilated convolution with different dilation rates in parallel. The high-level semantic features are fused with the low-level high-resolution features layer by layer to capture contextual information from local details to global layout.
[0022] The features that integrate multimodal and multiscale information are upsampled and refined to output the final pixel-level semantic segmentation map;
[0023] Based on the segmentation results, the location and outline of each semantic region are extracted; the spatial topological relationship between regions is analyzed, and a layout logic tree is constructed.
[0024] The identified raw text information is associated with the corresponding semantic region based on its spatial coordinates, so that each pixel region is matched with the corresponding semantic tag;
[0025] The prior rules for this type of document are retrieved from the knowledge graph. The prior rules are then used to perform logical verification on the associated results to verify whether the segmented regions of the document image match the corresponding semantic tags.
[0026] Furthermore, at each spatial location of the visual feature map, its co-attention weights with the text features are calculated, including:
[0027] Retrieve each spatial location corresponding to the visual feature map;
[0028] Using spatial location p as the center, extract the window containing spatial location p in the visual feature map according to the 3*3 local window method;
[0029] Extract the feature vectors corresponding to all spatial locations within the window;
[0030] The spatial aggregation factor corresponding to spatial location p is obtained by using the feature vectors of all locations within the window corresponding to spatial location p.
[0031] The co-attention weights of each spatial location and text feature in the visual feature map are obtained by using the text features corresponding to the same document image to which the visual feature map belongs and the spatial clustering factor corresponding to the spatial location p.
[0032] Further, by utilizing the text features corresponding to the same document image to which the visual feature map belongs and the spatial clustering factor corresponding to the spatial location p, the co-attention weights of each spatial location and text feature in the visual feature map are obtained, including:
[0033] Retrieve the text features corresponding to the same document image belonging to the same visual feature map;
[0034] Obtain the Euclidean norm of the text feature corresponding to the text feature vector;
[0035] Retrieve the feature vector corresponding to spatial location p, and obtain its corresponding Euclidean norm based on the feature vector corresponding to spatial location p;
[0036] The basic correlation parameters between the text features and the spatial location p are obtained by performing correlation processing using the Euclidean norm corresponding to the text features and the Euclidean norm of the feature vector corresponding to the spatial location p.
[0037] Retrieve the spatial aggregation factor corresponding to spatial location p;
[0038] The co-attention weights of each spatial location and text feature in the visual feature map are obtained by combining the spatial clustering factor corresponding to the spatial location p with the basic correlation parameters between the text feature and the spatial location p.
[0039] Furthermore, based on a multi-core central processing unit, the template matching task is decomposed into feature extraction, decision tree initial screening, deep semantic matching, knowledge graph association query, and result fusion and ranking, including:
[0040] Preload new document data into the pending processing path and retrieve the running status of all core clusters in the multi-core central processing unit;
[0041] By using predictive models, the execution time of tasks can be predicted based on the type and complexity of documents, allowing for advance task allocation and resource scheduling.
[0042] The preloaded document data is divided into micro-batches, and tasks are dynamically allocated according to the current load of each core cluster, assigning corresponding tasks to each core cluster.
[0043] Collect the results of completed tasks from each core cluster, perform weighted semantic fusion and sorting on the results of all parallel tasks for the same document, and generate the final candidate template list.
[0044] Output the final matching results and record the processing timestamp, cache hit rate, and core load for each document for subsequent analysis and optimization.
[0045] Furthermore, based on feedback and matching accuracy, the knowledge graph and template database are optimized, including:
[0046] Continuously collect user feedback information. If a user manually corrects or rejects the template matching result, the correction content and correction timestamp will be automatically recorded, and the original template will be classified as a negative sample or a positive sample.
[0047] The matching accuracy of each version of the template is calculated periodically. If the accuracy is lower than the threshold or a change in business rules is detected, a new version is automatically created.
[0048] The new version learns and optimizes from the knowledge graph through knowledge fusion technology to adapt to new business rules or format changes.
[0049] Furthermore, if the accuracy rate falls below a threshold or a change in business rules is detected, a new version creation will be automatically triggered, including:
[0050] Establish a template version evolution map to record the validity period, changes, and performance indicators of each version of the template.
[0051] When a major change to business rules is detected, a new version of the template is automatically created, while maintaining historical compatibility with the old version;
[0052] During the matching process, the date range of the documents to be processed is obtained, and the corresponding time period template version is automatically associated with the date range to avoid errors caused by policy retrospective.
[0053] Based on user feedback, a template quality assessment system was established to automatically downgrade or archive low-quality templates.
[0054] Through a continuous learning mechanism, the verified matching results are used as new samples and fed back into the training process.
[0055] Furthermore, it also includes the following steps:
[0056] Establish a task priority assessment mechanism to set processing priorities based on the urgency of documents and customer level;
[0057] Allocate dedicated computing resources to high-priority documents to ensure that their processing latency is minimized;
[0058] Real-time monitoring of task queue depth and response time in each core cluster; when task backlog is detected, automatic elastic scaling is initiated to dynamically migrate tasks to idle cores.
[0059] Establish a timeout warning mechanism to isolate and recover abnormal tasks.
[0060] Furthermore, it also includes the following steps:
[0061] Establish a hotspot template prediction model, based on historical processing records with timestamps, to identify high-frequency matching templates in a specific time period or for a specific customer, and use them as hotspot templates.
[0062] The vectorized representations of the identified hotspot templates, along with the relevant knowledge graph subgraphs, are preloaded into the shared cache of the multi-core CPU.
[0063] When performing deep semantic matching and knowledge graph association queries, priority is given to searching and matching in the shared cache;
[0064] If a cache hit occurs, the corresponding task will be routed to a dedicated core for accelerated processing.
[0065] If a cache miss occurs, the process switches to the regular processing flow and the miss information is recorded for model optimization.
[0066] Furthermore, it also includes the following steps:
[0067] Construct a cross-language semantic mapping layer to perform unified semantic encoding on the content of multilingual documents;
[0068] When non-native language text is detected, an intelligent translation mechanism is activated to prioritize rule-based translation for specialized terms and deep learning translation for general text.
[0069] The translation results are semantically fused with the original text to generate a semantic vector representation;
[0070] Based on this semantic vector, cross-language entity linking and relationship mapping are performed in the knowledge graph, supporting template matching for multilingual documents.
[0071] Compared with the prior art, the beneficial effects of the present invention are:
[0072] 1. In this invention, by using semantic segmentation networks and multimodal feature fusion technology, different logical regions in a document can be accurately identified, and text information can be accurately associated with the corresponding semantic regions. Based on deep semantic matching and knowledge graph association query, the accuracy of template matching is further improved, ensuring the correct filling of document information. Through the parallel processing mechanism of a multi-core central processing unit, a large number of documents can be processed efficiently, significantly improving processing speed and efficiency. Combined with a task priority evaluation mechanism and elastic expansion function, the rapid processing of high-priority documents is further ensured.
[0073] 2. In this invention, through user feedback and matching accuracy optimization mechanisms, the knowledge graph and template database can be dynamically adjusted, and new version templates can be automatically created to adapt to changes in business rules; combined with hotspot template prediction, the response speed and processing efficiency of the method are further improved; based on the timeliness matching mechanism and template version management, it is ensured that historical documents can accurately match the template version at that time, solving the problem of historical data processing caused by policy or format changes, and improving the flexibility and practicality of the method. Attached Figure Description
[0074] Figure 1 This is a flowchart of the intelligent matching and fast switching method for multi-dimensional document templates according to the present invention. Detailed Implementation
[0075] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0076] To address the limitations of traditional document template matching and switching methods, which typically only recognize documents with fixed templates and lack semantic understanding, the recognition rate drops drastically once the format changes. Secondly, switching between different document templates requires manual intervention and cannot automatically recommend or switch to the most suitable processing flow based on document content. Furthermore, the document processing system is isolated from the enterprise's internal database and big data resource services, lacking intelligent interaction methods such as natural language querying and machine question answering. For technical issues preventing users from flexibly querying document information or issuing instructions, please refer to [link / reference needed]. Figure 1 This embodiment provides the following technical solution:
[0077] The intelligent matching and quick switching method for multi-dimensional document templates includes the following steps:
[0078] We utilize big data resource services to collect various document samples, and then use character recognition technology to perform character recognition, word segmentation, and grammatical analysis on the text content in the documents to extract the original text information.
[0079] A semantic segmentation network is used to segment the input document image into regions, and a corresponding semantic label is assigned to each pixel region to identify different logical regions; for example: title region, supplier information region, product list region, amount summary region, etc.; including:
[0080] The document image is input into the visual encoder of the semantic segmentation network to generate a multi-scale visual feature map; character recognition is performed on the same document image, and the recognized text sequence is input into the text encoder to generate text features; at each spatial location of the visual feature map, the co-attention weight between the visual feature map and the text feature is calculated; based on the co-attention weight, the text semantic information is fused into the visual features to generate a text-enhanced visual feature map; multiple feature layers of different depths and resolutions are retained in the text-enhanced visual feature map, and dilated convolutions with different dilation rates are performed on the top-level feature map in parallel, and high-level semantic features are fused with low-level high-resolution features layer by layer to capture contextual information from local details to global layout; Features from multimodal and multi-scale information are upsampled and refined to output the final pixel-level semantic segmentation map. Based on the segmentation results, the position and contour of each semantic region are extracted. The spatial topological relationships between regions are analyzed to construct a layout logic tree. The identified original text information is associated with the corresponding semantic regions according to its spatial coordinates, so that each pixel region is matched with the corresponding semantic label. Prior rules for this type of document are queried from the knowledge graph, and the prior rules are used to perform logical verification on the associated results to verify whether the segmented regions of the document image are compatible with the corresponding semantic labels. For example, if non-numeric text is identified in the unit price column of the product list area, it is marked that there may be a feature recognition error or segmentation error.
[0081] Specifically, at each spatial location of the visual feature map, its co-attention weight with the text features is calculated, including:
[0082] Retrieve each spatial location corresponding to the visual feature map;
[0083] Using spatial location p as the center, extract the window containing spatial location p in the visual feature map according to the 3*3 local window method;
[0084] Extract the feature vectors corresponding to all spatial locations within the window;
[0085] The spatial aggregation factor corresponding to spatial location p is obtained by using the feature vectors of all locations within the window corresponding to spatial location p.
[0086] The spatial clustering factor corresponding to the spatial location p is obtained by the following formula:
[0087]
[0088] Where S represents the spatial aggregation factor corresponding to spatial location p; n represents the number of all location points within the window corresponding to spatial location p; v p The feature vector corresponding to spatial location p; v pi This represents the feature vector corresponding to the i-th spatial location point within the window corresponding to spatial location p;
[0089] The co-attention weights of each spatial location and text feature in the visual feature map are obtained by using the text features corresponding to the same document image to which the visual feature map belongs and the spatial clustering factor corresponding to the spatial location p.
[0090] The above technical solution effectively addresses the technical pain points of insufficient local contextual information of visual features and inaccurate semantic association between visual and text in traditional co-attention computation through the innovative design of "3×3 local window spatial feature aggregation + visual-text semantic fusion". It achieves multi-dimensional performance optimization: on the one hand, by fusing target location and neighborhood features through spatial aggregation factors, the local structural semantics and anti-interference ability of visual features are strengthened, making up for the information defects of single-location features and making the visual expression richer and more stable; on the other hand, by accurately fusing enhanced visual features and text features, the cross-modal semantic gap is narrowed, and a refined weight allocation that takes into account both the rationality of spatial structure and semantic relevance is achieved, which is more in line with the structural characteristics of document image table layout, field association, etc. Ultimately, it significantly improves the accuracy and anti-interference ability of core tasks such as document information extraction and table structure recognition, while enhancing the model's generalization adaptability to different types of documents, providing key technical support for the performance upgrade of document intelligent processing systems, and comprehensively optimizing the quality and efficiency of cross-modal attention guidance.
[0091] Specifically, the co-attention weights between each spatial location and the text feature of the visual feature map are obtained by using the text feature corresponding to the same document image to which the visual feature map belongs and the spatial clustering factor corresponding to the spatial location p. This includes:
[0092] Retrieve the text features corresponding to the same document image belonging to the same visual feature map;
[0093] Obtain the Euclidean norm of the text feature corresponding to the text feature vector;
[0094] Retrieve the feature vector corresponding to spatial location p, and obtain its corresponding Euclidean norm based on the feature vector corresponding to spatial location p;
[0095] The basic correlation parameters between the text features and the spatial location p are obtained by performing correlation processing using the Euclidean norm corresponding to the text features and the Euclidean norm of the feature vector corresponding to the spatial location p.
[0096] The basic correlation parameter between the text features and the spatial location p is obtained by the following formula:
[0097]
[0098] Where R represents the basic correlation parameter between text features and spatial location p; The Euclidean norm corresponding to the eigenvector of spatial location p; The Euclidean norm representing the text feature;
[0099] Retrieve the spatial aggregation factor corresponding to spatial location p;
[0100] The co-attention weights of each spatial location and text feature in the visual feature map are obtained by combining the spatial clustering factor corresponding to the spatial location p with the basic correlation parameters between the text feature and the spatial location p.
[0101] The co-attention weights between each spatial location of the visual feature map and the text features are obtained using the following formula:
[0102]
[0103] Where W represents the co-attention weight between each spatial location of the visual feature map and the text feature; R represents the basic correlation parameter between the text feature and the spatial location p; and S represents the spatial clustering factor corresponding to the spatial location p.
[0104] The aforementioned technical solution addresses the shortcomings of traditional methods in calculating cross-modal co-attention weights for document images, which are susceptible to interference from feature scale differences and lack consideration for both semantic relevance and spatial structure rationality. Through an innovative design combining "Euclidean norm correlation modeling + spatial aggregation factor fusion," it achieves multi-dimensional performance optimization: Firstly, by calculating the Euclidean norm of both the text feature vector and the visual spatial location feature vector p, and obtaining the basic correlation parameter R based on this norm, it effectively normalizes the scale differences in amplitude and dimension of different modal features, avoiding misjudgments of correlation caused by inconsistent feature numerical ranges. This makes the semantic association measurement between text and visual location more fair and accurate, laying a reliable foundation for weight calculation. Secondly, by combining the spatial aggregation factor S, which characterizes the integrity and anti-interference ability of the local visual structure, with the basic correlation parameter R, and through weight... Formula W integrates to form the final co-attention weights, ensuring that the weight allocation fully reflects the semantic relevance between text and visual location, while also deeply integrating structural association information from the local visual neighborhood. This addresses the shortcomings of traditional weight calculations that only consider semantic similarity and ignore the rationality of visual spatial structure. It is more in line with the scenario characteristics of strong binding between text fields and corresponding visual regions (such as table cells and numerical regions) in document images. Ultimately, it significantly improves the accuracy and reliability of cross-modal co-attention weights for document images, effectively enhancing robustness to interference factors such as scanning noise, feature scale differences, and local distortion. This enables the model to more accurately focus on key related information and weaken interference from irrelevant regions in core tasks such as document information extraction, table structure recognition, and field-visual region matching. At the same time, it enhances the generalization and adaptation capabilities to different types of documents, comprehensively optimizing the cross-modal fusion quality and core task performance of the intelligent document processing system.
[0105] Based on the segmentation results, the location and outline of each semantic region are extracted, and the identified original text information is associated with the corresponding semantic region; for example, if the text located in the product list area is identified, it can be determined to be product information. Semantic analysis models are used to perform semantic recognition and classification on the original text information to generate structured semantic data.
[0106] Structured semantic data is semantically fused with a pre-built knowledge graph, whose data sources include big data resource services and enterprise internal databases. Based on the fused semantic information, multiple candidate document templates are matched from a pre-set template database using a decision tree model.
[0107] The beneficial effects achieved by the above are as follows: Through semantic segmentation networks and multimodal feature fusion technology, different logical regions in documents can be accurately identified, and textual information can be accurately associated with the corresponding semantic regions; based on deep semantic matching and knowledge graph association query, the accuracy of template matching is further improved, ensuring the correct filling of document information; through the parallel processing mechanism of multi-core central processing units, a large number of documents can be processed efficiently, significantly improving processing speed and efficiency; combined with task priority evaluation mechanism and elastic expansion function, the rapid processing of high-priority documents is further ensured.
[0108] When a new document is input, the template matching task is decomposed into feature extraction, decision tree initial screening, deep semantic matching, knowledge graph association query, and result fusion and sorting based on a multi-core CPU. This process is then distributed across different core clusters for parallel processing to determine the corresponding document template. This includes:
[0109] New document data is preloaded into the processing path, and the running status of all core clusters in the multi-core CPU is retrieved. Using a predictive model, the execution time of tasks is predicted based on the document type and complexity, allowing for advance task allocation and resource scheduling to further optimize the processing flow. The preloaded document data is divided into micro-batches, and tasks are dynamically allocated based on the current load of each core cluster, ensuring load balancing across core clusters and improving overall system efficiency. Completed task results are collected from each core cluster, and weighted semantic fusion and sorting are performed on all parallel task results for the same document to generate a final candidate template list. The final matching result is output, and the processing timestamp, cache hit rate, and core load of each document are recorded for subsequent analysis and optimization. For example, while one document is undergoing deep semantic matching, another document can simultaneously undergo decision tree initial screening, with core A responsible for feature extraction, core B for deep semantic matching, and core C for knowledge graph association query.
[0110] Based on the matching results, the system automatically switches to the corresponding document template and fills the key information from the document into the appropriate positions in the template; it obtains feedback information on the matching results, introduces timestamps to manage the matching accuracy of each template, and optimizes the knowledge graph and template database based on the feedback information and matching accuracy; including:
[0111] Continuously collect user feedback. If a user manually corrects or rejects the template matching result, the system automatically records the correction details, such as field mapping adjustments, template replacements, and correction timestamps. The original template is categorized as a negative sample (e.g., incorrect match) or a positive sample (e.g., a correct match requiring fine-tuning). The system periodically calculates the matching accuracy of each template version, such as the correction rate of the most recent 100 matches. If the accuracy falls below a threshold (e.g., 85%), or if a business rule change is detected (e.g., a tax policy update), a new version is automatically created. This includes:
[0112] A template version evolution graph is established, recording the validity period, changes, and performance metrics of each version. When a significant change in business rules is detected, a new template version is automatically created while maintaining historical compatibility with older versions. During the matching process, the date range of the documents to be processed is obtained, and the corresponding template version for that time period is automatically associated based on the date range, avoiding errors caused by policy retrospectives. For example, when processing a historical document from 2022, the system will automatically match the old template that was valid in 2022, rather than the current latest template, to address compatibility issues in historical data processing and ensure that historical documents can accurately match the templates used at that time, improving the system's flexibility and usability. Based on user feedback, a template quality evaluation system is established, automatically downgrading or archiving low-quality templates. Through a continuous learning mechanism, verified matching results are used as new samples and fed back into the training process. New versions learn and optimize from the knowledge graph using knowledge fusion technology, adapting to new business rules or format changes.
[0113] Establish a task priority assessment mechanism to set processing priorities based on the urgency of documents and customer level; allocate dedicated computing resources to high-priority documents to ensure that their processing latency is minimized; monitor the task queue depth and response time of each core cluster in real time, and automatically initiate elastic expansion when task backlog is detected to dynamically migrate tasks to idle cores; establish a processing timeout warning mechanism to isolate and recover abnormal tasks.
[0114] A hotspot template prediction model is established. Based on historical processing records with timestamps, high-frequency matching templates in specific time periods or for specific customers are identified as hotspot templates. The vectorized representations of the identified hotspot templates and related knowledge graph subgraphs are preloaded into the shared cache of a multi-core CPU. When performing deep semantic matching and knowledge graph association queries, the search and matching are prioritized in the shared cache. If the cache is hit, the corresponding task is routed to a dedicated core for accelerated processing. If the cache is not hit, the process returns to the normal processing flow, and the miss information is recorded for model optimization.
[0115] A cross-language semantic mapping layer is constructed to perform unified semantic encoding on the content of multilingual documents. When non-subject language text is identified, an intelligent translation mechanism is activated to prioritize rule-based translation for professional terms and deep learning translation for general text. The translation results are semantically fused with the original text to generate a semantic vector representation. Based on this semantic vector, cross-language entity linking and relationship mapping are performed in the knowledge graph to support template matching for multilingual documents.
[0116] In one embodiment, assuming the background is: processing an electronic invoice from a top-tier hospital that contains mixed Chinese and English terminology, such as "CT Examination Fee," the implementation steps include:
[0117] Using a multimodal semantic segmentation network, the invoice is segmented into areas such as patient information, chargeable items, and medical insurance code, and associated with feature recognition text. A cross-language semantic mapping layer is activated to map CTExaminationFee to the standard field of image examination fee in the knowledge graph. The medical industry knowledge graph is combined to match the new version of the medical invoice template in 20XX, such as version 4.1, and the item code, unit price, and medical insurance settlement ratio are automatically filled in. However, if a logical conflict is detected between examination fee and drug fee, such as both being selected but without an associated medical order, manual review is triggered, and the correction is recorded and updated to version 4.2.
[0118] The beneficial effects achieved by the above content are as follows: Through user feedback and matching accuracy optimization mechanisms, the knowledge graph and template database can be dynamically adjusted, and new version templates can be automatically created to adapt to changes in business rules; combined with hotspot template prediction, the response speed and processing efficiency of the method are further improved; based on the timeliness matching mechanism and template version management, it is ensured that historical documents can accurately match the template version at that time, solving the problem of historical data processing caused by policy or format changes, and improving the flexibility and practicality of the method.
[0119] Working principle: This system collects document samples through big data, uses a semantic segmentation network for region segmentation and logical region identification, generates structured semantic data using a semantic analysis model, and integrates it with a knowledge graph. It then processes template matching tasks in parallel using a multi-core CPU, automatically switching templates and populating key information. Based on feedback, it optimizes the knowledge graph and template database, managing template versions to maintain historical compatibility. Real-time monitoring and optimization of task scheduling, along with preloading of frequently used templates, improves processing speed. This not only enhances the efficiency and accuracy of document processing but also strengthens the adaptability and flexibility of the method, meeting the needs of enterprises for high-performance document processing systems.
[0120] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0121] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for intelligent matching and quick switching of multi-dimensional document templates, characterized in that, Includes the following steps: We utilize big data resources to collect various document samples, and use character recognition technology to perform character recognition, word segmentation, and grammatical analysis on the text content in the documents to extract the original text information. A semantic segmentation network is used to segment the input document image into regions, and a corresponding semantic label is assigned to each pixel region to identify different logical regions; including: The document image is input into the visual encoder of the semantic segmentation network to generate a multi-scale visual feature map; Character recognition is performed on the same document image, and the recognized text sequence is input into a text encoder to generate text features; At each spatial location of the visual feature map, calculate its co-attention weight with the text features; Based on the common attention weights, the semantic information of the text is fused into the visual features to generate a text-enhanced visual feature map; Multiple feature layers of different depths and resolutions are preserved in the visual feature map of text enhancement. The top feature map is subjected to dilated convolution with different dilation rates in parallel. The high-level semantic features are fused with the low-level high-resolution features layer by layer to capture contextual information from local details to global layout. The features that integrate multimodal and multiscale information are upsampled and refined to output the final pixel-level semantic segmentation map; Based on the segmentation results, the location and outline of each semantic region are extracted; the spatial topological relationship between regions is analyzed, and a layout logic tree is constructed. The identified raw text information is associated with the corresponding semantic region based on its spatial coordinates, so that each pixel region is matched with the corresponding semantic tag; The prior rules for this type of document are retrieved from the knowledge graph. The prior rules are then used to perform logical verification on the associated results to verify whether the segmented regions of the document image match the corresponding semantic tags. Based on the segmentation results, the location and contour of each semantic region are extracted, and the identified original text information is associated with the corresponding semantic region; Semantic analysis models are used to perform semantic recognition and classification on raw text information to generate structured semantic data; Structured semantic data is semantically fused with a pre-built knowledge graph. Based on the fused semantic information, multiple candidate document templates are matched from a pre-set template database using a decision tree model. When a new document is input, the template matching task is decomposed into feature extraction, decision tree screening, deep semantic matching, knowledge graph association query, and result fusion and sorting based on a multi-core central processing unit; and then distributed to different core clusters for parallel processing to determine the corresponding document template. Based on the matching results, automatically switch to the corresponding document template and fill the key information from the document into the corresponding positions in the template; Obtain feedback information on matching results, introduce timestamps to manage the matching accuracy of each template, and optimize the knowledge graph and template database based on the feedback information and matching accuracy.
2. The method for intelligent matching and quick switching of multi-dimensional bill templates according to claim 1, characterized in that, At each spatial location of the visual feature map, its co-attention weight with the text features is calculated, including: Retrieve each spatial location corresponding to the visual feature map; Using spatial location p as the center, extract the window containing spatial location p in the visual feature map according to the 3*3 local window method; Extract the feature vectors corresponding to all spatial locations within the window; acquire the spatial aggregation factor corresponding to the spatial position p by using the feature vectors of all positions in the window corresponding to the spatial position p; acquire the co-attention weight between each spatial position of the visual feature map and the text feature by using the text feature corresponding to the same invoice image of the visual feature map and the spatial aggregation factor corresponding to the spatial position p.
3. The method for intelligent matching and quick switching of multi-dimensional bill templates according to claim 2, characterized in that, acquire the co-attention weight between each spatial position of the visual feature map and the text feature by using the text feature corresponding to the same invoice image of the visual feature map and the spatial aggregation factor corresponding to the spatial position p, including: acquire the text feature corresponding to the same invoice image of the visual feature map; acquire the Euclidean norm corresponding to the text feature by using the text feature vector corresponding to the text feature; acquire the feature vector corresponding to the spatial position p, and acquire the Euclidean norm corresponding to the feature vector according to the feature vector corresponding to the spatial position p; acquire the basic correlation parameter between the text feature and the spatial position p by using the Euclidean norm corresponding to the text feature and the Euclidean norm of the feature vector corresponding to the spatial position p for correlation processing; acquire the spatial aggregation factor corresponding to the spatial position p; acquire the co-attention weight between each spatial position of the visual feature map and the text feature by using the spatial aggregation factor corresponding to the spatial position p and the basic correlation parameter between the text feature and the spatial position p.
4. The method for intelligent matching and quick switching of multi-dimensional bill templates according to claim 1, characterized in that, based on the multi-core central processing unit, the template matching task is decomposed into feature extraction, decision tree preliminary screening, deep semantic matching, knowledge graph association query and result fusion and sorting, including: preloading new invoice data into the to-be-processed path, and acquiring the running state of all core clusters in the multi-core central processing unit; predicting the execution time of the task according to the type and complexity of the invoice by using the prediction model, and performing task allocation and resource scheduling in advance; dividing the preloaded invoice data into micro-batches, dynamically allocating tasks according to the current load of each core cluster, and allocating corresponding tasks to each core cluster; collecting the completed task results from each core cluster, performing weighted semantic fusion and sorting on all parallel task results of the same invoice, and generating a final candidate template list; outputting the final matching result, and recording the processing timestamp, cache hit rate and core load of each invoice for subsequent analysis and optimization.
5. The method for intelligent matching and quick switching of multi-dimensional bill templates according to claim 1, characterized in that, according to the feedback information and the matching accuracy, optimizing the knowledge graph and the template database, including: continuously collecting user feedback information, if the user manually corrects or rejects the template matching result, then automatically recording the correction content and the correction timestamp, and classifying the original template as a negative sample or a positive sample; periodically calculating the matching accuracy of each version of the template, if the accuracy is lower than the threshold or a business rule change is detected, then automatically triggering the creation of a new version; the new version learns and optimizes from the knowledge graph through knowledge fusion technology, and adapts to new business rules or format changes.
6. The method for intelligent matching and quick switching of multi-dimensional bill templates according to claim 5, characterized in that, if the accuracy is lower than the threshold or a business rule change is detected, then automatically triggering the creation of a new version, including: establishing a template version evolution graph to record the valid period, change content and performance indicators of each version of the template; when a major change in the business rule is detected, automatically creating a new version of the template and maintaining the historical compatibility of the old version; In the matching process, the date range of the document to be processed is obtained, and the corresponding template version of the time period is automatically associated according to the date range, so as to avoid errors caused by policy retroactive; Based on user feedback, a template quality evaluation system is established to automatically reduce the weight or archive low-quality templates; Through a continuous learning mechanism, correct matching results are used as new samples and fed back to the training process.
7. The method for intelligent matching and quick switching of multi-dimensional bill templates according to claim 1, characterized in that, Further comprising the following steps: Establish a task priority evaluation mechanism to set processing priorities according to the urgency of the document and the customer level; Allocate exclusive computing resources for high-priority documents to minimize processing delays; Real-time monitoring of task queue depth and response time of each core cluster, automatic elastic expansion when detecting task accumulation, and dynamic migration of tasks to idle cores; Establish a processing timeout warning mechanism to isolate and recover abnormal tasks.
8. The method for intelligent matching and quick switching of multi-dimensional bill templates according to claim 1, characterized in that, Further comprising the following steps: Establish a hot template prediction model to identify high-frequency matching templates in a specific time period or specific customer based on historical processing records with timestamps; Vectorize the identified hot templates and related knowledge graph subgraphs and preload them into the shared cache of the multi-core central processing unit; When performing deep semantic matching and knowledge graph association queries, preferentially search and match in the shared cache; If the cache hits, route the corresponding task to a dedicated core for accelerated processing; If the cache misses, enter the regular processing flow and record the miss information for model optimization.
9. The method for intelligent matching and quick switching of multi-dimensional bill templates according to claim 8, characterized in that, Further comprising the following steps: Build a cross-language semantic mapping layer to uniformly encode multi-language document content; When non-main language text is identified, an intelligent translation mechanism is started to preferentially use rule-based translation for professional terms and deep learning translation for general text; Fuse the translation results with the original text to generate a semantic vector representation; Based on the semantic vector, perform cross-language entity linking and relationship mapping in the knowledge graph to support multi-language document template matching.
Citation Information
Patent Citations
Image report generation method, system and equipment based on multi-granularity knowledge fusion
CN119851852A
Semi-structured file processing method based on LLMs large language model
CN120218236A