Framework generation method for bidding file based on directory semantic constraint and openxml fragment fidelity

By performing structured analysis and three-level mapping of the tender documents, and combining differentiated purification strategies to generate a tender document framework, the issue of format control for the cover and attachments in tender document generation was resolved, ensuring the integrity and consistency of the tender documents.

CN123159299APending Publication Date: 2026-11-24HANGZHOU OPEN ATOM INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611390178.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-09
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing technologies struggle to reliably maintain the table grid, merge relationships, numbering definitions, tabs, line breaks, whitespace retention attributes, and section control within a Word document package when generating tender documents. This can lead to corrupted cover page layouts or attachment titles appearing in the target document navigation. Furthermore, multi-section documents are prone to missing attachments, missing titles, and inconsistent pagination.

Method used

By performing structured parsing of the tender documents, establishing a three-level mapping between directory semantics and OpenXML fragments, employing a differentiated cleanup strategy to process the cover and ordinary attachments, constructing target document packages separately, and verifying the generated tender document framework through an independent structure checker.

Benefits of technology

This feature ensures that cover tabs, line breaks, and section breaks are retained when generating tender documents, preventing attachment titles from appearing in the navigation and ensuring consistency and integrity across multiple tender sections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123159299A_ABST
    Figure CN123159299A_ABST
Patent Text Reader

Abstract

This invention discloses a method for generating a tender document framework based on directory semantic constraints and OpenXML fragment fidelity. The method parses the tender document to obtain section information, hierarchical directory, formatted chapters, and attachment identifiers. It identifies attachment boundaries within the document package of the tender document and establishes a mapping between directory nodes, attachment identifiers, and original document structure fragments. For cover attachments, tabs, line breaks, whitespace retention attributes, and section break attributes are preserved. For ordinary attachments, attachment identifier lines, polluting navigation header styles, and embedded section break attributes are removed, while maintaining the relative order of tables and running nodes. Title styles, navigation levels, and actual pagination controls are generated based on the directory tree. The purified original fragments are injected after the corresponding titles, and the tender document framework is output by section. This scheme reduces format corruption caused by document redrawing and improves the fidelity of attachments, directory navigation, and consistency of multi-section output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer software and electronic document processing technology, and specifically relates to a method for generating a tender document framework based on directory semantic constraints and OpenXML fragment fidelity. Background Technology

[0002] Tender documents typically consist of a main body and multiple formatted attachments. Existing techniques often generate the tender document framework through manual copying, document reconstruction after text extraction, or filling in external templates. These methods cannot consistently maintain the internal table grids, merge relationships, numbering definitions, tabs, line breaks, whitespace retention attributes, and section control within a Word document. Especially when the cover page is mixed with regular attachments, uniform cleanup rules can cause layout corruption in the cover page fields or allow heading styles from the attachment text to appear in the target document navigation. Multi-section documents also require repeated copying and organization, easily leading to missing attachments, missing headings, and inconsistent pagination. For example, Chinese patent document CN110232177B discloses a tender document generation system and method in the government sector, which stores key content of the tender document as keywords in a database by reviewing and modularizing the content of the tender document; Chinese patent document CN112651218A discloses an automatic tender document generation method that determines keywords based on the content of the tender document and matches the tender type based on the keywords. The above solutions all focus on keyword extraction and template matching of the tender document text content. They do not use the original document structure fragments in the source document package as templates, do not establish a verifiable mapping between directory nodes and attachment structure fragments, and do not perform differentiated purification of structure fragments according to attachment type.

[0003] Tender documents are not simply composed of continuous text; their DOCX document packages typically include components such as the main document, styles, numbering, media, relationships, and section breaks. Table borders, cell merging, automatic numbering, tab stops, and page layouts in formatted attachments are expressed by OpenXML nodes at different levels. If only visible text is extracted and the target document is reconstructed, even with identical text content, the original layout of the attachments may be altered due to missing structural nodes, relationship references, or style definitions.

[0004] Existing whole-section copying methods suffer from coupling issues between the target and source structures. Directly copying an entire formatted section will bring irrelevant attachments, attachment identifier lines, and heading styles from the source document into the target document; manually deleting them one by one makes it difficult to guarantee consistency between multiple section files. When ordinary attachments contain Heading styles or section break attributes, the copied attachment text may appear in the navigation pane or change the margins, headers, footers, and paper orientation of subsequent pages.

