Document editing method, client device and system based on natural language instruction

By introducing intent discrimination and selection area judgment into the document editing system, and coordinating small-scale neural networks with large-scale language models, the problems of high resource consumption and long response latency of large models in document editing are solved, realizing efficient and accurate intelligent document editing, and improving user control capabilities and system response speed.

CN121328481APending Publication Date: 2026-01-13BAIDU ONLINE NETWORK TECH (BEIJIBG) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511405064.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-28
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

Existing technologies struggle to efficiently and accurately integrate the capabilities of large-scale language models into interactive document editing systems. Traditional editing tools lack intelligent assistance, and pure large-model generation systems are difficult for users to control with fine granularity, while also consuming significant computational resources and experiencing high response latency.

Method used

By introducing intent discrimination and selection area judgment, and coordinating small-scale neural network models and large-scale language models, natural language instructions are received, and the classification and processing module executes document editing operations, including text modification, undo, and redo operations with and without selection areas, thereby achieving resource optimization and accurate response.

Benefits of technology

It enables efficient and accurate intelligent document editing, reduces computing resource consumption, improves interactive flexibility and editing efficiency, and ensures the integrity and consistency of document content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121328481A_ABST
    Figure CN121328481A_ABST
Patent Text Reader

Abstract

The invention provides a document editing method based on a natural language instruction, client equipment and a system, relates to the technical field of artificial intelligence, in particular to the technical fields of natural language processing, large language models, model cooperative calculation and the like, and can be applied to scenes such as intelligent document editing, automatic content generation and human-computer interaction interfaces. According to the specific implementation scheme, a natural language instruction input by a user is received; processing the natural language instruction based on the intention discrimination model to generate an instruction type discrimination result; the instruction type comprises selected-area-free text modification, selected-area text modification, revocation operation, redo operation and refusal operation; according to the instruction type discrimination result, calling a corresponding processing module to execute document editing operation; wherein the intention discrimination model is a pre-trained small-scale neural network model. According to the scheme, accurate, efficient and low-resource-consumption intelligent document editing is realized through intention judgment, selection judgment and cooperation of large and small model capabilities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, particularly to the fields of natural language processing, large language models and model collaborative computing, and can be applied to scenarios such as intelligent document editing, automatic content generation and human-computer interaction interfaces. Specifically, it relates to document editing methods, client devices and systems based on natural language instructions. Background Technology

[0002] With the rapid development of artificial intelligence technology, large-scale language models have demonstrated powerful capabilities in text generation and content creation. However, integrating these capabilities efficiently and accurately into interactive document editing systems still presents significant challenges. Summary of the Invention

[0003] This disclosure provides a document editing method, client device, and system based on natural language commands.

[0004] According to a first aspect of this disclosure, a document editing method based on natural language instructions is provided, comprising:

[0005] The system receives natural language commands input by the user; processes the natural language commands based on an intent discrimination model to generate command type discrimination results; the command types include: text modification without selection area, text modification with selection area, undo operation, redo operation, and reject operation; based on the command type discrimination results, it calls the corresponding processing module to execute document editing operations; wherein, the intent discrimination model is a pre-trained small-scale neural network model.

[0006] According to a second aspect of this disclosure, a document editing device based on natural language instructions is provided, comprising: an instruction receiving module for receiving natural language instructions input by a user; an intent discrimination module configured with a pre-trained small-scale neural network model for processing the natural language instructions and generating an instruction type discrimination result; and a text processing module for performing document editing operations according to the instruction type discrimination result. Specifically: when the instruction type is an undo or redo operation, the text processing module is configured to perform document state restoration or redo operations based on historical operation records; when the instruction type is text modification without selection or text modification with selection, the text processing module is configured to call a large-scale language model to modify the document; and when the instruction type is a rejection operation, the text processing module is configured to generate rejection feedback information.

[0007] According to a third aspect of this disclosure, a document editing system is provided, comprising: a client device; and a server communicating with the client device, the server being configured with a large-scale language model for performing text modification operations in response to requests from the client device.

[0008] According to a fourth aspect of this disclosure, an electronic device is provided, comprising:

[0009] At least one processor; and

[0010] The memory is communicatively connected to the at least one processor; wherein,

[0011] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform any of the methods described in the present disclosure.

[0012] According to a fifth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform any of the methods according to embodiments of this disclosure.

[0013] According to a sixth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements any of the methods according to embodiments of this disclosure.

[0014] By employing the solution disclosed herein, and through intent discrimination and selection area judgment, combined with the capabilities of size models, accurate, efficient, and low-resource-consumption intelligent document editing is achieved.

[0015] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0016] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0017] Figure 1 This is a flowchart illustrating a document editing method based on natural language instructions according to an embodiment of the present disclosure;

[0018] Figure 2 This is a flowchart of a document editing method combining intent classification and model collaboration according to an embodiment of the present disclosure;

[0019] Figure 3 This is a structural diagram of a document editing device based on natural language instructions according to an embodiment of the present disclosure;

[0020] Figure 4 This is a structural diagram of a document editing system according to an embodiment of the present disclosure;

[0021] Figure 5 This is a schematic diagram of a scenario for a document editing method based on natural language instructions according to an embodiment of the present disclosure;

[0022] Figure 6 This is a structural diagram of an electronic device used to implement the document editing method based on natural language instructions according to the embodiments of this disclosure. Detailed Implementation

[0023] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0024] In this article, the terms "first" and "second" refer to and distinguish multiple similar technical terms, and do not imply a specific order or that there are only two. For example, "first feature" and "second feature" refer to two types / two features. The first feature can be one or more, and the second feature can also be one or more.

[0025] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.

[0026] Before introducing the technical solutions of the embodiments of this disclosure, the technical terms that may be used in this disclosure will be further explained:

[0027] Large-scale language models (LLMs) refer to foundational artificial intelligence models with a large number of parameters, pre-trained on massive amounts of unlabeled text data through self-supervised learning. The core capability of these models lies in their deep understanding and generation of natural language, enabling them to predict and generate coherent following text based on given context (cues). They are typically built on a Transformer architecture and can be adapted to downstream tasks such as text summarization, translation, question answering, and content creation through instruction fine-tuning and cue engineering. The large-scale language models described in this disclosure are the core engines for performing complex text generation and modification operations. It should be noted that their "large-scale" nature is relative to the "small-scale neural network models" used for intent discrimination described in this disclosure.

[0028] With the rapid development of artificial intelligence technology, large language models have demonstrated powerful capabilities in text generation and content creation. However, integrating these capabilities efficiently and accurately into interactive document editing systems remains a significant challenge. Currently, common solutions all have obvious limitations:

[0029] Traditional editing tools: While these systems offer flexible manual editing functions, they fail to effectively utilize the creative capabilities of large languages ​​and cannot provide intelligent assistance to users, resulting in lower creative efficiency and quality ceilings.

[0030] Pure large model generation system: This type of solution relies entirely on the model itself for content creation. Users have difficulty in fine-grained control and customized modification of the generated results, and the output quality is greatly affected by prompt words, resulting in insufficient interactive flexibility.

[0031] Full-text regenerative editing systems: These systems regenerate the entire text in response to user commands, regardless of the scope of the modification. This approach consumes significant computational resources, has high response latency, and may introduce unnecessary modifications due to model "illusions," destroying parts of the original text that do not need to be changed, resulting in low editing accuracy and efficiency.

[0032] To at least partially address one or more of the aforementioned problems and other potential issues, this disclosure proposes an intelligent document editing scheme based on natural language commands. By introducing intent discrimination and selection area judgment, and coordinating the capabilities of large and small models, it achieves accurate response and efficient processing of user commands. This scheme can balance the powerful creativity of large models with the user's need for precise control, and can intelligently allocate computing resources according to editing intent. This not only improves the intelligence level of document editing but also effectively reduces computing resource consumption, significantly improving interactive flexibility and editing efficiency.

[0033] This disclosure provides a document editing method based on natural language instructions. Figure 1 This is a flowchart illustrating a document editing method based on natural language instructions according to an embodiment of the present disclosure. This method can be applied to a document editing device based on natural language instructions. The document editing device is located in an electronic device. This electronic device includes, but is not limited to, fixed devices and / or mobile devices. For example, fixed devices include, but are not limited to, servers, which can be cloud servers or ordinary servers. Mobile devices include, but are not limited to, mobile phones and tablets. In some possible implementations, the document editing method based on natural language instructions can also be implemented by a processor calling computer-readable instructions stored in memory. Figure 1 As shown, this document editing method based on natural language instructions includes:

[0034] S101, Receive natural language commands input by the user;

[0035] S102. Process natural language commands based on the intent discrimination model to generate command type discrimination results; command types include: text modification without selection area, text modification with selection area, undo operation, redo operation, and reject operation;

[0036] S103. Based on the instruction type determination result, call the corresponding processing module to perform document editing operations.

[0037] The intent discrimination model is a pre-trained small-scale neural network model. Here, "small-scale neural network model" is in contrast to "large-scale language model," referring to a deep learning model with fewer parameters and lower computational resource requirements.

