Document revision methods, document revision devices and storage media

By parsing and embedding structured revision information, this method utilizes a semantic analysis model to achieve high efficiency and accuracy in document revision, solving the problems of format loss and semantic misreplacement in traditional technologies. It is suitable for office automation and industry document standardization processing.

CN121435933BActive Publication Date: 2026-04-03CHENGDU HONGRUI TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-04
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Traditional document revision techniques are insufficient to meet the needs for efficient and accurate revisions, especially in terms of insufficient format preservation and lack of semantic understanding. As a result, the revision results cannot meet industry standards and require a lot of manual calibration.

Method used

By parsing the structured revision information of the reference document, structured document information is generated. Then, using a target model with semantic analysis and semantic transfer capabilities, the target revision information is directly embedded into the document to be revised, ensuring format integrity and semantic accuracy.

Benefits of technology

It enables precise revisions without intermediate format conversion, reduces manual intervention costs, minimizes formatting and semantic errors, and meets the compliance requirements for document revisions in industries such as pharmaceuticals and law.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121435933B_ABST
    Figure CN121435933B_ABST
Patent Text Reader

Abstract

This application discloses a document revision method, a document revision apparatus, and a storage medium, relating to the field of data processing technology. This application first acquires a reference document and a document to be revised in revision mode. Then, it parses the reference document to extract structured revision information corresponding to the reference revision operation traces. Furthermore, it parses the document to be revised to generate structured document information containing target content and target format information. Next, it generates prompt words based on the semantic intent of the structured revision information, and inputs the prompt words and structured document information into a target model to obtain target revision information. Finally, it maps the target revision information to the document to be revised to generate a target document with target revision operation traces. The document revision method of this application can ensure the standardization and accuracy of the revision results, reduce the cost of manual intervention, and reduce formatting and semantic errors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, specifically to a document revision method, document revision device, and storage medium. Background Technology

[0002] In industry-standardized document processing scenarios (such as pharmaceuticals, law, and engineering), document revision is a crucial step in ensuring content accuracy and format conformity. Traditional document revision techniques mainly rely on two implementation paths: one is through document format conversion, converting Word documents to Markdown format to provide context for the Large Language Model (LLM) to understand and process before converting them back to the original format; the other is a mechanical revision method based on text keyword matching or string replacement, directly replacing content in the target document.

[0003] For the first method, during document format conversion (such as Word→Markdown→Word), it is difficult to completely preserve the complex formatting information of the original document, especially key formatting elements such as tables, headers and footers, paragraph styles, image layouts, and font attributes, which are prone to errors, omissions, or distortions. In scenarios with extremely high requirements for format specifications, such as pharmaceutical industry compliance documents and legal documents, the loss of formatting can cause the revised document to fail to meet industry standards or review requirements, necessitating a significant amount of manual format calibration and severely reducing processing efficiency.

[0004] For the second method, traditional mechanical revision methods rely solely on surface-level keyword matching or string equality replacement, without understanding the revision intent or the semantics of the document content. When the document to be revised contains content with similar keywords but different semantics from the reference document, erroneous replacements are prone to occur, leading to insufficient accuracy in the revision results or even content errors. Subsequent manual verification and correction are still required, further increasing operational costs.

[0005] In summary, traditional document revision technologies, due to their insufficient ability to preserve formatting and lack of semantic understanding, are unable to meet the needs for efficient and accurate document revision. Summary of the Invention

[0006] The purpose of this application is to provide a document revision method, document revision device, and storage medium to solve the problem that traditional document revision technologies cannot meet the needs for efficient and accurate document revision.

[0007] To achieve the above objectives, the first aspect of this application provides a document revision method, comprising:

[0008] Obtain a reference document and a document to be revised in revision mode, wherein the reference document includes at least one reference revision operation trace, and the reference document and the document to be revised are documents of the same type;

[0009] The reference document is parsed to extract the structured revision information corresponding to the reference revision operation traces. The structured revision information includes at least the revision type, revision metadata, and revision content. The structured revision information is used to characterize the semantic intent of the manual revision.

[0010] The document to be revised is parsed to generate structured document information containing target content and target format information. The target content is the structured information in the document to be revised that can be semantically matched, and the target format information is the format attributes of the document to be revised. The target content and the target format information have a mapping relationship.

[0011] Based on the semantic intent of the structured revision information, prompt words are generated. The prompt words and the structured document information are input into the target model to obtain the target revision information. The target model is a model with semantic analysis and semantic transfer functions.

[0012] The target revision information is mapped to the document to be revised to generate a target document with target revision operation traces. The target revision operation traces include at least the revision type, revision metadata, and comparison information before and after the revision.

[0013] A second aspect of this application provides a document revision apparatus, comprising:

[0014] The acquisition module is used to acquire a reference document and a document to be revised in revision mode. The reference document includes at least one reference revision operation trace, and the reference document and the document to be revised are documents of the same type.

[0015] The first parsing module is used to parse the reference document and extract the structured revision information corresponding to the reference revision operation traces. The structured revision information includes at least the revision type, revision metadata, and revision content. The structured revision information is used to characterize the semantic intent of the manual revision.

[0016] The second parsing module is used to parse the document to be revised and generate structured document information containing target content and target format information. The target content is the structured information in the document to be revised that can be semantically matched, and the target format information is the format attribute of the document to be revised. The target content and the target format information have a mapping relationship.

[0017] The analysis module is used to generate prompt words based on the semantic intent of the structured revision information, input the prompt words and the structured document information into the target model to obtain the target revision information, wherein the target model is a model with semantic analysis and semantic transfer functions;

[0018] The mapping module is used to map the target revision information to the document to be revised, and generate a target document with target revision operation traces. The target revision operation traces include at least the revision type, revision metadata, and comparison information before and after the revision.

[0019] A third aspect of this application provides a computer-readable storage medium storing a program that can be loaded by a processor and executed using the document revision method described above.

[0020] The beneficial effects of this application are:

[0021] This application achieves accurate representation of the semantic meaning of manual revisions by parsing reference documents and extracting structured revision information containing revision type, revision metadata, and revision content. This enables subsequent revisions to move beyond mechanical imitation of the text surface and instead achieve accurate transfer of semantic intent, reducing the risk of semantic misreplacement from the source.

[0022] When parsing a document to be revised, structured document information containing target content and target formatting information is generated, and a mapping relationship between the two is established. Without any intermediate format conversion, content and formatting information are extracted directly from the document's underlying structure, ensuring that complex formatting elements are completely recorded. Simultaneously, the mapping relationship between content and formatting information allows for precise synchronization between formatting adjustments and content revisions during subsequent revisions, reducing misalignment between formatting and content and providing data support for zero-loss formatting revisions.

[0023] Next, based on the semantic intent of the structured revision information, prompt words are generated. These prompt words, along with the structured document information, are input into the target model to obtain the target revision information. This target revision information is then mapped to the document to be revised, generating a target document with traces of the target revision operation. In this way, revision information can be embedded directly based on the document's underlying structure without intermediate format conversion, fully preserving the original document's complex format. Furthermore, the revised document does not require manual format calibration, reducing manual operation costs. The generated target revision information can include revision type, revision metadata, and before-and-after comparison information, enabling full-process traceability of the revision process.

[0024] In summary, the document revision method proposed in this application, from semantic intent extraction to semantic matching revision and then to format integrity preservation, can ensure the standardization and accuracy of the revision results, reduce the cost of manual intervention, and reduce format and semantic errors. It can be adapted to scenarios with extremely high requirements for efficiency and standardization, such as office automation and industry document standardization processing.

