A method and system for contract detail extraction and classification

CN121435939BActive Publication Date: 2026-08-28CHINA DATANG GRP DIGITAL TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511370039.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-24
Publication Date
2026-08-28
Estimated Expiration
2045-09-24

AI Technical Summary

Technical Problem

这类方案虽然在一定程度上提升了处理速度,但其自身的技术局限性导致了新的瓶颈:1)扩展性差,规则引擎高度依赖固定的合同模板,对于格式复杂多变的合同则难以覆盖,无法满足业务的灵活扩展需求;2)维护成本高,业务中每增加一个新的商品类别或合同条款,就需要工程师重新编写和调试匹配规则,耗费大量人力和时间;3)性能与合规性不足,在面临大规模、高并发的合同处理请求时,其处理性能和数据提取的准确率均会显著下滑,难以满足企业级的合规与审计要求

Benefits of technology

[0018] By employing the contract detail extraction and classification scheme provided above, this embodiment of the application significantly reduces the burden of manual data entry and identification by automatically receiving, parsing, and accurately extracting detailed tables from contracts. Next, intelligent identification and merging are performed to address table splitting issues caused by pagination, ensuring data integrity and continuity and preventing information omissions. Subsequently, the system can automatically split complex tables with internal classifications into clearly structured independent sub-tables, effectively solving the structured problem of "tables within tables," making data easier to manage and analyze. More importantly, by accurately classifying detailed data into tax categories, the accuracy and standardization of financial data are ensured, providing a solid foundation for subsequent tax accounting. Finally, the customizable spreadsheet file generated based on the classification results not only provides a highly flexible data output format to meet users' personalized needs but also facilitates direct subsequent financial operations and audits, thereby comprehensively improving the efficiency, accuracy, and practicality of contract data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121435939B_ABST
    Figure CN121435939B_ABST
Patent Text Reader

Abstract

The application discloses a contract detail extraction and classification method and system, and the method comprises the following steps: receiving and analyzing a contract file to locate and extract a detail table containing preset characteristic fields; identifying and merging the detail table split due to pagination to form a complete table; splitting the merged detail table containing a category row with a specific identifier into multiple independent sub-tables which inherit the column structure of the original table; classifying the detail data in the sub-tables according to tax categories; and generating an electronic spreadsheet file containing self-defined fields based on the classification results. According to the scheme, the table splitting problem caused by pagination can be intelligently identified and merged, the data integrity and continuity are ensured, and information omission is avoided. The complex table with internal classification can be automatically split into independent sub-tables with clear structure, the structured problem of a table in a table is effectively solved, and the data is easier to manage and analyze subsequently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application generally relates to the field of contract data processing technology. More specifically, this application relates to a method and system for extracting and classifying contract details. Background Technology

[0002] In the wave of enterprise digital transformation, contracts, as core business documents, require crucial data management. However, current contract data processing primarily falls into two categories:

[0003] The first method is the traditional, purely manual processing model. Operators manually extract key information from various contracts (such as Word documents) and input it into spreadsheets (such as Excel) for classification and management. This method has obvious bottlenecks: 1) Low efficiency: processing a single contract often takes a long time, and errors and misalignments are easily caused during format conversion; 2) Low accuracy: prolonged repetitive manual operations can lead to operator fatigue, resulting in a high error rate; 3) Hinders development: the aforementioned inefficiency and high error rate severely hinder the progress of enterprise contract management digitization.

[0004] The second type is a solution that employs preliminary automation technologies, such as regular expression-based rule engines. While these solutions improve processing speed to some extent, their inherent technical limitations lead to new bottlenecks: 1) Poor scalability: rule engines heavily rely on fixed contract templates, making it difficult to cover contracts with complex and varied formats, and thus unable to meet the flexible expansion needs of the business; 2) High maintenance costs: each new product category or contract clause added to the business requires engineers to rewrite and debug the matching rules, consuming significant manpower and time; 3) Insufficient performance and compliance: when faced with large-scale, high-concurrency contract processing requests, both processing performance and data extraction accuracy decline significantly, making it difficult to meet enterprise-level compliance and auditing requirements.

[0005] In view of this, there is an urgent need to provide a solution for extracting and classifying contract details in order to break through the dual limitations of existing contract data processing technology in terms of efficiency and accuracy, and to achieve large-scale, efficient and high-precision automated processing of various complex contracts. Summary of the Invention

[0006] In order to at least solve one or more of the technical problems mentioned above, this application proposes a scheme for extracting and classifying contract details in several aspects.

[0007] In a first aspect, this application provides a method for extracting and classifying contract details, comprising: receiving and parsing a contract document to locate and extract a detail table containing preset feature fields; identifying and merging the detail table that has been split due to pagination to form a complete table; splitting the merged detail table containing category rows with specific identifiers into multiple independent sub-tables that inherit the column structure of the original table; and classifying the detail data in the sub-tables by tax category.

[0008] Generate a spreadsheet file containing custom fields based on the classification results.

[0009] In some embodiments, during the parsing of the contract document, the following steps are performed: identifying and recording the physical location of all tables in the received contract document, wherein the physical location includes page numbers and paragraphs; traversing all tables based on the recorded physical location to determine whether each table contains a preset feature field; in response to a table not containing a preset feature field, not processing the table; in response to a table containing a preset feature field, extracting it as a detail table.