[0038] Here, the intent discrimination model is a trained artificial intelligence model used to understand the true purpose behind user commands (i.e., intent classification) and categorize user commands into predefined categories. For example, lightweight text classification models, such as distilled Transformer-based Bidirectional Encoder Representations from Transformers (BERT) models or convolutional neural networks, can be used, with a much smaller number of parameters than large-scale language models.

[0039] Natural language instructions refer to the editing intentions expressed by users in everyday language, rather than specific program code or menu clicks. For example, natural language instructions might include phrases like "Make the second paragraph more vivid," "Summarize the core points of this list," or "Undo the previous action." These are merely illustrative examples and do not represent a complete list of all possible natural language instructions.

[0040] The instruction type discrimination result is the classification result output by the intent discrimination model, which determines which processing flow the system will subsequently initiate. For example, the model classifies the instruction "bold heading" as "selected text modification" and "redo" as "redo operation".

[0041] The corresponding processing module refers to a dedicated software component or algorithm designed according to different instruction types. For example, the module for "text modification" will call the large model; the module for "undo / redo" will operate on the history stack.

[0042] In this embodiment of the disclosure, the process of receiving natural language instructions input by the user can first provide a text input box or a voice input interface through a graphical user interface. After the user submits an instruction via keyboard input, paste, or voice recognition, the system captures the text string of the instruction. The above is merely an illustrative example and is not intended to limit all possible scenarios for receiving natural language instructions.

[0043] In this embodiment of the disclosure, the process of processing natural language instructions based on the intent discrimination model can first combine the natural language instruction with a preset intent discrimination prompt template to generate a structured combined instruction. For example, the prompt template could be: "Please determine the intent category of the instruction '[USER_INPUT]': A. Full text modification without selection area; B. Modification with selection area; C. Cancel; D. Redo; E. Refuse / Unable to process". Subsequently, the combined instruction is input into the intent discrimination model. The model encodes and analyzes the instruction and outputs a specific category label as the instruction type discrimination result. The above is merely an illustrative example and does not limit all possible cases of intent discrimination processing.

[0044] In this embodiment, the process of calling the corresponding processing module to perform document editing operations is a branch processing flow. If the determination result is unselected text modification or selected text modification, the text generation and modification module is called, which may further call a large-scale language model. If the determination result is undo or redo, the history state management module is called to operate the history data stack to restore or advance the document state. If the determination result is reject, the user interaction module is called to return explanatory information and operation guidance to the user. The above is only an illustrative example and is not intended to limit all possible cases of calling processing modules.

[0045] The technical solution of this disclosure, by introducing a small-scale intent discrimination model as a decision hub, achieves rapid and low-cost classification of user instructions, laying the foundation for subsequent differentiated processing. By calling dedicated processing modules according to instruction type, complex tasks are assigned to a large model, while simple, deterministic tasks are handled by lightweight logic, achieving intelligent allocation and optimization of computing resources. The overall solution endows the document editing system with powerful Artificial Intelligence (AI) capabilities while effectively reducing system response latency and computing resource consumption, and improving the flexibility and efficiency of interaction.

[0046] In some embodiments, processing natural language instructions based on an intent discrimination model to generate instruction type discrimination results includes: combining natural language instructions with preset intent discrimination prompt word templates to generate a first combined instruction; inputting the first combined instruction into the intent discrimination model; and obtaining the instruction type discrimination results output by the intent discrimination model.

[0047] In this embodiment of the disclosure, the intent discrimination prompt template is a preset text structure used to standardize and structure the user's original instructions so that the intent discrimination model can more accurately understand the task requirements. It is essentially an "instruction description" for the model.

[0048] In this embodiment of the disclosure, the first combined instruction refers to the complete instruction text that conforms to the model processing specifications after the user's natural language instruction is filled into a specific position of the intent discrimination prompt word template.

[0049] Here, the instruction type discrimination result is a deterministic classification result output by the intent discrimination model after analyzing the first combination of instructions. This result corresponds to one of several preset instruction types.

[0050] In some implementations, the process of combining natural language instructions with a preset intent-based prompt template to generate a first combined instruction is as follows: The system predefines a prompt template, for example: "Please classify the following user instructions into the most appropriate category. Category list: [No selection area modification, Selected area modification, Undo, Redo, Reject]. Instruction:<USER_INPUT> Please only return the category name. When the user enters a command such as "Delete the previous paragraph," the system will replace the existing text in the template with that command.<USER_INPUT> The placeholder generates the following first combined instruction: "Please classify the following user instructions into the most appropriate category. Category list: [No selection area modification, Selected area modification, Undo, Redo, Reject]. Instruction: Delete the previous paragraph. Please only return the category name." Through this method, the template transforms unstructured user instructions into a structured classification task, effectively eliminating ambiguity in model understanding and improving the standardization of input information. Clear instruction context and output format constraints significantly improve the accuracy and reliability of intent discrimination results, while avoiding redundant interpretations from the model.

[0051] In some implementations, the process of inputting the first combined instruction into the intent discrimination model specifically involves the system inputting the generated first combined instruction text into a loaded small-scale intent discrimination model. The encoder within the model encodes the instruction text, and then the intent classification is calculated through a classification layer. Since the intent discrimination model is a lightweight structure (such as an optimized BERT classification model), this classification process is extremely fast and has very low latency, thus providing a reliable guarantee for the system to achieve real-time response. At the same time, compared with directly calling a large-scale language model, the computational resources consumed in this step are significantly reduced, becoming a key link in achieving efficient utilization of overall system resources.

[0052] In some implementations, when obtaining the instruction type discrimination result output by the intent discrimination model, the model outputs a short classification label (e.g., "selection area modification"). After capturing this string, the system passes it as a flow control variable to the subsequent branch processing module. By obtaining such explicit, machine-readable discrimination results, the system provides an indisputable decision-making basis for subsequent editing operations, while avoiding the additional overhead of parsing intent from lengthy text, thereby achieving seamless and rapid switching between different processing flows.

[0053] The solution disclosed in this embodiment, through a technical approach combining "prompt word templates and small-scale dedicated models," can efficiently transform ambiguous user intentions into precise, operable instructions. While achieving high-precision intention classification with extremely low computational cost, it effectively avoids using expensive, large-scale language models for simple classification tasks that they are not suited for, thus achieving a good balance between accuracy and efficiency. Furthermore, the standardized processing flow significantly reduces sensitivity to user input formats, enabling the system to stably adapt to diverse instruction expressions, further enhancing the robustness and adaptability of the overall interaction.

[0054] In some embodiments, when the instruction type is text modification without selection area, the corresponding processing module is invoked to perform document editing operations, including: obtaining the full text content of the current document; combining the natural language instruction, the full text content, and a preset document modification prompt word template to generate a second combined instruction; inputting the second combined instruction into a large-scale language model to obtain the modified full text content generated by the large-scale language model; and replacing the full text content of the current document with the modified full text content.

[0055] In this embodiment of the disclosure, the full text content of the current document refers to all the text content in the document to be edited when the user issues an instruction.

[0056] In this embodiment, the document modification prompt template is a pre-defined instruction framework specifically designed to guide large-scale language models in text modification. It specifies the task format, objectives, and requirements, ensuring that the model output meets expectations.

[0057] In this embodiment of the disclosure, the second combined instruction is a complete and structured request sent to a large-scale language model after the user's natural language instruction and full text content are filled into the document modification prompt word template.

[0058] In this embodiment of the disclosure, the modified full text content is the complete new document content generated by the large-scale language model after rewriting, restating, optimizing or expanding the original text according to the understanding of the second combination instruction.

[0059] In some implementations, when retrieving the full text of the current document, the system directly reads the complete text data of the currently active document by accessing the document editor's memory or the underlying document model. For example, when processing a document named "Project Plan," the system will retrieve its entire content (e.g., "1. Project Objectives…2. Implementation Steps…3. Expected Outcomes…"). By retrieving the full text, the system provides the global context necessary for large-scale language models to perform semantic understanding and structural modifications, thereby ensuring that the subsequently generated modifications are consistent with the overall logic of the document, maintaining the coherence and consistency of the content.

[0060] In some implementations, the process of combining the natural language instruction, the full text content, and a preset document modification prompt template to generate a second combined instruction is as follows: The system-predefined template clarifies the model's role, task scope, and output format, for example: "You are a professional editing assistant. Please modify the original text according to the following requirements: Requirements:"<USER_INSTRUCTION> .original:<FULL_TEXT> "Please output the revised full text directly, without any additional explanation." When a user inputs a command such as "Make the tone of the entire document more formal," the system substitutes the command and the full text of the document into the template, generating a structured second set of commands. Through this type of structured prompt, the system effectively constrains the generation direction of the large model, significantly reducing the possibility of the model generating illusions or redundant content, while improving its ability to parse ambiguous semantic commands, thereby ensuring that the output text meets user expectations in terms of quality and compliance.