[0005] On the other hand, the bid document's table of contents derives from semantic information such as the bidding requirements, scoring items, and attachment list, while the attachment templates are located in the format section of the source document. These two are typically not adjacent in the source file, and the same attachment may be referenced by multiple bid sections. Therefore, it is necessary to establish a verifiable mapping relationship between the table of contents nodes, standardized attachment identifiers, and fragments of the source document structure, and to identify any missing mappings before generation to avoid outputting a target document with a complete table of contents but missing attachments. Summary of the Invention

[0006] The purpose of this invention is to provide a tender document framework generation scheme that uses source tender document attachments as template sources, a directory tree as assembly constraints, and attachment type differentiation and purification as its core. This scheme can link semantic directories, attachment boundaries, original document fragments, title navigation, and tender section output. Accordingly, this invention also provides a tender document framework generation device and an electronic device.

[0007] To achieve the above objectives, this invention first performs structured parsing on the input tender documents, retaining both visible text information and document package structure information. Text, outlines, and table content are used to identify the project, bid sections, tender document composition, and hierarchical directory, while the main document XML and its associated components are used to determine attachment boundaries and obtain original structural fragments that can be cloned. Thus, directory semantic generation and layout structure migration form two complementary but separate processing chains.

[0008] The hierarchical directory data includes section nodes and chapter nodes, entry nodes, and sub-entry nodes under each section node. Each directory node records at least the node identifier, title text, directory depth, belonging section, parent node, sort value, and attachment references. During the framework assembly stage, whitespace and hyphens in attachment identifiers are standardized. Attachment fragment boundaries are determined based on adjacent attachment identifier lines within the formatted chapters, and ordered document elements from the current attachment identifier line to the next attachment identifier line are formed into attachment fragments. Based on this, the system establishes a three-level mapping between directory nodes, standardized attachment identifiers, and OpenXML fragment indexes.

[0009] Before assembling the fragments, the system calculates the required set of attachments based on the attachments referenced in the target directory and compares it with the available set of attachments in the fragment index. If any attachments are missing, the assembly of the corresponding target document is stopped and the missing attachment identifier and its corresponding directory title are output; if the mapping is complete, the first cleanup strategy is selected based on the pre-configured cover attachment set, or the second cleanup strategy is applied to ordinary attachments.

[0010] The first cleanup strategy is used for cover attachments. Its goal is to remove attachment identifiers used only for locating the source tender document, while maintaining the empty paragraphs, empty runs, tabs, line breaks, whitespace retention attributes, and section break controls upon which field layout depends. The second cleanup strategy is used for regular attachments. Its goal is to remove Heading styles and embedded section break attributes that would pollute the target navigation or change the target page layout, while maintaining the relative order of tables, merge relationships, numbered references, run nodes, and body elements.

[0011] The target document is built based on the source document package, retaining the source document package components while replacing the document body. The table of contents depth is converted to the corresponding heading style, the outline level is provided by the heading style, and a real pagination control node is written before each heading. The cleaned-up attachment fragments are then written immediately after their mapped headings. Independent target document packages are built for different sections. Shared attachments are stored only once in the fragment index, and their XML elements are cloned when assembled into different sections, ensuring that mutable nodes are not shared between target documents.

[0012] After generation, the target document is submitted to an independent structure checker for verification. This checker examines the number and hierarchy of headings, pagination nodes before headings, attachment fragment mappings, residual heading styles in attachment body text, and the legality of the document structure. The verification report records the inspection results. Heading, pagination, left alignment, attachment mappings, and navigation contamination checks are all performed by the independent structure checker. Numbering, media relationships, and anomaly backtracking are also included in the node-level verification scope. The independent structure checker can be invoked by the target framework assembly module or electronic device via an interface.

[0013] Accordingly, the tender document framework generation device includes: a table of contents generation module, used to generate hierarchical table of contents data based on the tender document; a tender document parsing module, used to read the main document component of the tender document, output an ordered set of elements in the document body, the ordered set of elements including paragraph elements, table elements, and drawing elements; an attachment boundary recognition module, used to identify and standardize attachment identifiers in the format section, determine attachment boundaries based on adjacent attachment identifier lines and the end position of the format section, and establish an attachment fragment index; and a table of contents node, attachment identifier, and OpenXML fragment mapping module, used to query the attachment fragment index based on attachment references in the hierarchical table of contents data, and establish table of contents nodes, standardized attachment identifiers, and the OpenXML original document structure. The document outlines the mapping relationships between segments; a differential cleansing module that performs a first cleansing strategy on a pre-configured set of cover attachments, retaining layout control nodes, and a second cleansing strategy on ordinary attachments, removing attachment identifier lines, embedded section attributes, and Heading style references that will enter the target document navigation; a target frame assembly module that generates a target document title structure with heading level, outline level, and real page break control nodes, clones and writes the cleaned OpenXML original document structure fragments through an XML element tree, and outputs the target document according to the segment range; and an independent structure checker interface that calls a structure verification tool deployed independently of the program that generates the target document, performs node-level verification on the output target document, and outputs the verification results.

