Business document field extraction and form filling method and device
By parsing and structuring multi-format source documents, and combining field rule cards and validation rules, contract fields are automatically extracted and populated, solving the problem of low efficiency in contract creation in enterprise business scenarios and achieving full-process automation and standardization.
Patent Information
- Application Number
- CN202611382140.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-07
- Publication Date
- 2026-11-20
AI Technical Summary
In existing enterprise business scenarios, the contract creation process requires manual extraction of key fields from multiple sources of unstructured or semi-structured business documents and input into the contract system, resulting in low efficiency and the inability to perform review and verification.
By parsing and structuring source documents of various formats, a structured document object with evidence anchors and text hash values is generated. Combined with field rule cards and validation rules, field values are automatically matched and populated, and traceability information is provided to ensure integrity and compliance.
It has achieved full automation and standardization of the contract creation process, improved efficiency, ensured the accuracy and traceability of field extraction, and solved the inefficiency of manual data entry and review.
Smart Images

Figure CN123139964A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for extracting business document fields and filling forms. Background Technology
[0002] Currently, in business scenarios such as engineering construction, bidding, centralized procurement of materials, and equipment leasing, the core fields of contract forms are not generated independently, but are scattered from multiple sources of unstructured or semi-structured business documents, such as bid award reports, bid evaluation documents, price lists, bidding materials, attachment tables, and compressed files. The contract creation process requires manual retrieval from massive amounts of heterogeneous documents to extract fields such as the parties involved, contract amount, tax rate, construction period, scope of work, payment method, and security deposit, and then manually enters them into the contract system form. This is a core aspect of enterprise contract management.
[0003] One existing automated field extraction and form filling method uses large-model question-and-answer extraction technology. Specifically, it is based on a retrieval-enhanced generative model to retrieve document text fragments and output corresponding fields through large-model question-and-answer, and then fill in the fields according to a preset template.
[0004] However, when using large-scale question-and-answer extraction, the output only contains the extracted fields. The extracted field values lack original document traceability information and cannot display source evidence such as page numbers, table coordinates, and text ranges, making it impossible to perform verification and resulting in low contract creation efficiency. Summary of the Invention
[0005] This application provides a method and apparatus for extracting business document fields and filling forms, which can automate and standardize the entire process of field extraction, validation, and filling, thereby improving the efficiency of contract creation.
[0006] In a first aspect, embodiments of this application provide a method for extracting business document fields and filling in forms, including: In response to a business document creation request, the form of the business document is determined based on the business identifier and business type carried in the business document creation request, and the corresponding source document set is obtained based on the business identifier, wherein the source document set includes files of different formats; Each source file in the source document collection is parsed and structured to obtain a structured document object, and evidence anchors and text hash values are generated for each field in the structured document object; According to the business type, the corresponding field rule card is matched from the database. The field rule card includes the field identifier to be extracted, field value extraction parameters, validation rules, and form control mapping relationship. Match the target field corresponding to the field identifier from the structured document object according to the field identifier, and extract at least one candidate value for each target field from the structured document object according to the field value extraction parameters; Based on the form control mapping relationship, the candidate values that pass the validation based on the validation rules are mapped and filled into the corresponding control positions in the form of the business document.
[0007] Secondly, embodiments of this application provide a business document field extraction and form filling apparatus, comprising: The first processing module is used to respond to a business document creation request, determine the form of the business document based on the business identifier and business type carried in the business document creation request, and obtain the corresponding source document set based on the business identifier, wherein the source document set includes files of different formats; The second processing module is used to parse and structure each source file in the source document set to obtain a structured document object, and generate evidence anchors and text hash values for each field in the structured document object; The matching module is used to match the corresponding field rule card from the database according to the business type. The field rule card includes the field identifier to be extracted, field value extraction parameters, validation rules, and form control mapping relationship. The matching module is further configured to: match a target field corresponding to the field identifier from the structured document object according to the field identifier, and extract at least one candidate value for each target field from the structured document object according to the field value extraction parameter; The fill module is used to map and fill the candidate values that have passed the validation based on the validation rules into the corresponding control positions in the form of the business document, according to the form control mapping relationship.
[0008] In one embodiment, the second processing module is used to: Parse and extract the nested attachments of each source file in the source document collection; For each source file, text extraction is performed on the source file and the nested attachment according to their file formats to obtain text content and table data; The table data is subjected to table structure recognition to obtain table structure recognition results, which include at least one of the following: table row and column index frame, table header hierarchy relationship, and cell merging relationship; Based on the text content, the table data, and the table structure recognition results, an association relationship is established. The association relationship includes the nesting and inclusion relationship between the source file and the nested attachment, the cross-form reference relationship between different tables within the same source file, and the contextual relationship between text paragraphs and table data. Based on the aforementioned relationship, content indexes and position indexes are established for the text content and the table data to generate the structured document object. The text content and the table data serve as the carriers of the fields in the structured document object.
[0009] In one embodiment, the evidence anchor point includes the position information of the field in the corresponding source file, and the position information includes at least one of the following: document page number, sheet form identifier, table row and column coordinates, paragraph number, and character start and end range.
[0010] In one embodiment, the second processing module is further configured to: Based on the evidence anchor points corresponding to each candidate value, the quantitative scores of each candidate value on multiple scoring dimensions are determined respectively; Based on the preset weights corresponding to each of the scoring dimensions, the quantitative scores of each candidate value on multiple scoring dimensions are weighted and summed to obtain the comprehensive score of each candidate value. Based on the comprehensive score of each candidate value, a target candidate value is determined from the at least one candidate value, and the target candidate value is determined as the object to be verified based on the verification rules.
[0011] In one embodiment, the plurality of scoring dimensions includes at least one of data source priority, text semantic similarity, format compliance, context matching distance, table title matching degree, and historical manual adoption rate, and the second processing module is further configured to: Save the source file information corresponding to the target candidate value of the target field, the comprehensive score of the target candidate value, and the evidence anchor point of the target field.
[0012] In one embodiment, before the filling module maps and fills the candidate values that have passed the validation based on the validation rules to the corresponding control positions in the form of the business document, the second processing module is further configured to: The target candidate value is validated based on the validation rules. The validation includes at least one of the following: text format validation, business enumeration compliance validation, numerical range threshold validation, date sequence logic validation, amount case consistency validation, and cross-field business association validation.
[0013] In one embodiment, the filling module is used for: Based on the form control mapping relationship, the target control corresponding to the candidate value that passed the validation is determined from the form of the business document. The target control includes at least one of an input box, a drop-down list, and a table cell. The candidate values that pass the verification are filled into the target control.
[0014] In one embodiment, the second processing module is further configured to: Obtain manual review operation information for the fields already filled in the form of the business document, wherein the manual review operation information includes at least one of confirmation, modification and rejection; Based on the manual review operation information, a structured field sample event is generated. The structured field sample event includes the field identifier of the field being operated on, the original fill value of the field being operated on, the reviewed value of the field being operated on, the review result type, and the review time. Based on the structured field sample event, the field value extraction parameters and / or validation rules in the field rule card are modified to obtain an updated field rule card.
[0015] Thirdly, embodiments of this application provide a computer device, including: a processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program stored in the memory to perform the method of the first aspect.
[0016] Fourthly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a computer program, cause the computer to perform the method as described in the first aspect.
[0017] In summary, in this embodiment, by responding to a business document creation request to obtain a collection of multi-format source documents, and parsing and structuring the source documents to generate structured document objects with evidence anchors and text hash values, each subsequently extracted field can be accurately traced back to the original document location and its integrity can be verified. This solves the problem of field extraction lacking original document traceability information and being unable to be verified. By automatically matching field rule cards containing field identifiers, field value extraction parameters, verification rules, and form control mapping relationships according to the business type, the field extraction logic is decoupled from hard coding. Business personnel can add new contract types and business fields without code by configuring rule cards, solving the problem of rule expansion relying on development iterations. Furthermore, by matching and locating target fields and extracting candidate values through field identifier matching, and automatically filling them according to form control mapping relationships after verification based on verification rules, the field extraction and filling process is freed from the inefficient mode of manual item-by-item entry. Ultimately, the entire process of field extraction, verification, and filling is automated and standardized, improving contract creation efficiency. Attached Figure Description
[0018] Figure 1 A schematic diagram illustrating an implementation scenario of a business document field extraction and form filling method provided in this application embodiment; Figure 2 A flowchart illustrating a method for extracting business document fields and filling out forms, provided in an embodiment of this application; Figure 3 A schematic diagram of a business document field extraction and form filling device provided in this application embodiment; Figure 4 This is a schematic block diagram of a computer device 300 provided in an embodiment of this application. Detailed Implementation
[0019] 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 embodiments of the embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the embodiments of this application.
[0020] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of the embodiments of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the present application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.
[0021] The business document field extraction and form filling method provided in this application can be applied to contract creation scenarios in business operations such as engineering construction, bidding, centralized procurement of materials, and equipment leasing. For example, in the contract signing stage of an engineering construction project, the contract handler needs to create contract forms of various types, such as construction contracts, general contracting contracts, subcontracting contracts, and supervision contracts, based on multiple unstructured business documents, including bid evaluation reports, bid award notices, tender documents, price lists, bills of quantities, and attachment tables. Specifically, the contract handler uses the method of this application to input multiple heterogeneous documents (including bid evaluation reports in PDF format, tender documents in Word format, bills of quantities and price lists in Excel format, and attachments in compressed file format) as a set of source documents into the system. The system performs unified parsing and structured processing on all source files, constructs evidence anchors, and automatically matches corresponding field rule cards based on the contract business type (e.g., "Engineering Construction General Contracting Contract"). It extracts candidate values for key fields such as contract amount, construction period, tax rate, scope of work, payment method, warranty period, and performance bond. After multi-dimensional comprehensive scoring and intelligent arbitration, the optimal value is automatically filled into the corresponding controls in the contract form. Simultaneously, the system retains the evidence anchor information for each filled field for approval personnel to verify the source and conduct compliance reviews. In this application scenario, the method described in this application can reduce the manual document retrieval, field extraction, and data entry verification work, which originally required hours or even days, to minutes, significantly improving contract creation efficiency. At the same time, the evidence anchor mechanism ensures that every contract data point is traceable and verifiable, meeting the audit compliance requirements of engineering construction projects.
[0022] It should be noted that the application scenarios described above are for illustrative purposes only and are not intended to limit the scope of this application. In specific implementations, the technical solutions provided in the embodiments of this application can be flexibly applied according to actual needs.
[0023] For example, Figure 1 This is a schematic diagram illustrating an implementation scenario of a business document field extraction and form filling method provided in an embodiment of this application, such as... Figure 1 As shown, the implementation scenario of this application involves server 1 and terminal device 2. Terminal device 2 can communicate with server 1 via a communication network. The communication network can be an intranet, the Internet, Global System for Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, voice communication network, or other wireless or wired networks.
[0024] In some possible implementations, terminal device 2 refers to a device with rich human-computer interaction methods, internet access capabilities, typically running various operating systems, and possessing strong processing power. Terminal devices can be smartphones, tablets, laptops, desktop computers, or smartwatches, but are not limited to these. Optionally, in this embodiment, terminal device 2 has various applications installed.
[0025] In some possible implementations, the terminal device 2 includes, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, and vehicle terminals.
[0026] Figure 1 Server 1 in this context can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services. This application embodiment does not impose any limitations on this. In this application embodiment, server 1 can be the backend server of an application installed on terminal device 2.
[0027] In some possible ways, Figure 1 An exemplary terminal device and a server are shown, but in practice, other numbers of terminal devices and servers may be included, and this application does not limit this.
[0028] In some embodiments, when business document creation (such as contract creation) is required, server 1 or terminal device 2 may use the business document field extraction and form filling method provided in the embodiments of this application.
[0029] The technical solutions of the embodiments of this application will be described in detail below: Figure 2 This application provides a flowchart of a method for extracting business document fields and filling out forms. The execution entity of this application embodiment is a device with business document field extraction and form filling functions, such as a server. Figure 2 As shown, the method may include: S101. In response to a business document creation request, determine the form of the business document based on the business identifier and business type carried in the business document creation request, and obtain the corresponding source document set based on the business identifier. The source document set includes files of different formats.
[0030] Specifically, in this embodiment, the business document creation request is used to request the creation of a business document, which can be any of the following: an engineering contract, a procurement contract, a lease contract, a service contract, or a framework agreement. In actual business scenarios, the key fields required for the contract form are not provided by a single document, but are distributed across multiple business documents with different formats. Therefore, the business identifier is also used to associate and retrieve the corresponding set of source documents from business systems (such as project management systems, procurement systems, and document systems). Each source file in the source document set is the original business data required for this contract creation. The source document set can include at least two of the following: bid award reports, bid evaluation documents, price lists, tender documents, bidding documents, lease application forms, equipment lists, quotation sheets, and supplier qualification documents. The source document set includes files in different formats, such as PDF, Word documents (.doc / .docx), Excel spreadsheets (.xls / .xlsx), images (.jpg / .png), compressed files (.zip / .rar), etc. For example, in the scenario of creating an engineering construction contract, the bid award report may be in PDF format, the price list in Excel format, the tender document in Word document, and the technical specifications in PDF format. These documents may also be packaged into a compressed file and submitted together.
[0031] Specifically, a business document creation request can be a request message generated by the system frontend (such as a contract management system, low-code development platform, etc.) and sent to the backend processing module (such as a server) when a user triggers a contract creation operation. This request carries a business identifier and a business type, used to uniquely identify the business instance and contract category to which this contract creation task belongs. The business identifier can be a unique identifier that can be associated with a specific business entity, such as a contract number, purchase order number, or project number. The business type indicates the category to which the contract to be created belongs, so that subsequent steps can match the corresponding field rule cards and form templates.
[0032] In one embodiment, in S101, the corresponding set of source documents is obtained based on the business identifier. Specifically, this can be achieved by directly retrieving the documents from the business system. When a user initiates a contract creation request through the contract management system, the system automatically queries the associated document list from the project management system or the file system based on the business identifier (such as the purchase order number) and retrieves the corresponding source files in batches.
[0033] It can also be implemented as follows: When a user initiates a contract creation request, they can manually select and upload relevant source files through a graphical user interface. The system then constructs a source document collection based on the user-uploaded files. Users can submit locally stored files such as PDFs, Word documents, Excel files, images, and compressed files to the system via drag-and-drop or click upload methods on the front-end interface. After receiving these files, the system stores them uniformly and incorporates them into the source document collection.
[0034] S102. Parse and structure each source file in the source document collection to obtain a structured document object, and generate evidence anchors and text hash values for each field in the structured document object.
[0035] Specifically, the structured document object includes searchable and locatable fields and content indexes, evidence anchors are used to locate the fields to their corresponding source file locations, and text hash values are used to perform integrity verification and tamper detection on the fields.
[0036] In this embodiment, parsing and structuring each source file in the source document set refers to employing appropriate parsing strategies for source files of different formats (including but not limited to compressed files, PDFs, Word documents, Excel spreadsheets, images, etc.) to extract text content, tabular data, and document structure information, and organizing them into a unified, programmable data format. The core objective of this step is to integrate unstructured / semi-structured data originally scattered across documents of different formats into a unified data view with a clear structure and searchable location capabilities.
[0037] In one embodiment, the evidence anchor may include the position information of the field in the corresponding source file, and the position information includes at least one of the following: document page number, sheet form identifier, table row and column coordinates, paragraph number, and character start and end range.
[0038] Optionally, in one implementable approach, S102 parses and structures each source file in the source document collection to obtain a structured document object, specifically: S1021. Parse and extract the nested attachments of each source file in the source document collection.
[0039] Specifically, the file format type can be identified based on the file extension and header information of each source file. Appropriate parsing strategies are then employed for different source file formats. For example, compressed archives are automatically decompressed to extract nested attachments. In scenarios where a compressed archive contains nested archives, the decompression operation is recursively performed until all nested files are extracted. Subsequently, format identification and parsing are performed on each decompressed file.
[0040] S1022. For each source file, extract text from the source file and nested attachments according to their file formats to obtain text content and table data.
[0041] Specifically, for PDF files, PDF document parsing is performed to extract the plain text content, identify the page number structure, paragraph divisions, and the content and structure of table areas. For scanned PDFs, OCR capabilities can be used for text recognition. For Word documents, text paragraphs, heading levels, tables, images, and other elements are parsed, preserving logical information such as paragraph numbering and chapter structure. For Excel files, all sheets are traversed, and table data in each sheet is extracted, identifying sheet names, row and column structures, cell content, merged cells, and header areas. For image files, OCR technology can be used to detect and recognize text within the images, extracting the text information contained within them.
[0042] S1023. Perform table structure recognition on the table data to obtain the table structure recognition result. The table structure recognition result includes at least one of the following: the table's row and column index frame, the table header hierarchy, and the cell merging relationship.
[0043] Specifically, for the tabular data extracted from the source file, table structure recognition is performed to reconstruct the logical structure of the table. Table structure recognition may include: Row and column index frame identification: Determine the total number of rows and columns of the table, determine the row index and column index of each cell, and establish a two-dimensional matrix structure of the table.
[0044] Table header hierarchy identification: Identify the table header area and its hierarchy, determine which cells belong to the header, the hierarchical relationship between headers (such as multi-level headers), and the correspondence between the header and the data body.
[0045] Cell Merging Relationship Identification: Identify merged cells in a table and determine the range of rows and columns covered by the merged cells.
[0046] Through the above identification, tables that may have been formatted incorrectly (such as irregular tables in PDFs or manually drawn tables in Word) can be restored to well-structured, programmatically accessible table data objects.
[0047] S1024. Based on the text content, table data, and table structure recognition results, establish association relationships, including the nesting and inclusion relationship between the source file and the nested attachments, the cross-form reference relationship between different tables within the same source file, and the contextual relationship between text paragraphs and table data.
[0048] Specifically, based on the parsed text content, table data, and table structure recognition results, the system further establishes the relationships between various content units. These relationships include: Nested inclusion relationships: establishing the hierarchical relationship between the source file and its decompressed nested attachments, recording information such as which compressed package each attachment belongs to and the nesting path of each compressed package. Cross-form reference relationships: establishing reference relationships between different tables within the same source file, such as a cell in Sheet A of an Excel file referencing data in Sheet B, or a paragraph in a Word document referencing content from a table within the document. Contextual attribution relationships: establishing the contextual attribution relationship between text paragraphs and table data, for example, if a paragraph describes "see the table below," the system associates this paragraph with the corresponding table, providing cross-content type joint retrieval capabilities for subsequent candidate value recall.
[0049] S1025. Based on the relationship, establish content index and position index for text content and table data, and generate a structured document object. The text content and table data are the carriers of fields in the structured document object.
[0050] Specifically, based on the established relationships, content indexes and location indexes are created for the text content and table data respectively, generating structured document objects. For each piece of text content and each table data unit, a content-level index is created, enabling subsequent steps to quickly match and locate the corresponding content unit based on field identifiers (such as "contract amount" and "tax rate"). Through the above index construction, the content units in the structured document object all have the ability to be "searchable and located"—they can be quickly retrieved through the content index and accurately located to the specific location in the original file through the location index.
[0051] Specifically, in step S102, an evidence anchor and a text hash value are generated for each field in the structured document object. The evidence anchor is used to locate the field to its corresponding position in the source file, and the text hash value is used for integrity verification and tamper detection of the field. The evidence anchor is bound to the corresponding field content and stored, forming a mapping relationship between the field content and the evidence anchor. This mapping relationship ensures that when subsequent steps extract any field value from the structured document object, the field value carries the location information of its original source. For text paragraphs from Word or PDF: the location information may include the document page number, paragraph number, and character start and end range (i.e., the starting and ending character positions of the field in the paragraph), and optionally, auxiliary location information such as the total number of pages in the document. For tabular data from Excel files: the location information may include the sheet identifier (i.e., the sheet name or sheet index), the table row and column coordinates (i.e., the row number and column number where the field is located), and optionally, information such as whether the cell has been merged and the merge range. For tables originating from Word or PDF: location information may include document page number, table number (or table sequence number in the document), table row and column coordinates, and the spatial location of the cell on the page.
[0052] S103. Match the corresponding field rule card from the database according to the business type. The field rule card includes the field identifier to be extracted, field value extraction parameters, validation rules, and form control mapping relationship.
[0053] Specifically, the field identifier uniquely specifies which business fields the rule card needs to extract from the source document. Each field identifier corresponds to a specific contract field, such as contract amount, client entity, contractor entity, tax rate, construction period, scope of work, payment method, warranty period, performance bond, etc. The field identifier serves as the retrieval keyword for matching and locating target fields from the structured document object in subsequent step S104. In one embodiment of this application, the field identifier includes not only the field's name identifier but also a list of semantic aliases for the field. For example, the field identifier for the contract amount field includes the main identifier "contract amount" and semantic aliases such as "total contract price," "contract price," "contract price," and "contract amount," to improve the semantic coverage during subsequent matching and retrieval in the document. The list of semantic aliases is stored in the rule card along with the field identifier.
[0054] The field value extraction parameters instruct the system how to extract candidate values for a field from a structured document object. Specifically, the field value extraction parameters include at least one of the following: Data type: Indicates the data type of the field value, including but not limited to numeric, string, date, boolean, enumeration, etc., used to guide type conversion during extraction and subsequent validation.
[0055] Format specification: Indicates the valid format of the field value, such as amount format (e.g., "keep two decimal places"), date format (e.g., "YYYY-MM-DD"), tax rate format (e.g., "percentage / decimal"), etc., for format validation in subsequent step S106; Data source priority: When this field may appear in multiple types of source documents, define the priority order of different document types (such as benchmarking reports, price lists, and tender documents) as one of the scoring criteria for data source priority in the subsequent comprehensive scoring of S105 candidate values.
[0056] Historical Manual Adoption Rate Weight: This records the percentage of automatically extracted results that were manually reviewed in the past. It is used for the comprehensive scoring of candidate values in subsequent step S105, forming a closed-loop iterative optimization of the rule card parameters. For fields without historical data, this parameter uses a preset initial value.
[0057] Validation rules are used to perform business compliance checks on the field value after the candidate value passes the comprehensive scoring arbitration, ensuring that the data filled into the form conforms to business specifications and logical requirements. Validation rules may include at least one of the following: text format validation, business enumeration compliance validation, numerical range threshold validation, date sequence logic validation, amount case consistency validation, and cross-field business association validation.
[0058] Form control mappings indicate which specific control in the target business document form should be populated with the validated field value. Specifically, the form control mapping includes the correspondence between field identifiers and form control names / identifiers, as well as information indicating the control type. For example, control types include different types of form controls such as input boxes, drop-down lists, radio buttons, checkboxes, and table cells.
[0059] S104. Match the target field corresponding to the field identifier from the structured document object according to the field identifier, and extract at least one candidate value for each target field from the structured document object according to the field value extraction parameters.
[0060] Specifically, in one embodiment of this application, the field identifier list in the field rule card matched in S103 is obtained. The field identifier list contains all contract fields that need to be extracted in this business scenario. Each field identifier in the field identifier list is traversed, and the target field corresponding to the current field identifier is matched in the structured document object using the content index in the structured document object. Optionally, the matching process can be: using the field identifier as a search keyword, performing an exact match in the content index of the structured document object. For example, if the field identifier is "contract amount", the system searches the content index to see if all content units contain the complete field name "contract amount". If the match is successful, the content unit is located as the source of the target field. Alternatively, since the same field may appear with different names in different business documents (for example, "contract amount" may also be called "total contract price", "contract price", "contract price", etc.), the field identifier in the field rule card also contains a list of semantic aliases for the field. When searching in the content index, the main identifier and its semantic aliases are matched simultaneously. For example, the semantic aliases for the field "Contract Amount" might be "Total Contract Price," "Contract Price," "Contract Price," and "Contract Amount." Matching all these names in the content index will include any content unit matching any of these aliases within the candidate source range for the target field. This approach effectively improves the coverage of field recall and avoids missed recalls due to differences in document descriptions.
[0061] After locating the source of the target field, parameters can be extracted based on the field values in the field rule card to extract at least one candidate value for each target field from the structured document object. Specifically, the field value extraction parameters indicate the data type, formatting specifications, data source priority, and other information of the target field value within the structured document object. Based on the data type (such as numeric, string, date, enumeration, etc.), corresponding content fragments are extracted from the text content or tabular data unit containing the target field to generate candidate values.
[0062] In this embodiment, a high coverage recall of target fields from structured document objects is achieved by combining precise matching of field identifiers with semantic alias extended matching; candidate value extraction is driven by field value extraction parameters to ensure that the extracted data types and formats meet the requirements of subsequent verification and filling; and the binding of candidate values with evidence anchors provides a complete traceability basis for subsequent multi-dimensional scoring, conflict arbitration and manual review.
[0063] S105. Based on the form control mapping relationship, map and fill the candidate values that have passed the validation based on the validation rules into the corresponding control positions in the form of the business document.
[0064] Optionally, in one embodiment, after extracting at least one candidate value for each target field from the structured document object based on the field value extraction parameters in S104, the method may further include S106-S108: S106. Based on the evidence anchor points corresponding to each candidate value, determine the quantitative score of each candidate value on multiple scoring dimensions.
[0065] S107. Based on the preset weights corresponding to each scoring dimension, the quantitative scores of each candidate value on multiple scoring dimensions are weighted and summed to obtain the comprehensive score of each candidate value.
[0066] S108. Based on the comprehensive score of each candidate value, determine the target candidate value from at least one candidate value, and determine the target candidate value as the object to be verified based on the verification rules.
[0067] Optionally, the scoring dimensions include at least one of the following: data source priority, text semantic similarity, format compliance, context matching distance, table title matching degree, and historical manual adoption rate. The method in this embodiment may further include: S109. Save the source file information corresponding to the target candidate value of the target field, the comprehensive score of the target candidate value, and the evidence anchor point of the target field.
[0068] In this embodiment, a multi-dimensional scoring system is constructed, which includes data source priority, text semantic similarity, format compliance, context matching distance, table title matching degree, and historical manual adoption rate. Each candidate value is quantitatively scored and weighted to obtain a comprehensive score. This comprehensive score is used to arbitrate and select the optimal target candidate value as the object for subsequent verification and filling. At the same time, the source file information, comprehensive score, and evidence anchor points of the target candidate value are saved. This solves the industry pain point of not being able to automatically identify valid values when there are data conflicts in fields with the same name in multiple source documents. It realizes intelligent selection of field candidate values in multi-source heterogeneous document scenarios, which greatly improves the accuracy and credibility of field filling and provides a complete scoring basis and traceability evidence chain for subsequent manual review.
[0069] Optionally, in one embodiment, before mapping and filling the candidate values that have passed the validation rules to the corresponding control positions in the form of the business document in S105, the following may also be included: The target candidate value is validated based on the validation rules. The validation includes at least one of the following: text format validation, business enumeration compliance validation, numerical range threshold validation, date sequence logic validation, amount case consistency validation, and cross-field business association validation.
[0070] In this embodiment, by performing at least one of the following checks on the target candidate values: text format validation, business enumeration compliance validation, numerical range threshold validation, date sequence logic validation, amount case consistency validation, and cross-field business association validation, it is ensured that only field values that fully comply with business specifications and logical constraints can be filled into the form control. This eliminates format and compliance issues of key fields such as inconsistent amount case, date logic conflicts, numerical values exceeding thresholds, and non-standard enumerations at the source, ensuring the standardization and compliance of contract data and significantly reducing the error rate of form filling.
[0071] Optionally, in one implementable manner, S105 may specifically be: S1051. Based on the form control mapping relationship, determine the target control corresponding to the candidate value that has passed the validation from the form in the business document. The target control includes at least one of the following: input box, drop-down list and table cell.
[0072] S1052. Fill the candidate values that have passed the validation into the target control.
[0073] Optionally, in one embodiment, the method of this embodiment may further include: S1053. Obtain manual review operation information for fields already filled in the form of the business document. The manual review operation information includes at least one of confirmation, modification, and rejection.
[0074] S1054. Based on the manual review operation information, generate a structured field sample event. The structured field sample event includes the field identifier of the field being operated on, the original fill value of the field being operated on, the reviewed value of the field being operated on, the review result type, and the review time.
[0075] S1055. Based on the structured field sample event, modify the field value extraction parameters and / or validation rules in the field rule card to obtain the updated field rule card.
[0076] In this embodiment, by obtaining manual review information of the fields already filled in the form of the business document, a structured field sample event is generated based on the manual review information. Based on the structured field sample event, the field value extraction parameters and / or validation rules in the field rule card are corrected to obtain the updated field rule card. This forms a closed-loop iterative mechanism of manual review, event accumulation, and rule update, enabling the system to continuously learn from manual feedback and optimize the rule card configuration, thereby continuously improving the field extraction accuracy and enhancing the system's scenario adaptability.
[0077] The business document field extraction and form filling method provided in this embodiment obtains a multi-format source document set in response to a business document creation request, and parses and structures the source documents to generate a structured document object with evidence anchors and text hash values. This allows each subsequently extracted field to be accurately traced back to the original document location and its integrity to be verified, solving the problems of field extraction without original document traceability information and inability to be verified. By automatically matching field rule cards containing field identifiers, field value extraction parameters, verification rules, and form control mapping relationships according to the business type, the field extraction logic is decoupled from hard coding. Business personnel can add new contract types and business fields without code by configuring rule cards, solving the problem of rule expansion relying on development iterations. Then, by matching and locating target fields and extracting candidate values through field identifier matching, and automatically filling them according to form control mapping relationships after verification based on verification rules, the field extraction and filling process is freed from the inefficient mode of manual item-by-item entry. Finally, it realizes full automation and standardization of the field extraction, verification, and filling process, improving the efficiency of contract creation.
[0078] Figure 3 A schematic diagram of a business document field extraction and form filling device provided in this application embodiment is shown below. Figure 3 As shown, the device may include: a first processing module 11, a second processing module 12, a matching module 13, and a filling module 14.
[0079] The first processing module 11 is used to respond to the business document creation request, determine the form of the business document according to the business identifier and business type carried in the business document creation request, and obtain the corresponding source document set according to the business identifier. The source document set includes files of different formats. The second processing module 12 is used to parse and structure each source file in the source document collection to obtain a structured document object, and generate evidence anchors and text hash values for each field in the structured document object; The matching module 13 is used to match the corresponding field rule card from the database according to the business type. The field rule card includes the field identifier to be extracted, field value extraction parameters, validation rules and form control mapping relationship. The matching module 13 is also used to: match the target field corresponding to the field identifier from the structured document object according to the field identifier, and extract at least one candidate value for each target field from the structured document object according to the field value extraction parameters; The fill module 14 is used to map and fill the candidate values that have passed the validation rules into the corresponding control positions in the form of the business document according to the form control mapping relationship.
[0080] In one embodiment, the second processing module 12 is used to: Parse and extract nested attachments from each source file in the source document collection; For each source file, text extraction is performed on both the source file and the nested attachments according to their file formats to obtain text content and table data. Perform table structure recognition on the table data to obtain the table structure recognition result. The table structure recognition result includes at least one of the following: table row and column index frame, table header hierarchy relationship, and cell merging relationship. Based on the recognition results of text content, table data, and table structure, establish association relationships, including the nesting and inclusion relationship between the source file and the nested attachments, the cross-form reference relationship between different tables within the same source file, and the contextual relationship between text paragraphs and table data. Based on the relationships, content indexes and position indexes are created for text content and table data to generate structured document objects. The text content and table data serve as the carriers of fields in the structured document objects.
[0081] In one embodiment, the evidence anchor includes the position information of the field in the corresponding source file, and the position information includes at least one of the following: document page number, sheet form identifier, table row and column coordinates, paragraph number, and character start and end range.
[0082] In one embodiment, the second processing module 12 is further configured to: Based on the evidence anchor points corresponding to each candidate value, the quantitative scores of each candidate value on multiple scoring dimensions are determined respectively; Based on the preset weights corresponding to each scoring dimension, the quantitative scores of each candidate value on multiple scoring dimensions are weighted and summed to obtain the comprehensive score of each candidate value. Based on the comprehensive score of each candidate value, a target candidate value is determined from at least one candidate value, and the target candidate value is determined as the object to be verified based on the verification rules.
[0083] In one embodiment, the multiple scoring dimensions include at least one of data source priority, text semantic similarity, format compliance, context matching distance, table title matching degree, and historical manual adoption rate. The second processing module 12 is further used for: Save the source file information corresponding to the target candidate value of the target field, the comprehensive score of the target candidate value, and the evidence anchor point of the target field.
[0084] In one embodiment, before the filling module maps and fills the candidate values that have passed the validation rules to the corresponding control positions in the form of the business document, the second processing module 12 is further configured to: The target candidate value is validated based on the validation rules. The validation includes at least one of the following: text format validation, business enumeration compliance validation, numerical range threshold validation, date sequence logic validation, amount case consistency validation, and cross-field business association validation.
[0085] In one embodiment, the filling module 14 is used for: Based on the form control mapping relationship, determine the target control corresponding to the candidate value that has passed the validation from the form in the business document. The target control includes at least one of the following: input box, drop-down list and table cell. Fill the target control with the candidate values that pass the validation.
[0086] In one embodiment, the second processing module 12 is further configured to: Obtain manual review information for fields already filled in the form of a business document. The manual review information includes at least one of confirmation, modification, and rejection. Based on the manual review operation information, a structured field sample event is generated. The structured field sample event includes the field identifier of the field being operated on, the original filled value of the field being operated on, the reviewed value of the field being operated on, the review result type, and the review time. Based on the structured field sample events, the field value extraction parameters and / or validation rules in the field rule card are modified to obtain the updated field rule card.
[0087] It should be understood that the device embodiments and method embodiments can correspond to each other, and similar descriptions can be found in the method embodiments. To avoid repetition, further details are omitted here. Specifically, Figure 3 The business document field extraction and form filling device shown can execute the method embodiment corresponding to the computer device, and the foregoing and other operations and / or functions of each module in the device are respectively for implementing the method embodiment corresponding to the computer device, which will not be described in detail here for the sake of brevity.
[0088] The foregoing description, in conjunction with the accompanying drawings, describes the business document field extraction and form filling device and the information prediction device of the embodiments of this application from the perspective of functional modules. It should be understood that these functional modules can be implemented in hardware, in software instructions, or in a combination of hardware and software modules. Specifically, the steps of the method embodiments in this application can be completed by the integrated logic circuits in the processor's hardware and / or by software instructions. The steps of the methods disclosed in the embodiments of this application can be directly manifested as execution by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps in the above method embodiments.
[0089] Figure 4 This is a schematic block diagram of a computer device 300 provided in an embodiment of this application.
[0090] like Figure 4 As shown, the computer device 300 may include: The system includes a memory 310 and a processor 320. The memory 310 stores computer programs and transfers the program code to the processor 320. In other words, the processor 320 can retrieve and run the computer program from the memory 310 to implement the methods described in the embodiments of this application.
[0091] For example, the processor 320 can be used to execute the above-described method embodiments according to instructions in the computer program.
[0092] In some embodiments of this application, the processor 320 may include, but is not limited to: General-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0093] In some embodiments of this application, the memory 310 includes, but is not limited to: Volatile memory and / or non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0094] In some embodiments of this application, the computer program may be divided into one or more modules, which are stored in the memory 310 and executed by the processor 320 to complete the method provided in this application. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the computer device.
[0095] like Figure 4 As shown, the computer device may further include: Transceiver 330, which can be connected to processor 320 or memory 310.
[0096] The processor 320 can control the transceiver 330 to communicate with other devices; specifically, it can send information or data to other devices or receive information or data sent by other devices. The transceiver 330 may include a transmitter and a receiver. The transceiver 330 may further include antennas, and the number of antennas may be one or more.
[0097] It should be understood that the various components in the computer device are connected through a bus system, which includes, in addition to the data bus, a power bus, a control bus, and a status signal bus.
[0098] This application also provides a computer storage medium storing a computer program thereon, which, when executed by a computer, enables the computer to perform the methods of the above-described method embodiments. Alternatively, this application also provides a computer program product containing instructions that, when executed by a computer, cause the computer to perform the methods of the above-described method embodiments.
[0099] When implemented using software, it can be implemented entirely or partially as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0100] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of the embodiments of this application.
[0101] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or modules may be electrical, mechanical, or other forms.
[0102] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. For example, the functional modules in the various embodiments of this application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0103] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this application should be included within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.
Claims
1. A method for extracting business document fields and filling in forms, characterized in that, include: In response to a business document creation request, the form of the business document is determined based on the business identifier and business type carried in the business document creation request, and the corresponding source document set is obtained based on the business identifier, wherein the source document set includes files of different formats; Each source file in the source document collection is parsed and structured to obtain a structured document object, and evidence anchors and text hash values are generated for each field in the structured document object; According to the business type, the corresponding field rule card is matched from the database. The field rule card includes the field identifier to be extracted, field value extraction parameters, validation rules, and form control mapping relationship. Match the target field corresponding to the field identifier from the structured document object according to the field identifier, and extract at least one candidate value for each target field from the structured document object according to the field value extraction parameters; Based on the form control mapping relationship, the candidate values that pass the validation based on the validation rules are mapped and filled into the corresponding control positions in the form of the business document.
2. The method according to claim 1, characterized in that, The step of parsing and structuring each source file in the source document set to obtain a structured document object includes: Parse and extract the nested attachments of each source file in the source document collection; For each source file, text extraction is performed on the source file and the nested attachment according to their file formats to obtain text content and table data; The table data is subjected to table structure recognition to obtain table structure recognition results, which include at least one of the following: table row and column index frame, table header hierarchy, and cell merging relationship; Based on the text content, the table data, and the table structure recognition results, an association relationship is established. The association relationship includes the nesting and inclusion relationship between the source file and the nested attachment, the cross-form reference relationship between different tables within the same source file, and the contextual relationship between text paragraphs and table data. Based on the aforementioned relationship, content indexes and position indexes are established for the text content and the table data to generate the structured document object. The text content and the table data serve as the carriers of the fields in the structured document object.
3. The method according to claim 1, characterized in that, The evidence anchor point includes the position information of the field in the corresponding source file, and the position information includes at least one of the following: document page number, sheet form identifier, table row and column coordinates, paragraph number, and character start and end range.
4. The method according to claim 1, characterized in that, After extracting at least one candidate value for each target field from the structured document object based on the field value extraction parameters, the method further includes: Based on the evidence anchor points corresponding to each candidate value, the quantitative scores of each candidate value on multiple scoring dimensions are determined respectively; Based on the preset weights corresponding to each of the scoring dimensions, the quantitative scores of each candidate value on multiple scoring dimensions are weighted and summed to obtain the comprehensive score of each candidate value. Based on the comprehensive score of each candidate value, a target candidate value is determined from the at least one candidate value, and the target candidate value is determined as the object to be verified based on the verification rules.
5. The method according to claim 4, characterized in that, The multiple scoring dimensions include at least one of data source priority, text semantic similarity, format compliance, context matching distance, table title matching degree, and historical manual adoption rate. The method also includes: Save the source file information corresponding to the target candidate value of the target field, the comprehensive score of the target candidate value, and the evidence anchor point of the target field.
6. The method according to claim 4, characterized in that, Before mapping and filling the candidate values that have passed the validation based on the validation rules to the corresponding control positions in the form of the business document, the method further includes: The target candidate value is validated based on the validation rules. The validation includes at least one of the following: text format validation, business enumeration compliance validation, numerical range threshold validation, date sequence logic validation, amount case consistency validation, and cross-field business association validation.
7. The method according to claim 1, characterized in that, The step of mapping and filling the candidate values that have passed the validation based on the validation rules into the corresponding control positions in the form of the business document according to the form control mapping relationship includes: Based on the form control mapping relationship, the target control corresponding to the candidate value that passed the validation is determined from the form of the business document. The target control includes at least one of an input box, a drop-down list, and a table cell. The candidate values that pass the verification are filled into the target control.
8. The method according to claim 7, characterized in that, The method further includes: Obtain manual review operation information for the fields already filled in the form of the business document, wherein the manual review operation information includes at least one of confirmation, modification and rejection; Based on the manual review operation information, a structured field sample event is generated. The structured field sample event includes the field identifier of the field being operated on, the original fill value of the field being operated on, the reviewed value of the field being operated on, the review result type, and the review time. Based on the structured field sample event, the field value extraction parameters and / or validation rules in the field rule card are modified to obtain the updated field rule card.
9. A device for extracting business document fields and filling forms, characterized in that, include: The first processing module is used to respond to a business document creation request, determine the form of the business document based on the business identifier and business type carried in the business document creation request, and obtain the corresponding source document set based on the business identifier, wherein the source document set includes files of different formats; The second processing module is used to parse and structure each source file in the source document set to obtain a structured document object, and generate evidence anchors and text hash values for each field in the structured document object; The matching module is used to match the corresponding field rule card from the database according to the business type. The field rule card includes the field identifier to be extracted, field value extraction parameters, validation rules, and form control mapping relationship. The matching module is further configured to: match a target field corresponding to the field identifier from the structured document object according to the field identifier, and extract at least one candidate value for each target field from the structured document object according to the field value extraction parameter; The fill module is used to map and fill the candidate values that have passed the validation based on the validation rules into the corresponding control positions in the form of the business document, according to the form control mapping relationship.
10. A computer device, characterized in that, include: A processor and a memory, the memory being used to store a computer program, the processor being used to invoke and run the computer program stored in the memory to perform the method of any one of claims 1 to 8.