[0010] In some embodiments, during the process of identifying and merging the detail tables that have been split due to pagination, the following steps are performed: determining whether the first row and first column of each detail table are empty or have no header information; in response to the first row and first column of the corresponding detail table not being empty and having header information, not processing it; in response to the first row and first column of the corresponding detail table being empty or having no header information, determining that the detail table is a pagination continuation of the previous table, and merging the data rows of the detail table upwards to the end of the previous table.

[0011] In some embodiments, after merging the corresponding detail table data rows upwards to the end of the previous table, the following steps are performed: check the consistency of column widths of all data columns in the merged complete table, and adjust the column widths of all data columns in the merged complete table to be consistent.

[0012] In some embodiments, the specific identifier is a Chinese numeral; in the process of splitting the merged detail table containing the category row with the specific identifier into multiple independent sub-tables that inherit the column structure of the original table, the following steps are performed: by detecting the category row containing the Chinese numeral as the split point, the corresponding merged detail table is split; the splitting result is reorganized into multiple independent sub-tables, and the table header of the corresponding detail table before splitting is copied to each sub-table, so that each sub-table inherits the column structure of the corresponding detail table before splitting.

[0013] In some embodiments, during the classification of detailed data in the sub-table, the following steps are performed: preloading the detailed data in the sub-table into a cache; concurrently traversing all detailed data in the cache and attempting to acquire the processing lock corresponding to each piece of detailed data, and determining whether the processing lock is successfully acquired; in response to the failure to acquire the processing lock, waiting and retrying according to a preset retry mechanism; in response to the successful acquisition of the processing lock, asynchronously matching the corresponding detailed data for tax categories by dynamically scheduling the large language model engine and combining it with preset prompt word engineering templates.

[0014] In some embodiments, after asynchronous tax category matching of the detail names in the cache, the following steps are performed: the detail names in the cache are matched again by dynamically scheduling the large language model engine and combining it with a preset category feature library; it is determined whether the result of the rematching process is consistent with the result of the asynchronous tax category matching; in response to the result of the rematching process being consistent with the result of the asynchronous tax category matching, the result of the asynchronous tax category matching is written back to the cache and the processing lock is released; in response to the result of the rematching process being inconsistent with the result of the asynchronous tax category matching, asynchronous tax category matching is performed again.

[0015] In some embodiments, during the process of generating a spreadsheet file containing custom fields based on the classification results, the following steps are performed: obtaining the user-configured custom field mapping relationship; integrating the detailed data after classification processing according to the custom field mapping relationship; and generating a spreadsheet file based on the integration result.

[0016] In some embodiments, after generating the spreadsheet file, at least one of the following steps is performed: configuring the tax category column in the spreadsheet file to include drop-down selection controls for multiple preset tax categories; establishing a linkage mechanism between the tax categories and their corresponding tax rates, so that when a specific tax category is selected through the drop-down selection controls, the corresponding tax rate is automatically updated; setting a modification monitoring mechanism for the tax rate cells in the spreadsheet file; configuring price recalculation logic, so that when the value of the tax rate cell changes, price recalculation is automatically triggered and the corresponding tax-inclusive and tax-exclusive price fields in the spreadsheet file are updated synchronously; and locking the cells in the spreadsheet file containing calculation formulas to prevent unauthorized modification.

[0017] In a second aspect, this application provides a system for extracting and classifying contract details, employing the method for extracting and classifying contract details as described in any embodiment of the first aspect. The system includes: a detail table extraction module for receiving and parsing contract documents to locate and extract detail tables containing preset feature fields; a detail table completion module for identifying and merging detail tables split due to pagination to form a complete table; a detail table splitting module for splitting the merged detail table containing category rows with specific identifiers into multiple independent sub-tables that inherit the column structure of the original table; a detail data classification module for classifying the detail data in the sub-tables according to tax categories; and a table file generation module for generating an electronic spreadsheet file containing custom fields based on the classification results.

[0018] By employing the contract detail extraction and classification scheme provided above, this embodiment of the application significantly reduces the burden of manual data entry and identification by automatically receiving, parsing, and accurately extracting detailed tables from contracts. Next, intelligent identification and merging are performed to address table splitting issues caused by pagination, ensuring data integrity and continuity and preventing information omissions. Subsequently, the system can automatically split complex tables with internal classifications into clearly structured independent sub-tables, effectively solving the structured problem of "tables within tables," making data easier to manage and analyze. More importantly, by accurately classifying detailed data into tax categories, the accuracy and standardization of financial data are ensured, providing a solid foundation for subsequent tax accounting. Finally, the customizable spreadsheet file generated based on the classification results not only provides a highly flexible data output format to meet users' personalized needs but also facilitates direct subsequent financial operations and audits, thereby comprehensively improving the efficiency, accuracy, and practicality of contract data processing.

