Word document format conversion method and system capable of configuring rules and cooperating with natural language

By combining templated parameters and natural language descriptions, the complexity of converting unstyled Word documents is solved, achieving efficient conversion with unified formatting and editable mathematical formulas.

CN121706728APending Publication Date: 2026-03-20CCCC SECOND HARBOR ENGINEERING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511824281.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-05
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing technologies are ineffective at handling poorly formatted, unstyled Word documents, and existing methods require high levels of user skill, resulting in time-consuming, labor-intensive, and error-prone document format conversion.

Method used

A method combining configurable rules and natural language is adopted to obtain the target format through two approaches: templated parameter input and natural language description. Combined with a document parsing library, HTML tree structure transformation, and deep style reconstruction, the document format is standardized.

Benefits of technology

It achieves intelligent format standardization for Word documents without styles, lowers the user's operating threshold, ensures format consistency and the editability of mathematical formulas, and improves conversion efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121706728A_ABST
    Figure CN121706728A_ABST
Patent Text Reader

Abstract

The invention discloses a Word document format conversion method capable of configuring rules and cooperating with a natural language, which comprises the following steps of: S1, configuring a document format, and obtaining a structured parameter of a target format; s2, carrying out Word document analysis and structured conversion; s3, reconstructing a depth style of the HTML document; and S4, converting the processed HTML document into a docx format file, performing format conversion on the LaTeX code in the document, converting the LaTeX code into an Office mathematical formula object, and finally outputting a standardized Word document. The original Word documents in various formats can be processed, the standard Word documents output after processing do not have the situation of format disorder or content loss, and the problems that in traditional document format conversion, operation is complex, formats are not uniform, and formulas cannot be edited are effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of document intelligent processing technology, specifically relating to a method and system for automated conversion of Word document formats that integrates configurable rules and natural language processing (NLP). Background Technology

[0002] Currently, various industries have strict and diverse requirements for document formatting, covering numerous elements such as titles, body text, charts, captions, and formulas. However, in practice, problems such as chaotic document formatting and inconsistent styles are common. An even more serious challenge lies in the fact that when existing documents need to be migrated entirely to a new format template, the standardization process involves a massive amount of manual adjustments—including correcting text styles, image sizes, table styles, formula formats, and caption numbering one by one. This is not only extremely time-consuming and labor-intensive but also highly error-prone. For large documents that often run to hundreds of pages, the formatting update work is daunting, becoming a heavy burden in document management.

[0003] Existing document conversion technology research and applications mainly focus on efficient conversion between different file formats (such as Word to PDF / XML or other formats to Word), but generally neglect the core requirement of standardized conversion of Word's internal style formatting, especially for "unstyled documents" lacking built-in style information. Related patents on generating Word documents mostly rely on preset templates and highly structured input data to generate new documents, failing to effectively parse and process existing, poorly formatted, unstyled documents. Attempts to automate formatting adjustments through Word scripts or macros place excessive demands on the programming skills of ordinary users, creating a high operational barrier, and the processing results for complex and diverse unstyled documents are difficult to guarantee in terms of consistency and accuracy. Therefore, there is an urgent need for an end-to-end format standardization conversion method that can intelligently process unstyled documents, support flexible rule configuration, and lower the operational barrier for users. Summary of the Invention

[0004] To achieve these objectives and other advantages according to the present invention, the present invention provides a configurable rule-based Word document format conversion method in conjunction with natural language, comprising the following steps: S1. Document Format Configuration It provides two configuration methods: templated parameter input and natural language description, allowing users to customize the target format and obtain structured parameters of the target format. S2, Word document parsing and structured conversion The uploaded original Word document is parsed using a document parsing library and converted into an HTML tree structure. The text is converted into HTML paragraph tags, the formulas are extracted into LaTeX code using the MathType API, and the tables and images retain the DOM node structure. S3, Deep Style Refactoring of HTML Documents The basic style cleaning, image normalization, table normalization, multi-level heading recognition and numbering, chart numbering refresh and style injection operations are performed sequentially to complete the structure optimization and format adaptation of the HTML document; S4, HTML to Word format conversion (fidelity). The processed HTML document is converted into a docx format file. The LaTeX code in the document is then converted into an Office mathematical formula object, and finally a standardized Word document is output.