[0025] Other features and advantages of this application will be described in detail in the following detailed description section. Attached Figure Description

[0026] Figure 1 This is a flowchart illustrating a document revision method provided in an embodiment of this application;

[0027] Figure 2 This is a flowchart illustrating a document revision method provided in a specific embodiment of this application;

[0028] Figure 3 This is a schematic diagram of the structure of a document revision device provided in an embodiment of this application. Detailed Implementation

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

[0030] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified. Details are set forth in the following description for illustrative purposes. It should be understood that those skilled in the art will recognize that this application can be implemented without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid unnecessarily obscuring the description of this application. Therefore, this application is not intended to be limited to the embodiments shown, but rather to be consistent with the broadest scope of the principles and features disclosed herein.

[0031] Figure 1 This is a flowchart illustrating a document revision method provided in an embodiment of this application. Figure 1 As shown, the document revision method may include steps 101-105, which will be described in detail below.

[0032] Step 101: Obtain the reference document and the document to be revised, both in revision mode. The reference document includes at least one reference revision operation trace, and both the reference document and the document to be revised are of the same type.

[0033] A reference document is a document in revision mode that contains at least one reference revision operation trace. Revision mode is a mode in document editing software that records revision operation traces, preserving the original information of who revised it, when it was revised, and the content of the revision. Reference revision operation traces are records of specific operations performed manually in the reference document, such as insertion, deletion, and formatting modifications, and serve as the basis for subsequently extracting the revision intent.

[0034] The document to be revised is the object of the document revision method; that is, a document that has not yet been revised. It needs to be of the same type as the reference document. "Same type" means that both have consistent content attributes or application scenarios, and their document formats are compatible. For example, both the reference document and the document to be revised can be office documents or industry-compliant documents, and both support underlying structure parsing.

[0035] In addition, after obtaining the reference document and the document to be revised, an integrity check can be performed to ensure that the document is undamaged and that no content is missing. Obtaining reference documents and documents to be revised of the same type can reduce the failure of revision logic due to differences in scenarios.

[0036] Step 102: Parse the reference document and extract the structured revision information corresponding to the reference revision operation traces.

[0037] Structured revision information is a collection of revision-related data organized with fixed fields and a uniform format. It is a digital and standardized representation of reference revision operation traces. In one example, based on the underlying format structure of the reference document (such as OpenXML structure), a hierarchical traversal algorithm (such as hierarchical traversal according to the document as a whole - revision node - attribute / content) can be used to parse the reference revision operation traces in the reference document and finally extract the structured revision information.

[0038] Structured revision information is used to characterize the semantic intent of manual revisions. Manual revision is the action of an operator, and semantic intent is the logic hidden behind the revision action—that is, why the revision was performed. For example, the semantic intent of manually deleting a piece of text might be that the text contains redundant information. Structured revision information includes at least the revision type, revision metadata, and revision content. The revision type is the specific category of the revision operation, which can include insertion revisions, deletion revisions, and format modification revisions. Revision metadata is information used to trace the revision process, and can include at least a revision identifier, operator identifier, and revision timestamp to ensure traceability. The revision content is the specific object of the revision operation; for example, the newly added text for an insertion revision, the text to be deleted for a deletion revision, and the format change data for a format modification revision.

[0039] Specifically, we can first identify the feature nodes representing the revision operation, and then extract the revision type, revision metadata, and revision content from these feature nodes. Next, we encapsulate the revision type, revision metadata, and revision content according to a preset structured format, forming structured data that can be parsed by the subsequent target model. Through structured extraction, we can achieve precise standards for the revision intent, not only recording the revision content but also clearly defining the revision type, executor, and reason for the revision, providing a logical basis for subsequent semantic revisions.

[0040] Step 103: Parse the document to be revised and generate structured document information containing target content and target format information. The target content is the structured information in the document to be revised that can be semantically matched, and the target format information is the format attributes of the document to be revised. There is a mapping relationship between the target content and the target format information.

[0041] Structured document information is a standardized data set containing the target content and target format information of the document to be revised, establishing a correlation mapping between content intervention and format. Target content refers to the information in the document to be revised that possesses semantic attributes and can be revised; it is the object of semantic matching and revision operations. Target format information comprises all format attributes of the document to be revised, including basic formatting (such as font and font size) and complex formatting (such as nested tables and image layouts), serving as the basis for ensuring the integrity of the revised format.

[0042] Employing the same underlying structure parsing technology as the reference document, it directly parses the document to be revised without any intermediate format conversion. In one example, the target content of the document to be revised, such as paragraph text, table data, and technical terminology, can be extracted first. Simultaneously, the target formatting information, such as font style, paragraph line spacing, table structure, and image layout, is extracted. Then, a mapping relationship between the target content and the target formatting information is established using unique identifiers, and the data is encapsulated according to preset specifications to generate structured document information.

[0043] It directly parses the underlying structure without intermediate format conversion, preserving the complex formatting information of the document to be revised. Furthermore, the established mapping between content and formatting ensures that subsequent formatting adjustments are precisely synchronized with content revisions, reducing the likelihood of formatting errors after content revisions.

[0044] Step 104: Generate prompt words based on the semantic intent of the structured revision information, and input the prompt words and structured document information into the target model to obtain the target revision information.

[0045] Cue words are instructional texts used to guide the target model in understanding the revision logic. They need to accurately convey the semantic intent of the structured revision information, enabling the target model to clearly understand the revision rules. The target model is a model with semantic analysis and semantic transfer capabilities. Semantic analysis refers to understanding the revision intent and the semantics of the content to be revised. Semantic transfer refers to transferring the revision intent of the reference document to the document to be revised.

[0046] In one example, semantic intent can be extracted from the structured revision information, and prompts containing that semantic intent can be generated. These prompts, along with the structured document information, are then simultaneously input into the target model. The target model first parses the semantic intent and revision logic of the prompts, then associates the content and format mapping of the structured document information, and locates the area to be revised using a semantic matching algorithm. Finally, based on the semantic intent and the content or format features of the area to be revised, target revision information containing the revision type, revision location, and revised content or format is generated.

[0047] Compared to the problem of semantic misreplacement caused by mechanical substitution, the semantic analysis capabilities of the target model allow revisions to go beyond superficial keyword matching and instead achieve precise transfer of semantic intent. Even if the document to be revised contains superficially similar but semantically different content, the target model can reduce misreplacements through semantic analysis, and the content and format of the target revision information remain compatible with the document to be revised, thus improving the accuracy of the revision.

[0048] Step 105: Map the target revision information to the document to be revised to generate a target document with target revision operation traces.

[0049] Mapping refers to the process of directly embedding target revision information into the underlying structure of the document to be revised. Parsing the target revision information clarifies the revision type, location, content, or format for each revision. Then, based on the underlying structure of the document, the target revision information is directly embedded into the corresponding location without intermediate format conversion. For example, inserted revision content can be embedded at the corresponding character offset in a specified paragraph, or format modification rules can be applied to a designated area. The embedding process preserves a complete trace of the target revision operations, generating a target document with these traces. These traces include at least the revision type, revision metadata, and a comparison of the revisions before and after. Integrating the document structure after embedding the revision information generates the final target document.

[0050] Mapping is performed directly based on the underlying structure, without intermediate format conversion. This ensures that complex formatting elements such as tables, headers and footers, nested structures, and image layouts in the document to be revised are preserved without manual calibration, reducing operational costs. Complete preservation of the target revision process ensures full traceability, meeting compliance requirements for document revisions in industries such as pharmaceuticals and law. Mapping to target revision information generated from the target model ensures that the revised content aligns with semantic meaning. Figure 1 This reduces the possibility of omissions or errors that may occur during manual revisions, thereby improving revision efficiency and accuracy.