[0019] Furthermore, in some embodiments, by using a simple and efficient heuristic rule—determining the presence of header information—the system can intelligently identify the continuation of a table and seamlessly merge it with the main table. This not only perfectly solves the problem of data fragmentation due to pagination and ensures the integrity of the logical table, but also avoids the risk of incorrectly splicing different tables. Based on this, by checking and uniformly adjusting the column widths of the merged table, this method further solves the problem of inconsistent column widths or data misalignment caused by page breaks or parsing errors. These two steps work together to ensure that the table data extracted from the original document is not only complete in content but also structurally regular and uniform, providing high-quality and reliable input for subsequent data processing and analysis, significantly improving the accuracy and robustness of the entire automated extraction process.

[0020] Furthermore, in some embodiments, firstly, by preloading detailed data into the cache and combining concurrent traversal with independent processing locks, the original serial, time-consuming large model call process is successfully transformed into a highly efficient parallel processing mode, fundamentally solving the performance bottleneck of large-scale data classification and greatly shortening user waiting time. Secondly, it innovatively designs a dual verification process combining initial matching and secondary verification. Initial classification is performed using prompt word engineering templates, achieving fast and broad semantic matching. Secondary verification is then performed using a more accurate category feature library, providing a second layer of assurance for the accuracy of the classification results. Only when the two matching results are consistent is the classification confirmed as valid and resources released; in case of inconsistency, automatic retry is initiated. This rigorous verification and self-correction mechanism ensures the high reliability and consistency of the final output results, thereby achieving an order-of-magnitude improvement in processing speed while also guaranteeing classification accuracy.

[0021] Furthermore, in some embodiments, by supporting user-defined field mapping, the data output is given extremely high flexibility and practicality. Users can generate completely personalized tables according to their own management habits or subsequent system integration needs, eliminating the tedious work of manually adjusting column order or renaming table headers, and achieving seamless integration out of the box. By directly embedding a series of powerful financial auxiliary functions into the final generated Excel file: the drop-down selection of tax categories and the automatic linkage of tax rates greatly improve the efficiency and accuracy of data entry, avoiding input errors and tax rate misuse from the source. Real-time monitoring of tax rate changes and instant price recalculation transform the static data table into a dynamic financial accounting and simulation tool. Users can directly analyze or correct tax rates in the table and immediately obtain accurate tax-inclusive / tax-exclusive price feedback, greatly facilitating financial accounting and decision-making. The automatic locking of key formula cells provides security for all these intelligent functions, effectively preventing damage to the built-in logic due to accidental operation, and ensuring the long-term reliability of the table and the integrity of the data. This not only automates data extraction and organization, but also provides users with a one-stop solution from data acquisition to intelligent application by deeply empowering output files, significantly improving the efficiency, accuracy and convenience of subsequent financial work. Attached Figure Description

[0022] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of this application are illustrated by way of example and not limitation, and the same or corresponding reference numerals denote the same or corresponding parts, wherein:

[0023] Figure 1 An exemplary flowchart of a method for extracting and classifying contract details according to an embodiment of this application is shown;

[0024] Figure 2 An exemplary flowchart illustrating the receipt and parsing of contract documents according to an embodiment of this application is shown;

[0025] Figure 3 An exemplary flowchart illustrating the identification and merging of detail tables split due to pagination, according to an embodiment of this application, is shown.

[0026] Figure 4 An exemplary flowchart illustrating the tax category classification of detailed data in a sub-table according to an embodiment of this application is shown;

[0027] Figure 5 An exemplary structural block diagram of a system for extracting and classifying contract details according to an embodiment of this application is shown. Detailed Implementation

[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0029] It should be understood that the terms "comprising" and "including" used in the specification and claims of this application indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0030] It should also be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this specification and claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this specification and claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations.

[0031] Figure 1 An exemplary flowchart of a method 100 for extracting and classifying contract details according to an embodiment of this application is shown.

[0032] like Figure 1 As shown, in step S110, the contract document is received and parsed to locate and extract the detailed table containing preset feature fields.

[0033] The specific process involved in step S110 in the embodiments of this application can be found in [reference needed]. Figure 2 .

[0034] Figure 2 An exemplary flowchart illustrating the receipt and parsing of contract documents according to an embodiment of this application is shown.

[0035] like Figure 2 As shown, in step S210, the physical location of all tables in the received contract document is identified and recorded. In step S220, all tables are traversed based on the recorded physical locations. In step S230, it is determined whether each table contains a preset feature field. In response to a table not containing a preset feature field, no processing is performed on that table in step S240. In response to a table containing a preset feature field, it is extracted as a detail table in step S250.

[0036] In the embodiments of this application, the contract document may be a .doc format file or a .docx format file, or a file in other formats besides .doc and .docx formats. This application does not impose any restrictions on these formats.

[0037] In embodiments of this application, the aforementioned physical location includes page numbers and paragraphs.

[0038] In the embodiments of this application, the preset feature fields are purchase contract feature fields, including unit price, quantity, specifications, etc., set according to actual needs.

[0039] Based on step S110, by using preset feature fields, the automated and accurate extraction of specific detailed tables from contract documents is achieved. It can automatically filter out useless tables, retaining and extracting only valid tables containing key information. This not only greatly improves the efficiency and accuracy of information extraction, reducing the tedious work and potential errors of manual screening, but also makes subsequent data processing and analysis more convenient and efficient.