[0005] Preferably, in step S1, the templated parameter input specifically involves: in the preset template interface, users can manually configure format attributes, including font style, font size, alignment, paragraph indentation, line spacing, paragraph spacing, chart title numbering format, and color; the natural language description configuration specifically involves: integrating a large language model to perform semantic parsing on Chinese natural language instructions, mapping the format requirements contained in the Chinese natural language instructions to structured parameters consistent with the templated parameter input, wherein the Chinese natural language instructions include descriptive instructions for the format of specific document elements.

[0006] Preferably, in step S3, the basic style cleaning specifically includes: first, removing the inline style attributes of all HTML tags; and then, using a DOM tree traversal algorithm, deleting tags with empty content and redundant tags.

[0007] Preferably, the image normalization process in step S3 specifically includes: S321, Traverse using DOM tree analysis algorithm When two or more consecutive and adjacent tags are detected... When the interval between tags is less than one character width, it is determined to be a continuous image group; S322. Check the parent node of the consecutive image group. If the parent node is not... <figure>Tags or If a tag is added, a standard image group container will be automatically created to enclose the continuous image group. S323. Traverse the adjacent text nodes of consecutive image groups downwards, and use regular expressions to match the image names. If a match is successful, associate the image name with the image group; if a match fails, generate a temporary image name marker highlighted in red. S324. Set the image processing whitelist in the table, when... The label is located at

[0008] When inside a tag, operations S321 to S323 are not performed. Preferably, the table standardization process described in step S3 specifically includes: S331, locating the HTML tree structure... Tag, remove Non-table structure elements inside the tag; S332, traversing upwards. The text nodes adjacent to the tag are matched with the table name using regular expressions. If a match is found, the table name is inserted. Within the label In the tag; if a match fails, a temporary table name with a blue background is generated, and the data is inserted. The label includes a prompt.

[0009] Preferably, the multi-level title identification and numbering in step S3 specifically includes: S341, Locating the HTML tree structure <h>Explicit heading tags, extracted using regular expressions <h>The heading number within the explicit heading tag, and the verification number. <h>To ensure consistency in explicit heading levels, the serial number should be consistent with the level. <h>Explicit title tag text is stored in the candidate title set; S342, Locating the HTML tree structure Paragraph tags, scanned using regular expressions Does the text within the paragraph tag contain potential heading numbers? If not included, skip; If included, an NLP model is invoked to calculate the title confidence score based on semantic independence, word count reasonableness, and contextual coherence, filtering titles with confidence scores higher than a preset threshold. The paragraph label text is further verified to confirm the hierarchical continuity between its sequence number and the candidate heading set sequence number; those that meet the requirements will be... Paragraph label text is stored in the candidate body title set; S343. Using a dynamic programming algorithm, with the goal of minimizing title hierarchy breaks and maximizing structural coherence, we traverse the candidate title set and the candidate body title set, calculate the globally optimal title selection path, and determine the complete optimal title set. S344. Initialize the multi-level counter array, update the multi-level counter array and generate numbers according to the order of appearance of titles in the optimal title set, following the state machine principle: When a first-level heading is detected for the first time, the first value of the multi-level counter array is incremented by 1 and a corresponding first-level heading number is generated. When a lower-level heading is detected, the current level counter is initialized to 1 based on the current value of the upper-level counter and a level number is generated. When a sibling heading is detected, the current level counter is incremented by 1 and the number is updated. When a parent heading is detected, the lower-level counter is cleared to zero, the upper-level counter is incremented by 1, and a new parent heading number is generated.