[0014] Accordingly, the electronic device includes a processor and a memory, the memory storing program instructions that, when executed by the processor, implement the above-described tender document framework generation method.

[0015] Corresponding to the problems described in the background art, the beneficial effects of the present invention are as follows: It retains layout control nodes such as tabs, line breaks, whitespace retention attributes, empty nodes, and section break control for cover attachments, avoiding damage to cover field layout caused by uniform cleanup rules; it removes Heading style references and embedded section break attributes from ordinary attachments, preventing attachment body titles from entering the target document navigation; through a three-level mapping of directory nodes, attachment identifiers, and OpenXML fragments, as well as a necessary attachment check before generation, it avoids outputting a target document with a complete directory but missing attachments; it constructs independent target document packages for different sections and clones shared attachments separately, improving the consistency of multi-section output. Attached Figure Description

[0016] Figure 1This illustrates the overall architecture of the invention. The tender document parsing module provides text blocks, paragraph blocks, table blocks, document outlines, and tender section information to the directory generation module, and provides ordered elements of the main document to the attachment boundary recognition module. The directory generation module outputs a hierarchical directory, and the attachment boundary recognition module outputs a fragment index. The two form a three-level mapping in the directory node, attachment identifier, and OpenXML fragment mapping module; the mapping results are sequentially entered into the differentiation purification module, the target framework assembly module, and the independent structure checker.

[0017] Figure 2 This document illustrates the overall workflow for generating a tender document framework. The process begins with inputting the tender document, proceeding through document parsing, table of contents generation, attachment boundary identification, three-level mapping, and necessary attachment checks before entering fragment cleanup. If the mapping is incomplete, missing information is output and the generation of the corresponding tender segment is prevented; if the mapping is complete, the target body is assembled according to the table of contents order, inheriting relevant document components. Finally, an independent structure checker performs node-level verification and outputs the verified tender segment file.

[0018] Figure 3 This diagram illustrates the process of parsing and generating a table of contents for a tender document. The system extracts candidate headings from project basic information, bid section descriptions, tender document composition, scoring items, and format sections. It determines the hierarchy based on numbering, style, indentation, and context, and writes the parent node, sorting value, bid section scope, and attachment references for each node. This diagram demonstrates that the hierarchical table of contents is not a simple copy of the source outline, but rather a target assembly order formed by the semantic constraints of the tender document.

[0019] Figure 4 This demonstrates attachment boundary identification and the mapping relationship between directory attachments. Adjacent attachment identifiers in the source document body determine the start and end positions of fragments, and the normalized attachment identifiers serve as fragment index keys. Attachment references in directory nodes use the same normalization rule to query the index, thus forming a correspondence between directory nodes, attachment identifiers, and ordered sets of OpenXML elements. The mapping record also stores segment and source locations to support integrity checks and anomaly backtracking.

[0020] Figure 5 This demonstrates the differentiated cleanup process for cover attachments and regular attachments. Cover attachments enter the first branch, removing the attachment identifier but retaining tabs, line breaks, whitespace retention attributes, empty nodes, and section break controls. Regular attachments enter the second branch, removing the attachment identifier, navigation pollution styles, and embedded section break attributes, while maintaining the relative order of tables, merge relationships, runs, numbering, and media references. Both branches output cleaned fragments suitable for structure cloning.

[0021] Figure 6This demonstrates the document component inheritance, fragment assembly, and navigation reconstruction process. The target document package inherits styles, numbering, media, and relationship components from the source document. Directory nodes are converted into heading paragraphs with corresponding heading and outline levels, with actual pagination controls written before the headings. Cleaned fragments are injected immediately following the headings. The assembled body and inherited components are collectively encapsulated into the target document, which undergoes verification for heading, pagination, attachments, and relationship integrity. Detailed Implementation

[0022] The present invention will be further described below with reference to the accompanying drawings and embodiments. The embodiments are used to illustrate the collaborative relationship between directory semantic constraints, OpenXML fragment fidelity migration, and node-level validation performed by an independent structure checker, and are not intended to limit the steps to be performed in a specific order. Except for steps with data dependencies, some parsing, normalization, and validation operations can be performed in parallel. The overall processing architecture is as follows: Figure 1 As shown, the overall processing flow is as follows: Figure 2 As shown.