[0040] After step S110 is completed, in step S120, the detail tables that were split due to pagination are identified and merged to form a complete table.

[0041] The specific process involved in step S120 in the embodiments of this application can be found in [reference needed]. Figure 3 .

[0042] Figure 3 An exemplary flowchart illustrating the identification and merging of detail tables split due to pagination, according to an embodiment of this application, is shown.

[0043] like Figure 3As shown, in step S310, it is determined whether the first row and first column of each detail table are empty or have no header information. If the first row and first column of the corresponding detail table are not empty and have header information, no processing is performed in step S320. If the first row and first column of the corresponding detail table are empty or have no header information, in step S330, it is determined that the detail table is a pagination continuation of the previous table, and the data rows of the detail table are merged upwards to the end of the previous table. Next, in step S340, it is checked whether the column widths of all data columns in the merged complete table are consistent. If the column widths of all data columns in the merged complete table are consistent, no processing is performed in step S350. If the column widths of all data columns in the merged complete table are inconsistent, in step S360, the column widths of all data columns in the merged complete table are adjusted to be consistent.

[0044] Based on step S120, by intelligently detecting tables without headers and identifying them as page breaks of the previous table, the problem of table fragmentation due to pagination in electronic documents is accurately solved. Its main advantages are: First, it can automatically identify and merge split tables, ensuring data integrity and continuity, and avoiding information loss or misreading. Second, by appending subsequent table data to the previous table, it achieves automated table structure reconstruction, reducing the tediousness and errors of manual splicing. Third, the step of uniformly adjusting column widths after merging ensures that the final output table has a standardized, aesthetically pleasing, and consistent format, greatly improving data usability and the convenience of subsequent processing.

[0045] After step S120 is completed, in step S130, the merged detail table containing category rows with specific identifiers is split into multiple independent sub-tables that inherit the column structure of the original table.

[0046] Because large, detailed tables have already been manually categorized, they still appear as tables from a program's perspective. While such tables are easy for the human eye to understand, they pose a problem for computer programs because they lack a flat data structure, leading to confusion when directly imported into a database or used for data analysis. Therefore, automatically breaking down such large tables with internal classifications into multiple smaller tables with uniform structures makes the data cleaner, more organized, and easier to process.

[0047] In the embodiments of this application, the specific identifier is a Chinese numeral.

[0048] In the embodiment of the present application, during the execution of step S130, firstly, the category lines containing Chinese numerals are detected as split points to split the corresponding merged detailed table. Then, the split result is recombined into a plurality of independent sub-tables, and the table header of the corresponding detailed table before splitting is copied into each sub-table respectively, so that each sub-table inherits the column structure of the corresponding detailed table before splitting.

[0049] In the embodiment of the present application, during the process of detecting category lines containing Chinese numerals, a matching algorithm or the like is used to determine whether the text of the cell in each line contains "yi", "er", "san" and the like.

[0050] In an embodiment of the present application, the detailed table before splitting is as follows:

[0051] Table 1 Detailed table before splitting

[0052]

[0053] Next, each line is scanned line by line to determine whether there is a category line containing Chinese numerals. Specifically, the first line is scanned and does not match. When scanning the second line, it is detected that the first cell contains "yi", and the 2nd line is determined to be a category title. The third and fourth lines are scanned and do not match. When scanning the fifth line, it is detected that the first cell contains "er", and the 5th line is determined to be a category title. Thus, it is clear that the split points are at the 2nd line and the 5th line.

[0054] Then, based on the category title split points found in the previous step, the data of the original table is cut into several segments. The first segment of data is all lines from after the first category title line (the 2nd line) to before the second category title line (the 5th line). In this example, it is the 3rd line and the 4th line. The second segment of data is all lines from after the second category title line (the 5th line) to the end of the table. In this example, it is the 6th line and the 7th line.

[0055] Thereafter, a new empty sub-table (sub-table 1) is created. The table header (the 1st line) of the original table is copied into sub-table 1. The first segment of data (the 3rd and 4th lines) is copied under the table header of sub-table 1. Then another new empty sub-table (sub-table 2) is created. Similarly, the table header of the original table is copied into sub-table 2. The second segment of data (the 6th and 7th lines) is copied under the table header of sub-table 2.

[0056] Finally, each newly generated sub-table is checked. For example, it verifies whether the number of columns (5 columns) of sub-table 1 is the same as that of the original table, and whether the column headers ("Serial Number", "Name of Goods or Services", etc.) are also completely consistent with those of the original table. This is achieved by inheriting the format of the parent table during generation, that is, reusing the header information of the original table. In a more refined implementation, it may also mean that format information such as column widths, cell alignment, and fonts of the sub-table should also be consistent with those of the original table, so as to ensure that the output document is visually neat.

[0057] Through the above process, the original Table 1 is successfully converted into two independent, structured sub-tables, as shown in Table 2 and Table 3.

[0058] Table 2 Split Sub-table 1

[0059]

[0060] Table 3 Split Sub-table 2

[0061]