[0010] Preferably, the NLP model in step S342 calculates the title confidence score by: semantic independence being quantified by the frequency of occurrence of general terms in the text; word count reasonableness being determined by judging whether the number of characters in the text is within a preset threshold range; and contextual coherence being determined by calculating the topic similarity between the text and adjacent paragraphs; the hierarchical continuity verification specifically involves: The tag text number is compared hierarchically with the number of the most recent title in the candidate title set. If... If the tag text number is the same level or direct subordinate number of the nearest number in the candidate title set, the hierarchy is considered continuous; otherwise, it is considered discontinuous.

[0011] Preferably, the chart number refresh in step S3 specifically includes: S351. Read the chart number bound to the title level configured by the user in step S1. The bound title level includes a first-level title and a second-level title. S352. Traverse the HTML document tree by bound heading level, and initialize the figure counter and table counter in each bound level chapter respectively; S353, When detected <figcaption>When tagging, generate a construction number string based on the chapter number (e.g., "3.2") and the current count value.

[0012] This invention also provides a configurable rule-based and natural language collaborative Word document format standardization conversion system, comprising: The document format configuration module provides two configuration methods: templated parameter input and natural language description, allowing users to customize the target format and obtain the structured parameters of the target format. The Word document parsing and structure conversion module uses a document parsing library to parse the uploaded original Word document and convert it into an HTML tree structure. The text is converted into HTML paragraph tags, the formulas are extracted into LaTeX code through the MathType API, and the tables and images retain the DOM node structure. The HTML document undergoes deep style reconstruction, sequentially performing basic style cleaning, image normalization, table standardization, multi-level heading recognition and numbering, chart numbering refresh, and style injection operations to complete the structural optimization and format adaptation of the HTML document. The HTML to Word format fidelity conversion module converts the processed HTML document into a docx format file, performs format conversion on the LaTeX code in the document, converts it into Office mathematical formula objects, and finally outputs a standardized Word document.

[0013] This invention offers at least the following advantages: It can process raw Word documents in various formats, including PDF documents converted to Word format without built-in styles. By reconstructing the semantic hierarchy through a structural analysis engine, this invention supports colloquial commands and rule templates, reducing the barriers to using professional tools. The resulting standardized Word document conforms to the user-defined target format for all its elements, and mathematical formulas within the document can be directly edited in Office software without formatting errors or content loss. This effectively solves the problems of complex operations, inconsistent formats, and uneditable formulas in traditional document format conversion, improving the efficiency and accuracy of Word document format standardization processing.

[0014] Other advantages, objectives and features of the present invention will become apparent in part from the following description, and in part from those skilled in the art through study and practice of the invention. Attached Figure Description

[0015] Figure 1 This is a flowchart illustrating the Word document format conversion method of the present invention. Detailed Implementation

[0016] The present invention will now be described in further detail with reference to the accompanying drawings, so that those skilled in the art can implement it based on the description.

[0017] The following description is intended to disclose the present invention and enable those skilled in the art to implement it. The preferred embodiments described below are merely examples, and other obvious modifications will occur to those skilled in the art. The basic principles of the invention defined in the following description can be applied to other embodiments, modifications, improvements, equivalents, and other technical solutions that do not depart from the spirit and scope of the invention.

[0018] Those skilled in the art should understand that, in the disclosure of this invention, the terms "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the above terms should not be construed as limiting this invention.

[0019] It is understood that the term "a" should be understood as "at least one" or "one or more", that is, in one embodiment, the number of an element can be one, while in another embodiment, the number of the element can be multiple, and the term "a" should not be understood as a limitation on the number.

[0020] like Figure 1 As shown, a preferred embodiment of the present invention provides a Word document format conversion method with configurable rules and natural language collaboration, comprising the following steps: S1. Document Format Configuration It provides two configuration methods: templated parameter input and natural language description, allowing users to customize the target format and obtain structured parameters of the target format. In practice, the system provides two entry points on the user interface: templated parameter configuration and natural language input. If the user selects templated parameter input, clicking the corresponding entry will display a list of configuration items including level 1 to N headings, body text, formulas, tables, images, and chart titles. Each configuration item has an attribute setting bar; for example, users can select options like regular, bold, and italic in the font style bar, and choose values ​​like 12 or 14 in the font size bar. If the user selects natural language description, entering a Chinese command such as setting a level 3 heading to 14-point bold and left-aligned will cause the system's built-in processing module to perform semantic analysis, extract the element types (level 3 heading, body text) and corresponding format attributes, convert them into structured parameters consistent with the templated parameter input format, and store them.