[0023] In one implementation, the processing object is a DOCX file conforming to the Open Packaging Convention. The system reads the main document components and their relational files, and establishes a reachable set of styles, numbering, media, and other referenced components. For paragraph, table, and section attributes in the main document body, XML elements are used as the migration unit, and attachments are not converted to plain text and redrawn.

[0024] Directory nodes can be represented as data objects containing node identifiers, parent node identifiers, hierarchy values, titles, section identifiers, attachment references, and sorting values. Attachment fragment indexes can be represented as mapping objects with normalized attachment identifiers as keys and start and end element positions and ordered set of elements as values. These objects can be stored in memory or serialized into intermediate files to support location and retries in case of generation failures.

[0025] For ease of understanding, the tab node referred to in this article corresponds to the w:tab element in WordprocessingML, the line break node corresponds to the w:br element in running text, the carriage return node corresponds to the w:cr element or paragraph mark, the whitespace preservation attribute corresponds to the xml:space="preserve" attribute on the w:t text element, the section break attribute corresponds to the w:sectPr element, the embedded section break attribute corresponds to the embedded w:sectPr in the paragraph attribute, the end section break attribute corresponds to the w:sectPr at the end of the paragraph, the bookmark node corresponds to the w:bookmarkStart and w:bookmarkEnd elements, the drawing element corresponds to the w:drawing element, the numbered reference corresponds to the numPr element in the paragraph attribute, the table grid corresponds to the tblGrid element, the table header row repeat attribute corresponds to the tblHeader attribute, and the page break control node corresponds to the w:br element with the type attribute value of page. The attachment fragment referred to in this article is an abbreviation for the OpenXML raw document structure fragment; the two are interchangeable. The Heading style referred to in this article is the built-in heading style in WordprocessingML, identified by Heading 1 to Heading N, which will enter the outline level of the target document's navigation pane. The runtime attribute sub-nodes correspond to the sub-elements under the runtime attribute element `rPr`, the number level sub-nodes correspond to the sub-elements of the `lvl` element in the numbering definition, and the VML shape corresponds to the `shape` element and its shape identifier attribute in the VML namespace. This correspondence will be used to interpret any mention of these nodes or attributes thereafter. The target document referred to in this document is the tender document framework document output by bid section.

[0026] Example 1: Extraction of Table of Contents and Attachment Fragments The system parses the input DOCX to obtain text, paragraphs, tables, and outline information. It identifies basic project information, bid sections, bid document composition, scoring criteria, formatted sections, and attachment identifiers. The attachment identifiers are standardized to form a set of attachment identifiers. The start and end positions of attachment fragments are located by adjacent rows of attachment identifiers, representing attachment fragments as ordered collections of XML elements. For example... Figure 3As shown, the catalog generation stage generates hierarchical catalog data based on the tender documents; the framework assembly stage performs validity checks on the input DOCX, reads the main document components and their main ordered elements, and identifies attachment identifiers and attachment fragments in the format chapters. Paragraphs, tables, and drawing elements are retained as original structural fragments for subsequent catalog mapping and assembly. For chapters on tender document composition, response document composition, or document format, the system determines the parent-child relationship based on numbering hierarchy, paragraph style, indentation relationship, and context headings. Each tender section forms a tender section node, first-level divisions form chapter nodes, entries under chapters form entry nodes, and sub-item requirements within entries form sub-entry nodes. Each node inherits the scope identifier of its tender section. Attachment identifier recognition can be achieved by combining text patterns and structural features. For example, first, the attachment prefix and its integer or connector-based number are identified from the paragraph text, and then ordinary references to attachments in the main text are excluded based on conditions such as the paragraph being located in a format chapter and having independent paragraph boundaries. The recognition results are standardized by unifying whitespace, connectors, and numbering. In the ordered element sequence of the main document body, the system records the element position corresponding to each attachment identifier line. The paragraphs, tables, and other text elements following the current identifier line and preceding the next identifier line constitute candidate fragments for the current attachment; the endpoint of the last attachment is before the main section attribute. The system also records the source location of the fragment for subsequent anomaly backtracking. For candidate fragments, further checks can be performed to ensure they contain at least a text paragraph, table, or image reference. Candidate fragments containing only blanks and unable to form template content are marked as pending review and are not directly used as usable attachments, thereby reducing the situation where the identifier is recognized but the actual template is missing.