[0062] Based on step S130, by automatically detecting rows containing Chinese numerals such as "1" and "2" as split points, a large and complex "nested table within a table" is intelligently split into multiple independent sub-tables with complete structures. The core advantages are as follows: First, it accurately identifies the logical categories within the table and performs automatic splitting based on this, which greatly improves the efficiency and accuracy of data processing. Second, by copying the original header for each split sub-table, the method ensures that all sub-tables inherit the complete column structure and data context, guaranteeing the integrity and availability of data. Finally, this processing method enables different types of data originally mixed in a large table to be clearly organized into independent small tables that are easy to understand and use, which greatly optimizes the regularity and readability of data, and lays a solid foundation for subsequent data analysis and application.

[0063] After step S130 is executed, in step S140, tax category classification is performed on the detailed data in the sub-tables.

[0064] In the embodiment of the present application, for the specific process involved in step S140, reference can be made to Figure 4 .

[0065] Figure 4 shows an exemplary flow chart of tax category classification for detailed data in sub-tables according to an embodiment of the present application.

[0066] As shown in Figure 4As shown, in step S410, the detailed data in the sub-table is preloaded into the cache. In step S420, all detailed data in the cache is concurrently traversed, and an attempt is made to acquire the processing lock corresponding to each detailed data, determining whether the processing lock is successfully acquired. In step S430, it is determined whether the processing lock is successfully acquired. In response to the failure to acquire the processing lock, in step S440, waiting and retrying are performed according to the preset retry mechanism. In response to the successful acquisition of the processing lock, in step S450, the corresponding detailed data is asynchronously matched for tax categories by dynamically scheduling the large language model engine and combining it with the preset prompt word engineering template. Next, in step S460, the detailed names in the cache are matched again by dynamically scheduling the large language model engine and combining it with the preset category feature library. In step S470, it is determined whether the result of the rematching process is consistent with the result of the asynchronous tax category matching process. In response to the consistency between the result of the rematching process and the result of the asynchronous tax category matching process, in step S480, the asynchronous tax category matching result is written back to the cache, and the processing lock is released. In response to the inconsistency between the rematch processing result and the asynchronous tax category matching result, return to step S450, that is, perform asynchronous tax category matching again.

[0067] In the embodiments of this application, the prompt word engineering template and category feature library are set according to actual needs and history, and this application does not impose any restrictions.

[0068] A key challenge in intelligent classification of large amounts of detailed data using a large language model is handling latency. If a traditional sequential processing method is used, i.e., calling the model service one by one, the total processing time increases linearly with the number of details. For example, for a contract containing 100 details, assuming a single model call takes 2 seconds, the total processing time would be as long as 200 seconds. Such a long waiting time severely impacts the system's real-time responsiveness and user experience. By concurrently traversing all the detailed data in the cache in step S420, the limitation of sequential execution can be broken, distributing processing requests for all detailed data almost synchronously, fundamentally changing the task execution mode. Furthermore, by acquiring a processing lock for each piece of detailed data in step S420, it is ensured that in a parallel processing environment, each independent piece of detailed data is accessed and operated on by only one processing thread at any given time. This effectively prevents potential problems such as data races, duplicate classifications, or inconsistent states that may result from concurrency, ensuring data processing consistency.

[0069] In the tax processing flow, the highly diverse and non-standardized nature of supplier names in transaction details makes traditional regular expressions or custom keyword matching methods ineffective in covering all situations, thus limiting the accuracy of classification. In step S450, a preliminary asynchronous tax category matching is performed on the detailed data by dynamically scheduling the large language model engine and combining it with preset prompt word engineering templates. This step fully utilizes the powerful natural language understanding capabilities of the large language model, which can go beyond literal text and accurately capture the commercial substance and tax attributes behind various unstructured detailed names, completing the initial intelligent classification. Next, in step S460, the system again dynamically schedules the large language model engine and combines it with a preset, more accurate category feature library to perform secondary matching verification and refinement processing on the cached detailed names. This step is equivalent to an expert review mechanism, further refining the classification results through more targeted feature comparisons, ensuring the accuracy and high reliability of the final tax category matching. By adopting the large language model engine, the matching failure problem caused by the non-standardization of supplier names in traditional methods is overcome.

[0070] Based on step S140, a highly efficient and reliable automated tax category matching process was constructed. Its core advantage lies in its innovative dual-verification and concurrent processing mechanism. First, by introducing concurrent traversal and processing locks, this method can process large amounts of detailed data in parallel, greatly improving processing efficiency and system throughput. Second, it creatively combines prompt word engineering templates (for intelligent semantic matching) and static preset feature libraries (for fast rule matching). This dual-engine verification mode forms a closed-loop quality control and self-correction system by comparing the consistency of the two results. Output is only confirmed when the matching results of the two methods are consistent; otherwise, re-matching is triggered. This design significantly improves the accuracy and reliability of classification, effectively avoids errors and omissions that may occur with a single model, and ultimately achieves automated data processing that is both fast and accurate.

[0071] After step S140 is completed, in step S150, a spreadsheet file containing custom fields is generated based on the classification results.

[0072] In the embodiments of this application, during step S150, firstly, the user-configured custom field mapping relationship is obtained. Next, based on the custom field mapping relationship, the categorized detailed data is integrated. Then, a spreadsheet file is generated based on the integration result.