[0021] S2, Word document parsing and structured conversion The uploaded original Word document is parsed using a document parsing library and converted into an HTML tree structure. The text is converted into HTML paragraph tags, the formulas are extracted into LaTeX code using the MathType API, and the tables and images retain the DOM node structure. The original Word document can be an unstyled Word document converted from a PDF.

[0022] S3, Deep Style Refactoring of HTML Documents The basic style cleaning, image normalization, table normalization, multi-level heading recognition and numbering, chart numbering refresh and style injection operations are performed sequentially to complete the structure optimization and format adaptation of the HTML document; S4, HTML to Word format conversion (fidelity). The processed HTML document is converted into a docx format file. The LaTeX code in the document is then converted into an Office mathematical formula object, and finally a standardized Word document is output.

[0023] This invention can process raw Word documents in various formats, including PDF documents converted to Word without built-in styles. It reconstructs the semantic hierarchy through a structural analysis engine, supports conversational commands and rule templates, lowers the barrier to using professional tools, and outputs standardized Word documents whose elements conform to the user-defined target format. Furthermore, mathematical formulas in the document can be directly edited in Office software without formatting errors or content loss. This effectively solves the problems of complex operations, inconsistent formatting, and uneditable formulas in traditional document format conversion, improving the efficiency and accuracy of Word document format standardization processing.

[0024] In another technical solution, in step S1, the input of the templated parameters specifically involves: in the preset template interface, users can manually configure format attributes, including font style, font size, alignment, paragraph indentation, line spacing, paragraph spacing, chart title numbering format and color; the configuration of the natural language description specifically involves: integrating a large language model to perform semantic parsing on Chinese natural language instructions, mapping the format requirements contained in the Chinese natural language instructions to structured parameters consistent with the input of the templated parameters, wherein the Chinese natural language instructions include descriptive instructions for the format of specific document elements.

[0025] In the above technical solution, users can flexibly choose the format configuration method according to their own operating habits and needs. Users unfamiliar with professional format parameter settings can complete the configuration through simple, conversational Chinese commands; users familiar with parameter configuration can achieve more refined format definitions through template-based input. Both methods ultimately generate structured parameters with a unified format, providing a consistent standard for subsequent document format reconstruction, reducing the barrier to using professional tools, and ensuring the accuracy and comprehensiveness of format configuration.

[0026] In another technical solution, step S3, the basic style cleaning, specifically includes: first, removing the inline style attributes of all HTML tags; then, using a DOM tree traversal algorithm, deleting tags with empty content and redundant tags.

[0027] In the above technical solution, all empty and redundant tags with no practical meaning in the document are removed, simplifying the structure of the HTML document and reducing the amount of document data. This not only reduces the computational load of subsequent image normalization and table standardization operations, but also... In another technical solution, the image normalization processing in step S3 specifically includes: S321, Traverse using DOM tree analysis algorithm When two or more consecutive and adjacent tags are detected... When the label interval is less than 1 character width, it is determined to be a continuous image group; S322, check the parent node of the continuous image group, if the parent node is not... <figure>Tags or If a tag is added, a standard image group container will be automatically created to enclose the continuous image group. S323. Traverse downwards through adjacent text nodes of consecutive image groups, using regular expressions to match image names. If a match is successful, associate the image name with the image group; if a match fails, generate a temporary image name marker highlighted in red. S324. Set an image processing whitelist within the table. The label is located at

