Implementation method for controlling office software to execute target operation through natural language
By building a natural language-controlled office software automatic execution system, using large language models to generate and execute the secondary development code of office software, the problem of users having secondary development capabilities and limited code is solved, and the user's diversified operation needs are achieved. Automated execution improves office efficiency.
Patent Information
- Application Number
- CN202411197486.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-12-10
AI Technical Summary
The existing technology requires users to have the ability to develop office software, write code to implement operations, and the number of codes is limited, which cannot meet users' diverse operational needs, resulting in low efficiency.
By building a target operation automatic execution system, using large language models and special corpus, users use natural language to describe their needs, and the system generates and executes executable code that meets the secondary development interface specifications of office software to achieve automated operations.
Users can achieve operational needs without learning office software usage skills, reduce learning costs, improve office efficiency, and meet diversified operational needs.
Smart Images

Figure CN119105832A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer office software automation, and in particular to a method for implementing a target operation by controlling office software through natural language. Background Art
[0002] Office software (such as Microsoft Office, WPS Office, etc.) usually has many functions. Mastering the use of these functions requires users to pay a very high learning cost. Some advanced functions even require users to have software development capabilities, which leads to users often encountering problems where they want to perform certain operations but do not know how to do them, and the operation process is too cumbersome and inefficient.
[0003] The existing technical method is to use the secondary development interface provided by office software to write codes that meet the secondary development interface specifications and can automatically perform certain fixed operations. When the user needs to perform an operation, the user directly runs the relevant code to automatically complete the corresponding operation. In actual operation, the following problems still exist:
[0004] 1. Users are required to have the ability to perform secondary development of office software, which ordinary users do not have.
[0005] 2. The code is written manually, and the amount of code written is limited, which can only implement a small number of common operations. However, the actual operation requirements of users vary greatly, and there are still a large number of operation requirements that cannot be met.
[0006] Therefore, the present invention needs to design a method for controlling office software to execute target operations through natural language to solve the above-mentioned problems. Summary of the invention
[0007] The purpose of the present invention is to provide a method for controlling office software to execute target operations through natural language in order to solve the above problems, thereby solving the problems mentioned in the background technology.
[0008] In order to solve the above problems, the present invention provides a technical solution:
[0009] A method for controlling office software to perform a target operation through natural language includes the following specific steps:
[0010] S1. Build a target operation automatic execution system, and set up a demand input end, a code generation end, and a code execution end in the system;
[0011] S2. Build a dedicated corpus, including: secondary development interface documents of office software, secondary development codes of office software publicly available on the Internet, manually written secondary development codes of office software, automatically generated secondary development codes of office software, etc.;
[0012] S3, deploy a large language model and use the dedicated corpus in S2 to pre-train the large language model to enhance its ability in writing code for secondary development of office software;
[0013] S4. Install the office software required for actual operation, add a requirement input device in the office software or on the device where the office software is installed, and the user inputs the operation requirements described in natural language through the device, and the device submits the user requirements and office software related information to the code generation end;
[0014] S5, the code generation end receives and understands the natural language description. After receiving the request data of S4, the code generation end uses a large language model to evaluate the feasibility of realizing the user's operation requirements by writing executable code according to the operation requirements and office software information described by the user. If feasible, it enters S6;
[0015] S6. The code generation end generates code that can be executed in the office software according to the requirements described in natural language. According to the office software information submitted in S4 and the operation requirement information described by the user in natural language, the large language model inside the code generation end is called to generate executable code that meets the secondary development interface specification of the office software in the code generation large model;
[0016] S7, checking the executable code inside the code generation end, and transmitting the corrected executable code result to the code execution end, thereby entering step S8;
[0017] S8. Automatically execute the executable code through the code execution terminal, and automatically execute the generated code through the secondary development interface provided by the office software to complete the relevant functions;
[0018] S9. The code execution end reports the execution result to the code generation end to supplement the corpus.
[0019] As a preferred technical solution, the code generation end in S1 includes one or more large language models that have both natural language understanding capabilities and executable code generation capabilities.
[0020] As a preferred technical solution, the secondary development interface specifications of office software in S6 include VBA, Python, JSA, etc.
[0021] As a preferred technical solution, the office software related information in S4 includes the software name, version number, etc.
[0022] As a preferred technical solution, when the executable code of the code generation end is checked in S7, due to the hallucination phenomenon of the large language model, there is a probability of generating erroneous code. During the inspection, the code generated by the large language model will be checked and corrected twice.
[0023] As a preferred technical solution, the execution effect in S9 can be evaluated by the user, and the evaluation result can be fed back to the code generation end. The code generation end can organize the original requirements and automatically generated codes according to the user evaluation to form a new corpus to improve the corpus in S2.
[0024] As a preferred technical solution, the target operation automatic execution system includes a demand input end, a code generation end and a code execution end;
[0025] The output end of the demand input end is communicatively connected to the input end of the code generation end, and the code generation end is bidirectionally communicatively connected to the code execution end.
[0026] As a preferred technical solution, the demand input end includes a demand input unit and a first communication unit;
[0027] The demand input unit is used for the user to describe the operation demand through natural language, and the form may include: text;
[0028] The first communication unit is responsible for sending the operation requirements input by the user to the code generation end.
[0029] As a preferred technical solution, the demand input end includes a demand input unit and a first communication unit;
[0030] The demand input unit is used for the user to describe the operation demand through natural language, and the form may include: text;
[0031] The first communication unit is responsible for sending the operation requirements input by the user to the code generation end.
[0032] As a preferred technical solution, the code generation end includes a second communication unit, a training unit, a large language model unit and a code verification unit;
[0033] The second communication unit is used to receive user requirements sent by the requirement input end, to send executable code to the code execution end, and to receive execution effect feedback sent by the code execution end;
[0034] The training unit is used to enhance the ability of the large language model in office software secondary development based on the corpus, such as office software secondary development interface documents, manually written office software secondary development executable codes, automatically generated office software secondary development executable codes, etc.
[0035] The large language model unit is used to understand the operation requirements described by the user in natural language and generate executable code that complies with the secondary development interface specification of the office software;
[0036] The code verification unit is used to check the executable code automatically generated by the large language model, correct the obviously erroneous code, and add additional code to improve the robustness of the code.
[0037] As a preferred technical solution, the code execution end includes a third communication unit, a local execution unit and a visualization unit;
[0038] The third communication unit is used to receive the executable code sent by the code generation end, and is also used to send the execution effect evaluation to the code generation end;
[0039] The local execution unit is used to execute the received code;
[0040] The visualization unit is used to visualize the code execution process and also collect users' evaluation of the execution effect; the evaluation includes but is not limited to: full satisfaction of requirements, partial satisfaction of requirements, execution error, etc.
[0041] The beneficial effects of the present invention are as follows: the present invention constructs a target operation automatic execution system, and respectively sets a demand input terminal, a code generation terminal and a code execution terminal in the system. In actual use, the user only needs to use natural language to describe the operation requirements, and use a large language model to automatically generate corresponding codes according to the requirements, and automatically execute the codes to control the office software to achieve the operations desired by the user, so that the user can achieve the desired operation effect without having to learn a lot of office software usage skills, thereby reducing the user's learning cost and improving office efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] For ease of explanation, the present invention is described in detail with reference to the following specific implementations and the accompanying drawings.
[0043] Figure 1 It is a flowchart of the overall process steps of a method for implementing a target operation by controlling office software through natural language of the present invention;
[0044] Figure 2 It is an overall structural topology diagram of a target operation automatic execution system of a method for implementing a target operation by controlling office software to execute a target operation through natural language according to the present invention;
[0045] Figure 3 It is a schematic diagram of input description of a first embodiment of a method for implementing a method of controlling office software to execute a target operation through natural language according to the present invention;
[0046] Figure 4It is a schematic diagram of automatic execution results of a first embodiment of a method for implementing a method of controlling office software to execute a target operation through natural language according to the present invention;
[0047] Figure 5 It is a schematic diagram of input description of a second embodiment of a method for implementing a method of controlling office software to execute a target operation through natural language according to the present invention;
[0048] Figure 6 It is a schematic diagram of automatic execution results of a second embodiment of a method for implementing a method of controlling office software to execute a target operation through natural language according to the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0050] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.
[0051] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0052] It should be understood that although the terms first, second, third, etc. may be used to describe in the embodiments of the present application, these descriptions should not be limited to these terms. These terms are only used to distinguish the descriptions. For example, without departing from the scope of the embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.
[0053] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0054] It should also be noted that the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprising a ..." do not exclude the existence of other identical elements in the commodity or device including the elements.
[0055] It should be particularly noted that any symbols and / or numbers in the specification that are not marked in the accompanying drawings are not drawing marks.
[0056] The optional embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0057] The embodiment provided in this application is an embodiment of a method for analyzing the correlation between driving behavior factors and driving risks based on big data.
[0058] like Figure 1 , Figure 2 As shown, this specific implementation adopts the following technical solutions:
[0059] A method for controlling office software to perform a target operation through natural language includes the following specific steps:
[0060] S1. Build a target operation automatic execution system, and set up a demand input end, a code generation end, and a code execution end in the system;
[0061] S2. Build a dedicated corpus, including: secondary development interface documents of office software, secondary development codes of office software publicly available on the Internet, manually written secondary development codes of office software, automatically generated secondary development codes of office software, etc.;
[0062] S3, deploy a large language model and use the dedicated corpus in S2 to pre-train the large language model to enhance its ability in writing code for secondary development of office software;
[0063] S4. Install the office software required for actual operation, add a demand input device to the office software or the device where the office software is installed, and the user inputs the operation requirements described in natural language through the device. The device combines the user requirements and the office software. The code generation end includes one or more large language models with both natural language understanding capabilities and executable code generation capabilities. The office software related information includes the software name, version number, etc.;
[0064] S5, the code generation end receives and understands the natural language description. After receiving the request data of S4, the code generation end uses a large language model to evaluate the feasibility of realizing the user's operation requirements by writing executable code according to the operation requirements and office software information described by the user. If feasible, it enters S6;
[0065] S6. The code generation end generates code that can be executed in the office software according to the requirements described in natural language. According to the office software information submitted in S2 and the operation requirement information described by the user in natural language, the large language model inside the code generation end is called to generate executable code that complies with the secondary development interface specification of the office software in the code generation large model. The secondary development interface specification of the office software includes VBA, Python, JSA, etc.;
[0066] S7, check the executable code inside the code generation end, and transmit the corrected executable code result to the code execution end, so as to enter step S8. When checking the executable code of the code generation end, due to the hallucination phenomenon of the large language model, there is a probability of generating erroneous code. In the inspection, the code generated by the large language model will be checked and corrected twice;
[0067] S8. Automatically execute the executable code through the code execution terminal, and automatically execute the generated code through the secondary development interface provided by the office software to complete the relevant functions;
[0068] S9, the code execution end reports the execution result to the code generation end to supplement the corpus. When the execution result does not meet the user's expectations, the user can feedback the result to the code generation end. The code generation end summarizes and organizes the results and returns them to S1 to complete the integrity of the entire device and continuously improve and iterate. When the execution result meets expectations, it means that the automatic execution process and results meet the requirements.
[0069] Furthermore, the target operation automatic execution system includes a demand input terminal, a code generation terminal and a code execution terminal; the output terminal of the demand input terminal is communicatively connected to the input terminal of the code generation terminal, and the code generation terminal is bidirectionally communicatively connected to the code execution terminal.
[0070] Furthermore, the demand input end includes a demand input unit and a first communication unit; the demand input unit is used for the user to describe the operation requirements through natural language, and the form may include: text; the first communication unit is responsible for sending the operation requirements input by the user to the code generation end.
[0071] Furthermore, the demand input end includes a demand input unit and a first communication unit; the demand input unit is used for the user to describe the operation requirements through natural language, and the form may include: text; the first communication unit is responsible for sending the operation requirements input by the user to the code generation end.
[0072] Furthermore, the code generation end includes a second communication unit, a training unit, a large language model unit and a code verification unit; the second communication unit is used to receive user requirements sent by the requirement input end, and is also used to send executable code to the code execution end, and is also used to receive execution effect feedback sent by the code execution end; the training unit is used to enhance the ability of the large language model in office software secondary development based on the corpus in the corpus, such as: office software secondary development interface documents, manually written office software secondary development executable code, automatically generated office software secondary development executable code, etc.; the large language model unit is used to understand the user's operation requirements described in natural language, and generate executable code that complies with the office software secondary development interface specification; the code verification unit is used to check the executable code automatically generated by the large language model, correct obviously erroneous code, and add additional code to improve the robustness of the code.
[0073] Furthermore, the code execution end includes a third communication unit, a local execution unit and a visualization unit; the third communication unit is used to receive the executable code sent by the code generation end, and is also used to send the execution effect evaluation to the code generation end; the local execution unit is used to execute the received code; the visualization unit is used to visualize the code execution process, and also collect the user's evaluation of the execution effect; the evaluation includes but is not limited to: full satisfaction of requirements, partial satisfaction of requirements, execution error, etc.
[0074] Large Language Model (LLM) is a language model consisting of an artificial neural network with many parameters (usually billions of weights or more) that is trained on a large amount of unlabeled text using self-supervised learning or semi-supervised learning. Large language models have strong natural language understanding and reasoning capabilities, and can understand the meaning of natural language text and generate natural language text. They perform well in various natural language tasks, such as dialogue, question-answering, code generation, text creation, etc.
[0075] Embodiment 1: A user inputs the following text at the requirement input terminal: Replace all Hello in the article with Hello, add double quotes, make it bold, and mark it in red.
[0076] The code generation end generates the following VBA code:
[0077]
[0078]
[0079] The code execution end calls the secondary development interface of Microsoft Word to execute the above VBA code to achieve the operation desired by the user.
[0080] Embodiment 2: The user enters the following text at the demand input terminal: Compare the data in columns A and B of each row in the table. If the data in column A is greater than the data in column B, calculate the average of the data in columns A and B and put it in column C; otherwise, multiply the data in column A by 5 and then subtract the data in column B and put it in column C;
[0081] The code generation end generates the following VBA code:
[0082]
[0083]
[0084] The code execution end calls the secondary development interface of Microsoft Excel to execute the above VBA code to achieve the operation desired by the user.
[0085] Specifically: In actual applications, the present invention constructs a target operation automatic execution system, and respectively sets a demand input terminal, a code generation terminal and a code execution terminal in the system. In actual use, the user only needs to use natural language to describe the operation requirements, and use the large language model to automatically generate the corresponding code according to the requirements, and automatically execute the code to control the office software to achieve the operation the user wants. This enables the user to achieve the desired operation effect without having to learn a lot of office software usage skills, reducing the user's learning cost and improving office efficiency.
[0086] Those of ordinary skill in the art will appreciate that the modules and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0087] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, equipment and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0088] In the several embodiments provided in the present application, it should be understood that the disclosed devices, systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or units can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or equipment, which can be electrical, mechanical or other forms.
[0089] The demand input terminal, code generation terminal and code execution terminal may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0090] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0091] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program instructions, such as a USB flash drive, a mobile hard disk, a read-only storage server, a random access storage server, a magnetic disk or an optical disk.
[0092] In addition, it should be noted that the combination of the various technical features in this case is not limited to the combination described in the claims of this case or the combination described in the specific embodiments. All technical features described in this case can be freely combined or combined in any way unless there is a contradiction between them.
[0093] It should be noted that the above examples are only specific embodiments of the present invention, and the present invention is obviously not limited to the above examples, and there are many similar variations. All variations directly derived or associated from the contents disclosed by the technicians in this field should fall within the protection scope of the present invention.
[0094] The above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for controlling office software to perform target operations through natural language, It is characterized in that The specific steps include: S1. Build a target operation automatic execution system, and set up a demand input end, a code generation end, and a code execution end in the system; S2. Build a dedicated corpus, including: secondary development interface documents of office software, secondary development codes of office software publicly available on the Internet, manually written secondary development codes of office software, automatically generated secondary development codes of office software, etc.; S3, deploy a large language model and use the dedicated corpus in S2 to pre-train the large language model to enhance its ability in writing code for secondary development of office software; S4. Install the office software required for actual operation, add a requirement input device in the office software or on the device where the office software is installed, and the user inputs the operation requirements described in natural language through the device, and the device submits the user requirements and office software related information to the code generation end; S5, the code generation end receives and understands the natural language description. After receiving the request data of S4, the code generation end uses a large language model to evaluate the feasibility of realizing the user's operation requirements by writing executable code according to the operation requirements and office software information described by the user. If feasible, it enters S6; S6. The code generation end generates code that can be executed in the office software according to the requirements described in natural language. According to the office software information submitted in S4 and the operation requirement information described by the user in natural language, the large language model inside the code generation end is called to generate executable code that meets the secondary development interface specification of the office software in the code generation large model; S7, checking the executable code inside the code generation end, and transmitting the corrected executable code result to the code execution end, thereby entering step S8; S8. Automatically execute the executable code through the code execution terminal, and automatically execute the generated code through the secondary development interface provided by the office software to complete the relevant functions; S9. The code execution end reports the execution result to the code generation end to supplement the corpus.
2. The method for implementing the target operation by controlling office software through natural language according to claim 1, Features: The code generation end in S1 includes one or more large language models that have both natural language understanding capabilities and executable code generation capabilities.
3. The method for implementing the target operation by controlling office software through natural language according to claim 1, Features: The secondary development interface specifications of the office software in S6 include VBA, Python, JSA, etc.
4. The method for implementing the target operation by controlling office software through natural language according to claim 1, Features: The office software related information in S4 includes software name, version number, etc.
5. The method for implementing the target operation by controlling office software through natural language according to claim 1, Features: When the executable code of the code generation end is checked in S7, due to the hallucination phenomenon of the large language model, there is a probability of generating erroneous code. During the inspection, the code generated by the large language model will be checked and corrected twice.
6. The method for implementing the target operation by controlling office software through natural language according to claim 1, Features: The execution effect in S9 can be evaluated by the user, and the evaluation result can be fed back to the code generation end. The code generation end can organize the original requirements and automatically generated codes according to the user evaluation to form a new corpus to improve the corpus in S2.
7. A method for implementing a target operation by controlling office software through natural language according to claim 1, Features: The target operation automatic execution system includes a demand input end, a code generation end and a code execution end; The output end of the demand input end is communicatively connected to the input end of the code generation end, and the code generation end is bidirectionally communicatively connected to the code execution end.
8. A method for implementing a target operation by controlling office software through natural language according to claim 7, Features: The demand input end includes a demand input unit and a first communication unit; The demand input unit is used for the user to describe the operation demand through natural language, and the form may include: text; The first communication unit is responsible for sending the operation requirements input by the user to the code generation end.
9. The method for implementing a target operation by controlling office software through natural language according to claim 1, Features: The code generation end includes a second communication unit, a training unit, a large language model unit and a code verification unit; The second communication unit is used to receive user requirements sent by the requirement input end, to send executable code to the code execution end, and to receive execution effect feedback sent by the code execution end; The training unit is used to enhance the ability of the large language model in office software secondary development based on the corpus, such as office software secondary development interface documents, manually written office software secondary development executable codes, automatically generated office software secondary development executable codes, etc. The large language model unit is used to understand the operation requirements described by the user in natural language and generate executable code that complies with the secondary development interface specification of the office software; The code verification unit is used to check the executable code automatically generated by the large language model, correct the obviously erroneous code, and add additional code to improve the robustness of the code.
10. A method for controlling office software to perform target operations through natural language according to claim 9, Features: The code execution end includes a third communication unit, a local execution unit and a visualization unit; The third communication unit is used to receive the executable code sent by the code generation end, and is also used to send the execution effect evaluation to the code generation end; The local execution unit is used to execute the received code; The visualization unit is used to visualize the code execution process and also collect users' evaluation of the execution effect; the evaluation includes but is not limited to: full satisfaction of requirements, partial satisfaction of requirements, execution error, etc.
Citation Information
Cited By
Code generation method and device based on natural language and medium
CN120469666A
Natural language based code generation method, device and medium
CN120469666B
Intelligent plug-in method and system based on large language model
CN120780297A