[0051] The document revision method in this application, from semantic intent extraction to semantic matching revision and then to format integrity preservation, can ensure the standardization and accuracy of the revision results, reduce the cost of manual intervention, and reduce format and semantic errors. It can be adapted to scenarios with extremely high requirements for efficiency and standardization, such as office automation and industry document standardization processing.

[0052] In step 102, the underlying format structure of the reference document can be traversed first to identify the reference feature nodes corresponding to the revision type. The underlying format structure refers to the native data organization form of the document during storage, which can cover all document types that support native revision node storage. For example, the OpenXML structure of a Word document. Reference feature nodes are used to differentially store reference revision operation traces for revision types and are the direct storage units of revision information. For example, in OpenXML, the w:ins node corresponds to insert revisions, and the w:del node corresponds to delete revisions. Differentiated storage means that different types of revision operation traces are stored in their corresponding dedicated feature nodes. The node's structure and attribute fields strongly match the revision type, reducing the confusion between different types of revision information.

[0053] Then, the basic metadata for each reference feature node is extracted. This basic metadata uniquely identifies a single revision operation and traces the revision process. It includes at least a revision identifier, an operator identifier, and a revision timestamp. The revision identifier is a globally unique identifier for a single revision operation (e.g., string encoding and numerical sequence number), used to distinguish different revision operations within the same reference document. The operator identifier is the user's identity information for performing the revision operation, used to record the responsible party for the revision. The revision timestamp is a record of the specific time the revision operation was performed, used to reconstruct the temporal logic of the revision operations and provide a basis for tracing the order of multiple revisions. The synergistic effect of the basic metadata makes the document revision process systematic and manageable.

[0054] Next, the content data and location association information of each reference feature node are extracted. Content data is the object directly affected by the revision operation, representing the specific data of the revision. Location association information is a set of information used to define the location of the operation within the reference document; it establishes the correspondence between the revision operation and specific areas of the document and can include paragraph markers, character offsets, and range boundaries. In one example, differentiated content and location information extraction can be performed based on the type of reference feature node.

[0055] Finally, the basic metadata, content data, and location-related information are encapsulated according to a preset data structure to generate structured revision information corresponding to the reference revision operation trace. The preset data structure is a predefined, standardized format template used to organize revision-related data, characterized by fixed fields, uniform format, and machine readability. Structured revision information is a complete, digital representation of a single reference revision operation trace. The process of organizing the scattered basic metadata, content data, and location-related information into a unified whole according to a fixed logic—that is, the structured encapsulation process—establishes the inherent relationship between metadata, content, and location, ensuring data integrity and parsability.

[0056] In this embodiment, the revision type can include insertion revision, deletion revision, and format modification revision. In step 102, structured revision information can be generated according to the revision type. The structured structure (such as a JSON structure) achieves differentiated storage through conditional fields. For example, insertion revisions require precise location of the content insertion position, while format modification revisions require recording comparison data before and after changes such as font and paragraph style. Examples of insertion revision, deletion revision, and format modification revision are given below.

[0057] For inserted revisions, the first node representing the inserted revision in the reference document is identified. The first basic metadata of the first node, the inserted first text content, and the positioning information of the inserted revision are extracted. These are then encapsulated into structured revision information corresponding to the inserted revision. The first node is a native node in the underlying format of the reference document used to store the traces of the inserted revision operation. It is the carrier of the inserted revision information and can store the inserted content and associated insertion position. The first basic metadata is information used to uniquely identify and trace the inserted revision. The first basic metadata may include the first revision identifier, the first operator identifier, and the first revision timestamp. It should be noted that "first" only distinguishes the basic metadata corresponding to the inserted revision and its function is consistent with general basic metadata. The first text content is the document content manually revised through insertion and is the object of the inserted revision operation. The positioning information defines the specific location of the inserted revision in the reference document. The positioning information may include the first paragraph identifier and the character offset. The first paragraph identifier is the identifier corresponding to the target paragraph of the inserted revision. The character offset is the specific insertion position within that target paragraph. For example, insertion after the 9th character of paragraph 3.

[0058] For deletion revisions, the second node representing the deletion revision in the reference document is identified. The second basic metadata, the deleted second text content, and the deletion scope information of the deletion revision are extracted from the second node. These elements are then encapsulated into structured revision information corresponding to the deletion revision. The second node is a native node in the underlying format of the reference document that stores the deletion revision operation trace, preserving the deleted content and recording the deletion scope. The second basic metadata is used to trace and mark the deletion revision. It can include a second revision identifier, a second operator identifier, and a second revision timestamp. It should be noted that "second" only distinguishes the basic metadata corresponding to the deletion revision and serves the same purpose as general basic metadata. The second text content is the original document content that was manually deleted; it represents the deletion revision operation and its content characteristics directly reflect the semantic intent of the deletion. The deletion scope information defines the area covered by the deletion revision. It can include a second paragraph identifier, a start offset, and an end offset. The second paragraph identifier is the identifier corresponding to the paragraph containing the deleted content. The start offset is the starting character number of the deleted content within the paragraph. The end offset is the ending character number of the deleted content within the paragraph.

[0059] For format modification and revision, the third node representing the format modification and revision in the reference document is identified. The third basic metadata, format change set, and format application scope of the third node are extracted, and these are encapsulated into structured revision information corresponding to the format modification and revision. The third basic metadata is used to trace and identify format modification and revision. It includes a third revision identifier, a third operator identifier, and a third revision timestamp. It should be noted that "third" only distinguishes the basic metadata corresponding to the format modification and revision; its function is consistent with general basic metadata. The format change set includes comparative data composed of old and new format values, representing the object of the format modification and revision operation and reflecting the semantic intent of how the format is adjusted. The format application scope information includes a third paragraph identifier and a character offset range. The third paragraph identifier indicates the paragraph covered by the format modification, and the character offset range is the character interval within the paragraph that the character format modification needs to lock. If the paragraph format is modified, the entire paragraph is covered.

[0060] The aforementioned revisions, through a three-dimensional data combination of basic metadata, core content data, and location or scope information, fully preserve the logical structure of the revision's subject, object, location, and timing. This allows the structured revision information to accurately map the semantic intent of the manual revisions, providing comprehensive data support for subsequent semantic analysis. By employing dedicated node identification and differentiated data extraction, it ensures that information from various revisions is neither confused nor missing. This enables the target model to understand the revision logic based on complete and accurate structured data, rather than relying on surface-level text features, thus reducing semantic misreplacement at the source.

[0061] In step 103, a mapping table containing the first mapping relationship between node identifiers, document structural elements, and document format can be retrieved. The mapping table is a pre-configured standardized rule table containing the association logic between underlying nodes, structural elements, and format attributes. This mapping table can include three core elements: node identifiers, document structural elements, and document format. A node identifier is a marker in the document's underlying structure used to uniquely identify a certain type of native node; it serves as a bridge connecting underlying nodes and upper-level structural elements. Document structural elements are the core building blocks of the document and can include paragraphs, tables, table rows, table cells, images, sections, headers, and footers; they are the carriers of document content. Document format refers to the format attributes corresponding to document structural elements and can include basic and complex formats. Basic formats can include font, font size, color, paragraph line spacing, and indentation. Complex formats can include table styles, image layouts, and nested structure rules. The association relationship between node identifiers, document structural elements, and document format—the first mapping relationship—is the rule basis for subsequent location and extraction operations. For example, the node identifier "para_001" corresponds to the document structure element "paragraph," and the associated document format attributes can include: "font, line spacing, and alignment." Predefined rules in the mapping table can reduce inconsistencies in parsing logic across different scenarios. Quickly associating structural elements with format attributes through node identifiers eliminates the need for manual node function checks, reducing subjective errors in the parsing process and improving parsing efficiency.