[0028] When inside a tag, operations S321 to S323 are not performed. In another technical solution, the table standardization processing described in step S3 specifically includes: S331, locating the table within the HTML tree structure. Tag, remove Non-table structure elements inside the tag; S332, traversing upwards. The text nodes adjacent to the tag are matched with the table name using regular expressions. If a match is found, the table name is inserted. Within the label In the tag; if a match fails, a temporary table name with a blue background is generated, and the data is inserted. The label includes a prompt.

[0029] The above technical solution uses table standardization to remove unnecessary elements inside the `` tag, ensuring the simplicity and standardization of the table structure and preventing irrelevant elements from interfering with the normal display of the table and subsequent formatting configuration. At the same time, accurate matching and supplementation of table names ensures that each table has a corresponding title identifier, and the generation of temporary table names prompts users to promptly supplement missing table names, solving the problem of tables without titles or with confusing titles.

[0030] In another technical solution, the multi-level title recognition and numbering in step S3 specifically includes: S341, Locating the HTML tree structure <h>Explicit heading tags, extracted using regular expressions <h>The heading number within the explicit heading tag, and the verification number. <h>To ensure consistency in explicit heading levels, the serial number should be consistent with the level. <h>Explicit title tag text is stored in the candidate title set; S342, Locating the HTML tree structure Paragraph tags, scanned using regular expressions Does the text within the paragraph tag contain potential heading numbers? If not included, skip; If included, an NLP model is invoked to calculate the title confidence score based on semantic independence, word count reasonableness, and contextual coherence, filtering titles with confidence scores higher than a preset threshold. The paragraph label text is further verified to confirm the hierarchical continuity between its sequence number and the candidate heading set sequence number; those that meet the requirements will be... Paragraph label text is stored in the candidate body title set; S343. Using a dynamic programming algorithm, with the goal of minimizing title hierarchy breaks and maximizing structural coherence, we traverse the candidate title set and the candidate body title set, calculate the globally optimal title selection path, and determine the complete optimal title set. S344. Initialize the multi-level counter array, update the multi-level counter array and generate numbers according to the order of appearance of titles in the optimal title set, following the state machine principle: When a first-level heading is detected for the first time, the first value of the multi-level counter array is incremented by 1 and a corresponding first-level heading number is generated. When a lower-level heading is detected, the current level counter is initialized to 1 based on the current value of the upper-level counter and a level number is generated. When a sibling heading is detected, the current level counter is incremented by 1 and the number is updated. When a parent heading is detected, the lower-level counter is cleared to zero, the upper-level counter is incremented by 1, and a new parent heading number is generated.

[0031] In another technical solution, the NLP model in step S342 calculates the title confidence score, specifically as follows: semantic independence is quantified by the frequency of occurrence of general terms in the text; word count reasonableness is determined by judging whether the number of characters in the text is within a preset threshold range; contextual coherence is determined by calculating the topic similarity between the text and the preceding and following paragraphs; the hierarchical continuity verification specifically involves: The tag text number is compared hierarchically with the number of the most recent title in the candidate title set. If... If the tag text number is the same level or direct subordinate number of the nearest number in the candidate title set, the hierarchy is considered continuous; otherwise, it is considered discontinuous.

[0032] In another technical solution, the chart number refresh mentioned in step S3 specifically includes: S351. Read the chart number bound to the title level configured by the user in step S1. The bound title level includes a first-level title and a second-level title. S352. Traverse the HTML document tree by bound heading level, and initialize the figure counter and table counter in each bound level chapter respectively; S353, When detected <figcaption>When tagging, generate a construction number string based on the chapter number (e.g., "3.2") and the current count value.