[0073] In the embodiments of this application, the custom field mapping relationship includes: selecting data columns to be exported from the contract details entries, customizing the display order of the selected data columns, and customizing the display name of the selected data columns.

[0074] Specifically, users may only care about "goods name", "quantity", "unit price" and "tax category", and not about temporary fields in the internal processing. Therefore, users select the corresponding data columns that need to be exported.

[0075] Specifically, users can drag or select the order of exported data columns to suit their review habits or the requirements for subsequent import into other systems.

[0076] Specifically, by customizing the display name of the selected data column, users can make the display name of the selected data column appear as needed. For example, the internal data column name is "product_name", but the user wants it to be displayed as "Product Name" or "Full Product Name" in Excel.

[0077] Based on step S150, a highly flexible and personalized data export function is provided, the core advantage of which lies in giving the user complete control over the definition of the final output format. By allowing users to independently select the data columns to be exported, customize the sorting order, and modify the display names of the columns, it precisely meets the specific needs of different users in different scenarios, whether it is to conform to personal review habits or to seamlessly integrate with other systems with specific format requirements. This user-centered design not only greatly improves the direct usability and readability of the exported files, saving users the tedious steps of manually organizing and modifying the format after acquiring the data, but also significantly enhances the practicality and compatibility of the entire system in terms of data sharing and transfer.

[0078] In the embodiments of this application, after generating the spreadsheet file, the tax category column in the spreadsheet file is configured to include drop-down selection controls for multiple preset tax categories. For example, in each cell of the "Tax Categories" column in Excel, instead of directly displaying text, a drop-down menu is provided. This drop-down menu contains nine preset tax categories (e.g., "Software Services," "Hardware Sales," "Consulting Services," etc.). This prevents users from manually entering typos or non-standard category names.

[0079] In the embodiments of this application, after configuring the tax category column in the spreadsheet file, a linkage mechanism between tax categories and corresponding tax rates is established, so that when a specific tax category is selected through a drop-down selection control, the corresponding tax rate is automatically updated. The system presets logic in the Excel file (usually implemented through Excel data validation and a combination of functions such as VLOOKUP / INDEX+MATCH, or through VBA macros). When a user selects a specific category in the tax category drop-down menu, the tax rate column in the same row (which may be a hidden column or directly displayed in a visible column) is automatically filled with the preset tax rate corresponding to that category. For example, if a user selects "Software Services" in the "Tax Category" column of row A, the system automatically fills the "Tax Rate" column of row A with "6%" according to preset rules (e.g., "Software Services" corresponds to a 6% tax rate). This ensures the accuracy of tax rates, reduces errors from manual queries and data entry, and improves the automation level of tax processing.

[0080] In the embodiments of this application, after establishing a linkage mechanism between tax categories and corresponding tax rates, a modification monitoring mechanism for tax rate cells in an spreadsheet file is set up. Specifically, related cells in the Excel file (such as "tax rate," "price including tax," and "price excluding tax") are set as interrelated formulas. When a user manually modifies the "tax rate" of a specific item, the system will "monitor" this change.

[0081] In the embodiments of this application, after setting up a modification monitoring mechanism for tax rate cells in the spreadsheet file, price recalculation logic is configured. When the value of the tax rate cell changes, price recalculation is automatically triggered, and the corresponding tax-inclusive and tax-exclusive price fields in the spreadsheet file are updated synchronously. Specifically, once a tax rate change is detected, the relevant formulas are automatically recalculated. For example, assuming the original data includes "quantity" and "unit price," the tax-exclusive price = quantity × unit price, and the tax-inclusive price = tax-exclusive price × (1 + tax rate). If a user changes the tax rate of a product from 6% to 9%, the tax-inclusive price of that product will be immediately recalculated and displayed according to the new tax rate. This provides an instant and accurate price calculation function, allowing users to directly perform simulation calculations or corrections in Excel without having to return to the system for reprocessing or manual calculation.

[0082] In the embodiments of this application, after generating the spreadsheet file, cells containing calculation formulas are locked to prevent unauthorized modification. This means that the contents of these cells cannot be directly modified, deleted, or accidentally overwritten by the user, thus protecting the built-in calculation logic and data integrity. Users might accidentally type in content, overwriting formulas, leading to calculation errors or functional malfunctions. By locking these cells, such human errors can be avoided, ensuring the core functionality and data chain of the Excel file remain stable and reliable.

[0083] In summary, by employing the contract detail extraction and classification scheme provided above, this embodiment of the application significantly reduces the burden of manual data entry and identification by automatically receiving, parsing, and accurately extracting detailed tables from contracts. Next, intelligent identification and merging are performed to address table splitting issues caused by pagination, ensuring data integrity and continuity and preventing information omissions. Subsequently, the system can automatically split complex tables with internal classifications into clearly structured independent sub-tables, effectively solving the structured problem of "tables within tables," making data easier to manage and analyze. More importantly, by accurately classifying detailed data into tax categories, the accuracy and standardization of financial data are ensured, providing a solid foundation for subsequent tax accounting. Finally, the customizable spreadsheet file generated based on the classification results not only provides a highly flexible data output format to meet users' personalized needs but also facilitates direct subsequent financial operations and audits, thereby comprehensively improving the efficiency, accuracy, and practicality of contract data processing.