[0061] In some implementations, the system inputs the second set of instructions into a large-scale language model via an Application Programming Interface (API) call or local inference. After understanding the semantics of the instructions, the model performs a holistic reconstruction and rewriting of the original text and directly returns the modified full-text content that meets the requirements. Through this process, the system effectively utilizes the powerful capabilities of the large model in style transfer, content optimization, and text reconstruction, achieving intelligent and in-depth modifications that are difficult to accomplish with traditional editing tools.

[0062] In some implementations, after receiving the modified full-text content returned by a large-scale language model, the system performs an atomic replacement operation to completely update the current document content to the modified content. This one-time replacement mechanism ensures real-time updates and internal consistency of the document state, avoiding state transition errors or content inconsistencies that may occur with step-by-step modifications.

[0063] The solution disclosed in this embodiment provides efficient and intelligent revision capabilities for modifying overall document attributes such as style and structure. By using prompt templates, user instructions are transformed into explicit constraints on the generation process, achieving precise and controllable editing effects while maintaining overall document generation capabilities. This solution effectively overcomes the blindness of traditional generative methods, significantly improves the efficiency and quality of large-scale document optimization, and enables users to leap from local modification to macro-level reshaping in their editing capabilities.

[0064] In some embodiments, when the instruction type is selected text modification, the corresponding processing module is invoked to perform document editing operations, specifically including: obtaining the currently selected document area as the selected area content; generating a range judgment result based on the natural language instruction and the selected area content, the range judgment result being used to indicate whether the scope of the modification operation is limited to the selected area or needs to be extended to the entire text; if the range judgment result indicates that it is limited to the selected area, then a large-scale language model is invoked to modify the selected area content and replace the original selected content with the modified content; if the range judgment result indicates that it needs to be extended to the entire text, then a large-scale language model is invoked to modify the full text content of the document and replace the original document content with the modified full text content.

[0065] In this embodiment of the disclosure, the selected area refers to the portion of text highlighted by the user in the document interface through mouse dragging or other methods. This content serves as the explicit initial target of the current editing operation.

[0066] In this embodiment of the disclosure, the scope determination result refers to a binary determination obtained by the system after analyzing the "semantic influence scope of the natural language instruction". It determines whether the editing operation should be strictly limited to the selected area or needs to extend to the entire text to maintain contextual coherence.

[0067] In this embodiment of the disclosure, limiting the modification to a selected area means that the semantics and scope of the modification are completely contained within the selected area, and the modification operation will not depend on or affect the text outside the selected area.

[0068] In this embodiment of the disclosure, the semantics of the instruction to be extended to the whole text are that although the instruction is directed at the selection area, its implementation needs to refer to or adjust the context of the whole text. Otherwise, it will lead to inconsistencies between the modified selection area and the whole text in terms of logic, style or fact.

[0069] Example 1 (Partial Modification Scenario)

[0070] The user selects the text "This product is great." and enters the instruction "Please provide specific evidence to support this view." After capturing the selected area, the system's judgment module analyzes the semantics of the instruction and finds that the core demand for "supporting this view" can be achieved by supplementing the selected area. Therefore, it generates a judgment result of "limited to the selected area." The system then embeds the instruction and the selected area content into a local modification template (template example: "Please execute the instruction within the context of the following text selection area. Instruction:...").<USER_INSTRUCTION> Original text of the constituency:<SELECTED_TEXT> Simply output the modified selection area content and send it to the large model. The model returns the enhanced text "This product is great because its user interface is simple and intuitive...", and the system only replaces the original selection area content. This process strictly limits the calculation to the selection area, combining the advantages of fast response speed and avoiding accidental modification of global text.

[0071] Example 2 (Global Modification Scenario)

[0072] The user selects "First," and instructs "Change all ordinal numbers to bullet points." The judgment module recognizes the keyword "all," indicating that the modification request is global, and generates a judgment result of "Needs to be expanded to the entire text." The system substitutes the instruction and the full text content into the global modification template (template example: "Please understand the entire text and execute the instruction. Instruction:...").<USER_INSTRUCTION> .full text:<FULL_TEXT> Please output the revised full text. The large model identifies ordinal numbers in the entire text and uniformly replaces them with bullet points before returning a new document. This system ensures consistency across paragraph modifications by capturing the deep semantics of the instructions, avoiding logical breaks caused by localized processing.

[0073] The dynamic range judgment mechanism enables efficient and accurate modification of selected areas, and intelligently identifies global needs, improving editing efficiency while ensuring the integrity and logical coherence of the document.

[0074] The technical solution of this disclosure, by introducing a "selective modification and range judgment" mechanism, effectively solves the core technical challenge of "when to perform local modifications and when to make global adjustments." Based on intelligent analysis of instruction semantics, the system can precisely apply editing operations to the target text range, much like performing surgery, achieving a unity of fine-grained control and deep semantic understanding. This mechanism significantly saves computing resources and time costs by avoiding unnecessary full-text regeneration: for problems that can be solved locally, the system provides near real-time responses; for instructions requiring global processing, it ensures that the modification results are consistent throughout the entire text, thereby fundamentally improving interaction efficiency and output quality.

[0075] In some embodiments, generating a range judgment result based on a natural language instruction and the content of a selected region includes: combining the natural language instruction, the content of the selected region, and a prompt word template for judging the modification range to generate a range judgment instruction; and inputting the range judgment instruction into a judgment model to obtain a range judgment result.

[0076] In this embodiment, the prompt word template for determining the scope of modification is a preset instruction framework specifically designed to guide the model in performing a binary classification (local modification / global modification). It transforms the fuzzy scope determination task into a clear, structured classification problem.

[0077] In this embodiment of the disclosure, the range determination instruction is a complete and standardized query instruction for the specific task of "range determination" formed by filling the user instruction and the selected area content into the above template.

[0078] In this embodiment of the disclosure, the judgment model is an artificial intelligence model that performs the range judgment task. It can be a small classification model specifically fine-tuned for this task, or a large language model that is directly invoked.

[0079] In some implementations, the process of generating a range judgment instruction is as follows: The system predefines a prompt word template to transform ambiguous semantic judgment tasks into explicit structured questions, such as: "Please determine the scope of influence of the following editing instruction. Instruction: '<USER_INSTRUCTION> The selected text targeted by this instruction is: '<SELECTED_TEXT> Question: Can the modifications made to this instruction be made independently within the selected text area, without considering and modifying other parts of the entire document? Please answer only 'yes' or 'no'.

[0080] When a user selects the text "This product's response time reaches 200 milliseconds." and enters the command "Update to the latest test data," the system substitutes the corresponding content into the template, generating the following scope judgment command: "Please determine the scope of influence of the following editing command. Command: 'Update to the latest test data.' The selected text targeted by this command is: 'This product's response time reaches 200 milliseconds.' Question: Can the modification of this command be completed independently within the selected text scope, without considering and modifying other parts of the entire text? Please answer only 'Yes' or 'No'."

[0081] By transforming the complex semantic understanding problem into a standardized binary classification task, this system significantly reduces the processing complexity of the model. Clear instruction constraints and output format specifications effectively improve the accuracy and reliability of range determination, avoiding the risk of the model generating ambiguity or irrelevant content.

[0082] In some implementations, the system inputs the generated range determination instruction into the determination model to obtain the range determination result. Specifically, two technical paths are supported:

[0083] Dedicated small model approach: When using a lightweight text classification model (such as a finely tuned BERT model), the model quickly analyzes the instructions and outputs classification results based on semantic understanding. For example, for the instruction "update to the latest market information", the model recognizes that the operation may involve synchronizing relevant information throughout the text and outputs the judgment label "no".

[0084] Large Language Model Path: When using a large-scale language model, the model identifies the potential scope of an instruction through deep reasoning. For example, if it understands that "updating competitor information" may require a unified correction to all relevant descriptions in the text, it will output a "no" result.

[0085] The system maps the output "No" to the formal scope judgment result "needs to be expanded to the full text." This mechanism achieves intelligent judgment of the deeper meaning of the instruction through the model's semantic reasoning capabilities, going beyond simple keyword matching. The dual-path design ensures both judgment accuracy and provides flexible technology selection space for system deployment.

[0086] The solution in this embodiment achieves deep analysis of the user's editing intent through a range judgment result generation mechanism. This enables the system to go beyond the literal meaning of the instruction and accurately identify its potential global impact, thus completing the crucial leap from mechanical replacement to intelligent editing. This mechanism acts as an intelligent switch for allocating computing resources, directly guiding the system to initiate local or global modification processes by precisely determining the scope of modification, achieving precise resource allocation and optimized utilization. With the help of carefully designed prompt word templates, the system can obtain high-precision judgment results at a lower computational cost (especially when using small-scale models), ultimately achieving an excellent balance between system intelligence and response efficiency.

[0087] In some embodiments, the judgment model is implemented using a large-scale language model. In this implementation, the system calls a large-scale language model service in the cloud via an API to generate a range judgment instruction, which then performs deep reasoning on the instruction's semantics.