[0033] This invention also provides a configurable rule-based and natural language collaborative Word document format standardization conversion system, comprising: The document format configuration module provides two configuration methods: templated parameter input and natural language description, allowing users to customize the target format and obtain the structured parameters of the target format. The Word document parsing and structure conversion module uses a document parsing library to parse the uploaded original Word document and convert it into an HTML tree structure. The text is converted into HTML paragraph tags, the formulas are extracted into LaTeX code through the MathType API, and the tables and images retain the DOM node structure. The HTML document undergoes deep style reconstruction, sequentially performing basic style cleaning, image normalization, table standardization, multi-level heading recognition and numbering, chart numbering refresh, and style injection operations to complete the structural optimization and format adaptation of the HTML document. The HTML to Word format fidelity conversion module converts the processed HTML document into a docx format file, performs format conversion on the LaTeX code in the document, converts it into Office mathematical formula objects, and finally outputs a standardized Word document.

[0034] Although embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and embodiments. They can be applied to various fields suitable for the present invention. For those skilled in the art, other modifications can be easily made. Therefore, without departing from the general concept defined by the claims and their equivalents, the present invention is not limited to the specific details and illustrations shown and described herein.< / figcaption> < / h> < / h> < / h> < / h> < / figure> < / figcaption> < / h> < / h> < / h> < / h> < / figure>

Claims

1. A method for converting Word document formats using configurable rules and natural language processing, characterized in that, Includes the following steps: S1. Document Format Configuration It provides two configuration methods: templated parameter input and natural language description, allowing users to customize the target format and obtain structured parameters of the target format. S2, Word document parsing and structured conversion The uploaded original Word document is parsed using a document parsing library and converted into an HTML tree structure. The text is converted into HTML paragraph tags, the formulas are extracted into LaTeX code using the MathType API, and the tables and images retain the DOM node structure. S3, Deep Style Refactoring of HTML Documents The basic style cleaning, image normalization, table normalization, multi-level heading recognition and numbering, chart numbering refresh and style injection operations are performed sequentially to complete the structure optimization and format adaptation of the HTML document; S4, HTML to Word format conversion (fidelity). The processed HTML document is converted into a docx format file. The LaTeX code in the document is then converted into an Office mathematical formula object, and finally a standardized Word document is output.

2. The configurable rule-based and natural language collaborative Word document format conversion method according to claim 1, characterized in that, In step S1, the templated parameter input specifically involves: in the preset template interface, users can manually configure format attributes, including font style, font size, alignment, paragraph indentation, line spacing, paragraph spacing, chart title numbering format, and color; the natural language description configuration specifically involves: integrating a large language model to perform semantic parsing on Chinese natural language instructions, mapping the format requirements contained in the Chinese natural language instructions to structured parameters consistent with the templated parameter input, wherein the Chinese natural language instructions include descriptive instructions for the format of specific document elements.

3. The Word document format conversion method with configurable rules and natural language collaboration according to claim 1, characterized in that, In step S3, the basic style cleaning specifically includes: first, removing the inline style attributes of all HTML tags; and then, using a DOM tree traversal algorithm, deleting tags with empty content and redundant tags.

4. The Word document format conversion method with configurable rules and natural language collaboration according to claim 1, characterized in that, The image normalization process described in step S3 specifically includes: S321, Traverse using DOM tree analysis algorithm When two or more consecutive and adjacent tags are detected... When the interval between tags is less than one character width, it is determined to be a continuous image group; S322. Check the parent node of the consecutive image group. If the parent node is not... <figure>Tags or If a tag is added, a standard image group container will be automatically created to enclose the continuous image group. S323. Traverse the adjacent text nodes of consecutive image groups downwards, and use regular expressions to match the image names. If a match is successful, associate the image name with the image group; if a match fails, generate a temporary image name marker highlighted in red. S324. Set the image processing whitelist in the table, when... The label is located at 5. The configurable rule-based and natural language collaborative Word document format conversion method according to claim 1, characterized in that, The table standardization process described in step S3 specifically includes: S331, Locating the HTML tree structure When inside a label, operations S321 to S323 are not executed. Tag, remove S332, Traversing Upwards Non-table structure elements inside the tag; The text nodes adjacent to the tag are matched with the table name using regular expressions. If a match is found, the table name is inserted. Within the label In the tag; if a match fails, a temporary table name with a blue background is generated, and the data is inserted. The label includes a prompt.

