Automatic translation method of military intelligent software based on multi-agent collaboration
Through the multi-agent collaboration method, errors and incomplete problems in military software are solved when translating between different operating systems and hardware architectures, efficient and accurate code translation and automatic error repair are achieved, and high reliability and security needs of military software are met.
Patent Information
- Application Number
- CN202410686314.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-05-30
AI Technical Summary
Military software may have errors or incomplete translation results during development due to the use of different operating systems and hardware architectures.
The automatic translation method of military intelligent software based on multi-agent collaboration is adopted. Through the agent reading source code and knowledge query, the translation process is planned, and the translation process is completed in turn through the multi-agent collaboration, and grammar testing and sandbox testing are carried out to ensure the accuracy of the translation results.
It improves the efficiency and accuracy of code translation, automatically checks and fixes syntax and functional errors of the translation results, reduces the work burden of developers, and meets the needs of efficient, reliable and safe in military applications.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent software generation, and in particular to an automatic translation method of military intelligent software based on multi-agent collaboration. Background Art
[0002] As the field of software development continues to evolve, challenges such as cross-platform development and framework migration are becoming increasingly apparent. In terms of cross-platform development, developers need to ensure that their applications can run on different operating systems and devices, which requires them to be familiar with and able to adapt to a variety of different development environments and platform features. Framework migration involves migrating existing applications from one development framework to another, which may involve different languages, libraries, and tool sets, causing developers to relearn and adapt to new development environments. These challenges bring additional complexity and difficulty to software development.
[0003] In military applications, the challenges faced by software development are even more severe. Military systems often need to operate in various extreme environments and must have high reliability and high security. Therefore, cross-platform development and framework migration of military software must not only consider the complexity and diversity in general software development, but also meet strict performance and security requirements. For example, military command and control systems need to run seamlessly on multiple platforms such as land, sea, air, and space, and these platforms may use different operating systems and hardware architectures. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a method for automatic translation of military intelligent software based on multi-agent collaboration, which solves the technical problem that various military software systems may have errors or incomplete translation results during the development process due to the use of different operating systems and hardware architectures.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions: a method for automatic translation of military intelligent software based on multi-agent collaboration, the method comprising the following steps:
[0006] S1. Obtain the target code and source code to be translated, read the source code and perform knowledge query through the agent, and plan the translation process based on the differences between the source code and the target code;
[0007] S2, using the translation process and the difference between the source code and the target code as prompts, and having another agent or a human review whether the translation process is reasonable;
[0008] If reasonable, proceed to step S3;
[0009] If it is unreasonable, propose modification suggestions and return to step S1 to regenerate the translation process;
[0010] S3, through the cooperation of multiple agents, the translation process is completed in sequence to obtain the translation result;
[0011] S4, compiling the translated result using a target code compiler or interpreter to complete syntax testing;
[0012] If the syntax test passes, proceed to step S5;
[0013] If the syntax test fails, the error information is provided to the agent in step S3 for error handling and regeneration of the translation result;
[0014] S5. Test the translation results in a sandbox environment using test cases;
[0015] If there is a test case that fails, the test case and the error result are provided to the agent in step S3 for error handling and regeneration of the translation result;
[0016] If all test cases pass, the final translation results are output.
[0017] Furthermore, in step S1, the specific process includes the following steps:
[0018] S11, obtaining the target code language, toolkit, and framework information specified by the user, or automatically selecting a suitable toolkit or framework information by the agent according to the target code language;
[0019] S12, the agent reads the source code and sorts out the functions of the source code as well as the language, toolkit, and framework information used;
[0020] S13. The agent sorts out the differences between the source code and the target code and plans the translation process by querying the knowledge base.
[0021] Furthermore, in step S2, the specific process includes the following steps:
[0022] S21. After receiving the differences between the source code and the target code and the translation process, the agent re-examines whether the translation process is reasonable based on the differences;
[0023] If it is unreasonable, propose amendments;
[0024] If it is reasonable, it proceeds to step S22 for manual review;
[0025] S22, the agent outputs the translation process of the plan and its reasons and asks the developer for his or her opinions;
[0026] If the developer proposes a modification, the intelligent body will regenerate the translation process based on the modification and submit it to the developer for review again;
[0027] If the developer does not propose any modification suggestions, the process ends.
[0028] Furthermore, in step S3, the specific process includes a translation stage and an error handling stage, which are as follows:
[0029] In the translation phase, the knowledge base and rule base are queried according to the translation steps to obtain the translation operation and execute it. Then, the review agent is used to review and correct the translation operation.
[0030] In the error handling stage, the evaluation agent first summarizes and classifies the error information, the reflection agent reflects and summarizes the error information and translation results to generate repair operations, the execution agent handles the error according to the repair operations, and the review agent reviews the operations of the execution agent.
[0031] Furthermore, in the translation stage, the detailed process is as follows: if the current stage is the translation stage, the execution agent queries the knowledge base and the rule base according to the current translation task and performs the translation operation, and then the review agent reviews whether the translation result of the execution agent complies with the translation operation;
[0032] If not, the review agent will inform the execution agent of the translation operation that was not followed and ask it to re-execute the translation operation;
[0033] If followed, the current translation operation is completed and a translation result is generated;
[0034] In the error handling stage, the detailed process is as follows: if the current stage is the error handling stage, the evaluation agent will classify and summarize the errors, the reflection agent will generate a repair operation based on the translation result and the error summary, and the execution agent will execute it;
[0035] Then the review agent reviews whether the repair result of the executing agent complies with the repair operation;
[0036] If not, the review agent will inform the execution agent of the repair operation that was not followed and let it re-execute the repair operation;
[0037] If yes, the process goes to step S4 for retesting.
[0038] Furthermore, in step S4, the specific process includes the following steps:
[0039] S41, determining target language information or framework information according to target code information through an intelligent agent, and selecting a suitable target code compiler or interpreter;
[0040] S42, using a target code compiler or interpreter to perform syntax testing on the translated result;
[0041] If the syntax is incorrect, the error message is recorded and the process goes to step S3 to correct the error.
[0042] If the syntax is correct, the process proceeds to step S5 for sandbox testing.
[0043] Furthermore, in step S5, the specific process includes the following steps:
[0044] S51, the agent reads the source code as input and executes it to obtain output, forming several test cases;
[0045] S52, testing the translation result in a sandbox environment using a test case;
[0046] If the test case fails, the test case information and error information are recorded, and the process proceeds to step S3 to fix the error;
[0047] If all test cases pass, the translation result is the target code.
[0048] The technical solution also provides a system for realizing the automatic translation method of military intelligent software, the system comprising:
[0049] A translation process planning module, which is used to obtain the target code and source code to be translated, read the source code and perform knowledge query through the intelligent agent, and plan the translation process from the differences between the source code and the target code;
[0050] A translation process review module, wherein the translation process review module is used to use the translation process and the difference between the source code and the target code as prompt words, and to review whether the translation process is reasonable through another intelligent agent or manually;
[0051] If it is reasonable, it will enter the translation process execution module;
[0052] If it is unreasonable, propose modification suggestions and return to the translation process planning module to regenerate the translation process;
[0053] A translation process execution module, wherein the translation process execution module is used to complete the translation process in sequence through the cooperation between multiple agents to obtain the translation result;
[0054] A grammar test module, wherein the grammar test module compiles the translation result using a target code compiler or an interpreter to complete a grammar test;
[0055] If the syntax test passes, enter the translation result test module;
[0056] If the syntax test fails, the error information is provided to the translation process execution module for error handling and regeneration of the translation result;
[0057] A translation result testing module, wherein the translation result testing module uses a test case to test the translation result in a sandbox environment;
[0058] If there are any test cases that fail, the test cases and error results are provided to the translation process execution module for error handling and regeneration of translation results;
[0059] If all test cases pass, the final translation results are output.
[0060] By means of the above technical solution, the present invention provides a method for automatic translation of military intelligent software based on multi-agent collaboration, which has at least the following beneficial effects:
[0061] 1. The present invention can improve the efficiency and accuracy of code translation of large language models, and automatically check the syntax errors and functional errors of the translation results and repair them in time, effectively reducing the workload of developers.
[0062] 2. The present invention utilizes the collaboration between multiple language agents to more effectively handle large-scale code conversion and improve the accuracy and reliability of translation, thereby ensuring that the translation results can meet the needs of developers and help them easily develop and maintain software on different platforms and frameworks.
[0063] 3. The present invention can meet the requirements of high efficiency, reliability and security in military applications, greatly reduce the burden on developers, and improve the efficiency of military software development and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0065] Figure 1 A flowchart of the automatic translation method of military intelligent software of the present invention;
[0066] Figure 2 A schematic diagram of collaboration between multiple agents provided by the present invention;
[0067] Figure 3 A schematic diagram of querying the knowledge base and rule base provided by the present invention;
[0068] Figure 4 This is a schematic diagram of the syntax test and functional test provided by the present invention. DETAILED DESCRIPTION
[0069] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific implementation methods, so that the implementation process of how the present application uses technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly.
[0070] As the field of software development continues to evolve, challenges such as cross-platform development and framework migration are becoming increasingly apparent. In terms of cross-platform development, developers need to ensure that their applications can run on different operating systems and devices, which requires them to be familiar with and able to adapt to a variety of different development environments and platform features. Framework migration involves migrating existing applications from one development framework to another, which may involve different languages, libraries, and tool sets, causing developers to relearn and adapt to new development environments. These challenges bring additional complexity and difficulty to software development, so it is particularly important to find an efficient and accurate way to deal with these challenges.
[0071] Existing code translation tools have certain limitations in terms of translation efficiency and accuracy. Due to the complexity and diversity of programming languages or frameworks, these tools often cannot fully capture all semantic and structural differences, resulting in errors or incomplete translation results. In addition, existing tools may lack sufficient intelligence and adaptability to effectively respond to the challenges of changing development needs and emerging technologies. These problems limit the application scope and practicality of existing code translation tools and require further technological innovation and improvement to solve. In military applications, the challenges faced by software development are even more severe. Military systems often need to operate in various extreme environments and must have high reliability and high security. Therefore, cross-platform development and framework migration of military software must not only consider the complexity and diversity in general software development, but also meet strict performance and security requirements. For example, military command and control systems need to run seamlessly on multiple platforms such as land, sea, air, and space, which may use different operating systems and hardware architectures. In addition, with the continuous emergence of new technologies and new tactics, military software needs to quickly adapt and integrate these changes to maintain combat effectiveness.
[0072] Please refer to Figure 1-Figure 4 This embodiment proposes a method for automatic translation of military intelligent software based on multi-agent collaboration to meet the needs of cross-platform development and framework migration. This method utilizes the collaboration between multiple language agents to more effectively handle large-scale code conversion and improve the accuracy and reliability of translation, ensuring that the translation results can meet the needs of developers and help them easily develop and maintain software on different platforms and frameworks. The method includes the following steps:
[0073] S1, obtaining the target code and source code to be translated, reading the source code and performing knowledge query through the agent, and planning the translation process from the differences between the source code and the target code; as the optimal implementation method of step S1, the specific process includes the following steps:
[0074] S11, obtaining the target code language, toolkit, and framework information specified by the user, or automatically selecting a suitable toolkit or framework information by the agent according to the target code language;
[0075] S12, the agent reads the source code and sorts out the functions of the source code as well as the language, toolkit, and framework information used;
[0076] S13. The agent sorts out the differences between the source code and the target code and plans the translation process by querying the knowledge base.
[0077] In this embodiment, the agent used is a large language model agent, which performs knowledge query by using the language, framework and other characteristics of the source code and target code as prompts, summarizes the differences between the source code and the target code, and then plans the entire translation process.
[0078] S2, using the translation process and the difference between the source code and the target code as prompts, and having another intelligent agent or manual review whether the translation process is reasonable; if reasonable, proceed to step S3; if unreasonable, propose modification suggestions, and return to step S1 to regenerate the translation process; in this step, by using the obtained translation process and the difference between the source code and the target code as prompts, having another intelligent agent review the translation process, and then having manual review to obtain the correct translation process, the intelligent agent used here can be a large language model intelligent agent or a Judge intelligent agent and other agents that can perform autonomous review and hand over the modified translation process to the developer for re-review. Among them, as the optimal implementation method for implementing step S2, the specific process includes the following steps:
[0079] S21, after receiving the differences between the source code and the target code and the translation process, the agent re-examines whether the translation process is reasonable based on the differences; if not, it proposes modification suggestions; if reasonable, it proceeds to step S22 for manual review;
[0080] S22. The intelligent body outputs the planned translation process and its reasons and asks the developer for his / her opinion. If the developer proposes modification suggestions, the intelligent body will regenerate the translation process based on the modification suggestions and submit it to the developer for review again. If the developer does not propose modification suggestions, the process ends.
[0081] S3, through the cooperation of multiple agents, the translation process is completed in sequence to obtain the translation results; here, multiple agents cooperate with each other to complete each step in the translation process and perform error repair. In each translation step, under the prompt of the knowledge base and rule base, multiple agents complete the preliminary code translation task through language interaction. Please refer to Figure 2 As the optimal implementation method of step S3, the specific process includes a translation stage and an error handling stage, which are as follows:
[0082] In the translation phase, the knowledge base and rule base are queried according to the translation steps to obtain the translation operation and execute it, and then the review agent is used to review and correct the translation operation; the detailed process is: if the current phase is the translation phase, the execution agent queries the knowledge base and rule base according to the current translation task and executes the translation operation, and then the review agent is used to review whether the translation result of the execution agent complies with the translation operation;
[0083] If it is not followed, the review agent will inform the execution agent of the translation operation that was not followed and let it re-execute the translation operation; if it is followed, the current translation operation is completed and the translation result is generated.
[0084] In the error handling stage, the evaluation agent first summarizes and classifies the error information, the reflection agent reflects and summarizes the error information and the translation results to generate the repair operation, the execution agent performs error handling according to the repair operation, and the review agent reviews the execution agent's operation. The detailed process is: if the current stage is the error handling stage, the evaluation agent will classify and summarize the errors, the reflection agent will generate the repair operation according to the translation results and the error summary, and the execution agent will execute it; then the review agent will review whether the repair result of the execution agent complies with the repair operation; if not, the review agent will inform the execution agent of the repair operation that was not followed and let it re-execute the repair operation; if it complies, the flow goes to step S4 for retesting.
[0085] Please refer to Figure 3 and Figure 4 , as a preferred implementation of step S4 in this embodiment, specifically:
[0086] If the current stage is the translation stage, the Actor agent will query the knowledge base and rule base according to the current translation task and perform the translation operation; if the current stage is the error handling stage, the Evaluator agent will classify and summarize the errors, and the Reflection agent will generate repair operations based on the translation results and error summaries, which will be executed by the Actor agent.
[0087] If the current stage is the translation stage, the Judge intelligent body will review whether the translation result of the Actor intelligent body complies with the translation operation. If not, the Judge intelligent body will inform the Actor intelligent body of the translation operation that was not followed and let it re-execute the translation operation; if it is followed, the current translation operation is completed and the next translation step is executed; if the current stage is the error handling stage, the Judge intelligent body will review whether the repair result of the Actor intelligent body complies with the repair operation. If not, the Judge intelligent body will inform the Actor intelligent body of the repair operation that was not followed and let it re-execute the repair operation; if it is followed, the final translation result will be transferred to step S4 for compilation testing.
[0088] S4, compile the translation result using a target code compiler or interpreter to complete a syntax test. If the syntax test passes, proceed to step S5; if the syntax test fails, provide the error information to the agent in step S3 for error handling and regenerate the translation result; Figure 4 As shown, as the best implementation method for implementing step S4, the specific process includes the following steps:
[0089] S41, determining target language information or framework information according to target code information through an intelligent agent, and selecting a suitable target code compiler or interpreter;
[0090] S42, use the target code compiler or interpreter to perform syntax test on the translation result; if the syntax is incorrect, record the error information and flow to step S3 for error repair; if the syntax is correct, flow to step S5 for sandbox testing.
[0091] S5. Test the translation results with test cases. If there are any test cases that fail, provide the test cases and error results to the agent in step S3 for error handling and regeneration of the translation results. If all test cases pass, output the final translation results. Figure 4 As shown, as the best implementation method for implementing step S5, the specific process includes the following steps:
[0092] S51, the agent reads the source code as input and executes it to obtain output, forming several test cases;
[0093] S52, using test cases to test the translation results in a sandbox environment; if the test case fails, the test case information and error information are recorded, and the process proceeds to step S3 for error repair; if all test cases pass, the translation result is the target code.
[0094] The automatic translation method of military intelligent software proposed in the present invention has significant advantages in military applications. First, the multi-agent collaboration mechanism can effectively improve the efficiency and accuracy of code translation, ensuring that high-quality code migration is completed in a short time. Secondly, the introduction of a large language model enables the system to automatically identify and repair grammatical and functional errors in the translation process, further improving the reliability of the software. Finally, through technical means such as sandbox testing, strict functional verification can be performed on the translation results before deployment to ensure its stability and security in actual operation. These characteristics enable the code translation method of the present invention to meet the requirements of high efficiency, reliability and security in military applications, greatly reduce the burden on developers, and improve the development and maintenance efficiency of military software.
[0095] The military intelligent software automatic translation method proposed in the present invention effectively improves the efficiency and accuracy of code translation by a large language model, can automatically check syntax errors and functional errors in the translation results and repair them in time, effectively reducing the workload of developers.
[0096] Corresponding to the military intelligent software automatic translation method provided in the above embodiment, this embodiment also provides a military intelligent software automatic translation system. Since the military intelligent software automatic translation system provided in this embodiment corresponds to the military intelligent software automatic translation method provided in the above embodiment, the implementation method of the aforementioned military intelligent software automatic translation method is also applicable to the military intelligent software automatic translation system provided in this embodiment, and will not be described in detail in this embodiment.
[0097] The military intelligent software automatic translation system proposed in this embodiment is composed of a translation process planning module, a translation process review module, a translation process execution module, a grammar test module and a translation result test module. Specifically, the translation process planning module is used to obtain the target code and source code to be translated, and plan the translation process from the difference between the source code and the target code through the intelligent agent reading the source code and knowledge query; the translation process review module is used to use the translation process and the difference between the source code and the target code as prompt words, and review whether the translation process is reasonable through another intelligent agent or manual; if it is reasonable, enter the translation process execution module; if it is unreasonable, propose modification suggestions, and return to the translation process planning module to regenerate the translation process.
[0098] The translation process execution module is used to complete the translation process in sequence through the cooperation of multiple intelligent agents to obtain the translation results; the syntax testing module uses a target code compiler or interpreter to compile the translation results to complete the syntax test; if the syntax test passes, it enters the translation result testing module; if the syntax test fails, the error information is provided to the translation process execution module for error handling and regeneration of the translation result.
[0099] The translation result test module uses test cases to test the translation results in a sandbox environment; if there are any test cases that fail, the test cases and error results are provided to the translation process execution module for error handling and regeneration of the translation results; if all test cases pass, the final translation results are output.
[0100] It should be noted that the system provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0101] This embodiment also provides a computer device, which includes a processor, a memory, a network interface, an input device and a display screen connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory includes a storage medium and an internal memory. The storage medium can be a non-volatile storage medium or a volatile storage medium. The storage medium stores an operating system and can also store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor can implement the automatic translation method of military intelligent software. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the storage medium. The internal memory can also store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor can execute the automatic translation method of military intelligent software. The network interface of the computer device is used to communicate with an external server through a network connection. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the shell of the computer device, or an external keyboard, touchpad or mouse.
[0102] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, so the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0103] The above implementation methods have been described in detail. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for automatic translation of military intelligent software based on multi-agent collaboration, characterized in that: The method comprises the following steps: S1. Obtain the target code and source code to be translated, read the source code and perform knowledge query through the agent, and plan the translation process from the differences between the source code and the target code; S2, using the translation process and the difference between the source code and the target code as prompts, and having another agent or a human review whether the translation process is reasonable; If reasonable, proceed to step S3; If it is unreasonable, propose modification suggestions and return to step S1 to regenerate the translation process; S3, through the cooperation of multiple agents, the translation process is completed in sequence to obtain the translation result. The specific process includes the translation stage and the error handling stage, as follows: In the translation phase, the knowledge base and rule base are queried according to the translation steps to obtain the translation operation and execute it. Then, the review agent is used to review and correct the translation operation. Specifically: If the current stage is the translation stage, the Actor agent queries the knowledge base and rule base according to the current translation task and performs the translation operation; the Judge agent reviews whether the translation result of the Actor agent complies with the translation operation. If not, the Judge agent will inform the Actor agent of the translation operation that was not followed and re-execute the translation operation; if it complies, the current translation operation is completed and the next translation step is executed; In the error handling phase, the evaluation agent first summarizes and classifies the error information, the reflection agent reflects on the error information and the translation results and summarizes and generates repair operations, the execution agent handles the error according to the repair operations, and the review agent reviews the execution agent's operations, specifically: If the current stage is error handling, the Evaluator agent will classify and summarize the errors, and the Reflection agent will generate a repair operation based on the translation result and error summary, and the Actor agent will execute it; the Judge agent will review whether the repair result of the Actor agent complies with the repair operation. If not, the Judge agent will inform the Actor agent of the repair operation that was not followed and re-execute the repair operation; if it complies, the final translation result will be transferred to step S4 for compilation test; S4, compiling the translated result using a target code compiler or interpreter to complete syntax testing; If the syntax test passes, proceed to step S5; If the syntax test fails, the error information is provided to the agent in step S3 for error handling and regeneration of the translation result; S5. Test the translation results in a sandbox environment using test cases; If there is a test case that fails, the test case and the error result are provided to the agent in step S3 for error handling and regeneration of the translation result; If all test cases pass, the final translation results are output.
2. The method for automatically translating military intelligent software according to claim 1, characterized in that: In step S1, the specific process includes the following steps: S11, obtaining the target code language, toolkit, and framework information specified by the user, or automatically selecting a suitable toolkit or framework information by the agent according to the target code language; S12, the agent reads the source code and sorts out the functions of the source code as well as the language, toolkit, and framework information used; S13. The agent sorts out the differences between the source code and the target code and plans the translation process by querying the knowledge base.
3. The method for automatically translating military intelligent software according to claim 1, characterized in that: In step S2, the specific process includes the following steps: S21. After receiving the differences between the source code and the target code and the translation process, the agent re-examines whether the translation process is reasonable based on the differences; If it is unreasonable, propose amendments; If it is reasonable, it proceeds to step S22 for manual review; S22, the translation process and reasons of the intelligent agent output plan and ask the developer for his opinions; If the developer proposes a modification, the intelligent body will regenerate the translation process based on the modification and submit it to the developer for review again; If the developer does not propose any modification suggestions, the process ends.
4. The method for automatically translating military intelligent software according to claim 1, characterized in that: In step S4, the specific process includes the following steps: S41, determining target language information or framework information according to target code information through an intelligent agent, and selecting a suitable target code compiler or interpreter; S42, using a target code compiler or interpreter to perform syntax testing on the translated result; If the syntax is incorrect, the error message is recorded and the process goes to step S3 to correct the error; If the syntax is correct, the process proceeds to step S5 for sandbox testing.
5. The method for automatically translating military intelligent software according to claim 1, characterized in that: In step S5, the specific process includes the following steps: S51, the agent reads the source code as input and executes it to obtain output, forming several test cases; S52, testing the translation result in a sandbox environment using a test case; If the test case fails, the test case information and error information are recorded, and the process proceeds to step S3 to fix the error; If all test cases pass, the translation result is the target code.
6. A system for implementing the method for automatically translating military intelligent software according to any one of claims 1 to 5, characterized in that: The system includes: A translation process planning module, which is used to obtain the target code and source code to be translated, read the source code and perform knowledge query through the intelligent agent, and plan the translation process from the differences between the source code and the target code; A translation process review module, wherein the translation process review module is used to use the translation process and the difference between the source code and the target code as prompt words, and to review whether the translation process is reasonable through another intelligent agent or manually; If it is reasonable, it will enter the translation process execution module; If it is unreasonable, propose modification suggestions and return to the translation process planning module to regenerate the translation process; A translation process execution module, which is used to complete the translation process in sequence through the cooperation of multiple agents to obtain the translation result; A grammar test module, wherein the grammar test module compiles the translation result using a target code compiler or an interpreter to complete a grammar test; If the syntax test passes, enter the translation result test module; If the syntax test fails, the error information is provided to the translation process execution module for error handling and regeneration of the translation result; A translation result testing module, wherein the translation result testing module uses a test case to test the translation result in a sandbox environment; If there are any test cases that fail, the test cases and error results are provided to the translation process execution module for error handling and regeneration of translation results; If all test cases pass, the final translation results are output.
7. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for automatically translating military intelligent software as described in any one of claims 1 to 5 is implemented.
8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the military intelligent software automatic translation method as described in any one of claims 1-5.
Citation Information
Patent Citations
Code review method and device, electronic equipment and storage medium
CN117539767A
Code adaptation conversion method and device, equipment and storage medium
CN117742724A
Code conversion method and device, electronic equipment and storage medium
CN118092925A