[0088] For example, when a user selects the text "Experimental results are shown in the figure" and enters the instruction "Please cite the latest version of the charts," the system generates a corresponding scope judgment instruction and sends it to the large model. Based on its ability to understand semantics and context, the large model can infer that "cite the latest version of the charts" may involve a unified update of all relevant chart references throughout the text, and therefore outputs the judgment result "No." The system maps this to the formal scope judgment result "Needs to be extended to the entire text."

[0089] This implementation fully utilizes the deep reasoning capabilities of large-scale language models to accurately identify the potential impact of instructions, ensuring the rationality and reliability of the range judgment results.

[0090] Thus, by employing a large-scale language model as the judgment model, it is possible to deeply analyze the semantic information implicit in instructions and its potential global relevance (such as the chain of adjustments involved in "version update"), effectively handling complex, ambiguous, or common-sense reasoning-based judgment scenarios, and achieving extremely high recognition accuracy. This approach eliminates the need for specialized model training for range judgment tasks; it fully utilizes the existing capabilities of the large model simply through carefully constructed prompts, significantly reducing development complexity and time costs. Furthermore, this implementation method can directly reuse existing large model services in the system, eliminating the need for separate deployment and maintenance of dedicated judgment models, which simplifies the system's technical architecture and improves resource utilization efficiency.

[0091] In some embodiments, the judgment model is implemented using a pre-trained dedicated classification model, smaller in size than the large-scale language model. In this implementation, the system inputs the generated range judgment instruction into a locally deployed lightweight dedicated classification model (e.g., a model based on a BERT base version architecture and fine-tuned on a manually labeled "instruction-selection" dataset). This model can quickly extract features from the instruction and selection text and make judgments based on learned classification patterns: for example, by identifying keywords in the instruction (such as "quote" or "latest version") and their semantic relationships, combined with training experience, it determines that this type of instruction usually has a global impact, and thus outputs a classification result of "needs to be expanded to the full text". This dedicated model can complete inference in milliseconds, combining fast response speed with low resource consumption.

[0092] Thus, the dedicated classification model features low computational load and fast inference speed, completing range determination within milliseconds and providing users with near real-time feedback, significantly improving the interactive experience. Because the model supports local deployment, it does not rely on large cloud-based model API calls, greatly reducing the computational cost of a single determination, making it particularly suitable for high-concurrency, high-frequency business scenarios. Simultaneously, the edge-side processing ensures that user commands and document content do not need to be transmitted to third-party servers, effectively strengthening local data management capabilities and further guaranteeing data processing security and privacy compliance while meeting low-latency requirements.

[0093] In some embodiments, if the range determination result indicates that the selected area is limited to the selected area, a large-scale language model is invoked to modify the content of the selected area and replace the original selected content with the modified content. This includes: combining a natural language instruction, the content of the selected area, and a preset document modification prompt word template to generate a first modification instruction; inputting the first modification instruction into the large-scale language model to obtain the modified selected area content generated by it; and replacing the selected area content in the document with the modified selected area content.

[0094] In this embodiment of the disclosure, the first modification instruction refers to a complete request generated specifically for the "partial modification" task and sent to a large-scale language model. It integrates user instructions, selected content, and specific requirements for partial modification.

[0095] In this embodiment of the disclosure, the document modification prompt template (for local modification) is a preset instruction framework specifically designed to guide the large model to make modifications within a given selected text area and to constrain its output behavior to avoid affecting content outside the selected area.

[0096] In this embodiment of the disclosure, the modified selection area content is a new text fragment generated by a large-scale language model after understanding, rewriting, expanding or optimizing the content of the original selected area according to the modification instructions, and used to replace the original selection area.

[0097] The following example illustrates the partial modification process in this solution, where a user selects the sentence "Due to severe weather conditions, the project delivery time may be delayed." in a document and enters the instruction "Simplify this sentence to make it more concise."

[0098] The system first fills the user's instructions and the selected area content into a prompt template optimized for local modifications, for example: "Please strictly only operate on the following text enclosed in []. Your task:<USER_INSTRUCTION> Text to be modified: [<SELECTED_TEXT> Note: You can only output the modified text snippet. Do not add any additional explanations or modify anything outside the brackets []. The generated specific modification instructions are: "Please strictly operate only on the following text enclosed in brackets []. Your task: Simplify this sentence to make it more concise. Text to be modified: [Due to severe weather conditions, the project delivery time may be delayed.]. Note: You can only output the modified text snippet. Do not add any additional explanations or modify anything outside the brackets []. This template, through restrictive wording such as "strictly only on" and "only output", clearly defines the task boundaries of the model, effectively reducing the possibility of the model generating out-of-bounds modifications or redundant content.

[0099] Subsequently, the system sends the aforementioned modification instructions to a large-scale language model via API. After understanding the instructions, the model performs text simplification and reconstruction within a given selected area, outputting a modified result such as: "Severe weather may delay project delivery." This process fully leverages the capabilities of the large model in semantic compression, sentence reconstruction, and other aspects to achieve precise improvement in the quality of local text.

[0100] Finally, the system locates the original selected text within the document and replaces it with the returned modified content, "Severe weather may delay project delivery." This replacement operation is precisely limited to the user-selected area, while the structure, format, and content of the rest of the document remain unchanged. This improves the quality of local expression while maximizing the overall consistency of the document and avoiding unexpected changes that might be introduced by global regeneration.

[0101] The solution disclosed in this embodiment strictly limits editing operations to a user-selected text area, achieving high-precision modifications while ensuring zero interference with other parts of the document. This completely avoids potential errors and formatting issues that might arise from generating the entire document, demonstrating significant advantages of "high precision and low invasiveness." For common local optimization needs such as polishing, simplification, and error correction, this solution only requires processing the selected text area to obtain powerful AI-assisted capabilities. It features low computational cost, fast response speed, and low resource consumption, making it the most cost-effective intelligent editing method. Users clearly define the AI ​​processing scope through selection operations, making modification behavior predictable and acceptable, effectively improving the efficiency and quality of daily document editing.

[0102] In some embodiments, if the scope determination result indicates that it needs to be extended to the entire text, a large-scale language model is invoked to modify the full text content of the document, and the modified full text content replaces the original document content. This includes: combining natural language instructions, the full text content of the current document, and a preset document modification prompt word template to generate a second modification instruction; inputting the second modification instruction into the large-scale language model to obtain the modified full text content generated by it; and replacing the full text content of the current document with the modified full text content.

[0103] In this embodiment of the disclosure, the second modification instruction (in the context of full-text modification) refers to a complete request generated specifically for the "global modification" task and sent to a large-scale language model. It integrates user instructions, full-text content, and specific requirements designed to guide the model to think globally.

[0104] In this embodiment of the disclosure, the document modification prompt template (for global modification) is a preset instruction framework specifically designed to guide the large model to understand and modify the document as a whole, ensuring that its output remains consistent in structure, style and logic.

[0105] In this embodiment of the disclosure, the modified full text content is a completely new and complete document generated by a large-scale language model after executing user instructions based on a comprehensive understanding of the original text's intent, structure, and content.

[0106] The following example illustrates how a user can modify the overall tone of a project report. The user opens a project report containing sections such as "Project Background" and "Market Analysis," and enters the command at any location: "Change the tone of this report from 'exploratory' to 'conclusive,' emphasizing the project's certainty and feasibility."

[0107] The system first fills the user's instructions and the full text content into a prompt template for global modification optimization, for example: "You are a professional document restructuring expert. Please make global modifications and rewrites of the entire document based on the following requirements. Modification requirements:"<USER_INSTRUCTION> The complete document is as follows:<FULL_TEXT> Ensure that the revised document maintains consistency in overall style, tone, and logic, and directly output the complete revised document. The generated modification instructions explicitly include the user's instructions and the full text content. This template uses guiding words such as "global modification," "entire document," and "maintaining a consistent overall style" to strongly constrain the model to handle the task from a macro perspective, preventing it from getting bogged down in local details and ensuring that it recognizes this as a deep reconstruction task involving the overall tone, structure, and persuasiveness of the document.

[0108] The system sends the generated modification instructions to a large-scale language model. Based on these instructions, the model performs in-depth analysis and reconstruction of the entire text. For example, it transforms exploratory expressions such as "maybe" and "we tried" in the original text into conclusive statements such as "the results show" and "we are convinced," and strengthens the arguments for certainty and feasibility in each chapter, ultimately outputting a new report with a consistent style and rigorous logic. This process fully utilizes the large-scale model's capabilities in style transfer, structural optimization, and semantic consistency maintenance to accomplish complex and in-depth editing tasks that are difficult for humans to achieve quickly.

[0109] After receiving the complete new document returned by the large model, the system performs a global replacement operation, updating all content in the current document to the modified content. This one-time replacement mechanism ensures that the document immediately switches to a new state with completely consistent content and style, avoiding logical breaks, style inconsistencies, or intermediate state remnants that may occur with step-by-step modifications.

[0110] The solution of this disclosure effectively solves the complex editing requirements that need to maintain global consistency by triggering a full-text modification process. The solution utilizes the deep understanding and reconstruction capabilities of a large-scale language model to ensure that modifications to the tone, style or structure of a document can be carried out throughout the entire text and maintain logical coherence. It achieves macro-level reshaping that cannot be accomplished by local modifications, thereby ensuring high-quality output results while covering the most critical advanced application scenarios in intelligent editing.