6. The Word document format conversion method with configurable rules and natural language collaboration according to claim 1, characterized in that, The multi-level heading identification and numbering described in step S3 specifically includes: S341, Locating the HTML tree structure <h>Explicit heading tags, extracted using regular expressions <h>The heading number within the explicit heading tag, and the verification number. <h>To ensure consistency in explicit heading levels, the serial number should be consistent with the level. <h> Explicit title tag text is stored in the candidate title set;< / h> < / h> < / h> < / h> S342, Locating the HTML tree structure Paragraph tags, scanned using regular expressions Does the text within the paragraph tag contain potential heading numbers? If not included, skip; If included, an NLP model is invoked to calculate the title confidence score based on semantic independence, word count reasonableness, and contextual coherence, filtering titles with confidence scores higher than a preset threshold. The paragraph label text is further verified to confirm the hierarchical continuity between its sequence number and the candidate heading set sequence number; those that meet the requirements will be... Paragraph label text is stored in the candidate body title set; S343. Using a dynamic programming algorithm, with the goal of minimizing title hierarchy breaks and maximizing structural coherence, we traverse the candidate title set and the candidate body title set, calculate the globally optimal title selection path, and determine the complete optimal title set. S344. Initialize the multi-level counter array, update the multi-level counter array and generate numbers according to the order of appearance of titles in the optimal title set, following the state machine principle: When a first-level heading is detected for the first time, the first value of the multi-level counter array is incremented by 1 and a corresponding first-level heading number is generated. When a lower-level heading is detected, the current level counter is initialized to 1 based on the current value of the upper-level counter and a level number is generated. When a sibling heading is detected, the current level counter is incremented by 1 and the number is updated. When a parent heading is detected, the lower-level counter is cleared to zero, the upper-level counter is incremented by 1, and a new parent heading number is generated.

7. The configurable rule-based and natural language collaborative Word document format conversion method according to claim 6, characterized in that, The NLP model in step S342 calculates the title confidence score, specifically as follows: semantic independence is quantified by the frequency of occurrence of general terms in the text; word count reasonableness is determined by judging whether the number of characters in the text is within a preset threshold range; contextual coherence is determined by calculating the topic similarity between the text and the preceding and following paragraphs; the hierarchical continuity verification specifically involves: The tag text number is compared hierarchically with the number of the most recent title in the candidate title set. If... If the tag text number is the same level or direct subordinate number of the nearest number in the candidate title set, the hierarchy is considered continuous; otherwise, it is considered discontinuous.

8. The Word document format conversion method with configurable rules and natural language collaboration according to claim 6, characterized in that, The chart number refresh mentioned in step S3 specifically includes: S351. Read the chart number bound to the title level configured by the user in step S1. The bound title level includes a first-level title and a second-level title. S352. Traverse the HTML document tree by bound heading level, and initialize the figure counter and table counter in each bound level chapter respectively; S353, When detected <figcaption> When tagging, generate a construction number string based on the chapter number and the current count value.< / figcaption> 9. A conversion system based on the configurable rule-based and natural language collaborative Word document format conversion method according to any one of claims 1-8, characterized in that, include: The document format configuration module provides two configuration methods: templated parameter input and natural language description, allowing users to customize the target format and obtain the structured parameters of the target format. The Word document parsing and structure conversion module uses a document parsing library to parse the uploaded original Word document and convert it into an HTML tree structure. The text is converted into HTML paragraph tags, the formulas are extracted into LaTeX code through the MathType API, and the tables and images retain the DOM node structure. The HTML document undergoes deep style reconstruction, sequentially performing basic style cleaning, image normalization, table standardization, multi-level heading recognition and numbering, chart numbering refresh, and style injection operations to complete the structural optimization and format adaptation of the HTML document. The HTML to Word format fidelity conversion module converts the processed HTML document into a docx format file, performs format conversion on the LaTeX code in the document, converts it into an Office mathematical formula object, and finally outputs a standardized Word document. < / figure>