[0027] Example 2: Directory Mapping and Segment Output Each entry in the table of contents is converted into a directory node, and the directory node records its level, title, section range, and attachment references. The corresponding segment is located from the attachment identifier set based on the attachment reference. For each section, the directory nodes for that section are filtered, and a new target document body is created. Necessary cover attachments are added first, then titles are created according to the table of contents order, and mapped segments are injected. For example... Figure 4As shown, the system traverses the directory tree, reads attachment references from each directory node, and queries the fragment index using normalized attachment identifiers. Upon successful query, the directory node identifier, attachment identifier, and fragment index item are bound as a mapping record; upon failed query, the node is added to the missing mapping set. In a single-section scenario, all nodes can be processed sequentially according to the directory sorting value. In a multi-section scenario, the required nodes for the current target document are first filtered based on the section identifier, and then the required attachment set for that section is calculated. Shared attachments are stored only once in the fragment index, and their XML elements are cloned separately when assembled into different sections to avoid sharing variable nodes across different target documents. The construction order of the target body can include the cover fragment, the table of contents title, and its corresponding ordinary attachment fragments. For directory nodes without attachment mappings but belonging to explanatory chapters, only the title and reserved text space are generated; for nodes explicitly requiring appendices or formatted attachments, missing mappings prevent the current section from being generated, and the node title, expected attachment identifier, and source formatted chapter position are output. Taking a single-section file as an example, the input directory contains three first-level sections, each with several entries, and the formatted chapters include a cover and multiple ordinary attachments. The system maps first-level sections to first-level headings, entries to second-level headings, and sub-items to third- or fourth-level headings; the cover section is written into the main body first, and the remaining attachments are written in the order of the table of contents nodes, thus making the generation order subject to the semantics of the table of contents rather than the order of the chapters in the source format.

[0028] Example 3: Cover Attachment Processing The attachment identifier line is deleted from the cover attachments, but the paragraph text is not merged and written back using iterative text processing; empty paragraphs, empty line nodes, tabs, line breaks, carriage returns, the xml:space attribute, embedded section break attributes, and the section break attribute at the end of a paragraph are retained. This preserves the relative position of the cover field and the page layout. Figure 5As shown in the cover attachment branch, the first cleanup strategy first locates and deletes attachment identifier lines and conflicting bookmarks used only for locating the source file, but does not traverse and merge adjacent running nodes. For running tab, line break, and carriage return nodes, their node type and original order are maintained; for text nodes with whitespace preservation attributes, this attribute is kept unchanged. Fields such as project name, project number, tenderer, bidder, and date in the cover may create visual spacing through empty runs, tab stops, and empty paragraphs. If empty nodes are deleted or tabs are replaced with spaces, the fields will be horizontally or vertically shifted. Therefore, the first cleanup strategy retains these nodes as layout control nodes, rather than deciding to delete them based on whether the visible text is empty. When the cover fragment contains embedded section break attributes or fragment end section break attributes, the system retains the paper orientation, margins, header / footer references, or next section start method related to the cover page layout. If the attributes conflict with the target document body, this can be resolved by copying the corresponding relational components and updating the relational identifier, rather than directly removing the section break attributes. In one verification method, the system records the number of tab nodes, line break nodes, whitespace retention attributes, and section break attribute presence status before and after cleanup. If any required retention node category is less after cleanup than before cleanup and does not belong to an explicitly deleted object, the cover fragment is marked as a fidelity verification failure, and writing to the target document is stopped.

[0029] Example 4: Processing of ordinary attachments For regular attachments, remove the attachment identifier line, remove the Heading style that leads to the target navigation, and remove embedded section break attributes within the regular attachment that should not control the entire target document; do not remove table grids, merged cells, running nodes, numbered references, or the order of body elements. Regular attachment fragments are injected immediately after the corresponding table of contents heading. For example... Figure 5As shown in the ordinary attachment branch, the second cleansing strategy removes attachment identifier lines and conflicting bookmarks used only for locating the source file, then checks the paragraph styles of each paragraph within the fragment. If the style is a heading style that will enter the target navigation, the style reference is removed or replaced with a non-heading style compatible with the appearance of the source text, but the text, formatting, numbered references, and embedded objects in the paragraph are preserved. For section attributes within ordinary attachments, the system distinguishes between body-level section attributes and embedded section attributes. Section attributes located within ordinary attachment fragments that may change the layout of subsequent target pages are removed; attachment tables, table grids, merged cells, borders, cell widths, and paragraph formatting nodes are not rebuilt due to this processing. For attachments containing automatic numbering, the system preserves the numbering references in the paragraphs and ensures that the target document package contains the referenced numbering definitions and related styles. For attachments containing images or other media, the system preserves drawing nodes and relationship identifiers, while including the corresponding media and relationship components in the inheritance set of the target document package. After the ordinary attachments are cleaned, they are written immediately after the corresponding directory title using a deep copy of the element tree. Since the written object remains the original structural element, the row and column order of the table, the merging relationships, and the relative positions of different formats within paragraphs remain unchanged; since the heading styles have been cleaned up, the target navigation only displays headings generated by the directory tree.