[0111] In some embodiments, a range determination result is generated based on a natural language instruction and the content of a selected region, including: extracting keywords and performing dependency parsing on the natural language instruction to identify the core action object and modification relationship in the instruction; matching the identified action object with the semantic range of the content of the selected region; if the action object is completely within the semantic range of the content of the selected region, a range determination result is generated that indicates the instruction is limited to the selected region; otherwise, a range determination result is generated that indicates the instruction needs to be extended to the entire text.

[0112] In this embodiment of the disclosure, keyword extraction is to identify words (usually verbs and nouns) that carry core semantic meaning from natural language instructions, such as "delete", "simplify", "third paragraph", etc.

[0113] In this embodiment of the disclosure, dependency parsing is a natural language processing technique used to analyze the grammatical dependencies (such as subject-verb, verb-object, and attributive-head) between words in a sentence, thereby understanding "who did what to whom".

[0114] In this embodiment of the disclosure, the core action object is the entity directly acted upon by the action (verb) in the instruction. For example, in the instruction "bold this title", "title" is the core action object.

[0115] In this embodiment of the disclosure, semantic scope is the conceptual boundary covered by the meaning expressed by a piece of text. The semantic scope of the selected region's content is the set of topics discussed or entities mentioned in that part of the text.

[0116] In this embodiment of the disclosure, matching refers to determining whether the entity or concept pointed to by the "core action object" is completely contained within the "semantic scope of the selected area content".

[0117] In some implementations, the system achieves deep parsing of natural language instructions through keyword extraction and dependency parsing, and completes range determination by combining selected area semantic range matching. The specific process is as follows:

[0118] When a user selects a paragraph about "our company's 2023 revenue" and enters the command "replace all financial data in the text with charts," the system first extracts the key components of the command: "financial data" as the action object and "replace with charts" as the core action. Through dependency parsing, it further identifies "all in the text" as a global modifier, clarifying the user's intention to replace all financial data in the text with charts.

[0119] The system then matches the "all financial data in the text" specified in the instruction with the semantic scope of the current selection area (i.e., "financial data in 2023"). Since "all" in the instruction indicates that its target scope covers the entire text, far exceeding the semantic boundary of the current selection area, the system determines that the operation needs to be expanded to the entire text and generates the scope judgment result "needs to be expanded to the entire text".

[0120] In contrast, if the user instruction is "bold the financial data in this section," then the action object "the financial data in this section" is entirely within the semantic scope of the selected area, and the system will generate a judgment result of "limited to the selected area." By combining syntactic analysis and semantic matching, the system achieves accurate identification of the user's intent scope, providing a reliable basis for subsequent differentiated processing.

[0121] The solution of this disclosure provides a highly transparent, interpretable, and training-data-independent decision-making path by using rule-based keyword extraction and syntactic analysis for range determination. This method has extremely high processing efficiency and negligible resource overhead, providing the system with another efficient and reliable technical implementation option, and enhancing the robustness and practicality of the overall solution.

[0122] In some embodiments, before replacing the full text content of the current document with the modified full text content, the method further includes: displaying the full text content of the current document and the modified full text content side by side in the user interface, and highlighting the changed content areas; receiving a user's confirmation or rejection instruction for the modified full text content; and when receiving a user's confirmation instruction, performing the operation of replacing the full text content of the current document with the modified full text content.

[0123] In this embodiment of the disclosure, side-by-side display is a user interface layout method that displays the original text of the current document and the modified new document to the user simultaneously and side-by-side, facilitating intuitive visual comparison.

[0124] In this embodiment of the disclosure, the highlighting is based on side-by-side display, using different background colors, underlines, font colors and other visual means to highlight the text areas that differ between the two versions (such as additions, deletions, and modifications).

[0125] In this embodiment of the disclosure, the confirmation or rejection instruction is a user's explicit intention to express whether they accept the full text modification by clicking the "Confirm" or "Apply" button, or the "Cancel" / "Reject" button.

[0126] In some implementations, assuming the system has already generated the modified full-text content using a large model, the current document's full-text content and the modified full-text content are displayed side-by-side in the user interface, with the changed content areas highlighted. The specific process is as follows: The system triggers a modal window or split-screen view. The left panel, titled "Current Document," displays the original content; the right panel, titled "Modification Preview," displays the new content generated by the large model. The system runs a difference comparison algorithm (such as an algorithm based on the longest common subsequence) to accurately identify all added, deleted, and modified text areas. In the right-hand "Modification Preview" panel, all modified sentences or words are highlighted with a yellow background; newly added text is underlined in green; and deleted content is marked with a red strikethrough in the left-hand "Current Document" panel. This provides a global perspective and focus guidance: allowing users to clearly see the global impact of the modifications and specific changes at a glance, eliminating the need for line-by-line comparison and greatly reducing the complexity of the review process.

[0127] In some implementations, the system receives user confirmation or rejection commands for the modified full-text content. Below the side-by-side view, two prominent buttons are provided: "Apply Modifications" and "Cancel." After carefully reviewing the highlighted differences, if the user is satisfied with the modifications, they click "Apply Modifications" (confirmation command). If the modifications do not meet expectations (e.g., changing important meanings or introducing errors), they click "Cancel" (rejection command). This treats AI as a "suggestor" rather than an "executor," ensuring the user's ultimate control over the document content and meeting the security requirements of serious document editing scenarios.

[0128] In some implementations, the replacement operation is only performed upon receiving confirmation from the user. Only after the user clicks "Apply Changes" does the system overwrite the current document with the content of the right-hand preview panel. If the user clicks "Cancel," the modal window closes, the current document content remains unchanged, and the system returns to the editing-ready state. This prevents irreversible erroneous modifications: this mechanism acts as a crucial safety valve, effectively preventing low-quality or unintended modifications caused by modal "illusions" or ambiguous instructions from being directly applied to the original document, avoiding irreparable damage.

[0129] The technical solution of this disclosure introduces a user confirmation mechanism before full-text modification. The differences are displayed side-by-side and highlighted in the user interface. The replacement is only executed after the user confirms. This design fully leverages the efficiency advantages of AI batch processing while building a key safety valve. By giving the user the final decision-making power, it effectively prevents uncontrollable modifications caused by model illusions or ambiguous instructions, greatly improving the security and reliability of the system and significantly enhancing the user's trust in the intelligent editing tool. It achieves the best balance between intelligent and manual control.

[0130] In some embodiments, when the instruction type is an undo or redo operation, the corresponding processing module is invoked to perform a document editing operation, including: parsing the natural language instruction to determine the number of undo or redo operation steps N; where N is an integer greater than or equal to 1; accessing a history storage unit that stores historical operation records; and switching the document state to a previous historical state or a subsequent state after the Nth operation step according to the number of operation steps N.

[0131] In this embodiment of the disclosure, parsing the natural language instruction refers to performing natural language understanding on the user's input of undo / redo related instructions in order to extract the key parameter—the number of operation steps N.

[0132] In this embodiment of the disclosure, the number of operation steps N refers to the number of historical operations that the user wishes to undo or redo in one go. For example, N = 3 in "undo three steps".

[0133] In this embodiment of the disclosure, the historical record storage unit is a storage structure used to save the historical state of a document in sequence, and is usually implemented as a data structure such as a stack, a list, or an array with pointers.

[0134] In this embodiment of the disclosure, the document state is a snapshot of the document's complete content, format, cursor position, and other information at a certain operation point.

[0135] In this embodiment of the disclosure, switching document state means restoring the currently active document content from one state (current state) to another state (historical state or future state).

[0136] In some implementations, the user inputs the instruction: "Please redo the last two actions" or "Undo the previous step." The system parses the instruction using either of the following methods: Rule matching: A predefined keyword dictionary (e.g., undo / redo, steps / times / numbers) and a numeric pattern. If "redo" and "twice" are matched, N=2; if "undo" and "one step" (or the default value) are matched, N=1. Lightweight model: A small NLP model is used to identify the instruction intent and quantifiers. The system determines the action type (redo) and the number of steps, N=2.

[0137] In some implementations, a historical record storage unit containing records of past operations is accessed. The system accesses a state list that maintains the document history (e.g., [state 0, state 1, state 2, current state]). This list typically has a pointer to the current state.

[0138] In some implementations, the document state is switched to a previous historical state (Nth step ago) or a subsequent state (Nth step later) based on the number of operation steps N. For an undo operation (switching to a state Nth step ago): the state pointer is moved N positions towards the beginning of the list. For example, moving 2 steps forward from "current state" switches to "state 1". For a redo operation (switching to a subsequent state Nth step later): the state pointer is moved N positions towards the end of the list. For example, moving 2 steps backward from "state 1" switches back to "current state". The system updates the document view to the complete content corresponding to the state pointed to by the pointer.