[0062] Next, following the set hierarchical order, the document structural elements of the document to be revised are located based on the node identifiers in the mapping table. The set hierarchical order is a pre-defined traversal order based on the natural organizational logic of the document, conforming to human cognitive habits and ensuring that the parsing process completely covers all structural units of the document, reducing the possibility of missing nested structures. For example, a hierarchical order from whole to part, from macro to micro, can be used to traverse the underlying format structure of the document to be revised, starting from the overall document – ​​section – paragraph – table – table row – table cell – image. During the traversal, the identifiers of the underlying nodes of the document to be revised can be matched with the node identifiers in the mapping table. If a match is successful, the unit corresponding to that node is determined to be the target document structural element, and its hierarchical position in the document's underlying structure is recorded. The located document structural elements are marked to ensure no omissions or repetitions, forming a list of structural elements to be extracted.

[0063] Then, based on the mapping relationships in the mapping table, the target content and target format corresponding to the document structure elements are extracted element by element. Element-by-element extraction follows the list of structure elements sequentially, ensuring a one-to-one correspondence between the content and format information of each structure element, reducing cross-contamination. In one example, the target content carried by the corresponding structure element can be extracted based on the association rules between document structure elements and target content. Simultaneously, the target format information corresponding to that structure element is extracted based on the association rules between document structure elements and document formats in the mapping table. During the extraction process, the target content and target format of the same document structure element can be temporarily associated to reduce data misalignment.

[0064] Next, based on the rules of node identifiers in the mapping table, an element identifier is assigned to each document structural element, and a second mapping relationship is established between the element identifier, target content, and target format information through the element identifier. The element identifier is a globally unique tag assigned to a document structural element, serving as a crucial hub for content-format association. The second mapping relationship is the association between the element identifier, target content, and target format information established through the element identifier. Referring to the encoding rules of node identifiers in the mapping table, a globally unique element identifier is generated for each document structural element. The element identifier, target content, and target format information of the same structural element are associated and bound together, establishing a bidirectional association between the element identifier and target content, and between the element identifier and target format—that is, the second mapping relationship.

[0065] Finally, according to the structured data specifications of the mapping table, the second mapping relationship is encapsulated and integrated to generate structured document information. The structured data specifications are the standardized format requirements preset in the mapping table for organizing the second mapping relationship, ensuring that the generated structured document information has a unified format and can be directly parsed by the subsequent target model. Structured document information is a standardized data set containing all associated data of the revised document's element identifiers, target content, and target format. The preset structured data specifications in the mapping table are invoked; these specifications are compatible with the format of the structured revision information. Then, the second mapping relationship of each document structural element is filled into the corresponding fields according to the specifications, forming a single structured data unit. All structured data units are integrated and sorted according to the document's hierarchical logic to generate complete structured document information.

[0066] It directly parses the underlying structure of the document to be revised without intermediate format conversion. Combined with a mapping table for precise extraction of complex formats, it can completely preserve the original document's format attributes, resolving formatting errors or omissions caused by format conversion. By establishing a second mapping relationship between element identifiers, target content, and target format, it ensures that each piece of content accurately matches the corresponding format, reducing content and format misalignment in subsequent revisions and providing data support for zero format loss. Relying on the unified rules of the mapping table, it can reduce the arbitrariness and subjective errors of the parsing logic. Traversing according to the hierarchical structure order can ensure that structural elements are extracted without omission while reducing redundant data extraction. The mapping table can also adapt to documents from different industries, making it highly versatile. The standardized and encapsulated structured document information can directly interact with the target model and structured revision information, and can reuse the batch processing of up to multiple documents to be revised, improving revision efficiency.

[0067] In step 104, the structured format of the prompt words can be determined first. This structured format includes a first label representing the basis for revision and a second label representing the data to be revised. The structured format of the prompt words is a predefined, standardized format containing fixed labels and rules, enabling the target model to quickly distinguish between the basis for revision and the data to be revised, clarifying data boundaries and processing logic. The first label carries the data of the basis for revision, providing a reference for conveying revision rules to the target model and serving as the data source for the target model to understand the revision intent. The second label carries the data to be revised, providing the target model with the basic data for the revised content, which may include format information about the document to be revised. By clearly distinguishing the basis for revision and the data to be revised through differentiated labels, the data boundaries in the prompt words are clear, allowing the target model to distinguish between core logic and basic data, laying the data foundation for subsequent analysis.

[0068] Then, the structured revision information is embedded into the first tag, and the structured document information is embedded into the second tag. Data embedding is the process of filling structured data into the corresponding tags according to the preset tag format. It achieves a precise match between data and tag functions, ensuring that the target model can directly obtain complete target data when extracting tag content. In one example, the structured revision information can be completely and without omission filled into the first tag according to the preset tag data embedding rules. At the same time, the structured document information is completely filled into the second tag. During the embedding process, it is necessary to ensure that the data format is compatible with the tag requirements, without redundant characters or formatting errors.

[0069] Based on the first and second tags, revision rule instructions are generated. These instructions are standardized commands used to constrain the target model's processing logic and output format. A revision rule instruction may include a predefined structured data format for revising the content of the second tag according to the semantic intent and revision operation rules of the first tag, and outputting the target revision information. This predefined structured data format is the target revision information in a predefined structured data format. The revision rule instruction consists of two parts: first, it clarifies the processing logic, requiring targeted revisions of the structured document information in the second tag based on the semantic intent and revision operation rules of the structured revision information in the first tag; second, it clarifies the output requirements, specifying that only the predefined structured data of the target revision information should be output, and no non-target data, such as explanatory text and redundant formatting tags, should be included. By clarifying the processing boundaries of the target model through rule instructions, the occurrence of autonomous revisions by the target model that deviate from the revision intent can be reduced, and the output format requirements can be clearly defined to ensure that the target revision information output by the target model is structured standard data.

[0070] Finally, the first and second tags with embedded data are integrated with the revision rule instructions to obtain the prompt word. In one example, the revision rule instructions, the first tag containing embedded structured revision information, and the second tag containing embedded structured document information can be combined and concatenated according to a pre-defined logical order, such as revision rule instructions, first tags, and second tags, to form a complete prompt word. The complete prompt word contains all the information needed for the target model to process, namely rules, basis, and data, without the need for additional data, thus simplifying the input process of the target model.

[0071] In step 104, the prompt words and structured document data are input into the target model. In one example, the complete prompt words and structured document information can be encapsulated according to the standardized data format required by the target model and input synchronously into the target model. This ensures complete data transmission without format conflicts or data loss during the input process. The target model first parses the revision rule instructions in the prompt words to clarify the processing logic and output requirements.

[0072] Next, the content of the first tag in the prompt words is analyzed to determine the semantic intent of the structured revision information and the revision operation rules. The revision operation rules are the revision execution standards extracted from the structured revision information. A semantic decomposition algorithm is used to extract the core semantic intent of manual revision and the corresponding revision operation rules. Furthermore, the content of the second tag in the prompt words is analyzed, and a structured data mapping relationship for the document to be revised is established by associating the target content and target format through the node identifiers of the structured document information. This structured data mapping relationship is a strong association between the content and format of the document to be revised, established through element identifiers, ensuring that the target model can accurately locate the format information corresponding to the content. By associating the target content and target format through element identifiers, a structured data mapping relationship between content, format, and element identifiers can be established, restoring the complete data logic of the document to be revised.