[0030] Example 5: Navigation and Pagination Restructuring Convert table of contents depths 1 through 4 to Heading 1 through Heading 4 respectively, and set the outline levels. For each table of contents heading, insert a real pagination control node (e.g., a w:br element with a type attribute of page) before the heading paragraph. Left-align the heading paragraphs, and retain the numbering prefix and descriptive text found in the table of contents. Remove the heading styles from the attachment body to prevent attachment content from cluttering the target navigation. For example... Figure 6As shown, the system selects the target heading style based on the hierarchy value of the directory nodes and simultaneously sets the outline level. When the directory depth is one to four, it can correspond to heading levels one to four respectively. When the source directory level exceeds the heading level allowed by the target document, deep nodes can be merged or mapped to body paragraphs according to preset rules, but the parent-child order should be maintained. A real page break formed by page break control elements is inserted before each target heading, instead of simply pushing the heading to the next page with consecutive empty paragraphs. The heading paragraphs are left-aligned, and the numbering prefix and descriptive text in the directory are retained to maintain consistency between the body headings, navigation pane, and directory semantics. The fragment writing order is page break control, heading paragraph, and mapped attachment fragment. The system does not insert another page break between the heading and attachment fragments, thus ensuring that the attachment template follows its corresponding heading. For the cover fragment, it can be placed before the directory heading sequence according to a preset position, while retaining its own section control. To avoid style identifier conflicts in different documents, the target document inherits style components and numbered components based on the source document package. If the generator adds a new heading style, it uses an identifier that does not conflict with existing style identifiers and references that identifier in the main document; if a usable heading style already exists in the source document, it is reused directly. In one implementation, the target document package performs normalization processing on the WordprocessingML XML component before output: adjusting the order of the running attribute child nodes according to the sequence specified by the WordprocessingML schema; adjusting the order of the numbering level child nodes in the numbering definition; removing duplicate attributes from table header rows to avoid duplicate table headers for tables spanning multiple pages in the target document; and assigning unique shape identifiers to VML shapes to avoid shape identifier conflicts when different sections are output. The above normalization processing only adjusts the node order or identifier values ​​and does not change the visible content or layout of the document.

[0031] Example 6: Verifying the Closed Loop After generation, the system counts the number of headings, headings at all levels, pagination control nodes, attachment identifiers, the presence of numbered components, and document structure errors. The results are compared with the table of contents and attachment mapping table; if missing or discrepancies are found, the issue is located at the table of contents node, attachment identifier, or fragment boundary. This verification is not solely based on the self-readable output of the generation program.

[0032] Example 7: Reuse of shared attachments across multiple bidding sections When an input file contains multiple sections and some attachments are shared, the system performs attachment boundary identification only once on the source format section, forming a global read-only fragment index. Each section maintains its own set of directory nodes and required attachments; during assembly, the corresponding fragments are retrieved from the global index and a deep copy is performed, ensuring that nodes, relationships, and subsequent modifications in each target document are independent. For attachments applicable only to a specific section, the mapping record carries the section range, and this mapping is not retrieved during the directory filtering stage of other sections. Thus, while maintaining the efficiency of shared attachment reuse, it avoids writing format errors specific to a particular section into other section files.

[0033] Example 8: Missing Mapping and Recovery Processing When an attachment referenced by the target directory does not appear in the fragment index, the system does not use a blank template as a substitute, nor does it skip the node to continue assembling the target document. Instead, it outputs the missing attachment identifier and the corresponding directory title and stops assembling the corresponding target document. Missing mapping is blocked separately for each bid segment, only preventing the output of the affected bid segment and not affecting the assembly of other bid segments. After the user corrects the directory reference or source document, the attachment mapping and assembly can be re-executed. When the reason for the missing is a difference in the writing of the attachment identifier, the normalization rules can be extended to convert full-width and half-width connectors, whitespace before and after numbering, or synonymous prefixes into a unified form. When the reason for the missing is that the source file does not have a template, the abnormal result remains in a missing state to avoid the system automatically generating a substitute attachment that is inconsistent with the bidding format.

[0034] Example 9: Electronic Equipment This invention can also be implemented by an electronic device. The electronic device includes a processor, a memory, and program instructions stored in the memory and executable by the processor. When the processor executes the program instructions, it completes tasks such as tender document parsing, directory generation, attachment boundary identification, three-level mapping, differential cleanup, target document assembly, and node-level verification performed by an independent structure checker. The processor, memory, and file storage device can be located in the same computer or deployed across multiple computing nodes connected via a network; the functional modules can be deployed in a combined or independent manner, as long as their data transfer relationships enable the above-described methods.