[0084] Furthermore, in some embodiments, by using a simple and efficient heuristic rule—determining the presence of header information—the system can intelligently identify the continuation of a table and seamlessly merge it with the main table. This not only perfectly solves the problem of data fragmentation due to pagination and ensures the integrity of the logical table, but also avoids the risk of incorrectly splicing different tables. Based on this, by checking and uniformly adjusting the column widths of the merged table, this method further solves the problem of inconsistent column widths or data misalignment caused by page breaks or parsing errors. These two steps work together to ensure that the table data extracted from the original document is not only complete in content but also structurally regular and uniform, providing high-quality and reliable input for subsequent data processing and analysis, significantly improving the accuracy and robustness of the entire automated extraction process.

[0085] Furthermore, in some embodiments, firstly, by preloading detailed data into the cache and combining concurrent traversal with independent processing locks, the original serial, time-consuming large model call process is successfully transformed into a highly efficient parallel processing mode, fundamentally solving the performance bottleneck of large-scale data classification and greatly shortening user waiting time. Secondly, it innovatively designs a dual verification process combining initial matching and secondary verification. Initial classification is performed using prompt word engineering templates, achieving fast and broad semantic matching. Secondary verification is then performed using a more accurate category feature library, providing a second layer of assurance for the accuracy of the classification results. Only when the two matching results are consistent is the classification confirmed as valid and resources released; in case of inconsistency, automatic retry is initiated. This rigorous verification and self-correction mechanism ensures the high reliability and consistency of the final output results, thereby achieving an order-of-magnitude improvement in processing speed while also guaranteeing classification accuracy.

[0086] Furthermore, in some embodiments, by supporting user-defined field mapping, the data output is given extremely high flexibility and practicality. Users can generate completely personalized tables according to their own management habits or subsequent system integration needs, eliminating the tedious work of manually adjusting column order or renaming table headers, and achieving seamless integration out of the box. By directly embedding a series of powerful financial auxiliary functions into the final generated Excel file: the drop-down selection of tax categories and the automatic linkage of tax rates greatly improve the efficiency and accuracy of data entry, avoiding input errors and tax rate misuse from the source. Real-time monitoring of tax rate changes and instant price recalculation transform the static data table into a dynamic financial accounting and simulation tool. Users can directly analyze or correct tax rates in the table and immediately obtain accurate tax-inclusive / tax-exclusive price feedback, greatly facilitating financial accounting and decision-making. The automatic locking of key formula cells provides security for all these intelligent functions, effectively preventing damage to the built-in logic due to accidental operation, and ensuring the long-term reliability of the table and the integrity of the data. This not only automates data extraction and organization, but also provides users with a one-stop solution from data acquisition to intelligent application by deeply empowering output files, significantly improving the efficiency, accuracy and convenience of subsequent financial work.

[0087] This application also provides a system for extracting and classifying contract details. The system can use the aforementioned method 100 for extracting and classifying contract details, or it can use other methods for extracting and classifying contract details. This application does not impose any restrictions on this method.

[0088] Figure 5 An exemplary structural block diagram of a system for extracting and classifying contract details according to an embodiment of this application is shown.

[0089] like Figure 5 As shown, the system 500 includes a detail table extraction module 510, a detail table completion module 520, a detail table splitting module 530, a detail data classification module 540, and a table file generation module 550. In the embodiments of this application, the detail table extraction module 510, the detail table completion module 520, the detail table splitting module 530, the detail data classification module 540, and the table file generation module 550 can be separate units or integrated into the same controller; this application does not impose any restrictions here.

[0090] Specifically, the detailed table extraction module 510 is used to acquire electricity market data including historical electricity prices and exogenous variable characteristics, and to perform data preprocessing.

[0091] Specifically, the detail table completion module 520 is used to identify and merge detail tables that have been split due to pagination to form a complete table.

[0092] Specifically, the detail table splitting module 530 is used to split the merged detail table containing category rows with specific identifiers into multiple independent sub-tables that inherit the column structure of the original table.

[0093] Specifically, the detailed data classification module 540 is used to classify the detailed data in the sub-table into tax categories.

[0094] Specifically, the spreadsheet file generation module 550 is used to generate spreadsheet files containing custom fields based on the classification results.

[0095] When system 500 uses the aforementioned method 100 for extracting and classifying contract details, the aforementioned steps S110 are executed through the detail table extraction module 510, S120 through the detail table completion module 520, S130 through the detail table splitting module 530, S140 through the detail data classification module 540, and S150 through the table file generation module 550. The specific execution process can be found above and will not be repeated here.

[0096] While numerous embodiments of this application have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will arise for those skilled in the art without departing from the spirit and intent of this application. It should be understood that various alternatives to the embodiments of this application described herein may be employed in the practice of this application. The appended claims are intended to define the scope of protection of this application and therefore cover equivalents or alternatives within the scope of these claims.

Claims