[0073] Then, based on a semantic matching algorithm, the semantic intent of the revision information is associated with the structured data of the document to be revised, identifying the areas in the document to be revised that semantically match the reference document. The semantic matching algorithm analyzes the semantic relationship between the content to be revised and the semantic intent of the revision. It matches semantic logic rather than surface text features, and can identify content that differs in surface text but is semantically consistent. The semantic matching algorithm is invoked to associate the semantic intent of the revision with the structured data, identifying content areas in the document to be revised that are semantically homologous and logically consistent with the revision scenario in the reference document. The location information of the areas to be revised is recorded using element identifiers, generating a list of areas to be revised.

[0074] For the area to be revised, the corresponding revision type is matched according to the revision operation rules, and preliminary revision information is generated by combining the target format information of the structured document. The preliminary revision information is an initial revision scheme generated by the target model based on the semantic matching results. It may contain the core elements of the revision, but it has not been validated by the rules and needs further optimization.

[0075] If the structured revision information embedded in the prompt contains set rules, the preliminary revision information is verified, and corrected based on the verification results. Set rules are industry-specific rules, compliance requirements, numerical calculation standards, etc., serving as the basis for ensuring the professionalism and compliance of the revision results. In one example, the target model can detect whether the structured revision information embedded in the first tag contains set rules, such as sterilization parameter ranges in pharmaceutical documents or terminology specifications in legal documents. If it does, a professional verification is triggered, precisely checking the professional terminology, numerical accuracy, and compliance in the preliminary revision information. If the verification fails, the preliminary revision information is corrected based on the set rules, ensuring that the revised information conforms to professional logic and compliance requirements, further improving the revision accuracy and meeting the high professional requirements of industries such as pharmaceuticals and law.

[0076] Finally, following the field specifications that match the structured revision information, the preliminary revision scheme is encapsulated into structured target revision information. The field specifications are predefined requirements for structured data fields, compatible with the structured revision information, ensuring that the target revision information can be directly parsed. The target model can encapsulate and integrate the corrected preliminary revision information according to the preset field specifications, generating purely structured target revision information. During the encapsulation process, it ensures that fields are complete, data formats are compliant, and there are no redundant explanatory texts or formatting marks.

[0077] This application's embodiments overcome the limitations of mechanical text replacement by constructing structured prompts and precisely processing the semantics of the target model. Based on semantic intent transfer, it achieves accurate revisions and reduces erroneous replacements. Furthermore, by associating content and format data, it ensures that the revision scheme is compatible with the format, providing a high guarantee for zero format loss in subsequent revisions. In addition, the standardized design process adapts to batch revision scenarios, significantly improving revision efficiency. Simultaneously, professional rule verification meets high industry requirements, making it suitable for scenarios such as standardized document processing in the industry.

[0078] In step 105, the target revision information is parsed and categorized according to revision type, extracting the basic metadata, content data, and location association information corresponding to each revision type. Using the same parsing logic as in step 102, the structured target revision information output in step 104 is parsed across all fields to read the core data fields. Then, for each revision type, the corresponding basic metadata, content data, and location association information are extracted item by item to reduce cross-interference between data from insertion revisions, deletion revisions, and format modification revisions.

[0079] For each revision type, a corresponding native feature node is created. Revision metadata is configured into the node attributes of the native feature node, and content data is encapsulated into the node substructure of the native feature node. A native feature node is a dedicated revision node that conforms to the underlying document formatting standard. It is a structural unit natively supported by the document editing software for storing revision operation traces. The node attributes of a native feature node are inherent parameters used to store descriptive information such as metadata, serving as a carrier for traceable revision traces. The node substructure is the hierarchical structure within the native feature node, used to store specific content data, serving as the unit carrying the revision content. Configuring the extracted metadata into the node attributes of the native node means writing the extracted basic metadata into the node attributes of the native feature node, making the metadata an inherent attribute of the node, recognizable by the document editing software. Encapsulating content data into the node substructure of the native feature node means writing the extracted content data into the node substructure of the native feature node. For example, inserted text is stored in the text subnode of the node, and old and new format values ​​are stored in the comparison subnode of the node, ensuring that the content data matches the node's functionality.

[0080] Then, based on the location association information, the native feature node is determined in the target area of ​​the document to be revised, and the native feature node is embedded in the target area. The target area is the specific location in the document to be revised where the revision operation needs to be performed. It is precisely located through location association information and is the carrier of the revision operation. Based on the extracted location association information, the corresponding target area is accurately located in the underlying structure of the document to be revised. Then, differentiated embedding logic is executed according to the revision type. For example, insertion revision embeds the native feature node at the located character offset position to achieve precise text insertion. Deletion revision overwrites the located deletion position with the native feature node and marks it as deleted. Format modification revision associates the format modification node with the located target structural element and applies format change rules. In this way, paragraph and character positioning based on location association information can reduce the possibility of revision position misalignment and ensure that the revision result is consistent with the semantic meaning. Figure 1 It employs differentiated embedding logic for insertion, deletion, and formatting modifications, adapting to the technical characteristics of various revision operations. The embedding process operates based on the document's underlying structure, adding or modifying nodes only in the target area, preserving the integrity of the original document structure and reducing document damage caused by revisions.

[0081] Finally, the embedded native feature nodes and the original structure of the document to be revised are integrated to generate a target document with the target revision operation traces. These target revision operation traces are all revision records retained in the target document, including revision type, basic metadata, and a comparison of content before and after the revision. These traces can be viewed, reviewed, accepted, or rejected by document editing software. Seamlessly merging the target region structure of the embedded native feature nodes with the original underlying structure of the document to be revised ensures that the document's hierarchical logic and formatting rules remain unchanged after node embedding. This integration of native nodes and the underlying structure resolves errors caused by format conversion and reduces manual labor costs. The retained revision traces meet the compliance traceability requirements for document revisions. The integration process does not damage the original structure, ensuring the compatibility and usability of the target document and reducing issues such as documents being unopenable or uneditable due to revisions.

[0082] The following example uses a Word document containing both a reference document and a document to be revised. Figure 2 As shown, Figure 2 This is a flowchart illustrating a document revision method provided in a specific embodiment of this application. The document revision method may include steps 201-206.

[0083] Step 201: Upload the reference document and the document to be revised in Word format. The reference document is the revised document, which will serve as a template for revision.

[0084] Step 202: Parse the reference document to obtain structured revision information.

[0085] In Word's Open XML document revision mode, the core revision types include three main categories: insertion revisions, deletion revisions, and formatting revisions. Each type of revision is differentiated and tracked through specific elements in the XML structure. The WordRevisionInfo object is the structured representation of this information in the business system and contains an array of objects representing all data modifications.

[0086] Each field is designed with a clear necessity. The document identifier resolves document identifier conflicts in distributed systems, the total number of revisions provides a quantitative basis for version management, and the timestamp field ensures the traceability of revision operations. The synergistic effect of these basic metadata elements makes the document revision process systematic and manageable. The revision record array is the core data structure of the OpenXML document revision schema conversion technology and must be arranged strictly in chronological order to ensure the temporal traceability of the revision process. Each revision record contains two parts: basic metadata and dynamic content details. Basic metadata may include fixed fields such as revision ID, operating user, and timestamp. The content details dynamically adjust the field structure according to the revision type to achieve accurate data storage and redundancy control. The JSON structure design uses conditional fields to achieve differentiated storage; for example, insertion-type revisions need to accurately locate the content insertion position, while format modification-type revisions need to record comparison data before and after changes such as font and paragraph styles.