[0035] Alternative implementation methods The semantic generation of the directory can employ rule engines, statistical models, machine learning models, language models, or combinations thereof; attachment identification, in addition to text patterns, can also combine paragraph styles, numbering attributes, font attributes, and page positions. These alternative methods change the semantic extraction techniques but do not alter the processing relationship of the directory nodes constraining the assembly of attachment fragments. The cover attachment set can be configured based on attachment number, attachment name, or layout structure features; for example, attachments 1-0, 2-1, and 3-1 can be configured as cover attachments. The target document, in addition to DOCX, can also be an office document package capable of expressing equivalent styles, numbering, media relationships, and sectioning structures. Node-level verification is performed by a separate command-line tool or structure validator. Without departing from the technical concept of this invention, directory hierarchy mapping rules, attachment identification normalization rules, cleanup rules, and verification rules can all be configured. Combinations of different rules should still satisfy: constraining the output structure with directory nodes, using source structure fragments as attachment templates, differentiating by attachment type, and performing structure verification after output. Node-level verification is performed before and after generation. Pre-generation verification includes source document readability, directory node integrity, required attachment set, and mapping integrity; if any blocking condition is not met, the final file for the corresponding section is not created. After generation, the target document package is reopened, and the following statistics are collected: level 1 to 4 headings, heading pre-page break controls, attachment identifier residues, Heading style residues, numbered components, and media relationships. The heading statistics are compared with the directory node set, the attachment statistics are compared with the required attachment set for that section, and relationship references are checked to see if their target components actually exist. When discrepancies are found during verification, the system backtracks based on the mapping records retained during generation. For example, missing headings can be located at the directory node, missing attachments can be located at the normalized attachment identifier and source segment boundary, and broken media relationships can be located at the attachment segment containing the corresponding drawing node. Abnormal results include at least the abnormality type, section, directory node, attachment identifier, and processing stage. The determination of whether verification passes is based on the structural check results, not on the natural language description or a single return message output by the generation program. The target document can also be checked by the OpenXML structure validator and opened by office software; the above checks together form a closed loop of generation, verification, location and retry.

Claims

1. A method for generating a tender document framework based on directory semantic constraints and OpenXML fragment fidelity, characterized in that, include: Obtain the tender documents and the hierarchical directory data generated by the directory generation stage based on the tender documents. The hierarchical directory data includes section nodes, chapter nodes, entry nodes and sub-entry nodes, and records the directory depth, parent-child relationship, belonging section, sorting value and attachment references. Read the main document component of the tender document and obtain an ordered set of elements in the document body of the main document component, wherein the ordered set of elements includes paragraph elements, table elements and drawing elements; In the format section of the tender document, identify the attachment identifier line, determine the attachment boundary according to the position of adjacent attachment identifier lines, assemble the document elements within each attachment boundary into an ordered OpenXML raw document structure fragment, and establish an attachment fragment index using standardized attachment identifiers; Based on the attachment references in the hierarchical directory data, query the attachment fragment index, establish the mapping relationship between directory nodes, standardized attachment identifiers and OpenXML raw document structure fragments, and stop the assembly of the corresponding target document and output the missing attachment identifier when there are unmapped items in the referenced attachments; Differential cleanup is performed on the mapped OpenXML raw document structure fragments according to the attachment type. Specifically, a first cleanup strategy is adopted to retain the layout control node for the pre-configured cover attachment set, and a second cleanup strategy is adopted to remove attachment identifier lines, embedded section attributes and Heading style references that will enter the target document navigation for ordinary attachments other than the cover attachment set. Based on the document package of the tender document, construct a target document package. Generate a target document title structure with heading level, outline level and real pagination control node according to the hierarchical directory data. Write the cleaned OpenXML original document structure fragment after its mapped target document title through XML element tree cloning. Output at least one target document according to the bid section range in the hierarchical directory data. The output target document is submitted to an independent structure checker, which is a structure verification tool deployed independently of the program that generated the target document. The checker checks heading levels, heading pagination control, attachment mapping, attachment body heading style navigation pollution, and document structure constraints, and outputs the check results.

2. The method according to claim 1, characterized in that, The identification of the attachment identifier line and the establishment of the attachment fragment index include: Candidate identifiers containing attachment prefixes and integer numbers or hierarchical numbers with connectors are identified from the paragraph text of the formatted chapters. The whitespace and connectors in the candidate identifiers are standardized to obtain standardized attachment identifiers. The document elements from the current attachment identifier line to the next attachment identifier line are defined as the current attachment fragment, and the end of the formatted section is used as the boundary of the last attachment fragment.