[0139] The technical solution of this disclosure realizes precise switching of multi-step historical states based on a single instruction by parsing the step parameters in natural language instructions. This frees users from the tedious process of triggering undo / redo operations multiple times in a row, significantly improving the efficiency of history backtracking and replay in complex editing scenarios. At the same time, it replaces traditional shortcut key operations with more intuitive natural language interaction, enhancing the intuitiveness and flexibility of operation and improving the closed-loop experience of the intelligent editing system in core interactive functions.

[0140] In some embodiments, after each successful text modification operation based on the large-scale language model, the document state at the time of operation completion is automatically saved to the history storage unit.

[0141] In this embodiment of the disclosure, a successful text modification operation means that the modification request based on a large-scale language model has been successfully completed and a valid, error-free modification result has been received. This is typically indicated by a successful API call or the normal generation of a local model.

[0142] In this embodiment of the disclosure, the document state at the time of operation completion is a snapshot of the document's complete content, format, and structure after the text modification operation has been applied. It represents a new, stable version of the document.

[0143] In this embodiment of the disclosure, automatic saving refers to a saving behavior triggered by the system without manual intervention by the user.

[0144] For example, when a user enters the command "merge the second and third paragraphs", the system has successfully called the large model to generate a new merged paragraph and replaced the original content in the document.

[0145] In some implementations, the trigger condition is: the system successfully updates the document content from "State E" (before merging) to "State F" (after merging) on ​​the interface. This "successful update" action is the trigger signal. Creating a snapshot: The system captures the complete state of the current document (including text content, formatting, cursor position, etc.), serializes it (e.g., converts it to binary format), forming a snapshot of "State F". Performing a save: The system adds (e.g., "push") this snapshot of "State F" as a new history entry to the history storage unit (e.g., a stack). Result: The latest record in the history stack was originally "State E," and now "State F" has been added above it. This allows the user to subsequently perform an "undo" operation, reverting from "State F" to "State E". It should be noted that "saving" here is different from manually saving a file to disk; it specifically refers to the historical version record maintained in memory or temporary storage to support the undo / redo function.

[0146] The technical solution of this disclosure constructs a complete and continuous operation history chain by automatically saving the document state after each AI text modification, providing a reliable data foundation for the multi-step undo / redo function based on natural language instructions. This not only ensures the reversibility and operational safety of the document editing process, but also significantly reduces the user's operational burden through fully automated historical record management, truly realizing a "worry-free exploration" intelligent editing experience.

[0147] In some embodiments, the method further includes: recording the user's corrective behavior to the instruction type discrimination result; using the user's corrective behavior and the corresponding natural language instruction as new training samples; and using the new training samples to incrementally train the intent discrimination model to optimize its discrimination accuracy.

[0148] In this embodiment of the disclosure, the corrective action is an explicit corrective action taken by the user when the system's intent determination result does not match the user's expectation. For example, the system misclassifies "rewrite this sentence" as "selective modification", but the user manually reclassifies it as "non-selective modification" through a drop-down menu.

[0149] In this embodiment of the disclosure, the new training samples are data pairs consisting of "original user instructions" and "correct intent labels after user correction". For example: {Instruction: "Rewrite this sentence", Correct label: "No selection area modification"}.

[0150] In this embodiment of the disclosure, incremental training, also known as online learning or continuous learning, refers to fine-tuning the parameters of an existing model using new small batches of data without retraining the entire model, so that it can adapt to new knowledge and avoid forgetting the old knowledge that has been learned.

[0151] In some implementations, the user inputs the command: "Center the title." The intent discrimination model incorrectly classifies this as "Selected text modification" (possibly because the model over-focuses on the "title" selection). Upon discovering the error, the user manually selects the correct operation type, "Formatting," in the feedback area or drop-down menu (assuming this is a pre-defined category) or directly performs a formatting operation (the system infers this as a corrective action). The system detects and records this corrective event: the original command "Center the title," the model's discrimination result "Selected text modification," and the user's corrected intent "Formatting."

[0152] In some implementations, the user's corrective actions and corresponding natural language commands are used as new training samples. The system constructs a standardized training sample from the information recorded in the previous step. The sample format is: input text: "Center the title", target label: "Format adjustment". This sample is stored in a dedicated "corrective action sample pool".

[0153] In some implementations, the intent discrimination model is incrementally trained using new training samples to optimize its discrimination accuracy. When the number of samples in the "corrected behavior sample pool" accumulates to a certain threshold (e.g., 100) or at fixed intervals (e.g., 24 hours), the system initiates an offline training task. During training, the system loads the currently deployed intent discrimination model and performs incremental training on it using a small number of iterations with the new corrected sample set. After training is complete, an optimized new model version is generated, which seamlessly replaces the old online model after testing.

[0154] The technical solution of this disclosure, by recording the user's corrective behavior to the intent discrimination result and using it as training samples to incrementally learn the model, enables the system to continuously optimize itself from actual use. This mechanism can not only automatically improve the accuracy of intent discrimination and adapt to the user's personalized expression habits, but also significantly reduce the manual and data costs of later model maintenance, thereby building an adaptive human-computer interaction system that becomes smarter the more it is used and has a long life cycle.

[0155] In some embodiments, when the instruction type is a rejection operation, the corresponding processing module is invoked to perform a document editing operation, including: generating an explanation of why the natural language instruction cannot be executed; providing the user with suggestions for modifying the instruction or guiding the user to make more explicit instruction input.

[0156] In this embodiment of the disclosure, the operation denial means that the intention discrimination model determines that the user's natural language instruction does not belong to the editing type supported by the system (such as exceeding the functional scope, the instruction is ambiguous and cannot be parsed, or there is an internal contradiction). Therefore, the system decides not to perform any document modification operation.

[0157] In this embodiment of the disclosure, the explanation is that the system clearly states to the user the specific reasons why the instruction cannot be executed, rather than simply reporting an error.

[0158] In this embodiment of the disclosure, the suggestion to modify the instruction is an actionable improvement plan proactively provided to the user by the system based on the analysis of the reasons for instruction failure. The aim is to help the user adjust the instruction so that it falls within the scope that the system can handle.

[0159] In some implementations, scenarios in which explanations are generated for natural language instructions that cannot be executed include, but are not limited to, the following scenarios.

[0160] Scenario 1: Command exceeds capabilities. User command: "Make this image a circle." System explanation: "Sorry, I am currently focused on editing and processing text content and do not yet support modifying the shape of images." System suggestion: "You can try describing the text around the image, or use a dedicated image editing tool."

[0161] Scenario 2: Vague instructions. User instruction: "Fix it." System explanation: "Your instruction is rather vague; I cannot understand what specific changes need to be made to the document." System suggestion: "Please provide more specific actions, such as 'Simplify this text,' 'Check for spelling errors,' or 'Center the heading.'"

[0162] Scenario 3: Logical contradiction in the command. User command: "Delete this paragraph, but keep its content." System explanation: "There is a contradiction in your command: 'delete' and 'keep content' cannot be achieved simultaneously." System suggestion: "Do you want to move this text to another location, or just change its formatting?"

[0163] It's important to note that the key to generating explanations for unexecuted natural language commands lies in "explanation" rather than "rejection." Building user trust is achieved by explaining the reasons. Offering suggestions for modifying the command or guiding the user to input more specific instructions transforms a failed interaction into a guided dialogue, aiming to help the user successfully complete the task.

[0164] The solution in this embodiment generates explanations and provides modification suggestions in scenarios where instructions are refused to be executed, transforming a simple negative response into a positive guiding interaction. This not only effectively reduces user frustration and guides them to use the system correctly, but also subtly educates users in the process, while enhancing the system's robustness in handling abnormal inputs. As a result, a user-friendly, efficient, and educational human-computer collaboration experience is constructed.

[0165] Figure 2 A flowchart illustrating a document editing method that combines intent classification with model collaboration is shown, such as... Figure 2 As shown, the process includes:

[0166] S201: Receive user query and text to be modified.

[0167] S202: Intent classification based on query.

[0168] S203a: If the text is modified without a selection area, proceed to S204.

[0169] S203b: If the text is being modified within a selected area, proceed to S206.

[0170] S203c: If it is a cancel operation, proceed to S209.

[0171] S203d: If it is a redo operation, go to S211.

[0172] S203e: If the operation is rejected, proceed to S213.

[0173] S204: Use the large model to rewrite the entire text, then proceed to S205.

[0174] S205: Returns the rewritten full text and success status code; process ends.

[0175] S206: Determine whether the scope of the instruction needs to be extended to the entire document. If yes, proceed to S204; otherwise, proceed to S207.

[0176] S207: Call the large model to rewrite the selected text, then proceed to S208.

[0177] S208: Returns the modified selection text and success status code; process ends.

[0178] S209: Analyze and determine the number of undo operation steps N1, then go to S210.

[0179] S210: Switch the document status to the previous historical status (N1th one), and the process ends.

[0180] S211: Analyze and determine the number of redo operations N2, then go to S212.

[0181] S212: Switch the document state to the subsequent state after the N2th state, and the process ends.

[0182] S213: Returns a rejection status code and explanation, and the process ends.