1. A method for extracting and classifying contract details, characterized in that, include: Receive and parse the contract documents to locate and extract the detailed table containing preset feature fields; The detailed tables that have been split due to pagination are identified and merged to form a complete table; The merged detail table containing category rows with specific identifiers is split into multiple independent sub-tables that inherit the column structure of the original table; The detailed data in the sub-tables are categorized by tax type. Generate a spreadsheet file containing custom fields based on the classification results; The specific identifier is a Chinese numeral; In the process of splitting the merged detail table containing category rows with specific identifiers into multiple independent sub-tables that inherit the column structure of the original table, the following steps are performed: The corresponding merged detail table is divided by detecting the category rows containing Chinese characters and numbers as the dividing points; The splitting results are reorganized into multiple independent sub-tables, and the headers of the corresponding detail tables before splitting are copied to each sub-table, so that each sub-table inherits the column structure of the corresponding detail tables before splitting. During the process of classifying the detailed data in the sub-table, the following steps are performed: Preload the detailed data from the sub-table into the cache; Concurrently traverse all detailed data in the cache and attempt to acquire the processing lock corresponding to each detailed data, and determine whether the processing lock was successfully acquired; In response to the failure to acquire the lock, wait and retry according to the preset retry mechanism; In response to successful lock acquisition, the system dynamically schedules the large language model engine and combines it with preset prompt word engineering templates to perform asynchronous tax category matching on the corresponding detailed data. After asynchronously matching the tax categories of the detailed names in the cache, perform the following steps: The detailed names in the cache are matched again by dynamically scheduling the large language model engine and combining it with the preset category feature library. Determine whether the result of the rematch processing is consistent with the result of the asynchronous tax category matching; In response to the matching result being consistent with the asynchronous tax category matching result, the asynchronous tax category matching result is written back to the cache, and the processing lock is released; In response to the discrepancy between the result of the rematch and the result of the asynchronous tax category matching, asynchronous tax category matching is performed again.

2. The method for extracting and classifying contract details according to claim 1, characterized in that, During the process of parsing the contract document, the following steps are performed: Identify and record the physical location of all tables in the received contract documents, wherein the physical location includes page numbers and paragraphs; Based on the physical location of the records, all tables are traversed to determine whether each table contains a preset feature field; If the corresponding table does not contain the preset characteristic fields, no processing is performed on the table; If the corresponding table contains preset feature fields, extract it as a detail table.

3. The method for extracting and classifying contract details according to claim 1, characterized in that, In the process of identifying and merging the detail tables that have been split due to pagination, the following steps are performed: Determine whether the first row and first column of each detail table are empty or have no header information; If the first row and first column of the corresponding detail table are not empty and contain header information, no processing is performed on it. If the first row and first column of the corresponding detail table are empty or there is no header information, it is determined that the detail table is a pagination continuation of the previous table, and the data rows of the detail table are merged upwards to the end of the previous table.

4. The method for extracting and classifying contract details according to claim 3, characterized in that, After merging the corresponding detailed table data rows upwards to the end of the previous table, perform the following steps: check the consistency of column widths of all data columns in the merged complete table, and adjust the column widths of all data columns in the merged complete table to be consistent.

5. The method for extracting and classifying contract details according to claim 1, characterized in that, In the process of generating a spreadsheet file containing custom fields based on the classification results, the following steps are performed: Retrieve the user-configured mapping relationship of custom fields; Based on the custom field mapping relationship, the detailed data after classification is integrated; A spreadsheet file is generated based on the integration results.

6. The method for extracting and classifying contract details according to claim 5, characterized in that, After generating the spreadsheet file, perform at least one of the following steps: Configure the tax category column in the spreadsheet file to include drop-down selection controls for multiple preset tax categories; Establish a linkage mechanism between the tax categories and their corresponding tax rates, so that when a specific tax category is selected through the drop-down selection control, the corresponding tax rate is automatically updated; Configure a mechanism to monitor changes to the tax rate cells in the spreadsheet file; Configure price recalculation logic so that when the value of the tax rate cell changes, the price recalculation is automatically triggered and the corresponding tax-inclusive and tax-exclusive price fields in the spreadsheet file are updated synchronously. Lock the cells in the spreadsheet file that contain calculation formulas to prevent unauthorized modification.

7. A system for extracting and classifying contract details, characterized in that, Contract details are extracted and classified using the method for extracting and classifying contract details as described in any one of claims 1-6, wherein the system comprises: The detail table extraction module is used to receive and parse contract documents to locate and extract detail tables containing preset feature fields; The detail table completion module is used to identify and merge the detail tables that have been split due to pagination to form a complete table; The detail table splitting module is used to split the merged detail table containing category rows with specific identifiers into multiple independent sub-tables that inherit the column structure of the original table. The detailed data classification module is used to classify the detailed data in the sub-tables according to tax categories; The spreadsheet file generation module is used to generate spreadsheet files containing custom fields based on the classification results.

Citation Information

Patent Citations

  • Financial document intelligent verification method, device and storage medium

    CN109117479A

  • Government purchase contract PDF document rapid and batch extraction method

    CN116775740A

  • Information extraction method and device, equipment and storage medium

    CN117271627A

  • Method and system for merging and extracting PDF (Portable Document Format) file cross-page tables based on logistic regression

    CN119206750A