Program code automatic generation system and method, electronic equipment and storage medium
By analyzing the explanatory text of the project project and calling a large language model to generate program code, the problem that artificial intelligence programming assistants in the existing technology cannot independently complete project engineering writing is solved, and the complete program code is automatically generated, which improves programming efficiency.
Patent Information
- Application Number
- CN202411841203.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-04
AI Technical Summary
The existing artificial intelligence programming assistant cannot independently complete the programming of the entire project project, and developers need to assemble and adjust, resulting in inefficient programming.
It provides an automatic program code generation system, which analyzes the explanatory text of the project, extracts key text information, calls large language models to generate initial program code, and obtains the complete program code through the organization module.
It realizes automatic acquisition of project completion program code, improves programming efficiency, and reduces the steps of manual assembly and adjustment.
Smart Images

Figure CN119759340A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a system and method for automatically generating program codes, an electronic device, and a storage medium. Background Art
[0002] At present, in order to improve software development efficiency, developers usually perform programming with the assistance of artificial intelligence. Existing artificial intelligence programming assistants can help developers find the required program code snippets more quickly to find answers to technical problems or key program code snippets, greatly shortening programming time.
[0003] However, current artificial intelligence programming assistants can only obtain certain fragmented program codes based on user instructions. They are unable to independently complete the programming of the entire project and require developers to assemble and adjust the program code fragments, which is very inconvenient.
[0004] Therefore, how to automatically obtain the completed program code of a project has become a problem that needs to be solved urgently in the current programming field. Summary of the invention
[0005] In view of this, the embodiments of the present application provide a system, method, electronic device and storage medium for automatically generating program codes, which can automatically obtain the completed program codes of a project engineering.
[0006] In a first aspect, an embodiment of the present application provides a method for automatically generating program code, comprising:
[0007] A parsing module, used for obtaining a description text corresponding to a target project, and parsing the description text to extract key text information in a function description and a sub-function description; the description text includes the function description of the target project, and the sub-function descriptions corresponding to a plurality of sub-function modules in the target project;
[0008] A program code generation module, used to generate initial program codes corresponding to the plurality of sub-function modules respectively according to the key text information;
[0009] A program code arrangement module, used to generate target program codes corresponding to the multiple sub-function modules based on the initial program codes respectively corresponding to the multiple sub-function modules, and arrange the target program codes corresponding to the multiple sub-function modules to obtain the complete program code of the target project;
[0010] The program code storage module is used to store the complete program code, generate a target function description and a target annotation corresponding to the complete program code, and generate a target complete program code.
[0011] As an optional implementation of the embodiment of the present application, the parsing module is specifically used for:
[0012] Performing semantic recognition on the description text to obtain corresponding semantic recognition results;
[0013] According to the semantic recognition result, the target text in the description text is extracted, and the key text information is generated.
[0014] As an optional implementation of the embodiment of the present application, the program code generation module is specifically used for:
[0015] An interface corresponding to the large language model is called, and the key text information is sent to the large language model to obtain initial program codes respectively corresponding to the multiple sub-function modules generated by the large language model according to the key text information.
[0016] As an optional implementation of the embodiment of the present application, the program code generation module is specifically used for:
[0017] A program code template library is obtained so that the large language model can select corresponding program code templates from the program code template library according to the key text information, and generate initial program codes corresponding to the multiple sub-function modules respectively according to the program code templates.
[0018] As an optional implementation of the embodiment of the present application, the program code tidying module is also used for:
[0019] Calling the interface corresponding to the large language model, sending the initial program codes corresponding to the multiple sub-function modules to the large language model, so that the large language model corrects the initial program codes corresponding to the multiple sub-function modules and generates target program codes corresponding to the multiple sub-function modules.
[0020] As an optional implementation of the embodiment of the present application, the program code automatic generation system also includes: a feedback processing module, which is used to obtain the overall specifications of the target engineering project, and adjust the target complete program code based on the overall specifications of the target project to obtain the adjusted target complete program code.
[0021] As an optional implementation of the embodiment of the present application, the program code automatic generation system performs process control on the parsing module, the program code generation module, the program code organization module, the program code storage module, and the feedback processing module based on a JSON file.
[0022] In a second aspect, an embodiment of the present application provides a method for automatically generating program code, comprising:
[0023] Obtaining a description text corresponding to the target project engineering, and parsing the description text to extract key text information in the function description and the sub-function description; the description text includes the function description of the target project engineering, and the sub-function descriptions corresponding to the multiple sub-function modules in the target project;
[0024] Generating initial program codes corresponding to the plurality of sub-function modules respectively according to the key text information;
[0025] Generating target program codes corresponding to the multiple sub-function modules based on the initial program codes respectively corresponding to the multiple sub-function modules, and sorting the target program codes corresponding to the multiple sub-function modules to obtain the complete program code of the target project;
[0026] The complete program code is saved, a target function description and a target annotation corresponding to the complete program code are generated, and a target complete program code is generated.
[0027] As an optional implementation of the embodiment of the present application, the obtaining of the description text corresponding to the target project engineering and parsing of the description text to extract key text information in the function description and the sub-function description include:
[0028] Performing semantic recognition on the description text to obtain corresponding semantic recognition results;
[0029] According to the semantic recognition result, the target text in the description text is extracted, and the key text information is generated.
[0030] As an optional implementation manner of the embodiment of the present application, generating initial program codes corresponding to the multiple sub-function modules respectively according to the key text information includes: calling an interface corresponding to the large language model, sending the key text information to the large language model, so as to obtain the initial program codes corresponding to the multiple sub-function modules respectively generated by the large language model according to the key text information.
[0031] As an optional implementation manner of the embodiment of the present application, before calling the interface corresponding to the large language model and sending the key text information to the large language model to obtain the initial program codes corresponding to the multiple sub-function modules respectively generated by the large language model according to the key text information, the method also includes: obtaining a program code template library, so that the large language model screens the corresponding program code template from the program code template library according to the key text information, and generates the initial program codes corresponding to the multiple sub-function modules respectively according to the program code template.
[0032] As an optional implementation of the embodiment of the present application, the method further includes:
[0033] Calling the interface corresponding to the large language model, sending the initial program codes corresponding to the multiple sub-function modules to the large language model, so that the large language model corrects the initial program codes corresponding to the multiple sub-function modules and generates target program codes corresponding to the multiple sub-function modules.
[0034] As an optional implementation of the embodiment of the present application, the method further includes:
[0035] The overall specification of the target engineering project is obtained, and the target complete program code is adjusted based on the overall specification of the target project to obtain the adjusted target complete program code.
[0036] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to enable the electronic device to implement the method for automatically generating program code described in any of the above embodiments when executing the computer program.
[0037] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a computing device, the computing device implements the method for automatically generating program code described in any of the above embodiments.
[0038] The program code automatic generation system provided in the embodiment of the present application includes: a parsing module, which is used to obtain the description text corresponding to the target project engineering, and parse the description text to extract key text information in the function description and the sub-function description; the description text includes the function description of the target project engineering, and the sub-function descriptions corresponding to multiple sub-function modules in the target project; a program code generation module, which is used to generate initial program codes corresponding to the multiple sub-function modules according to the key text information; a program code arrangement module, which is used to generate target program codes corresponding to the multiple sub-function modules based on the initial program codes corresponding to the multiple sub-function modules, and arrange the target program codes corresponding to the multiple sub-function modules to obtain the complete program code of the target project engineering; a program code storage module, which is used to save the complete program code, generate the target function description and target annotation corresponding to the complete program code, and generate the target complete program code. The program code automatic generation system provided by the present application can comprehensively extract key text information based on the description text corresponding to the target project engineering by setting up a complete set of processes including a parsing module, a program code generation module, a program code organization module and a program code storage module, and generate codes corresponding to each sub-functional module based on this, and then organize and obtain the target complete program code of the target engineering project. Therefore, the present application can realize the automated process from parsing the description text to generating complete and usable code with description annotations through the collaborative work of various modules, thereby promoting the intelligent and efficient development of the programming field. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0041] Figure 1 The overall architecture diagram of the program code automatic generation system provided in the embodiment of the present application;
[0042] Figure 2 An architectural flow chart of a system for automatically generating program code provided in an embodiment of the present application;
[0043] Figure 3 A flowchart of the steps of the method for automatically generating program code provided in an embodiment of the present application;
[0044] Figure 4 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0046] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0047] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. In addition, in the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more.
[0048] It should be noted that, in this article, the term "comprises" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0049] In the embodiments of this application, refer to Figure 1 As shown, Figure 1 Schematic diagram of the overall architecture of the program code automatic generation system in the embodiment of the present disclosure, which includes: a parsing module 11, a program code generation module 12, a program code arrangement module 13, and a program code storage module 14.
[0050] The parsing module 11 is used to obtain the description text corresponding to the target project engineering, and parse the description text to extract key text information in the function description and sub-function description.
[0051] The description text includes the functional description of the target project and the sub-functional descriptions corresponding to the multiple sub-functional modules in the target project.
[0052] In some embodiments, the description text of the target project can be understood as the outline of the target project, so as to give the specific functions of the target project, and which program modules the target project is composed of, and the functional description and annotations corresponding to each program module. The description text of the target project can be written by a user who has a program coding requirement for the project, then the user organizes it into the description text according to the actual needs of the project, and uploads the description text to the parsing module 11, and then generates the completed program code corresponding to the project according to the description text corresponding to the project uploaded by the user, combined with the program code automatic generation system provided in the embodiment of the present application.
[0053] Exemplarily, the user can issue a program code generation instruction corresponding to an online book management system to the parsing module. Specifically, the instruction is: "Generate a Web application corresponding to the online book management system", and attach the functional description text of the online book management system and the description text corresponding to each functional module in the online book management system. For example, the functional description text of the online book management system can be: provide a convenient platform for libraries or personal book collectors to manage book information, borrowing records, user accounts and other related matters. For another example, the various functional modules in the online book management system can include: user module, book module, borrowing module, administrator module, interface design requirements, security and performance requirements, and the sub-function descriptions corresponding to these modules. Specifically, the sub-function description corresponding to the user module can include two parts, user registration and login and user information management; wherein, the description of user registration and login is: the user can register by providing information such as user name, password, email address, etc. After successful registration, the registered account can be used to log in to the system. After logging in, the user session state should be maintained until the user actively exits. The functional description of user information management is: after logging in, the user can modify his personal information, such as password, email address, contact information, etc. Users can write other functional modules according to actual needs, which will not be described here.
[0054] Then, the description text is parsed by a parsing module to extract key text information in the functional description of the target project and a plurality of sub-functional descriptions.
[0055] Specifically, the parsing module is used to: perform semantic recognition on the description text to obtain a corresponding semantic recognition result; extract the target text in the description text according to the semantic recognition result, and generate the key text information.
[0056] In the embodiment of the present application, the parsing module 11 may be provided with a large language model interface. After obtaining the description text corresponding to the target project uploaded by the user, the description text corresponding to the target project can be given to the large language model through the large language model interface in the parsing module 11, and then the large language model is instructed to perform semantic recognition on the description text through the pre-set parsing instructions to obtain the corresponding semantic recognition result; then, according to the semantic recognition result, the target text in the description text is extracted, and the key text information is generated. The target text can be the key information that can highly reflect the description text, and then through the extraction of key text information, the part of the text that is of great value for understanding the core content of the description text and realizing the program code writing task is screened out from the description text, which helps the subsequent large language model to accurately and efficiently perform reasoning retrieval based on the key text information, and use the code writing function of the large language model LLM to generate the program code corresponding to the target engineering project.
[0057] The large language model (LLM) is a deep learning model trained with a large amount of text data that can generate natural language text or understand the meaning of language text. The large language model can handle a variety of natural language tasks, such as text classification, question answering, and dialogue, and is an important path to artificial intelligence [1]. Currently, the large language model uses a Transformer architecture and pre-training objectives (such as Language Modeling) similar to the small model. The difference from the small model is that the model size, training data, and computing resources are increased.
[0058] The program code generation module 12 is used to generate initial program codes corresponding to the multiple sub-function modules respectively according to the key text information.
[0059] In an embodiment of the present application, according to the key text information, a specific method for generating the initial program codes corresponding to the multiple sub-function modules respectively may be: giving the key text information to a large language model, and having the large language model first perform intent recognition on the key text information, so as to analyze the programming purpose that is really wanted to be achieved behind the key information text through the key information text, that is, to obtain the specific functions of the target project, so as to help determine the general framework and key logical direction of the subsequent generated code, and then perform knowledge retrieval and matching. The large language model, relying on the massive programming knowledge and code examples learned in the pre-training stage, retrieves programming grammar, function library, algorithm logic and other contents related to the current needs from its own "knowledge base". For the need to add integers, knowledge modules such as defining variables (such as using the int type to define integer variables), using addition operators and output functions (such as print) in Python will be searched.
[0060] Then, the initial program code corresponding to each sub-functional module is obtained according to the above method, that is, the initial program code corresponding to each sub-functional module in the target engineering project is preliminarily obtained, and further needs to be sorted by the following program code sorting module 13.
[0061] Specifically, the program code generation module 12 is specifically used to: call the interface corresponding to the large language model, send the key text information to the large language model, and obtain the initial program codes corresponding to the multiple sub-function modules generated by the large language model according to the key text information.
[0062] In some embodiments, a large language model interface is also provided in the program code generation module 12. Then, after the key text information is acquired, the key text information is given to the large language model through the large language model interface. Then, through the program code generation instructions pre-set in the large language model interface of the program code generation module 12, the large language model is instructed to generate the initial program codes corresponding to the multiple sub-function modules respectively according to the key text information.
[0063] It should be noted that the program code generation module 12 also needs to obtain a program code template library so that the large language model can filter the corresponding program code template from the program code template library according to the key text information, and generate the initial program codes corresponding to the multiple sub-function modules respectively according to the program code template.
[0064] Specifically, in response to the program coding needs of diverse users, the corresponding program code template library can be customized to obtain program coding that better meets the user's needs.
[0065] Exemplarily, program code template libraries corresponding to different programming languages can be created, for example, program code template libraries corresponding to programming languages such as Python and Java, and program code template libraries corresponding to different application fields can also be created, for example, program code template libraries corresponding to application fields such as data science and analysis, game development, and program function classification; further, the corresponding program code template library can be determined based on the key information text, so as to generate initial program codes corresponding to the multiple sub-function modules generated by the large language model according to the key text information, and use the corresponding program code template library to generate program coding that better meets user requirements.
[0066] The program code arrangement module 13 is used to generate target program codes corresponding to the multiple sub-function modules based on the initial program codes corresponding to the multiple sub-function modules respectively, and to arrange the target program codes corresponding to the multiple sub-function modules to obtain the complete program code of the target project engineering.
[0067] In some embodiments, after obtaining the initial program codes corresponding to the multiple sub-function modules, the initial program codes corresponding to the multiple sub-function modules may have syntax errors, such as mismatched brackets, incorrect use of punctuation marks, or illogical problems, and therefore, corrections are required to ensure that the generated program codes are correct and usable at the syntax level and logically reasonable. Then, the target program codes corresponding to the multiple sub-function modules obtained by correction are sorted to obtain the complete program code of the target project, that is, the completed program code corresponding to the target project.
[0068] Specifically, the program code arrangement module 13 is specifically used to: call the interface corresponding to the large language model, send the initial program codes corresponding to the multiple sub-function modules to the large language model, so that the large language model can correct the initial program codes corresponding to the multiple sub-function modules, and generate target program codes corresponding to the multiple sub-function modules.
[0069] In some embodiments, a large language model interface is also provided in the program code generation module 13, so that the initial program codes corresponding to the multiple sub-function modules respectively obtained in the program code generation module 12 are given to the large language model again through the large language model interface in the program code generation module 13, and the large language model is instructed to correct the initial program codes corresponding to the multiple sub-function modules respectively, and generate target program codes corresponding to the multiple sub-function modules through the instructions set in advance in the large language model interface contained in the program code arrangement module 13.
[0070] Then, the large language model is instructed to construct a logical structure between multiple sub-functional modules according to the target program codes corresponding to the multiple sub-functional modules, and to assemble the target program codes corresponding to the multiple sub-functional modules in a correct and reasonable order to obtain the complete program code of the target project engineering.
[0071] The program code storage module 14 is used to store the complete program code, generate a target function description and a target annotation corresponding to the complete program code, and generate a target complete program code.
[0072] In some embodiments, after obtaining the complete program code of the target project, it is necessary to save the completed code of the target project, generate a target function description and target annotation corresponding to the complete program code, and generate a target complete program code.
[0073] Specifically, the specific implementation method of generating the target function description and target annotation corresponding to the complete program code and generating the target complete program code is: giving the complete program code to the large language model through the large language model interface in the program code storage module 14, and instructing the large language model to first obtain the target function description and target annotation of the complete program code through instructions pre-set in the large language model interface of the program code storage module 14.
[0074] Specifically, the large language model will disassemble and generate accurate and clear functional descriptions and comments in detail based on the logical structure of the complete program code, the data processing involved, the algorithm application and other factors. For example, if it is a piece of code that sorts list data and filters out specific elements, the functional description will explain how to sort the list, the conditions for filtering elements, and the form and meaning of the final output; the comments will explain the role of the line of code in the entire data processing flow at the key code line, such as annotating how the key steps of the sorting algorithm change the order of the list elements, and annotating the logical judgment basis of the filtering conditions, etc.
[0075] After generating the target function description and target annotation corresponding to the complete program code and generating the target complete program code, the program code automatic generation system can output the target complete program code to the user, so that the user can obtain the target complete program code corresponding to the target project engineering.
[0076] The program code automatic generation system provided in the embodiment of the present application includes: a parsing module, which is used to obtain the description text corresponding to the target project engineering, and parse the description text to extract key text information in the function description and the sub-function description; the description text includes the function description of the target project engineering, and the sub-function descriptions corresponding to multiple sub-function modules in the target project; a program code generation module, which is used to generate initial program codes corresponding to the multiple sub-function modules according to the key text information; a program code arrangement module, which is used to generate target program codes corresponding to the multiple sub-function modules based on the initial program codes corresponding to the multiple sub-function modules, and arrange the target program codes corresponding to the multiple sub-function modules to obtain the complete program code of the target project engineering; a program code storage module, which is used to save the complete program code, generate the target function description and target annotation corresponding to the complete program code, and generate the target complete program code. The program code automatic generation system provided by the present application can comprehensively extract key text information based on the description text corresponding to the target project engineering by setting up a complete set of processes including a parsing module, a program code generation module, a program code organization module and a program code storage module, and generate codes corresponding to each sub-functional module based on this, and then organize and obtain the target complete program code of the target engineering project. Therefore, the present application can realize the automated process from parsing the description text to generating complete and usable code with description annotations through the collaborative work of various modules, thereby promoting the intelligent and efficient development of the programming field.
[0077] As an extension and refinement of the above embodiment, the program code automatic generation system also includes: a feedback processing module 15, which is used to obtain the overall specifications of the target engineering project, and adjust the target complete program code based on the overall specifications of the target project to obtain the adjusted target complete program code.
[0078] Specifically, the software development team of the target project will formulate code style and structural specifications to enhance team collaboration efficiency and facilitate the smooth development of a series of subsequent maintenance and expansion work, ensure the consistency and readability of the code written by team members, and then generate the overall specifications. Specifically, the overall specifications may include: naming rules (such as naming methods for variables, functions, and classes), code indentation, bracket usage and other code style details, as well as module division principles, layered architecture (such as the division of presentation layer, business logic layer, and data access layer) and other structural specifications. For example, it is stipulated that all Java class names in the project use upper camel case naming method, function names use lower camel case naming method, and each functional module is required to have a clear interface definition to facilitate calls from other modules.
[0079] Furthermore, the overall specifications of the target engineering project and the target complete program code are given to the large language model, and the large language model is instructed to adjust the target complete program code according to the overall specifications of the target project according to pre-set instructions, thereby obtaining the adjusted target complete program code output by the large language model.
[0080] In some embodiments, in combination with the above embodiments, refer to Figure 2 As shown, it is a process architecture diagram of the program code automatic generation system provided in an embodiment of the present application, including: a large language model 20, a parsing module 21, a program code generation module 22, a program code organization module 23, a program code storage module 24, and a feedback processing module 25.
[0081] These five modules work together, the output of the previous module is the input of the next module, and the output of the last module is the input of the first module. Each module can also be understood as an intelligent agent, that is, after each module completes the corresponding operation, it will automatically enter the next module to complete the corresponding operation until the target complete program code is generated.
[0082] It should be noted that the automated process among the five modules of the parsing module 21, the program code generation module 22, the program code arrangement module 23, the program code storage module 24, and the feedback processing module 25 can be controlled by a JSON file, and the JSON file can be parsed by a parsing engine set in the program code automatic generation system. For example, the following is an example of a simple process JSON file:
[0083]
[0084] In the above code, "nodes" indicates the nodes corresponding to multiple modules, "nodeId" is the identifier corresponding to each module, "name" indicates the name of the module corresponding to the node, which is replaced by "nodeName" in this example, and "version" indicates the version number of the node, which is replaced by the number 111 here to distinguish the modules corresponding to nodes under different versions.
[0085] "input" and "output" refer to the input and output of the module corresponding to the node. "flowNodeType" is used to clarify the type of the node in a certain process, such as a calculation node, a judgment node, and the like.
[0086] The "config" object is used to store some configuration information related to the entire system.
[0087] Based on the same inventive concept, as an implementation of the above method, an embodiment of the present application also provides a method for automatically generating program code. This embodiment corresponds to the aforementioned method embodiment. For ease of reading, this embodiment will no longer repeat the details of the aforementioned method embodiment one by one, but it should be clear that a method for automatically generating program code in this embodiment can correspond to all the contents in the aforementioned system embodiment.
[0088] The present application embodiment provides a method for automatically generating program code. Figure 3 Automatically generate a method flow chart for the program code, such as Figure 3 As shown, the program code automatic generation method includes the following steps S301 to S304:
[0089] S301, obtaining a description text corresponding to a target project, and parsing the description text to extract key text information in a function description and a sub-function description; the description text includes the function description of the target project, and the sub-function descriptions corresponding to a plurality of sub-function modules in the target project;
[0090] S302, generating initial program codes corresponding to the plurality of sub-function modules respectively according to the key text information;
[0091] S303, generating target program codes corresponding to the multiple sub-function modules based on the initial program codes respectively corresponding to the multiple sub-function modules, and sorting the target program codes corresponding to the multiple sub-function modules to obtain the complete program code of the target project;
[0092] S304: Save the complete program code, generate a target function description and a target annotation corresponding to the complete program code, and generate a target complete program code.
[0093] As an optional implementation of the embodiment of the present application, the obtaining of the description text corresponding to the target project engineering and parsing of the description text to extract key text information in the function description and the sub-function description include:
[0094] Performing semantic recognition on the description text to obtain corresponding semantic recognition results;
[0095] According to the semantic recognition result, the target text in the description text is extracted, and the key text information is generated.
[0096] As an optional implementation manner of the embodiment of the present application, generating initial program codes corresponding to the multiple sub-function modules respectively according to the key text information includes: calling an interface corresponding to the large language model, sending the key text information to the large language model, so as to obtain the initial program codes corresponding to the multiple sub-function modules respectively generated by the large language model according to the key text information.
[0097] As an optional implementation manner of the embodiment of the present application, before calling the interface corresponding to the large language model and sending the key text information to the large language model to obtain the initial program codes corresponding to the multiple sub-function modules respectively generated by the large language model according to the key text information, the method also includes: obtaining a program code template library, so that the large language model screens the corresponding program code template from the program code template library according to the key text information, and generates the initial program codes corresponding to the multiple sub-function modules respectively according to the program code template.
[0098] As an optional implementation of the embodiment of the present application, the method further includes:
[0099] Calling the interface corresponding to the large language model, sending the initial program codes corresponding to the multiple sub-function modules to the large language model, so that the large language model corrects the initial program codes corresponding to the multiple sub-function modules and generates target program codes corresponding to the multiple sub-function modules.
[0100] As an optional implementation of the embodiment of the present application, the method further includes:
[0101] The overall specification of the target engineering project is obtained, and the target complete program code is adjusted based on the overall specification of the target project to obtain the adjusted target complete program code.
[0102] Based on the same inventive concept, an embodiment of the present disclosure also provides an electronic device. Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure, such as Figure 4 As shown, the electronic device provided in this embodiment includes: a memory 401 and a processor 402, wherein the memory 401 is used to store a computer program; and the processor 402 is used to execute the audio data processing method provided in the above embodiment when executing the computer program.
[0103] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the computing device implements the program code automatic generation method provided in the above embodiment.
[0104] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media that include computer-usable program code.
[0105] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0106] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0107] Computer readable media include permanent and non-permanent, removable and non-removable storage media. Storage media can be implemented by any method or technology to store information, and the information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0108] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A program code automatic generation system, characterized in that: include: A parsing module, used to obtain the description text corresponding to the target project engineering, and parse the description text to extract key text information in the function description and sub-function description; the description text includes the function description of the target project engineering, and the sub-function descriptions corresponding to multiple sub-function modules in the target project; A program code generation module, used to generate initial program codes corresponding to the plurality of sub-function modules respectively according to the key text information; A program code arrangement module, used to generate target program codes corresponding to the multiple sub-function modules based on the initial program codes respectively corresponding to the multiple sub-function modules, and arrange the target program codes corresponding to the multiple sub-function modules to obtain the complete program code of the target project; The program code storage module is used to store the complete program code, generate a target function description and a target annotation corresponding to the complete program code, and generate a target complete program code.
2. The system according to claim 1, characterized in that The analysis module is specifically used for: Performing semantic recognition on the description text to obtain corresponding semantic recognition results; According to the semantic recognition result, the target text in the description text is extracted, and the key text information is generated.
3. The system according to claim 1, characterized in that The program code generation module is specifically used for: An interface corresponding to the large language model is called, and the key text information is sent to the large language model to obtain initial program codes respectively corresponding to the multiple sub-function modules generated by the large language model according to the key text information.
4. The system according to claim 3, characterized in that The program code generation module is specifically used for: A program code template library is obtained so that the large language model can select corresponding program code templates from the program code template library according to the key text information, and generate initial program codes corresponding to the multiple sub-function modules respectively according to the program code templates.
5. The system according to claim 1, characterized in that The program code tidying module is also used for: Calling the interface corresponding to the large language model, sending the initial program codes corresponding to the multiple sub-function modules to the large language model, so that the large language model corrects the initial program codes corresponding to the multiple sub-function modules and generates target program codes corresponding to the multiple sub-function modules.
6. The system according to claim 1, characterized in that The program code automatic generation system also includes: a feedback processing module, which is used to obtain the overall specification of the target engineering project, and adjust the target complete program code based on the overall specification of the target project to obtain the adjusted target complete program code.
7. The system according to any one of claims 1 to 6, characterized in that: The program code automatic generation system performs process control on the parsing module, the program code generation module, the program code arrangement module, the program code storage module, and the feedback processing module based on the JSON file.
8. A method for automatically generating program code, characterized in that: include: Obtaining a description text corresponding to the target project engineering, and parsing the description text to extract key text information in the function description and the sub-function description; the description text includes the function description of the target project engineering, and the sub-function descriptions corresponding to the multiple sub-function modules in the target project; Generating initial program codes corresponding to the plurality of sub-function modules respectively according to the key text information; Generating target program codes corresponding to the multiple sub-function modules based on the initial program codes respectively corresponding to the multiple sub-function modules, and sorting the target program codes corresponding to the multiple sub-function modules to obtain the complete program code of the target project; The complete program code is saved, a target function description and a target annotation corresponding to the complete program code are generated, and a target complete program code is generated.
9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store a computer program; and the processor is used to enable the electronic device to implement the program code automatic generation method according to claim 8 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a computing device, the computing device implements the method for automatically generating program codes according to claim 8.
Citation Information
Patent Citations
Code generation method and device
CN116719520A
Bidirectional intelligent question and answer code supplementing method and system based on large language model
CN118426825A
Code generation method and device, electronic equipment and storage medium
CN118796171A
Code generation method, device and equipment based on multi-agent language system
CN119065650A
Cited By
Parameter calibration method and device based on EPICS, equipment and medium
CN121050335A