[0183] This solution achieves high-precision and high-efficiency modification of text content through an intelligent discrimination and processing workflow based on natural language commands. The system can intelligently invoke a large model for targeted processing based on user commands and whether a selection area is included: completing full-text reconstruction in scenarios without selection areas, and ensuring that modifications are precisely applied to the target area through a range judgment mechanism in scenarios with selection areas. This effectively avoids interference with unspecified content due to model illusions or capability limitations, thus maintaining the original state of non-modified areas at all times.

[0184] Meanwhile, the introduction of the selection function significantly improves system response efficiency. When only local content needs to be modified, the system significantly shortens the length of the generated text by constraining the output range of the large model, thereby reducing response latency and providing users with a near real-time interactive experience.

[0185] Furthermore, the system boasts excellent functional compatibility and clearly defined capability boundaries. For operations such as undo and redo that the model cannot directly support, the workflow automatically schedules front-end components to complete them efficiently, achieving seamless integration with traditional editing capabilities. When a user command is detected to be outside the system's supported scope, the system clearly defines the product's capability boundaries by returning a user-friendly rejection status and explanation, guiding users to use the system correctly. This enhances the user experience while also ensuring the system's stability and controllability.

[0186] It should be understood that Figure 2 The schematic diagrams shown are merely illustrative and not limiting, and are scalable; those skilled in the art can use them as a basis. Figure 2 Even with various obvious changes and / or substitutions to the examples, the resulting technical solutions still fall within the scope of this disclosure.

[0187] This disclosure provides a document editing device based on natural language commands, such as... Figure 3 As shown, the device may include: an instruction receiving module 301 for receiving natural language instructions input by a user; an intent determination module 302 configured with a pre-trained small-scale neural network model for processing the natural language instructions and generating instruction type determination results; and a text processing module 303 for performing document editing operations based on the instruction type determination results. Specifically: when the instruction type is an undo or redo operation, the text processing module 303 is configured to perform document state restoration or redo operations based on historical operation records; when the instruction type is unselected text modification or selected text modification, the text processing module 303 is configured to call a large-scale language model to modify the document; and when the instruction type is a reject operation, the text processing module 303 is configured to generate rejection feedback information.

[0188] In some embodiments, the intent discrimination module 302 is specifically used to: combine a natural language instruction with a preset intent discrimination prompt word template to generate a first combined instruction; input the first combined instruction into the intent discrimination model; and obtain the instruction type discrimination result output by the intent discrimination model.

[0189] In some embodiments, when the instruction type is text modification without selection area, the text processing module 303 is specifically used to: obtain the full text content of the current document; combine the natural language instruction, the full text content, and a preset document modification prompt word template to generate a second combined instruction; input the second combined instruction into a large-scale language model to obtain the modified full text content generated by the large-scale language model; and replace the full text content of the current document with the modified full text content.

[0190] In some embodiments, when the instruction type is selected text modification, the text processing module 303 is specifically used to: obtain the currently selected document area as the selected area content; generate a range judgment result based on the natural language instruction and the selected area content, the range judgment result being used to indicate whether the scope of the modification operation is limited to the selected area or needs to be extended to the whole text; if the range judgment result indicates that it is limited to the selected area, then call the large-scale language model to modify the selected area content and replace the original selected content with the modified content; if the range judgment result indicates that it needs to be extended to the whole text, then call the large-scale language model to modify the full text content of the document and replace the original document content with the modified full text content.

[0191] In some embodiments, when generating a range judgment result, the text processing module 303 is specifically used to: combine a natural language instruction, the content of the selected region, and a prompt word template for judging the modification range to generate a range judgment instruction; and input the range judgment instruction into a judgment model to obtain a range judgment result. The judgment model can be a large-scale language model, or a pre-trained dedicated classification model smaller than a large-scale language model.

[0192] In some embodiments, if the range determination result indicates that the selected area is limited to the selected area, the text processing module 303 is further configured to combine the natural language instruction, the content of the selected area and the preset document modification prompt word template to generate a first modification instruction; input the first modification instruction into the large-scale language model to obtain the modified selected area content generated therefrom; and replace the selected area content in the document with the modified selected area content.

[0193] In some embodiments, if the scope determination result indicates that it needs to be extended to the whole text, the text processing module 303 is further configured to combine the natural language instruction, the full text content of the current document, and the preset document modification prompt word template to generate a second modification instruction; input the second modification instruction into the large-scale language model to obtain the modified full text content generated therefrom; and replace the full text content of the current document with the modified full text content.

[0194] In some embodiments, the text processing module 303 is further configured to generate a scope judgment result by: extracting keywords and performing dependency parsing on the natural language instruction to identify the core action object and modification relationship in the instruction; matching the identified action object with the semantic scope of the selected area content; and generating a corresponding scope judgment result based on the matching result. If the action object is completely within the semantic scope of the selected area content, a scope judgment result is generated that limits the instruction to the selected area; otherwise, a scope judgment result is generated that extends the instruction to the entire text.

[0195] In some embodiments, the device further includes a display control module, configured to control the user interface to display a side-by-side comparison of the document's content before and after modification before performing a full-text replacement operation, and to execute the replacement operation based on the user's confirmation instruction. For example, before replacing the full-text content of the current document with the modified full-text content, the user interface displays the full-text content of the current document and the modified full-text content side-by-side, highlighting the changed content areas; receives the user's confirmation or rejection instruction for the modified full-text content; and, upon receiving the user's confirmation instruction, executes the operation of replacing the full-text content of the current document with the modified full-text content.

[0196] In some embodiments, when the instruction type is an undo or redo operation, the text processing module 303 is further configured to parse the natural language instruction to determine the number of undo or redo operation steps N; where N is an integer greater than or equal to 1; access the history storage unit storing historical operation records; and switch the document state to the historical state before the Nth operation or the subsequent state after the Nth operation based on the number of operation steps N.

[0197] In some embodiments, the text processing module 303 is also used to implement a historical operation management function, including: after each successful execution of a text modification operation based on a large-scale language model, automatically saving the document state at the time of operation completion to the historical record storage unit.

[0198] In some embodiments, the text processing module 303 is further configured to implement a model optimization function, including: recording the user's corrective behavior to the instruction type discrimination result; using the user's corrective behavior and the corresponding natural language instruction as new training samples; and using the new training samples to incrementally train the intent discrimination model to optimize its discrimination accuracy.

[0199] In some embodiments, when the instruction type is a rejection operation, the text processing module 303 is also used to generate an explanation of why the natural language instruction cannot be executed; to provide the user with suggestions for modifying the instruction or to guide the user to make more explicit instruction input.

[0200] In the above embodiments, the document editing device may take the form of, but is not limited to, an independent software module, a functional unit integrated into a local application, or a complete functional system deployed in a terminal device.

[0201] The specific functions and examples of each module and submodule of the apparatus in this disclosure can be found in the relevant descriptions of the corresponding steps in the above method embodiments, and will not be repeated here.

[0202] The document editing device in this embodiment achieves accurate response to natural language commands and optimized resource allocation by working collaboratively with the instruction receiving, intent discrimination, and text processing modules, combining the efficient discrimination of small-scale models with the intelligent generation capabilities of large-scale models. It not only supports precise and low-intrusive text modification of selected areas and the whole text, but also seamlessly integrates traditional operations such as undo and redo, as well as a user-friendly rejection mechanism. While improving editing efficiency and quality, the modular design ensures the system's reliability, scalability, and smooth user interaction.

[0203] Furthermore, the document editing device is a client device, which further includes a communication module. When the instruction type is text modification without selection area or text modification with selection area, the text processing module is configured to send natural language instructions and context information to a remote large-scale language model server through the communication module, and receive the returned modification results, thereby realizing intelligent editing function based on cloud model.

[0204] This client device achieves collaboration with the cloud-based large model service through a communication module, offloading computationally intensive text generation tasks to the server for processing. This fully leverages the powerful capabilities of the cloud model while significantly reducing the requirements for local computing resources on the client device. It enables lightweight devices to support high-performance intelligent editing functions, while facilitating unified updates and maintenance of the model on the server, thus improving the overall scalability and applicability of the system.

[0205] This disclosure provides a document editing system based on natural language instructions, such as... Figure 4 As shown, the document editing system mainly includes: a client device 401 and a server 402 that communicates with the client device 401.

[0206] Client device 401 provides the user interface and performs local computing tasks. Specifically, it includes the instruction receiving module, intent discrimination module, and text processing module (not shown again in the diagram), as described above. The core responsibilities of client device 401 are: 1. Receiving natural language instructions from the user. 2. Quickly determining the instruction type using a local, small-scale intent discrimination model. 3. Processing simple operations such as undo, redo, and reject directly locally. 4. For instructions requiring text modification, encapsulating the instruction and related document content (full text or selected content depending on the situation) into a request via the communication module and sending it to server 402.

[0207] Server 402, configured with a large-scale language model 403, is used to respond to requests from client device 401. Its core responsibilities are: 1. Receive text modification requests from client device 401. 2. Process the request by calling its configured large-scale language model 403, generating modified text that conforms to the user's instructions. 3. Return the modification result (modified full text or selected content) to client device 401.