[0087] For inserting revisions, the `w:ins` element can be used. Its attribute set includes the revision identifier `id`, the operator `author`, and the timestamp `date`. Child nodes use the `w:r` text execution node to store the newly added content. The `details` attribute can contain: `newContent`: the inserted text content; `position`: positioning information, including the first paragraph identifier (`paragraphId`) and the character offset (`offset`).

[0088] For deletion revisions (DELETE), the `w:del` element can be used, sharing the same attribute definitions as `w:ins`, but the core difference is that it retains deleted content rather than newly added content. The original text is stored through the `w:delText` node, enabling traceability of the deletion operation, and it extends the insertion structure. The `details` attribute can contain: `oldContent`: the deleted text content; `range`: the deletion range, including the second paragraph identifier (`paragraphId`), the start offset (`startOffset`), and the end offset (`endOffset`).

[0089] For formatting modifications (FORMAT_CHANGE), they can be divided into two categories based on the target: character formatting and paragraph formatting. Character formatting changes are implemented using the w:rPrChange element, while paragraph formatting changes use the w:pPrChange element. Both store the attribute values ​​before and after the formatting change through w:before and w:after child nodes, forming a complete chain of formatting change records. Designed for formatting change scenarios, details can include: formatChanges: a collection of formatting changes, each containing a comparison of oldValue and newValue; range: the scope of formatting application, including the third paragraph identifier (paragraphId) and the character offset range.

[0090] All structures maintain a consistent top-level field (revisionId, type, userId, timestamp, details) to ensure the consistency and scalability of the data model.

[0091] In one example, the mapping rules are shown in Table 1. Table 1 is an example of structured storage.

[0092] Table 1

[0093]

[0094] Step 203: Parse the document to be revised to obtain structured document information in JSON format.

[0095] Parsing Word content using OpenXML technology: Since OpenXML only natively supports docx, if a doc format is detected, it is first converted to docx without loss of quality, and then all information is accurately extracted according to the hierarchical structure of "section → paragraph → table".

