A document rewriting control method and system based on free instruction analysis
Patent Information
- Application Number
- CN202611258564.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-10-30
AI Technical Summary
更确切地,本发明提出了一种通过将自由文本指令解析为结构化改写任务配置,并基于该配置动态控制生成过程和结果校验的文档改写控制方法与系统,旨在解决自由文档改写场景中,用户自然语言指令不规范、任务意图不明确、生成控制策略选择粗放、改写过程不可控、结果难以校验以及多轮改写上下文漂移等核心技术难题
[0063](1)显著提高意图识别的精准性:能够从高度自由的自然语言指令中,精准识别用户真实改写意图(包括主副意图),并评估置信度,大幅降低大语言模型对用户需求的误解概率。
Smart Images

Figure CN123013868A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of natural language processing, generative artificial intelligence, document editing, human-computer interaction and intelligent writing technology, and specifically to a document rewriting control method, system, computer-readable storage medium and electronic device based on free instruction parsing. Background Technology
[0002] Currently, with the maturity of large language model technology, intelligent writing systems widely support various document processing tasks such as article rewriting, expansion, abbreviation, polishing, summary generation, style transfer, and title generation. However, when processing user-defined free text commands, existing systems generally adopt a simple approach of directly concatenating the user's original command with the text to be processed into prompt words for input into the large language model. This method has the following technical drawbacks in free command scenarios:
[0003] First, the unstructured and colloquial nature of user commands leads to unstable intent comprehension. For example, users often give implicit and vague instructions such as "Make it more formal," "This part is too wordy, shorten it," "Make it more like a policy report," or "Change to a more impactful title." If the system directly transmits the original instructions without in-depth analysis, it is easy for the large language model to produce intent bias, such as misinterpreting tone refinement as content rewriting or information compression as fact deletion, which seriously affects the usability of the generated results.
[0004] Second, rewriting tasks are diverse but lack a unified, structured task expression and control mechanism. Tasks such as expansion, abbreviation, polishing, style transfer, structural reorganization, and title generation have significantly different input and output constraints and generation focuses for the model. However, existing systems typically use generic prompt word templates to handle all tasks, lacking structured descriptions and refined control of key parameters such as task type, rewriting scope, length constraints, style level, factual preservation requirements, and prohibited items. This results in insufficient stability, accuracy, and controllability of the model output.
[0005] Third, the selection of generation control strategies is too broad, failing to dynamically match the optimal generation path based on different intentions. Different rewriting tasks have varying requirements for prompt word templates, model temperature, Top-P parameter settings, multi-step workflows, and post-processing strategies. For example, abbreviations need to emphasize information condensation and length control, polishing needs to maintain factual accuracy and fluency, style transfer needs to highlight the target stylistic features, and structural reorganization needs to ensure logical clarity. The existing system lacks pre-emptive intent recognition and structured configuration, causing all tasks to reuse the same generation path, making it difficult to achieve dynamic strategy optimization for task adaptation, and affecting the consistency and efficiency of rewriting results.
[0006] Fourth, there is a lack of pre-predictable task configuration and constraint quantification methods that can be verified after generation. Under the existing "original text + user instructions" free combination mode, the system cannot determine the completeness of the task or constraint conflicts before generation, nor can it objectively verify whether the result meets the instruction requirements after generation. For example, "compress it" does not specify a word count target, "be more formal" does not define a style level, and "do not change the original meaning" has no quantifiable verification standard, making it difficult to determine user expectations and making it impossible to automatically evaluate the quality of the result.
[0007] Fifth, context drift and instruction forgetting are prone to occur during multi-round free rewriting. In continuous rewriting scenarios, users often request iterative instructions such as "shorter," "keep the second paragraph," "change to a briefing style," and "it was too harsh just now, soften it." If the system lacks the ability to identify the task type and constraint update of each round of instructions and does not effectively manage the state of historical tasks, it is easy to lose the preceding requirements, leading to deviations in the rewriting direction or even the generation of content that contradicts the user's intention. This is a significant shortcoming of existing systems in terms of context state management.
[0008] In summary, existing intelligent writing systems have shortcomings in handling free instructions, such as intent understanding, task expression, strategy adaptation, constraint quantification, and context management. There is an urgent need for a method that can perform structured parsing of free instructions and implement refined rewriting control accordingly. Summary of the Invention
[0009] To overcome the aforementioned deficiencies in existing technologies, this application proposes a novel document rewriting control method and system based on free instruction parsing. More specifically, this invention proposes a document rewriting control method and system that parses free text instructions into structured rewriting task configurations and dynamically controls the generation process and result verification based on these configurations. This aims to solve core technical challenges in free document rewriting scenarios, such as non-standard user natural language instructions, unclear task intent, coarse selection of generation control strategies, uncontrollable rewriting process, difficulty in verifying results, and context drift during multiple rewriting rounds.
[0010] Specifically, the present invention mainly solves the following technical problems:
[0011] 1. How to accurately identify the user's true rewriting intent from highly free text instructions and convert it into a structured rewriting task configuration that is understandable and executable by the machine.
[0012] 2. How to effectively manage and transmit rewriting intentions and constraints, resolve instruction conflicts, and avoid context drift in compound instructions and multi-round rewriting scenarios.
[0013] 3. How to dynamically select the most suitable generation control strategy (including Prompt template, model parameters, workflow, preset validator, etc.) based on the generated structured rewrite task configuration.
[0014] 4. How to establish a closed loop for rewriting tasks that is predictable before generation and verifiable after generation, to ensure that the generated results highly meet user expectations.
[0015] 5. How to significantly reduce the probability of large language models misunderstanding user instructions through the above mechanisms, improve the stability, controllability and reliability of free rewriting results, and achieve automatic correction.
[0016] The core of this invention lies in introducing an intelligent control layer before calling the generative model for document rewriting. This control layer performs deep semantic parsing, multi-intent recognition, constraint extraction, semantic normalization, task configuration generation and verification on the user's free text instructions, and implements multi-round rewriting context management. Ultimately, the original natural language instructions are transformed into a standardized, verifiable, and traceable structured rewriting task configuration. Based on this configuration, the system dynamically selects the most suitable generation control strategy, including customized Prompt templates, model parameters, workflows, document pruning and injection rules, and validator combinations, thereby executing document rewriting and performing closed-loop verification and correction of the results.
[0017] This invention changes the simple prompt splicing mode in the prior art. By adding "instruction semantic normalization", "structured task configuration management" and "generation control strategy selection" before generation, the document rewriting task has clear task type, processing scope, target style, length requirements, fact preservation requirements, prohibited items and output format requirements, which significantly improves the accuracy, controllability and reliability of the generated results.
[0018] To achieve the above objectives, the present invention employs the following technical strategies:
[0019] 1. Mechanism for converting free instructions into executable structured rewrite task configurations
[0020] This invention does not simply send user-defined instructions to a generative model. Instead, it introduces an intelligent control layer that, through referential parsing, multi-intent recognition, constraint extraction, and context completion, comprehensively transforms unstructured, colloquial, and implicit user-defined instructions into a standardized, structured rewrite task configuration (RewriteTaskConfig) that includes rewrite type, precise range, hard / soft constraints, priority, and validation rules. This is the core prerequisite for achieving controllable rewrite.
[0021] 2. Supports a task normalization mechanism that incorporates complex intents, constraint priorities, and conflict handling.
[0022] To address the diversity and potential conflicts in user expression, this invention can simultaneously identify main ideas and secondary intentions, and differentiate and prioritize hard and soft constraints on requirements such as length, style, and factual preservation. When a constraint conflict is detected, the system automatically resolves it or clarifies it to the user according to a preset strategy, ensuring that the final generated task configuration is logically consistent and executable.
[0023] 3. Dynamic generation control strategy selection and adaptation mechanism based on structured task configuration
[0024] This invention dynamically and granularly selects and adapts the most suitable generation control strategy based on the intent, constraints, and priorities identified in RewriteTaskConfig. This includes: customized Prompt templates, document trimming and injection rules, model parameter configuration, multi-step workflows, and preset validation rule sets and failure handling strategies. This contrasts with existing technologies that use a single, general Prompt or a coarse-grained strategy.
[0025] 4. Multi-round rewrite context management mechanism based on task configuration version chain
[0026] To address the context drift issue in multi-round free rewriting, this invention introduces a task configuration version chain management mechanism. Each round of rewriting generates a new RewriteTaskConfig version, which intelligently inherits, overrides, or adds the intent and constraints of the previous round of tasks, ensuring that the instruction context is effectively and accurately transmitted and managed during continuous rewriting.
[0027] 5. Verifiable task configuration and closed-loop correction mechanism based on verification failures.
[0028] This invention establishes a closed-loop control process from pre-generation verification to post-generation correction. Before generation, the system performs integrity and conflict checks on the task configuration; after generation, it performs multi-dimensional automated verification based on the configuration. More importantly, when verification fails, the system can automatically identify the failed verification item, convert it into a specific correction constraint, and trigger local correction or regeneration until the result meets the requirements or reaches the retry limit, greatly improving the reliability of the generated results and the automation capability.
[0029] Specifically, this application provides the following technical solutions:
[0030] The first aspect of this application provides a document rewriting control method based on free instruction parsing, such as... Figure 1 As shown, it includes the following steps:
[0031] S1. Obtain the user's input instructions for rewriting free text and the context information corresponding to the current document;
[0032] S2. Preprocess the free text rewriting instructions, the preprocessing including at least reference parsing and context completion, to generate normalized instructions;
[0033] S3. Rewrite intent identification, constraint parameter extraction and rewrite range positioning are performed on the normalized instructions to obtain at least one candidate rewrite intent and associated structured constraint parameters.
[0034] S4. Normalize the semantics of the candidate rewriting intent, constraint parameters and rewriting range to generate a structured rewriting task configuration that includes the main rewriting intent, secondary rewriting intent, rewriting range, hard constraints, soft constraints and constraint priorities.
[0035] S5. Perform integrity verification and constraint conflict detection on the structured rewriting task configuration, and perform context inheritance, overwriting or addition based on the historical rewriting task configuration in multi-round rewriting scenarios to generate the final rewriting task configuration for the current round.
[0036] S6. Dynamically select the target generation control strategy based on the final rewritten task configuration;
[0037] S7. Based on the target generation control strategy, construct a model input and call the generative model to perform document rewriting to obtain the rewriting result;
[0038] S8. Perform multi-dimensional automated verification on the rewriting result according to the preset verification rule set determined in the final rewriting task configuration;
[0039] S9. When the rewriting result fails the verification, the failed verification item is converted into a correction constraint, and a local correction or regeneration is triggered based on the correction constraint until the rewriting result passes the verification or the preset number of retries is reached.
[0040] Furthermore, in the method of this application, in step S1, the context information includes at least the user-selected text, document structure, and historical rewrite task configuration;
[0041] In step S2, the preprocessing further includes: removing invalid whitespace characters, standardizing punctuation, identifying negative expressions, extracting degree adverbs, and identifying colloquial expressions.
[0042] Furthermore, in the method of this application, step S3, the rewriting intent identification includes: identifying one or more candidate rewriting intents contained in the normalization instruction, and evaluating the confidence level of each candidate rewriting intent; when the normalization instruction contains multiple rewriting intents, distinguishing between main intents and secondary intents; the rewriting intents include at least expansion, abbreviation, polishing, rewriting, style transfer, structural reorganization, title generation, abstract generation, tone adjustment, logic optimization, format conversion, content continuation, and correction of typos and grammatical errors.
[0043] Furthermore, in the method of this application, step S3, the rewriting scope positioning includes: based on the context information, parsing the pronouns in the free text rewriting instruction into a clear rewriting scope; the rewriting scope includes at least one of the selected text, the paragraph where the cursor is located, the specified paragraph or chapter, and the entire text, or is precisely defined by the start offset and the end offset.
[0044] Furthermore, in the method of this application, in step S3, the constraint parameters include hard constraints and soft constraints, wherein the hard constraints are conditions that must be met, and the soft constraints are conditions that are given priority but are allowed to be handled flexibly.
[0045] The constraint parameters include one or more of the following: rewrite type, target length, target style, target tone, fact preservation instruction, information addition / removal restrictions, structure preservation instruction, entity preservation instruction, output format, number of candidate results, and prohibited items.
[0046] Furthermore, in the method of this application, step S5, the integrity verification and constraint conflict detection includes: when there are missing key parameters in the structured rewriting task configuration, automatically inferring and completing them based on the context information or historical rewriting task configuration, or generating clarification questions to ask the user, or using a default strategy to complete and mark the confidence level; when a constraint conflict is detected, automatically resolving it based on the priority of hard constraints and soft constraints, or prompting the user of the conflict and requesting a selection.
[0047] Furthermore, in the method of this application, step S5, the context inheritance, overriding, or addition based on historical rewrite task configuration in a multi-round rewrite scenario includes: maintaining a task configuration version chain, wherein the task configuration version chain records the identifier, version number, and parent-child relationship of each round of task configuration to realize the inheritance, overriding, addition, or deletion of constraints; using the previous round of rewrite task configuration as the base configuration, adding constraint parameters to the base configuration when the current instruction is an incremental instruction; updating the corresponding fields in the base configuration when the current instruction is a modification instruction; removing the corresponding constraints in the base configuration when the current instruction is a deletion instruction; inheriting the base configuration by default for unmentioned constraint parameters; generating a new version of the structured rewrite task configuration based on the base configuration and the current instruction, and recording the inheritance relationship between versions.
[0048] Furthermore, in the method of this application, in step S6, the target generation control strategy includes: Prompt template selection, document trimming and injection rules, model parameter configuration, workflow selection, preset verification rule set, and verification failure handling strategy; wherein: the Prompt template is selected according to the main rewriting intent and the secondary rewriting intent; the document trimming and injection rules determine the content of the document to be injected and its trimming method according to the rewriting range and constraint parameters; the model parameter configuration includes at least temperature parameters and Top-P parameters.
[0049] Furthermore, in the method of this application, step S8 includes at least one of the following verifications: task type matching verification, length constraint verification, style conformity verification, tone conformity verification, factual consistency verification, entity consistency verification, number consistency verification, time consistency verification, structure preservation verification, output format verification, and prohibited items check.
[0050] A second aspect of this application provides a document rewriting control system based on free instruction parsing, wherein the system implements the steps of the aforementioned document rewriting control method based on free instruction parsing during operation, such as... Figure 2 As shown, the system includes:
[0051] The instruction receiving module is used to obtain the user's input of free text rewriting instructions and the context information corresponding to the current document;
[0052] The instruction preprocessing module is used to preprocess the free text rewriting instructions. The preprocessing includes at least reference parsing and context completion to generate standardized instructions.
[0053] The intent recognition and parameter extraction module is used to perform rewriting intent recognition, constraint parameter extraction and rewriting range positioning on the normalized instruction to obtain at least one candidate rewriting intent and associated structured constraint parameters.
[0054] The task configuration management module is used to semantically normalize the candidate rewriting intents, constraint parameters, and rewriting ranges to generate a structured rewriting task configuration that includes the main rewriting intent, secondary rewriting intent, rewriting range, hard constraints, soft constraints, and constraint priorities; and to perform integrity verification and constraint conflict detection on the structured rewriting task configuration, and to perform context inheritance, overwriting, or addition based on historical rewriting task configurations in multi-round rewriting scenarios to generate the final rewriting task configuration for the current round.
[0055] A control strategy generation scheduling module is used to dynamically select a target control strategy based on the final rewritten task configuration.
[0056] The rewrite execution module is used to construct model input based on the target generation control strategy and call the generative model to perform document rewriting to obtain the rewriting result.
[0057] The result verification and correction module is used to perform multi-dimensional automated verification of the rewriting result according to the preset verification rule set determined in the final rewriting task configuration; and when the rewriting result fails the verification, the failed verification item is converted into a correction constraint, and a local correction or regeneration is triggered based on the correction constraint until the rewriting result passes the verification or reaches the preset number of retries.
[0058] A third aspect of this application provides an electronic device, including: a memory and a processor;
[0059] Memory: Used to store computer programs;
[0060] Processor: Used to execute the computer program to implement the steps of the aforementioned document rewriting control method based on free instruction parsing.
[0061] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the steps of the aforementioned document rewriting control method based on free instruction parsing.
[0062] In summary, compared with existing technologies (simple Prompt splicing mode), the solution of this invention has the following advantages:
[0063] (1) Significantly improves the accuracy of intent recognition: It can accurately identify the user's true rewriting intent (including primary and secondary intents) from highly free natural language instructions, and assess the confidence level, greatly reducing the probability of the large language model misunderstanding the user's needs.
[0064] (2) Achieve structuring and standardization of rewrite tasks: Convert unstructured instructions into standardized RewriteTaskConfig that can be understood and executed by machines, including hard constraints, soft constraints and priorities, thereby improving the executability and automation of tasks.
[0065] (3) Provides refined generation control capabilities: It can dynamically select the most matching Prompt template, document trimming and injection rules, model parameters, workflow and validator combination according to the structured task configuration, to ensure that the generation process is highly controlled and the output results are more in line with expectations.
[0066] (4) Supports compound intents and multi-round rewriting scenarios: effectively handles compound instructions proposed by users, and through the task configuration version chain mechanism, intelligently manages context inheritance, overwriting and updating in the multi-round rewriting process, significantly solving the context drift problem.
[0067] (5) Establish a closed-loop, verifiable rewrite process: Perform task integrity and conflict checks before generation, and perform multi-dimensional automated checks on the results after generation. When the check fails, it can automatically generate correction constraints and trigger local correction or regeneration, which greatly reduces unqualified outputs and improves the reliability of the results.
[0068] (6) Improve the robustness and user experience of the intelligent writing system: Through precise instruction parsing, flexible strategy selection and automated closed-loop correction, the stability, controllability, generation quality and user satisfaction of the intelligent writing system in the free rewriting scenario are significantly improved.
[0069] (7) Provides a traceable audit and optimization mechanism: a complete task configuration version chain and execution record, providing comprehensive data support for subsequent performance analysis, model optimization, auditing and problem investigation. Attached Figure Description
[0070] To more clearly illustrate the technical solution of this application, the accompanying drawings involved in the description of this invention will be briefly introduced below. It should be noted that the drawings only show some embodiments of the invention. For those skilled in the art, other related drawings can be derived from these drawings without creative effort.
[0071] Figure 1 This is a schematic diagram illustrating the operational steps of the document rewriting control method based on free instruction parsing in this application.
[0072] Figure 2 This is a structural diagram of the document rewriting control system based on free instruction parsing in this application.
[0073] Figure 3 This is a schematic diagram of the overall implementation process of the method in this application. Detailed Implementation
[0074] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the protection scope of this application.
[0075] In this document, the term "including" and any variations thereof (such as "including," "including," etc.) are open-ended expressions and should be understood as "including but not limited to," meaning that the listed content is not an exhaustive list and may include other content not explicitly mentioned. The term "based on" should be understood as "at least partially based on," meaning that the basis or condition referred to may not be the only factor and may involve other relevant factors.
[0076] In this application, the terms "a" and "a plurality of" are used to modify related elements or features, and their expression is illustrative rather than restrictive. Unless otherwise expressly stated in the context, "a" should be understood as "at least one," and "a plurality of" should be understood as "at least two." Those skilled in the art should reasonably interpret these terms based on the semantic and logical relationships of the context to ensure that they cover the possibility of "one or more."
[0077] This invention provides the following technical solution:
[0078] In a first aspect, the present invention provides a document rewriting control method based on free instruction parsing.
[0079] like Figure 3 As shown, the method of the present invention includes the following core steps, which, through the synergistic effect of each module, realize the transformation from user-defined instructions to controllable and verifiable rewrite results.
[0080] S1: Obtain user-defined rewrite commands and document context
[0081] The system receives free text instructions (I) from the user and obtains rich contextual information (D) of the current document.
[0082] Document context D includes at least one or more of the following:
[0083] 1. User-selected text: The area to be rewritten as specified by the user.
[0084] 2. The paragraph where the cursor is currently located: the default focus for rewriting.
[0085] 3. Current chapter content and full text content: used to understand a more macro-level rewriting intention or to resolve referential issues.
[0086] 4. Document title, table of contents, paragraph structure, and format: Provides structured information to help determine the scope and constraints of rewriting.
[0087] 5. The result of the most recent rewrite: In a multi-round rewrite scenario, it serves as the basis for the current rewrite.
[0088] 6. History rewrite instruction record and corresponding task configuration version chain: used to understand the user's multi-round intent evolution and context inheritance.
[0089] For example, if a user inputs, "This is too colloquial; please make it more formal without changing the original meaning," the system will simultaneously retrieve the paragraph selected by the user as the text to be rewritten, and record the current rewriting round N, as well as the instructions and task configurations from the previous N-1 rounds.
[0090] S2: Preprocessing free instructions
[0091] The system performs preprocessing on the free text instruction I to obtain a normalized, easily parsed instruction text. Preprocessing includes:
[0092] 1. Remove invalid whitespace characters and standardize punctuation: standardize text format.
[0093] 2. Identify negative expressions: "Do not change the original meaning" and "Do not add new information".
[0094] 3. Extracting adverbs of degree: "a little shorter", "very formal", "a bit wordy".
[0095] 4. Identify colloquial expressions: This provides clues for subsequent intent recognition and style transfer.
[0096] 5. Identify pronouns and complete context: Combine pronouns such as "this section," "this part," "before," and "above" with the document context (D) and historical task configuration to parse them into a clear scope for rewriting. For example, "shorter" is parsed as: the current task is based on the results of the previous round, and the goal is to further shorten it.
[0097] S3: Identify rewrite intent categories and assess confidence levels
[0098] The system uses rules, classification models (such as fine-tuned models like BERT and RoBERTa) or large language models to perform intent recognition on preprocessed instructions, and obtains one or more candidate rewrite intent categories and their confidence scores.
[0099] Rewriting intentions include at least the following categories: expansion, abbreviation, polishing, rewriting, style transfer, structural reorganization, title generation, abstract generation, tone adjustment, logic optimization, format conversion, content continuation, and correction of typos and grammatical errors.
[0100] When a user command contains multiple intents, the system can identify composite intents and distinguish between primary intents and secondary intents.
[0101] For example: "Help me compress this passage to under 200 words and make it more formal without changing the original meaning."
[0102] The system identified it as:
[0103] Conceptual diagram: short (abbreviation), confidence level 0.95;
[0104] Sub-meaning Figure 1 :style_transfer (style transfer), target style: formal, confidence level 0.88;
[0105] Sub-meaning Figure 2 Preserve_meaning (preserve the original meaning), confidence level 0.92.
[0106] S4: Extract and rewrite constraint parameters and range
[0107] The system extracts structured constraint parameters and precise rewrite scope from free instructions (I) and document context (D).
[0108] I. Constraint parameters include, but are not limited to:
[0109] 1. RewriteType: such as shorten, polish, style_transfer.
[0110] 2. Target Length: such as maxChars=200, ratio=0.7, keepLength.
[0111] 3. Target Style: such as formal, policy_report, academic, journalistic.
[0112] 4. Target tone: such as objective, empathetic, neutral.
[0113] 5. PreserveMeaningAndFacts: Boolean value indicating whether the original meaning or facts can be changed.
[0114] 6. Information addition / removal restrictions (AllowNewInfo / ForbidInfoAddition): Whether to allow the addition of information not mentioned in the original text.
[0115] 7. Preserve Structure: Whether to retain the original text's paragraphs, headings, lists, and other structures.
[0116] 8. PreserveEntities / Numbers / Dates: Whether to retain specific types of information unchanged.
[0117] 9. Output format: such as replace_text, markdown, json_list.
[0118] 10. Number of candidate results (CandidateCount): Requires the number of alternative solutions to be generated.
[0119] 11. Prohibitions: such as forbidKeywords=['sensitive words'].
[0120] 12. Hard Constraint: A condition that must be met, such as an upper limit on length.
[0121] 13. Soft Constraint: Conditions that should be met as much as possible but can be handled flexibly, such as style preferences.
[0122] II. RewriteScope Analysis:
[0123] The system will intelligently parse and determine the specific scope of the rewrite, including:
[0124] 1. Selected text: The text segment that the user has explicitly selected.
[0125] 2. Current paragraph (cursor position): If the user does not select a paragraph, the current paragraph will be processed by default.
[0126] 3. Specify paragraph / section (paragraph_N / section_X): Identified by commands such as "second paragraph" and "first section".
[0127] 4. Full text (document): Identified through commands such as "whole" and "full text".
[0128] 5. Referential resolution: Locating information by combining the preceding paragraph, this part of the content with the context.
[0129] 6. Precisely defined using start / end offsets (startOffset, endOffset).
[0130] S5: Generate structured rewrite task configuration and perform integrity and conflict checks.
[0131] The system semantically normalizes the intents, extracted constraint parameters, and ranges identified in steps S3 and S4 into a unified, machine-parseable RewriteTaskConfig JSON object. It then performs integrity checks and constraint conflict detection on this configuration.
[0132] Structured configuration example:
[0133] {
[0134] "taskId": "rewrite_task_001",
[0135] "version": 1,
[0136] "rawInstruction": "This is too colloquial. Please revise it to be more formal, without changing the original meaning."
[0137] "normalizedInstruction": "Applies a formal style to the selected text while preserving its original meaning."
[0138] "intent": {
[0139] "primary": "polish",
[0140] "secondary": [],
[0141] "confidence": 0.98
[0142] },
[0143] "scope": {
[0144] "type": "selection",
[0145] "startOffset": 120, / / Starting offset of the selected text
[0146] "endOffset": 360, / / End offset of the selected text
[0147] "resolvedBy": "user_selection" / / Range determination method
[0148] },
[0149] "constraints": [
[0150] {"type": "style", "value": "formal", "priority": "hard"},
[0151] {"type": "preserveMeaning", "value": true, "priority": "hard"},
[0152] {"type": "allowNewFacts", "value": false, "priority": "hard"},
[0153] {"type": "preserveStructure", "value": true, "priority": "soft"} / / Soft constraint
[0154] ],
[0155] "validationPolicy": {
[0156] "onFail": "regenerate_with_correction_prompt", / / Attempt to correct after verification failure
[0157] "maxRetries": 2
[0158] },
[0159] "strategy": { / * To be filled in S7 later * / }
[0160] }
[0161] I. Integrity verification and missing parameter completion:
[0162] If a critical parameter is missing in RewriteTaskConfig (such as "compress" but without specifying the target length), the system will try:
[0163] 1. Automatically infer and complete based on document context and historical task configuration (for example, if the previous round was 200 words, the current round "shorter" will infer 150 words).
[0164] 2. If the inference cannot be made, generate a clarifying question to ask the user (e.g., "How many words would you like to compress to?").
[0165] 3. If the missing information cannot be completed and the user does not respond, the default strategy (such as compression by 20%) will be adopted, and the confidence level of the parameter will be marked.
[0166] II. Constraint Conflict Detection and Handling:
[0167] The system checks for conflicting constraints in RewriteTaskConfig, such as: "Be as detailed as possible, but do not exceed 100 words".
[0168] III. Priority Determination: Distinguish between hard constraints (must be satisfied) and soft constraints (satisfy as much as possible). Hard constraints have higher priority than soft constraints.
[0169] IV. Conflict Resolution Strategies:
[0170] For hard conflicts (such as two hard constraints that cannot be satisfied simultaneously), the system can prompt the user of the conflict and request a choice.
[0171] For soft conflicts or hard-soft conflicts, the system automatically resolves them based on preset rules or user priority preferences and records the resolution results. For example, in the scenario of "as detailed as possible, but no more than 100 words", the system will prioritize satisfying the hard constraint of "no more than 100 words" and emphasize "as detailed as possible within 100 words" in the Prompt.
[0172] S6: Perform multi-round context management rewriting
[0173] In multi-round interaction scenarios, the system maintains a task configuration version chain (TaskConfig VersionChain) to prevent context drift.
[0174] 1. Inheriting historical configuration: After a new round of user commands is issued, the system will load the RewriteTaskConfig that has been completed or is being executed in the previous round as the basic configuration.
[0175] 2. Incremental instruction parsing: The system determines whether the current instruction is an incremental instruction (such as "shorter" or "softer tone") or a completely new instruction.
[0176] 3. Configure update strategy:
[0177] New commands will be added directly to the current configuration.
[0178] For modification instructions, update the corresponding fields (e.g., "shorter" will override the length constraint from the previous round).
[0179] For deletion instructions (such as "do not keep the original meaning this time"), remove the corresponding constraints.
[0180] For constraints not mentioned, the configuration from the previous round will be inherited by default.
[0181] 4. Generate a new version configuration: Based on the basic configuration and incremental instructions, the system generates a new RewriteTaskConfig version and records its parentTaskId and version, forming a traceable chain.
[0182] For example:
[0183] First round configuration (generated by S5): {"taskId": "T001", "intent": "shorten", "targetLength": {"maxChars": 300}, "targetStyle": "formal", "preserveMeaning":true}
[0184] User instruction: "Shorter, but don't be too harsh."
[0185] Second round configuration (generated in S6):
[0186] {
[0187] "taskId": "T002",
[0188] "version": 2,
[0189] "parentTaskId": "T001",
[0190] "rawInstruction": "Make it shorter, but don't be too harsh in tone."
[0191] "intent": {"primary": "shorten", "secondary": ["tone_adjust"]},
[0192] "scope": {"type": "inherited"}, / / Inherit the scope from the previous round
[0193] "constraints": [
[0194] {"type": "targetLength", "value": {"policy": "shorter_than_previous", "ratio": 0.8}, "priority": "hard"}, / / Overwrite the previous length
[0195] {"type": "targetStyle", "value": "formal", "priority": "hard"}, / / Inheritance
[0196] {"type": "preserveMeaning", "value": true, "priority": "hard"}, / / Inheritance
[0197] {"type": "targetTone", "value": "soft", "priority": "hard"} / / New
[0198] ],
[0199] "validationPolicy": {"onFail": "regenerate_with_correction_prompt","maxRetries": 2}
[0200] }
[0201] S7: Determine the generation control strategy
[0202] Based on the finalized RewriteTaskConfig, the system dynamically selects the most suitable generation control strategy. The generation control strategy is not a simple prompt text, but a complete set of instruction construction, model invocation, and post-processing procedures.
[0203] The generation control strategy includes:
[0204] 1. Prompt Template Selection: Select the base Prompt template based on primaryIntent and secondaryIntent.
[0205] 2. Document Trimming and Injection Rules: Based on the scope and constraints, determine which parts of the original document (such as the entire document, selected text, and relevant chapters) and how (such as truncation, summarization, and specific formatting) will be injected into the Prompt.
[0206] 3. Model Parameter Configuration: Dynamically adjust the hyperparameters of the large language model based on intent and constraints, such as temperature (creativity) and top_p (diversity).
[0207] 4. Workflow Selection: For complex tasks, select a multi-step workflow, such as summarizing first and then rewriting, or outlining first and then expanding.
[0208] 5. PresetValidationRules: Based on the constraints in RewriteTaskConfig, determine the combination of validators to be enabled and update the strategy.validators field of RewriteTaskConfig.
[0209] 6. Failure Handling Policy: Explicitly define the behavior after a verification failure in RewriteTaskConfig, such as regenerate_with_correction_prompt, return_to_user_for_confirmation, and flag_and_stop.
[0210] For example:
[0211] If intent.primary = "shorten" and constraints include targetLength, then the shortened Prompt template is selected, and the length validator and key information retention validator are enabled.
[0212] If intent.primary = "polish" and constraints include preserveMeaning=true, then the polished Prompt template is selected, and the fact consistency checker and entity consistency checker are enabled.
[0213] If intent.primary = "style_transfer" and constraints contain targetStyle="policy_report", then select the policy report style Prompt template and enable the style scoring validator.
[0214] S8: Perform document rewriting based on task configuration.
[0215] Based on the generation control strategy determined in step S7, the system constructs model input and sends it to the large language model.
[0216] Model inputs include:
[0217] 1. Original content: processed by trimming and injection rules.
[0218] 2. Structured rewrite parameters: Key constraints extracted from RewriteTaskConfig are injected into the Prompt in the form of natural language or specific tags.
[0219] 3. Generation constraints: such as target length, style, and tone requirements.
[0220] 4. Output format requirements: such as markdown, plain_text.
[0221] 5. Prohibited items: such as the prohibition of using specific words and sentence structures.
[0222] 6. Examples or style notes: Provide a few few examples to guide the model.
[0223] The generative model returns a rewritten result based on the above input.
[0224] S9: Perform rewrite result verification and closed-loop correction
[0225] The system performs automated, multi-dimensional verification of the rewrite results returned by the model based on the set of verification rules defined in RewriteTaskConfig.
[0226] The verification content includes:
[0227] 1. Task type matching: Whether the specified tasks such as abbreviation, expansion, and polishing have been completed.
[0228] 2. Length constraints: Whether it meets the targetLength requirements (such as number of words, number of characters, ratio).
[0229] 3. Style / tone conformity: Whether it meets the targetStyle or targetTone (can be scored based on pre-trained classifier or model).
[0230] 4. Factual consistency: Whether the core facts of the original text are retained, whether new facts are introduced, and whether the basic semantics are changed.
[0231] 5. Entity / Number / Time Consistency: Whether there is unauthorized addition, deletion, or modification of named entities, numbers, and time information in the original text.
[0232] 6. Structure Preservation: Whether to retain the original paragraph hierarchy, list structure, and heading structure.
[0233] 7. Output format: Whether it conforms to the outputFormat requirements (e.g., whether it is in Markdown format).
[0234] 8. Prohibited Items Check: Does it contain any prohibited content as defined in the prohibitions section?
[0235] If validation fails, the system performs closed-loop correction based on the validationPolicy:
[0236] 1. Identify failed verification items: Locate which verification rule(s) failed.
[0237] 2. Generate corrective constraints: Convert failed items into specific, targeted corrective instructions / constraints. For example, if the length exceeds the limit, generate "Please compress this text to within X characters while maintaining the original meaning".
[0238] 3. Construct a secondary correction task: Combine the correction constraints with the original rewritten result or the original text to construct a new model, Prompt.
[0239] 4. Perform local corrections or regeneration:
[0240] If the impact of the failed item is small, try to make local corrections to the results;
[0241] If the failure has a significant impact or the local correction is ineffective, a regeneration will be triggered.
[0242] 5. Retry and Risk Warning: If the validation still fails after reaching the maxRetries count, a risk warning will be displayed to the user (e.g., "The length requirement has not been fully met, please adjust manually") or the system will be downgraded to manual editing mode.
[0243] For example: The user requested "abbreviation to within 200 characters, and formalized." The model initially output 230 characters, and the style was approved.
[0244] System verification: Length verification failed.
[0245] Correction: The system generated a correction prompt: "Please compress the following text to within 200 words, while maintaining a formal style and original meaning."
[0246] The model is called again until it passes the validation or the maximum number of retries is reached.
[0247] S10: Save task configuration version chain and execution record
[0248] The system saves the following complete task execution records for subsequent tracing, reuse, auditing, analysis, and optimization:
[0249] 1. Raw instructions and normalized instructions.
[0250] 2. Intent recognition results and confidence level.
[0251] 3. Extracted constraint parameters (including priority and hard and soft constraints).
[0252] 4. The complete version chain of RewriteTaskConfig (including taskId, version, parentTaskId).
[0253] 5. Selected generation control strategy (Prompt template ID, workflow ID, model parameters, validation rules).
[0254] 6. The results generated each time.
[0255] 7. The results and details of each verification failure.
[0256] 8. The user's acceptance status of the final result.
[0257] 9. Document version number.
[0258] This record is not only the foundation for auditing, but also valuable data for continuous optimization of the instruction parsing model, Prompt template, and validator.
[0259] Secondly, this invention provides a document rewriting control system based on free instruction parsing.
[0260] The system of this invention has a modular structure, with each module working collaboratively. Its specific components include:
[0261] 1. Instruction Input Module
[0262] Used to receive free text rewriting instructions from the user.
[0263] Get the current document context information, including selected text, cursor position, document structure, and historical task configuration.
[0264] 2. Instruction Preprocessing Module
[0265] User commands are cleaned, standardized, parsed, and context-completed.
[0266] 3. Intent Recognition & Parameter Extraction Module
[0267] Identify the rewrite intent category (primary / secondary intent) corresponding to the user command and assess the confidence level.
[0268] Extract structured constraint parameters such as length, style, tone, scope, factual preservation, and structural preservation from instructions and context.
[0269] Analyze and determine the precise scope of the rewrite.
[0270] 4. Task Configuration Management Module
[0271] The identified intent and extracted parameter semantics are normalized into a standard structured rewrite task configuration (RewriteTaskConfig).
[0272] Perform integrity checks and constraint conflict detection on the task configuration, and complete or resolve conflicts according to the policy.
[0273] Maintain the task configuration version chain to enable inheritance, overwriting, and updating of multiple rounds of rewriting context.
[0274] 5. Generation Control Strategy Dispatcher module
[0275] Based on the structured rewriting task configuration, dynamically select the most matching Prompt template, document trimming and injection rules, model parameters, multi-step workflow, and preset validation rule set.
[0276] Determine the closed-loop correction strategy after verification failure.
[0277] 6. Rewrite the execution module.
[0278] The input Prompt for the large language model is constructed based on the generation control strategy.
[0279] Call the generative model to perform document rewriting and receive the rewriting results.
[0280] 7. Result Validation & Correction Module
[0281] Based on the verification rules in the task configuration, the rewriting results are verified in multiple dimensions (such as length, style, factual consistency, entity consistency, structural consistency, etc.).
[0282] If the verification fails, a correction constraint is generated according to the preset strategy, triggering a local correction or regeneration, until the verification passes or the retry limit is reached.
[0283] 8. Record Storage Module
[0284] Save the original instructions, normalized task configuration, task configuration version chain, generation control strategy, generation results for each time, verification results, correction records and user adoption status.
[0285] It supports the tracing, auditing, and analysis of historical tasks, providing data for system optimization.
[0286] To more clearly illustrate the technical solution of this application, the following will provide further explanation through specific scenario embodiments.
[0287] Example 1: Formal polishing and multiple rounds of revisions
[0288] First round of instructions: The user selects a piece of text and enters: "This is too colloquial. Please make it more formal without changing the original meaning."
[0289] System identification results (RewriteTaskConfig v1):
[0290] {
[0291] "taskId": "task_A_v1",
[0292] "version": 1,
[0293] "rawInstruction": "This is too colloquial. Please revise it to be more formal, without changing the original meaning."
[0294] "intent": {"primary": "polish", "secondary": ["style_transfer"]},
[0295] "scope": {"type": "selection", "startOffset": 120, "endOffset":360, "resolvedBy": "user_selection"},
[0296] "constraints": [
[0297] {"type": "style", "value": "formal", "priority": "hard"},
[0298] {"type": "preserveMeaning", "value": true, "priority": "hard"},
[0299] {"type": "allowNewFacts", "value": false, "priority": "hard"}
[0300] ],
[0301] "validationPolicy": {"onFail": "regenerate_with_correction_prompt","maxRetries": 2},
[0302] "strategy": {"promptTemplateId": "prompt_polish_formal_v1", "validators": ["meaning_consistency", "entity_consistency", "style_score"]}
[0303] }
[0304] The system selected the formal polishing prompt and enabled factual consistency, entity consistency, and style score verification. The model generated results that only adjusted the tone and expression, without adding any new facts, and the style score passed.
[0305] Second round of instructions: The user is not completely satisfied with the result of the first round and enters: "It still feels a bit harsh, make it a little softer, but don't change the meaning."
[0306] System identification results (RewriteTaskConfig v2):
[0307] The system recognizes it as an incremental instruction, inherits from task_A_v1, and updates targetTone.
[0308] {
[0309] "taskId": "task_A_v2",
[0310] "version": 2,
[0311] "parentTaskId": "task_A_v1",
[0312] "rawInstruction": "It still feels a bit too rigid, let's soften it a bit, but don't change the meaning."
[0313] "intent": {"primary": "tone_adjust"},
[0314] "scope": {"type": "inherited"},
[0315] "constraints": [
[0316] {"type": "style", "value": "formal", "priority": "soft"}, / / Change the style from hard to soft to adjust the tone.
[0317] {"type": "preserveMeaning", "value": true, "priority": "hard"}, / / Inheritance
[0318] {"type": "allowNewFacts", "value": false, "priority": "hard"}, / / Inherit
[0319] {"type": "targetTone", "value": "soft", "priority": "hard"} / / Add tone constraints
[0320] ],
[0321] "validationPolicy": {"onFail": "regenerate_with_correction_prompt","maxRetries": 2},
[0322] "strategy": {"promptTemplateId": "prompt_polish_formal_soft_v1", "validators": ["meaning_consistency", "tone_score"]}
[0323] }
[0324] The system selects a gentler, more formal polishing prompt and enables tone scoring verification. It then fine-tunes the previous round's results to make the tone more gentle.
[0325] Example 2: Compression rewriting and closed-loop correction with conflict constraints
[0326] User instruction: "This is too long. Compress it to under 200 words, but make it as detailed as possible."
[0327] System identification results (RewriteTaskConfig v1):
[0328] {
[0329] "taskId": "task_B_v1",
[0330] "version": 1,
[0331] "rawInstruction": "This section is too long; compress it to under 200 characters, but make it as detailed as possible."
[0332] "intent": {"primary": "shorten", "secondary": ["detail_emphasis"]},
[0333] "scope": {"type": "selection", "startOffset": 0, "endOffset": 500,"resolvedBy": "user_selection"},
[0334] "constraints": [
[0335] {"type": "targetLength", "value": {"maxChars": 200}, "priority":"hard"}, / / Hard constraint
[0336] {"type": "detailLevel", "value": "high", "priority": "soft"} / / Soft constraints
[0337] ],
[0338] "validationPolicy": {"onFail": "regenerate_with_correction_prompt","maxRetries": 2},
[0339] "strategy": {"promptTemplateId": "prompt_shorten_detailed_v1", "validators": ["length_check", "key_info_preservation"]}
[0340] }
[0341] The system selects the abbreviation Prompt and enables length verification and critical information retention verification.
[0342] Initial result: 230 words, detailed content.
[0343] System verification: length_check failed (230 characters > 200 characters).
[0344] System closed-loop correction: Generate secondary correction Prompt: "Please compress the following text to within 200 characters, ensuring it meets the length requirement, and retain as much key information as possible within the limited word count."
[0345] The model is called again until the generated result meets the requirement of being within 200 characters.
[0346] Example 3: Structured Range Localization and Logic Optimization
[0347] User instruction: "Help me organize the logic of the second part, don't increase the word count too much, and make the tone more formal."
[0348] System identification results (RewriteTaskConfig v1):
[0349] {
[0350] "taskId": "task_C_v1",
[0351] "version": 1,
[0352] "rawInstruction": "Help me organize the logic of the second part, don't increase the word count too much, and make the tone more formal."
[0353] "intent": {"primary": "logic_optimization", "secondary": ["style_transfer", "length_control"]},
[0354] "scope": {"type": "section", "identifier": "Second Part", "resolvedBy": "instruction_and_document_structure"}, / / Precisely locate the second part
[0355] "constraints": [
[0356] {"type": "preserveMeaning", "value": true, "priority": "hard"},
[0357] {"type": "preserveStructure", "value": false, "priority": "soft"}, / / Logic streamlining may involve minor structural adjustments
[0358] {"type": "lengthPolicy", "value": "not_significantly_increase", "priority": "soft"},
[0359] {"type": "targetStyle", "value": "formal", "priority": "soft"}
[0360] ],
[0361] "validationPolicy": {"onFail": "regenerate_with_correction_prompt","maxRetries": 2},
[0362] "strategy": {"promptTemplateId": "prompt_logic_optimize_v1", "validators": ["logical_coherence_score", "length_increase_ratio_check", "style_score"]}
[0363] }
[0364] The system accurately identifies and locates the "second part" in the document, selects a logic optimization template, and verifies the logical fluency, word count variation ratio, and style conformity after generation.
[0365] The flowcharts and block diagrams in the accompanying drawings illustrate possible implementations of systems, methods, and computer program products according to various embodiments of this application, including architecture, functionality, and operation. In these figures, each block may represent a module, program segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should be noted that each block in the block diagrams and / or flowcharts, and combinations thereof, can be implemented using either a dedicated hardware-based system or a combination of dedicated hardware and computer instructions to achieve the specified function or operation.
[0366] Embodiments of this application also disclose an electronic device, including: a processor, a communication interface, a memory for storing a processor-executable computer program, and a communication bus. The processor, communication interface, and memory communicate with each other via the communication bus. The processor executes the executable computer program to implement the steps of the aforementioned document rewriting control method based on free instruction parsing.
[0367] The operations described in this application can be implemented by writing computer program code using one or more programming languages or a combination thereof.
[0368] Furthermore, this application also discloses a computer-readable storage medium, which, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the various steps of the document rewriting control method based on free instruction parsing disclosed in this application.
[0369] In the context of this application, a computer-readable storage medium refers to a tangible medium capable of storing computer program code and related data. Such computer-readable storage media can be used to store the program code and related data described in this application to support program execution and persistent data storage.
[0370] Specifically, according to embodiments of this application, the processes described in the flowcharts can be implemented as computer software programs. For example, embodiments of this application relate to a computer program product comprising a computer program carried on a non-transitory computer-readable medium. This computer program contains program code for executing the document rewriting control method based on free instruction parsing disclosed in this application. When this computer program is executed by a processing system, it can achieve the functions defined in the embodiments of this application.
[0371] While the foregoing discussion contains several specific implementation details, these details should not be construed as limiting the scope of this application. The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this application is not limited to technical solutions formed by specific combinations of the above-described technical features. Furthermore, this application should also cover other technical solutions formed by any combination of the above-described technical features or their equivalents without departing from the foregoing disclosed concept.
[0372] Those skilled in the art should also understand that modifications can be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features, without departing from the spirit and scope of the technical solutions of the embodiments of this application. These modifications or substitutions will not cause the essence of the corresponding technical solutions to deviate from the core spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A document rewriting control method based on free instruction parsing, characterized in that, Includes the following steps: S1. Obtain the user's input instructions for rewriting free text and the context information corresponding to the current document; S2. Preprocess the free text rewriting instructions, the preprocessing including at least reference parsing and context completion, to generate normalized instructions; S3. Rewrite intent identification, constraint parameter extraction and rewrite range positioning are performed on the normalized instructions to obtain at least one candidate rewrite intent and associated structured constraint parameters. S4. Normalize the semantics of the candidate rewriting intent, constraint parameters and rewriting range to generate a structured rewriting task configuration that includes the main rewriting intent, secondary rewriting intent, rewriting range, hard constraints, soft constraints and constraint priorities. S5. Perform integrity verification and constraint conflict detection on the structured rewriting task configuration, and perform context inheritance, overwriting or addition based on the historical rewriting task configuration in multi-round rewriting scenarios to generate the final rewriting task configuration for the current round. S6. Dynamically select the target generation control strategy based on the final rewritten task configuration; S7. Based on the target generation control strategy, construct a model input and call the generative model to perform document rewriting to obtain the rewriting result; S8. Perform multi-dimensional automated verification on the rewriting result according to the preset verification rule set determined in the final rewriting task configuration; S9. When the rewriting result fails the verification, the failed verification item is converted into a correction constraint, and a local correction or regeneration is triggered based on the correction constraint until the rewriting result passes the verification or the preset number of retries is reached.
2. The method according to claim 1, characterized in that, In step S1, the context information includes at least the user-selected text, document structure, and historical rewrite task configuration; In step S2, the preprocessing further includes: removing invalid whitespace characters, standardizing punctuation marks, identifying negative expressions, extracting degree adverbs, and identifying colloquial expressions.
3. The method according to claim 1, characterized in that, In step S3, the rewriting intent identification includes: identifying one or more candidate rewriting intents contained in the normalization instruction, and evaluating the confidence level of each candidate rewriting intent; when the normalization instruction contains multiple rewriting intents, distinguishing between main intents and secondary intents; the rewriting intents include at least expansion, abbreviation, polishing, rewriting, style transfer, structural reorganization, title generation, abstract generation, tone adjustment, logic optimization, format conversion, content continuation, and correction of typos and grammatical errors.
4. The method according to claim 1, characterized in that, In step S3, the rewriting scope positioning includes: based on the context information, parsing the pronouns in the free text rewriting instruction into a specific rewriting scope; the rewriting scope includes at least one of the selected text, the paragraph where the cursor is located, the specified paragraph or chapter, and the entire text, or can be precisely defined by the start offset and the end offset.
5. The method according to claim 1, characterized in that, In step S3, the constraint parameters include hard constraints and soft constraints. The hard constraints are conditions that must be met, and the soft constraints are conditions that should be met first but can be handled flexibly. The constraint parameters include one or more of the following: rewrite type, target length, target style, target tone, fact preservation instruction, information addition / removal restrictions, structure preservation instruction, entity preservation instruction, output format, number of candidate results, and prohibited items.
6. The method according to claim 1, characterized in that, In step S5, the integrity verification and constraint conflict detection include: when there are missing key parameters in the structured rewriting task configuration, automatically inferring and completing them based on the context information or historical rewriting task configuration, or generating clarification questions to ask the user, or using the default strategy to complete and mark the confidence level; when a constraint conflict is detected, automatically resolving it according to the priority of hard constraints and soft constraints, or prompting the user of the conflict and requesting a choice.
7. The method according to claim 1, characterized in that, In step S5, the context inheritance, overriding, or addition based on historical rewrite task configuration in a multi-round rewrite scenario includes: maintaining a task configuration version chain, which records the identifier, version number, and parent-child relationship of each round of task configuration to achieve constraint inheritance, overriding, addition, or deletion; using the previous round of rewrite task configuration as the base configuration, adding constraint parameters to the base configuration when the current instruction is an incremental instruction; updating the corresponding fields in the base configuration when the current instruction is a modification instruction; removing the corresponding constraints in the base configuration when the current instruction is a deletion instruction; inheriting the base configuration by default for unmentioned constraint parameters; generating a new version of the structured rewrite task configuration based on the base configuration and the current instruction, and recording the inheritance relationship between versions.
8. The method according to claim 1, characterized in that, In step S6, the target generation control strategy includes: Prompt template selection, document trimming and injection rules, model parameter configuration, workflow selection, preset verification rule set, and verification failure handling strategy; wherein: the Prompt template is selected based on the primary rewriting intent and the secondary rewriting intent; the document trimming and injection rules determine the content of the document to be injected and its trimming method based on the rewriting range and constraint parameters; the model parameter configuration includes at least temperature parameters and Top-P parameters.
9. The method according to claim 1, characterized in that, In step S8, the multi-dimensional automated verification includes at least one of the following verifications: task type matching verification, length constraint verification, style conformity verification, tone conformity verification, factual consistency verification, entity consistency verification, number consistency verification, time consistency verification, structure preservation verification, output format verification, and prohibited items check.
10. A document rewriting control system based on free instruction parsing, characterized in that, The system runtime implements the document rewriting control method based on free instruction parsing as described in any one of claims 1-9, including: The instruction receiving module is used to obtain the user's input of free text rewriting instructions and the context information corresponding to the current document; The instruction preprocessing module is used to preprocess the free text rewriting instructions. The preprocessing includes at least reference parsing and context completion to generate standardized instructions. The intent recognition and parameter extraction module is used to perform rewriting intent recognition, constraint parameter extraction and rewriting range positioning on the normalized instruction to obtain at least one candidate rewriting intent and associated structured constraint parameters. The task configuration management module is used to semantically normalize the candidate rewriting intents, constraint parameters, and rewriting ranges to generate a structured rewriting task configuration that includes the main rewriting intent, secondary rewriting intent, rewriting range, hard constraints, soft constraints, and constraint priorities; and to perform integrity verification and constraint conflict detection on the structured rewriting task configuration, and to perform context inheritance, overwriting, or addition based on historical rewriting task configurations in multi-round rewriting scenarios to generate the final rewriting task configuration for the current round. A control strategy generation scheduling module is used to dynamically select a target control strategy based on the final rewritten task configuration. The rewrite execution module is used to construct model input based on the target generation control strategy and call the generative model to perform document rewriting to obtain the rewriting result. The result verification and correction module is used to perform multi-dimensional automated verification of the rewriting result according to the preset verification rule set determined in the final rewriting task configuration; and when the rewriting result fails the verification, the failed verification item is converted into a correction constraint, and a local correction or regeneration is triggered based on the correction constraint until the rewriting result passes the verification or reaches the preset number of retries.