[0208] Client device 401 and server 402 interact via network to jointly complete a full intelligent editing task. The advantage of this distributed architecture is that it provides powerful AI capabilities as a service, enabling resource-constrained client devices (such as PCs and tablets) to enjoy the intelligent editing experience provided by top-tier large models, while also facilitating centralized model updates and maintenance.

[0209] This document editing system utilizes a collaborative architecture between the client and server, deploying lightweight intent recognition and interaction functions on the client side and computationally intensive large-model text generation tasks on the server side, thus achieving efficient and intelligent document editing.

[0210] This disclosure provides a scenario illustration of a document editing method based on natural language instructions, such as... Figure 5 As shown.

[0211] As previously described, the document editing method based on natural language instructions provided in this disclosure is applied to electronic devices. These electronic devices are intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers.

[0212] Specifically, the electronic device may perform the following operations:

[0213] Receive natural language commands from the user;

[0214] The natural language instructions are processed based on the intent discrimination model to generate instruction type discrimination results. The instruction types include: text modification without selection area, text modification with selection area, undo operation, redo operation, and reject operation. The intent discrimination model is a pre-trained small-scale neural network model.

[0215] Based on the instruction type, the corresponding processing module is invoked to perform the document editing operation.

[0216] It should be understood that Figure 5 The scene diagrams shown are merely illustrative and not restrictive; those skilled in the art can interpret them based on... Figure 5 Even with various obvious changes and / or substitutions to the examples, the resulting technical solutions still fall within the scope of this disclosure.

[0217] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0218] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0219] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0220] like Figure 6 As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 602 or a computer program loaded from storage unit 608 into random access memory (RAM) 603. RAM 603 may also store various programs and data required for the operation of device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.

[0221] Multiple components in device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of monitors, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0222] The computing unit 601 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as a document editing method based on natural language instructions. For example, in some embodiments, the document editing method based on natural language instructions can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the document editing method based on natural language instructions described above can be performed. Alternatively, in other embodiments, the computing unit 601 may be configured by any other suitable means (e.g., by means of firmware) to perform a document editing method based on natural language instructions.

[0223] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0224] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0225] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory (EPROM), flash memory, optical fiber, compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0226] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a cathode ray tube (CRT) or liquid crystal display (LCD) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0227] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0228] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0229] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.

[0230] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A document editing method based on natural language instructions, comprising: Receive natural language commands from the user; The natural language instructions are processed based on the intent discrimination model to generate instruction type discrimination results; The instruction types include: text modification without selection area, text modification with selection area, undo operation, redo operation, and reject operation; Based on the instruction type determination result, the corresponding processing module is invoked to perform the document editing operation; The intent discrimination model is a pre-trained small-scale neural network model.

2. The method according to claim 1, wherein, The process of processing the natural language instruction based on the intent discrimination model to generate an instruction type discrimination result includes: The natural language instruction is combined with a preset intent-based prompt template to generate a first combined instruction; The first combined instruction is input into the intent discrimination model; Obtain the instruction type discrimination result output by the intent discrimination model.

3. The method according to claim 2, wherein, When the instruction type is text modification without selection area, the step of calling the corresponding processing module to perform document editing operations includes: Get the full text of the current document; The natural language command, the full text content, and the preset document modification prompt template are combined to generate a second combined command; The second combination of instructions is input into a large-scale language model to obtain the modified full-text content generated by the large-scale language model. Replace the full text of the current document with the modified full text.

4. The method according to claim 2, wherein, When the instruction type is selected text modification, the step of calling the corresponding processing module to perform document editing operations includes: Get the currently selected document area by the user, and use it as the content of the selected area; Based on the natural language instruction and the content of the selected area, a range judgment result is generated. The range judgment result is used to indicate whether the scope of the modification operation is limited to the selected area or needs to be extended to the entire text. If the range determination result indicates that it is limited to the selected area, then a large-scale language model is invoked to modify the content of the selected area, and the modified content replaces the original selected content. If the scope determination result indicates that it needs to be extended to the entire text, then a large-scale language model is invoked to modify the full text content of the document, and the modified full text content replaces the original document content.

5. The method according to claim 4, wherein, The process of generating a range determination result based on the natural language instruction and the selected region content includes: The natural language instruction, the selected area content, and the prompt word template used to determine the modification range are combined to generate a range determination instruction; The range judgment instruction is input into the judgment model to obtain the range judgment result.

6. The method according to claim 5, wherein, The judgment model is the large-scale language model.

7. The method according to claim 5, wherein, The judgment model is a pre-trained dedicated classification model, which is smaller in size than the large-scale language model.

8. The method according to claim 5, wherein, If the range determination result indicates that the selection is limited to the selected region, then a large-scale language model is invoked to modify the content of the selected region, and the modified content replaces the original selected content, including: The natural language instruction, the selected area content, and the preset document modification prompt template are combined to generate a first modification instruction; The first modification instruction is input into the large-scale language model to obtain the modified selected area content generated by it. Replace the selected area content in the document with the modified selected area content.

9. The method according to claim 5, wherein, If the scope determination result indicates that the scope needs to be extended to the entire document, then a large-scale language model is invoked to modify the full-text content of the document, and the modified full-text content replaces the original document content, including: The natural language instruction, the full text of the current document, and the preset document modification prompt template are combined to generate a second modification instruction; The second modification instruction is input into the large-scale language model to obtain the modified full-text content generated by it. Replace the full text of the current document with the modified full text.

10. The method according to claim 4, wherein, The process of generating a range determination result based on the natural language instruction and the selected region content includes: Keyword extraction and dependency parsing are performed on the natural language instructions to identify the core action objects and modification relationships in the instructions; The identified action object is matched with the semantic scope of the selected region content; If the action object is entirely within the semantic scope of the selected area content, the generated instruction is limited to the scope judgment result of the selected area; otherwise, the generated instruction needs to be extended to the scope judgment result of the entire text.

11. The method according to claim 3 or 9, wherein, Before replacing the full text of the current document with the modified full text, the method further includes: The full text of the current document and the modified full text are displayed side by side in the user interface, and the changed content areas are highlighted. Receive user confirmation or rejection instructions for the modified full text content; When a user confirms a request, the operation of replacing the full text of the current document with the modified full text is performed.

12. The method according to claim 2, wherein, When the instruction type is an undo or redo operation, the step of calling the corresponding processing module to perform the document editing operation includes: Parse the natural language instruction to determine the number of undo or redo operation steps N; where N is an integer greater than or equal to 1; Access the historical record storage unit that contains records of past operations; Based on the number of operation steps N, the document state is switched to a historical state before the Nth step or a subsequent state after the Nth step.

13. The method according to claim 12, wherein, The method further includes: After each successful text modification operation based on the large-scale language model, the document state at the time of operation completion is automatically saved to the history storage unit.

14. The method according to claim 1, wherein, The method further includes: Record the user's corrective actions regarding the instruction type identification result; Use the user's corrective actions and corresponding natural language instructions as new training samples; The intent discrimination model is incrementally trained using the new training samples to optimize its discrimination accuracy.

15. The method according to claim 1, wherein, When the instruction type is a rejection operation, the step of calling the corresponding processing module to perform the document editing operation includes: Generate an explanation for why the natural language instructions cannot be executed; Provide users with suggestions on modifying commands or guide them to input more specific commands.

16. A document editing device based on natural language commands, comprising: The instruction receiving module is used to receive natural language instructions input by the user. The intent determination module is equipped with a pre-trained small-scale neural network model, which is used to process the natural language instructions and generate instruction type determination results; The text processing module is used to perform document editing operations based on the instruction type determination result, wherein: When the instruction type is an undo or redo operation, the text processing module is configured to perform document state restoration or redo operations based on historical operation records. When the instruction type is text modification without selection area or text modification with selection area, the text processing module is configured to call a large-scale language model to modify the document; When the instruction type is a rejection operation, the text processing module is configured to generate rejection feedback information.

17. The document editing apparatus according to claim 16, wherein, The device is a client device and also includes a communication module; When the instruction type is text modification without selection area or text modification with selection area, the text processing module is configured to send the natural language instruction and context information to the remote large-scale language model server through the communication module, and receive the returned modification result.

18. A document editing system, comprising: The client device as described in claim 17; In addition, a server that communicates with the client device, the server being configured with a large-scale language model for performing text modification operations in response to requests from the client device.

19. An electronic device comprising: At least one processor; as well as A memory that is communicatively connected to at least one processor; wherein, The memory stores instructions that can be executed by at least one processor to enable the at least one processor to perform the method of any one of claims 1-15.

20. A non-transitory computer-readable storage medium storing computer instructions, wherein, Computer instructions are used to cause a computer to perform the method according to any one of claims 1-15.

21. A computer program product comprising a computer program stored on a storage medium, wherein the computer program, when executed by a processor, implements the method according to any one of claims 1-15.

Citation Information

Cited By

  • Multi-tool collaborative interaction method and system based on natural language instruction

    CN122263827A

  • A multi-tool cooperative interaction method and system based on natural language instructions

    CN122263827B