3. The method according to claim 1, characterized in that, Also includes: When the attachment identifier referenced by the target document does not appear in the attachment fragment index, the missing attachment identifier and its corresponding directory title are output, and the assembly of the target document referencing the attachment is prevented.

4. The method according to claim 1, characterized in that, The first purification strategy includes: Remove the attachment identifier line and bookmark node from the fragment pre-configured as a cover attachment; Preserve at least one of the following attributes in the fragment: empty paragraph, empty run node, tab node, newline node, carriage return node, whitespace preservation attribute, embedded section break attribute, and fragment end section break attribute; Maintain the relative order of the running nodes and the layout control nodes, and do not perform text merging, blank folding, empty node deletion, or tab replacement on the cover attachments.

5. The method according to claim 1, characterized in that, The second purification strategy includes: Remove the attachment identifier line and bookmark node from a regular attachment fragment; Remove the embedded section attribute from ordinary attachment fragments, and remove the Heading style reference when the paragraph element of the fragment has a Heading style reference that will enter the target document navigation; Maintain the relative order of table elements, table grids, cell merge relationships, paragraph elements, running elements, numbered reference elements, drawing elements, and body text elements that were not deleted by the cleanup operation.

6. The method according to claim 1, characterized in that, The generation of the target document title structure includes: According to the sorting value in the hierarchical directory data, traverse the directory nodes corresponding to each section, map the directory depths one to four to the first to fourth level heading styles respectively, and set the corresponding outline level by the heading styles. Insert a real pagination control node formed by pagination control elements before each target document title, set the target document title to left alignment, and preserve the number prefix and title text in the hierarchical directory data; Write the target document body in the order of the actual pagination control node, the target document title, and the cleaned OpenXML raw document structure fragment, so that the OpenXML raw document structure fragment is immediately followed by its mapped target document title.

7. The method according to claim 1, characterized in that, The construction of the target document package includes: Based on the document package of the tender document, copy its document package components and replace the target document body; The purified OpenXML original document structure fragments are written into the target document body using the XML element tree cloning method; Perform normalization processing on the WordprocessingML XML component in the target document package. The normalization processing includes at least one of adjusting the order of run attribute child nodes, adjusting the order of number level child nodes, removing duplicate attributes from table header rows, and assigning non-repeating shape identifiers to VML shapes. When outputting target documents for different sections, construct independent target document packages for each section.

8. The method according to claim 1, characterized in that, Also includes: After generating the target document, an independent structure inspector is used to analyze the headings at all levels, the pagination control nodes before the headings, the mapping results of attachment fragments, and the residual heading styles in the attachment body text. The structural legality of the target document package is also checked, and the inspection results are output as a verification report.

9. A tender document framework generation device based on directory semantic constraints and OpenXML fragment fidelity, characterized in that, include: The directory generation module is used to generate hierarchical directory data based on the tender documents; The tender document parsing module is used to read the main document component of the tender document and output an ordered set of elements in the document body, which includes paragraph elements, table elements and drawing elements. The attachment boundary recognition module is used to identify and standardize attachment identifiers in the format section, determine attachment boundaries based on adjacent attachment identifier lines and the end position of the format section, and establish an attachment fragment index between the attachment identifier and the OpenXML original document structure fragment; The directory node, attachment identifier, and OpenXML fragment mapping module is used to query the attachment fragment index based on the attachment references in the hierarchical directory data, establish the mapping relationship between directory nodes, normalized attachment identifiers, and OpenXML raw document structure fragments, and stop the assembly of the corresponding target document when there are unmapped attachments. The differentiated cleanup module is used to perform a first cleanup strategy of preserving layout control nodes on a pre-configured set of cover attachments, and a second cleanup strategy of removing attachment identifier lines, embedded section attributes, and Heading style references that will enter the target document navigation on ordinary attachments. The target framework assembly module is used to generate the target document title structure and actual pagination control nodes based on the document package of the tender document, write the cleaned OpenXML original document structure fragment through XML element tree cloning, perform normalization processing on the WordprocessingML XML component in the target document package, and output the target document according to the bid section range in the hierarchical directory data. The independent structure checker interface is used to call a structure verification tool deployed independently of the program that generates the target document. This tool performs checks on the output target document for headings, pagination, attachment mapping, attachment text navigation contamination, and document structure, and outputs the verification results.

10. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores program instructions that, when executed by the processor, implement the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • A tender document generation system and method in the field of government affairs

    CN110232177B

  • Bidding document automatic generation method, management method, medium and computer

    CN112651218A