[0096] By depth-traversing multi-level nodes in XML, for example, section ( <w:sectpr>),sheet( <w:tbl>),OK( <w:tr>), cell ( <w:tc>),paragraph( <w:p>) and pictures ( <w:drawing>This tool enables structured extraction of tabular data, converts it to standard JSON output with a single click, and creates a unique index number for each paragraph or image in sequence.

[0097] Step 204: Input the structured revision information as part of the prompt words, along with the structured document information, into the target model.

[0098] For example, the prompt words are as follows:

[0099] #Prompt words

[0100] <source> Manually revising JSON

[0101] <content> JSON to be revised< / content>

[0102] You are a Word document revision and formatting expert, please refer to... <source> Modify the JSON structure inside <content>< / content> The content should only output JSON without interpretation. The revised JSON is as follows:

[0103] revisionId: revision ID

[0104] userId: Modifier ID

[0105] timestamp: Modification time

[0106] details.newContent: Insert data

[0107] details.oldContent: Deleted data

[0108] details.formatChanges.font.newValue: Font

[0109] details.formatChanges.fontSize.newValue: Font size

[0110] details.formatChanges.bold.newValue: bold

[0111] details.formatChanges.color.newValue: color.

[0112] Step 205: The target model outputs the revised target revision information in JSON format.

[0113] Organize the JSON output by the target model and use regular expressions to remove characters unrelated to the JSON.

[0114] Step 206: Parse the target revision information in JSON format and modify the Word document to be revised using OpenXML technology.

[0115] The processed JSON is then used to call the OpenXML revision mode interface to perform batch corrections on the documents to be revised. Finally, the processed documents can be exported for manual review. If there are multiple documents, repeat steps 203, 204, 205, and 206.

[0116] In traditional technologies, if multiple documents need to be revised, multiple reference document processing steps are required, which consumes system resources and is time-consuming. Therefore, in this embodiment, documents to be revised can be processed in batches. Specifically, at least two documents to be revised are first obtained, and a batch processing task queue is established. The batch processing task queue is an ordered set of tasks for documents to be revised, organized according to rules, used to schedule and manage multiple document revisions, ensuring orderly execution of the process. A parsing process is performed once for the same reference document, extracting and caching the structured revision information. The extracted structured revision information is stored in a local cache or memory according to a preset format, generating a standardized data copy that can be called multiple times.

[0117] Then, according to the task queue, based on the cached structured revision information, the document revision method of this embodiment is executed sequentially for each document to be revised. For each revised document, the cached structured revision information is directly called, without the need to repeatedly parse the reference document. After each document is revised, the corresponding target document is output, and the status flag in the task queue is updated to "completed". If the processing of a document fails, it is marked as a failure and the reason is recorded, and the processing of the next document continues without interrupting the entire batch process. After all documents in the queue have been processed, a batch processing report is generated. For example, it may include the total number of processed documents, the number of successful documents, the number of failed documents, and the reasons for failure, which is convenient for subsequent review.

[0118] This application embodiment only requires parsing and caching the reference file once, significantly reducing system resource consumption and shortening the total processing time, making it particularly suitable for scenarios with a large number of documents to be revised. All documents to be revised reuse the same set of cached structured revision information, and revisions are performed based on the same revision semantic intent and operation rules, reducing deviations in revision logic caused by parsing reference documents multiple times.

[0119] Figure 3 This is a schematic diagram of the structure of a document revision device provided in an embodiment of this application. Figure 3 As shown, the document revision device 300 may include an acquisition module 301, a first parsing module 302, a second parsing module 303, an analysis module 304, and a mapping module 305.

[0120] The acquisition module 301 is used to acquire a reference document and a document to be revised in revision mode. The reference document includes at least one reference revision operation trace, and the reference document and the document to be revised are documents of the same type.

[0121] The first parsing module 302 is used to parse the reference document and extract the structured revision information corresponding to the reference revision operation traces. The structured revision information includes at least the revision type, revision metadata, and revision content. The structured revision information is used to characterize the semantic intent of the manual revision.

[0122] The second parsing module 303 is used to parse the document to be revised and generate structured document information containing target content and target format information. The target content is the structured information in the document to be revised that can be semantically matched, and the target format information is the format attributes of the document to be revised. The target content and the target format information have a mapping relationship.

[0123] The analysis module 304 is used to generate prompt words based on the semantic intent of the structured revision information. The prompt words and structured document information are input into the target model to obtain the target revision information. The target model is a model with semantic analysis and semantic transfer functions.

[0124] The mapping module 305 is used to map the target revision information to the document to be revised, and generate a target document with target revision operation traces. The target revision operation traces include at least the revision type, revision metadata, and comparison information before and after the revision.

[0125] In this embodiment of the application, the first parsing module 302 may include an identification unit, a first extraction unit, a second extraction unit, and a first encapsulation unit.

[0126] The identification unit is used to traverse the underlying format structure of the reference document, identify the reference feature nodes corresponding to the revision type, and use the reference feature nodes to differentially store the reference revision operation traces of the revision type.

[0127] The first extraction unit is used to extract the basic metadata of each reference feature node. The basic metadata includes at least the revision identifier, operator identifier, and revision timestamp.

[0128] The second extraction unit is used to extract the content data and location association information of each reference feature node.

[0129] The first encapsulation unit is used to encapsulate the basic metadata, content data, and location association information according to a preset data structure, and generate structured revision information corresponding to the reference revision operation trace.

[0130] In this embodiment, the revision type may include insertion revision, deletion revision, and format modification revision. The first parsing module 302 may also include a first parsing subunit, a second parsing subunit, and a third parsing subunit.

[0131] The first parsing subunit is used to identify the first node in the reference document that represents the inserted revision, extract the first basic metadata of the first node, the inserted first text content, and the location information of the inserted revision, and encapsulate the first basic metadata, the first text content, and the location information into the structured revision information corresponding to the inserted revision. The first basic metadata includes the first revision identifier, the first operator identifier, and the first revision timestamp, and the location information includes the first paragraph identifier and the character offset.

[0132] The second parsing subunit is used to identify the second node in the reference document that represents the deletion revision, extract the second basic metadata of the second node, the deleted second text content, and the deletion scope information of the deletion revision, and encapsulate the second basic metadata, the second text content, and the deletion scope information into the structured revision information corresponding to the deletion revision. The second basic metadata includes the second revision identifier, the second operator identifier, and the second revision timestamp. The deletion scope information includes the second paragraph identifier, the start offset, and the end offset.

[0133] The third parsing subunit is used to identify the third node in the reference document that represents the format modification and revision, extract the third basic metadata, the set of format changes, and the scope of format application of the third node, and encapsulate the third basic metadata, the set of format changes, and the scope of format application into structured revision information corresponding to the format modification and revision. The third basic metadata includes the third revision identifier, the third operator identifier, and the third revision timestamp. The set of format changes includes comparison data composed of old and new format values. The scope of format application information includes the third paragraph identifier and the character offset range.

[0134] In this embodiment of the application, the second parsing module 303 may include a retrieval unit, a positioning unit, a third extraction unit, a first establishment unit, and a second encapsulation unit.

[0135] The retrieval unit is used to retrieve a mapping table that includes the first mapping relationship between node identifiers, document structure elements, and document format.

[0136] The positioning unit is used to locate the document structure elements of the document to be revised according to the node identifiers in the mapping table, based on the set hierarchical order.

[0137] The third extraction unit is used to extract the target content and target format corresponding to the document structure elements one by one, based on the mapping relationship of the mapping table.

[0138] The first establishment unit is used to assign an element identifier to each document structure element based on the rules of the node identifiers described in the mapping table, and to establish a second mapping relationship between the element identifier, the target content, and the target format information through the element identifier.

[0139] The second encapsulation unit is used to encapsulate and integrate the second mapping relationship according to the structured data specifications of the mapping table, and generate structured document information.

[0140] In this embodiment of the application, the analysis module 304 may include a first determining unit, a first embedding unit, a first generating unit, and a first integrating unit.

[0141] The first determining unit is used to determine the structured format of the prompt words. The structured format includes a first label for representing the basis for revision and a second label for representing the data to be revised.

[0142] The first embedding unit is used to embed structured revision information into the first tag and to embed structured document information into the second tag.

[0143] The first generation unit is used to generate revision rule instructions based on the first tag and the second tag. The revision rule instructions include revising the content of the second tag according to the semantic intent of the first tag and the revision operation rules, and outputting preset structured data of the target revision information.

[0144] The first integration unit is used to integrate the first tag, the second tag after embedding the data, and the revision rule instructions to obtain the prompt word.

[0145] In this embodiment, the analysis module 304 may further include an input unit, a second determination unit, a third determination unit, a fourth determination unit, a second generation unit, a verification unit, and a third encapsulation unit.

[0146] The input unit is used to input prompt words and structured document data into the target model.

[0147] The second determining unit is used to parse the content of the first tag in the prompt word, determine the semantic intent of the structured revision information and the revision operation rules.

[0148] The third determining unit is used to parse the content of the second tag in the prompt words, and establish a structured data mapping relationship of the document to be revised by associating the target content and target format with the node identifiers of the structured document information.

[0149] The fourth determining unit is used to associate the semantic intent of the revision information with the structured data of the document to be revised based on the semantic matching algorithm, and to determine the revision area in the document to be revised that semantically matches the reference document.

[0150] The second generation unit is used to match the corresponding revision type according to the revision operation rules for the area to be revised, and generate preliminary revision information by combining the target format information of the structured document information.

[0151] The verification unit is used to verify the preliminary revision information if the structured revision information embedded in the prompt contains set rules, and to correct the preliminary revision information based on the verification results.

[0152] The third encapsulation unit is used to encapsulate the preliminary revision scheme into structured target revision information according to the field specifications that match the structured revision information.

[0153] In this embodiment, the mapping module 305 may include a fourth extraction unit, a creation unit, a second embedding unit, and a second integration unit.

[0154] The fourth extraction unit is used to parse the target revision information and classify it according to the revision type, extracting the basic metadata, content data and location association information corresponding to each revision type.

[0155] The creation unit is used to create native feature nodes corresponding to each revision type, configure the revision metadata to the node attributes of the native feature nodes, and encapsulate the content data into the node substructure of the native feature nodes.

[0156] The second embedding unit is used to determine the target region of the original feature node in the document to be revised based on the location association information, and to embed the original feature node into the target region.

[0157] The second integration unit is used to integrate the embedded native feature nodes and the original structure of the document to be revised to generate a target document with the target revision operation traces.

[0158] In this embodiment, the document revision apparatus may further include a batch processing module. The batch processing module may include a second creation unit, a caching unit, and an execution unit.

[0159] The second setup unit is used to obtain at least two documents to be revised and to establish a batch processing task queue.

[0160] The caching unit is used to perform a single parsing process on the same reference document, extracting and caching the structured revision information of the reference document.

[0161] The execution unit is used to sequentially execute the document revision method in this application embodiment for each document to be revised according to the task queue and based on the cached structured revision information.

[0162] This application also provides a computer-readable storage medium storing a program that can be loaded by a processor and executed by any of the document revision methods described in this application.

[0163] Those skilled in the art will understand that all or part of the functions of the various methods in the above embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, which may include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to achieve the above functions. For example, the program can be stored in the memory of a device, and when the program in the memory is executed by the processor, all or part of the above functions can be achieved. In addition, when all or part of the functions in the above embodiments are implemented by computer programs, the program can also be stored in a server, another computer, disk, optical disk, flash drive, or external hard drive, etc., and can be downloaded or copied to the memory of a local device, or the system of the local device can be updated. When the program in the memory is executed by the processor, all or part of the functions in the above embodiments can be achieved.

[0164] The above examples illustrate this application only to aid understanding and are not intended to limit its scope. Those skilled in the art to which this application pertains can make various simple deductions, modifications, or substitutions based on the ideas presented.< / w:drawing> < / w:p> < / w:tc> < / w:tr> < / w:tbl> < / w:sectpr>

Claims

1. A document revision method, characterized in that, include: Obtain a reference document and a document to be revised in revision mode, wherein the reference document includes at least one reference revision operation trace, and the reference document and the document to be revised are documents of the same type; The reference document is parsed to extract the structured revision information corresponding to the reference revision operation traces. The structured revision information includes at least the revision type, revision metadata, and revision content. The structured revision information is used to characterize the semantic intent of the manual revision. The document to be revised is parsed to generate structured document information containing target content and target format information. The target content is the structured information in the document to be revised that can be semantically matched, and the target format information is the format attributes of the document to be revised. The target content and the target format information have a mapping relationship. Determine the structured format of the prompt words, the structured format including a first tag for representing the basis of the revision and a second tag for representing the data to be revised; The structured revision information is embedded in the first tag, and the structured document information is embedded in the second tag; Based on the first tag and the second tag, a revision rule instruction is generated. The revision rule instruction includes revising the content of the second tag according to the semantic intent and revision operation rules of the first tag, and outputting preset structured data of the target revision information. The first tag and the second tag after embedding the data are integrated with the revision rule instruction to obtain the prompt word; The prompt words and the structured document information are input into the target model, which is a model with semantic analysis and semantic transfer functions; Analyze the content of the first tag in the prompt word to determine the semantic intent of the structured revision information and the revision operation rules; The content of the second tag in the prompt word is parsed, and the target content and target format associated with the node identifier of the structured document information are used to establish a structured data mapping relationship for the document to be revised. Based on a semantic matching algorithm, the semantic intent of the revision information is associated with the structured data of the document to be revised, and the revision area in the document to be revised that semantically matches the reference document is determined. For the area to be revised, the corresponding revision type is matched according to the revision operation rules, and preliminary revision information is generated by combining the target format information of the structured document information; If the structured revision information embedded in the prompt contains set rules, the preliminary revision information is verified, and the preliminary revision information is corrected based on the verification result. The preliminary revision information is encapsulated into structured target revision information according to the field specifications that match the structured revision information; The target revision information is mapped to the document to be revised to generate a target document with target revision operation traces. The target revision operation traces include at least the revision type, revision metadata, and comparison information before and after the revision.

2. The document revision method according to claim 1, characterized in that, The step of parsing the reference document and extracting the structured revision information corresponding to the reference revision operation traces includes: Traverse the underlying format structure of the reference document to identify the reference feature node corresponding to the revision type. The reference feature node is used to differentially store the reference revision operation traces of the revision type. Extract the basic metadata of each of the reference feature nodes, wherein the basic metadata includes at least a revision identifier, an operator identifier, and a revision timestamp; Extract the content data and location association information of each of the reference feature nodes; The basic metadata, the content data, and the location association information are encapsulated according to a preset data structure to generate the structured revision information corresponding to the reference revision operation trace.

3. The document revision method according to claim 2, characterized in that, The revision types include insertion revisions, deletion revisions, and formatting modification revisions; The step of parsing the reference document and extracting the structured revision information corresponding to the reference revision operation traces includes: Identify the first node representing the inserted revision in the reference document, extract the first basic metadata of the first node, the inserted first text content, and the positioning information of the inserted revision, and encapsulate the first basic metadata, the first text content, and the positioning information into the structured revision information corresponding to the inserted revision. The first basic metadata includes a first revision identifier, a first operator identifier, and a first revision timestamp. The positioning information includes a first paragraph identifier and a character offset. Identify the second node representing the deletion revision in the reference document, extract the second basic metadata of the second node, the deleted second text content, and the deletion scope information of the deletion revision, and encapsulate the second basic metadata, the second text content, and the deletion scope information into the structured revision information corresponding to the deletion revision. The second basic metadata includes a second revision identifier, a second operator identifier, and a second revision timestamp. The deletion scope information includes a second paragraph identifier, a start offset, and an end offset. Identify the third node in the reference document that represents the format modification and revision, extract the third basic metadata, the format change set, and the format application scope of the third node, and encapsulate the third basic metadata, the format change set, and the format application scope into the structured revision information corresponding to the format modification and revision. The third basic metadata includes the third revision identifier, the third operator identifier, and the third revision timestamp. The format change set includes comparison data composed of old format values ​​and new format values. The format application scope information includes the third paragraph identifier and the character offset range.

4. The document revision method according to claim 1, characterized in that, The process of parsing the document to be revised and generating structured document information containing target content and target format information includes: Retrieve the mapping table that includes the first mapping relationship between node identifiers, document structure elements, and document format; According to the set hierarchical order, based on the node identifier of the mapping table, locate the document structure elements of the document to be revised; Based on the mapping relationship of the mapping table, extract the target content and target format corresponding to the document structure element element by element; Based on the rules of the node identifiers in the mapping table, an element identifier is assigned to each document structure element, and a second mapping relationship is established between the element identifier, the target content, and the target format information through the element identifier; According to the structured data specifications of the mapping table, the second mapping relationship is encapsulated and integrated to generate the structured document information.

5. The document revision method according to claim 1, characterized in that, The step of mapping the target revision information to the document to be revised, generating a target document with target revision operation traces, includes: The target revision information is parsed and classified according to revision type, and the basic metadata, content data and location association information corresponding to each revision type are extracted; For each revision type, a native feature node corresponding to the revision type is created, the revision metadata is configured into the node attribute of the native feature node, and the content data is encapsulated into the node substructure of the native feature node; Based on the location association information, the native feature node is determined in the target region of the document to be revised, and the native feature node is embedded in the target region. The embedded native feature nodes and the original structure of the document to be revised are integrated to generate the target document with the target revision operation traces.

6. The document revision method according to claim 1, characterized in that, Also includes: Obtain at least two documents to be revised and create a batch processing task queue; Perform a single parsing process on the same reference document to extract and cache the structured revision information of the reference document; According to the task queue, based on the cached structured revision information, the document revision method is executed sequentially for each document to be revised.

7. A document revision device, characterized in that, include: The acquisition module is used to acquire a reference document and a document to be revised in revision mode. The reference document includes at least one reference revision operation trace, and the reference document and the document to be revised are documents of the same type. The first parsing module is used to parse the reference document and extract the structured revision information corresponding to the reference revision operation traces. The structured revision information includes at least the revision type, revision metadata, and revision content. The structured revision information is used to characterize the semantic intent of the manual revision. The second parsing module is used to parse the document to be revised and generate structured document information containing target content and target format information. The target content is the structured information in the document to be revised that can be semantically matched, and the target format information is the format attribute of the document to be revised. The target content and the target format information have a mapping relationship. An analysis module is used to determine the structured format of the prompt words, the structured format including a first tag for representing the basis for revision and a second tag for representing the data to be revised; The structured revision information is embedded in the first tag, and the structured document information is embedded in the second tag; based on the first tag and the second tag, a revision rule instruction is generated, the revision rule instruction includes revising the content of the second tag according to the semantic intent and revision operation rules of the first tag, and outputting preset structured data of the target revision information; The first tag and the second tag after embedding the data are integrated with the revision rule instruction to obtain the prompt word; The prompt words and the structured document information are input into a target model, which is a model with semantic analysis and semantic transfer functions. The content of the first tag in the prompt words is parsed to determine the semantic intent of the structured revision information and the revision operation rules. The content of the second tag in the prompt words is parsed, and a structured data mapping relationship of the document to be revised is established by associating the target content with the target format through the node identifier of the structured document information. Based on a semantic matching algorithm, the semantic intent of the revision information is associated with the structured data of the document to be revised to determine the revision area in the document to be revised that semantically matches the reference document. For the area to be revised, the corresponding revision type is matched according to the revision operation rules, and preliminary revision information is generated by combining the target format information of the structured document information; If the structured revision information embedded in the prompt contains set rules, the preliminary revision information is verified, and the preliminary revision information is corrected based on the verification result. The preliminary revision information is encapsulated into structured target revision information according to the field specifications that match the structured revision information; The mapping module is used to map the target revision information to the document to be revised, and generate a target document with target revision operation traces. The target revision operation traces include at least the revision type, revision metadata, and comparison information before and after the revision.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that can be loaded by a processor and executed as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method, device and equipment for revising label-free document and computer readable medium

    CN118467716A

  • Document processing method and device, electronic equipment and storage medium

    CN119129539A