Code generation method and device for multi-modal demand, equipment and storage medium
By combining multimodal large models and target domain knowledge graphs, the problem of insufficient code generation adaptability in existing technologies is solved, achieving efficient and accurate automated code generation, and reducing technical comprehension biases and collaboration barriers.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-26
- Publication Date
- 2026-03-10
AI Technical Summary
In software development, existing technologies suffer from insufficient code generation adaptability in processing multimodal data from requirements documents. They cannot adapt to personalized technical architectures, and code generation tools require technical personnel to provide prior information. They cannot directly parse unstructured requirements documents, resulting in low conversion efficiency, high comprehension deviation rate, and high barriers to cross-role collaboration.
A multimodal large model is used to extract multimodal data from code requirement documents, generating candidate dimension code requirement data. Combined with the target domain knowledge graph and historical code generation constraints, target code generation constraints and templates are determined, and target requirement code is generated based on these conditions and templates.
It improves the adaptability of automated code generation, reduces technical misunderstandings, reduces barriers to cross-role collaboration, and improves the efficiency and accuracy of code generation.
Smart Images

Figure CN121635875A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computers, in particular to the technical field of automatic programming, and specifically to a code generation method and device for multi-modal requirements, an equipment and a storage medium. BACKGROUND
[0002] In current software development, the requirement document takes the product manager as the main body, and is mostly in the form of natural language description of requirement function and logic, and flowchart and other unstructured forms. Technical personnel need to manually interpret the requirements and convert them into code. This process has three major core pain points: first, the conversion efficiency is low; second, the requirement understanding deviation rate is high; and third, the cross-role collaboration barrier is high.
[0003] At present, the existing technology mostly uses code platforms and code generation tools to automatically convert requirements into code. Although this solves the drawbacks brought by manual conversion of requirements, due to the diversity of requirement expression in requirement documents, the existing requirement automatic conversion technology has the following problems in processing multi-modal data: code platforms mostly rely on preset components and visual drag-and-drop, and can only generate code for simple business logic, and have insufficient support for complex business rules (such as multi-condition branching and distributed transactions), and cannot adapt to personalized technical architecture; code generation tools generate code based on code snippet matching and simple semantic understanding, and require technical personnel to provide explicit function names, variable definitions and other pre-information, and cannot directly parse unstructured requirement documents, and the generated code lacks adaptability to existing technical stacks (such as framework versions and database types). SUMMARY
[0004] The present application provides a code generation method and device for multi-modal requirements, and an equipment and a storage medium, to improve the adaptability of code automatic generation.
[0005] According to an aspect of the present application, a code generation method for multi-modal requirements is provided, which comprises:
[0006] Upon receiving a code requirement document sent by a client, a multi-modal extraction is performed on the code requirement document based on a multi-modal large model, to obtain code requirement data of at least one candidate dimension; wherein the candidate dimensions include text, flowchart and data table;
[0007] According to the code requirement data and the business domain to which the code requirement document belongs, a target domain knowledge graph of the code requirement document is determined;
[0008] According to the target domain knowledge graph, a target code generation constraint condition and a target code template are determined from the historical code generation constraint conditions and historical code templates in the business domain;
[0009] generate a target requirement code based on the target code generation constraint condition and the target code template according to the target domain knowledge graph and the business domain.
[0010] According to another aspect of the present application, a multi-modal requirement code generation apparatus is provided, which comprises:
[0011] A data extraction module is configured to, when receiving a code requirement document sent by a client, perform multi-modal extraction on the code requirement document based on a multi-modal large model to obtain code requirement data of at least one candidate dimension; wherein the candidate dimension includes text, flowchart and data table.
[0012] A graph determination module is configured to determine a target domain knowledge graph of the code requirement document according to the code requirement data and a business domain to which the code requirement document belongs.
[0013] A data screening module is configured to determine a target code generation constraint condition and a target code template from a historical code generation constraint condition and a historical code template in the business domain according to the target domain knowledge graph.
[0014] A code generation module is configured to generate a target requirement code based on the target code generation constraint condition and the target code template according to the target domain knowledge graph and the business domain.
[0015] According to another aspect of the present application, an electronic device is provided, which comprises:
[0016] One or more processors;
[0017] A memory for storing one or more programs;
[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement any one of the multi-modal requirement code generation methods provided by the embodiments of the present application.
[0019] According to another aspect of the present application, a computer readable storage medium is provided, which stores a computer program, and the program is executed by a processor to implement any one of the multi-modal requirement code generation methods provided by the embodiments of the present application.
[0020] According to another aspect of the present application, a computer program product is provided, which comprises a computer program, and the computer program is executed by a processor to implement any one of the multi-modal requirement code generation methods provided by the embodiments of the present application.
[0021] The application extracts the code requirement data of at least one candidate dimension from the code requirement document based on a multi-modal large model when receiving the code requirement document sent by the client; determines the target field knowledge graph of the code requirement document according to the code requirement data and the business field to which the code requirement document belongs; determines the target code generation constraint condition and the target code template from the historical code generation constraint condition and the historical code template in the business field according to the target field knowledge graph; and determines the target requirement code according to the target field knowledge graph and the business field based on the target code generation constraint condition and the target code template. The above scheme converts multi-modal data into a knowledge graph, and uses the knowledge graph in combination with a business field, which helps to improve the adaptation rate of code automatic generation. BRIEF DESCRIPTION OF DRAWINGS
[0022] Figure 1 is a flowchart of a multi-modal requirement code generation method according to an embodiment of the application;
[0023] Figure 2 is a flowchart of a multi-modal requirement code generation method according to an embodiment of the application;
[0024] Figure 3 is a structural schematic diagram of a multi-modal requirement code generation device according to an embodiment of the application;
[0025] Figure 4 is a structural schematic diagram of an electronic device for implementing a multi-modal requirement code generation method according to an embodiment of the application. DETAILED DESCRIPTION
[0026] In order to enable personnel in the art to better understand the application scheme, the technical solutions in the embodiments of the application will be clearly and completely described below in conjunction with the drawings in the embodiments of the application. Obviously, the described embodiments are only a part of the embodiments of the application, rather than all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those of ordinary skill in the art without creative labor should be within the scope of protection of the application.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and in the above drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] In addition, it should also be noted that in the technical solutions of the present application, the collection, storage, use, processing, transmission, provision and disclosure of related data such as code requirement documents and code requirement data, etc. comply with relevant laws and regulations and do not violate public order and good customs.
[0029] Embodiment one
[0030] Figure 1 It is a flowchart of a multi-modal requirement code generation method according to the first embodiment of the present application. The present embodiment can be applied to the case of multi-modal requirement analysis and automatic code conversion of code requirement documents, and can be executed by a multi-modal requirement code generation device. The multi-modal requirement code generation device can be realized in the form of hardware and / or software, and can be configured in a computer device, such as a server. As shown in the figure, the method comprises: Figure 1
[0031] S110, when receiving the code requirement document sent by the client, performing multi-modal extraction on the code requirement document based on a multi-modal large model to obtain code requirement data of at least one candidate dimension.
[0032] The client refers to a user end for requirement analysis in the software development life cycle. The code requirement document refers to a document that details the implementation requirements of the code in a software project or system. It is usually generated during the requirement analysis stage of the software development life cycle and is used to clearly define the functions, behaviors, and technical requirements that developers need to implement. The multi-modal large model refers to an artificial intelligence model that can handle and understand multiple types of input data (such as text, images, audio, video, etc.) simultaneously. This model is not limited to traditional single input (such as pure text or pure image), but can integrate information from different sensory channels to achieve more intelligent and flexible performance. The candidate dimension refers to the different forms of data in the code requirement document. This candidate dimension can include at least one of text, flowchart, and data table. The code requirement data refers to the single-dimensional data parsed from the code requirement document to describe the code generation requirements.
[0033] For example, a multi-modal large model is used to uniformly parse and divide the text, flowchart, and data table in the code requirement document to obtain code requirement data in at least one dimension.
[0034] S120, according to the code requirement data and the business domain to which the code requirement document belongs, determine the target domain knowledge graph of the code requirement document.
[0035] The business domain refers to a specific industry or business scenario that the code requirement document is directed to. For example, this domain can be the ERP (Enterprise Resource Planning) domain, the financial domain, etc. The target domain knowledge graph refers to a structured knowledge representation method that describes the code requirement data in the business domain and its internal relationships and associations. It converts code requirement data into a graphical structure, with nodes representing concepts, entities, or topics within the domain, and edges representing relationships between them. In this way, the domain knowledge graph can effectively organize complex and scattered information into meaningful graphs, enabling intelligent data analysis, reasoning, and decision support.
[0036] Optionally, a multi-modal large model is used to convert code requirement data in at least one dimension into code requirement data in a unified dimension to obtain target requirement data. According to the target requirement data and the business domain to which the code requirement document belongs, the target domain knowledge graph of the code requirement document is determined.
[0037] The target requirement data refers to code requirement data in a unified dimension.
[0038] Exemplarily, the code requirement data of different dimensions can be uniformly converted into text dimension; for the data of the flowchart dimension, the nodes and connection relationships in the flowchart can be recognized through an image segmentation algorithm; for the data of the data table dimension, the field definition, business rules and other information can be extracted by using a table structured algorithm; finally, all the converted code requirement data is integrated to obtain target requirement data for generating a knowledge graph; the target requirement data is converted into a standardized data structure containing entities, relationships, rules and logic to obtain the target domain knowledge graph of the code requirement document.
[0039] In S130, the target code generation constraint condition and the target code template are determined from the historical code in the business domain according to the target domain knowledge graph.
[0040] The historical code generation constraint condition refers to some restrictions, rules and requirements set by the business domain in the past period of time in the code generation process in order to ensure the correctness, maintainability and compliance with the expected function of the code; these conditions are usually set according to business requirements, technical constraints, design patterns or coding specifications, and the purpose is to guide the code generation tool or the developer to follow these specific standards when automatically generating or manually writing code, so as to avoid producing code or behavior that does not meet the expectations. The historical code template refers to the reusable code structure or framework accumulated in the past development process; these templates are usually based on specific development patterns, technology stacks or programming languages, and have been verified by practice, which can effectively improve the development efficiency and avoid reinventing the wheel.
[0041] Exemplarily, the mapping relationship between the code generation requirements and the code snippets of the historical projects in the business domain is stored in the vector database; accordingly, the cosine similarity algorithm is used to retrieve the most similar historical cases to the target domain knowledge graph, and the reusable candidate code templates (such as general pagination query templates, exception handling templates) are extracted; the current technology stack is used to adaptively adjust the candidate code templates to obtain the target code template.
[0042] The current technology stack refers to the combination of various technical tools, programming languages, frameworks, libraries and services used for developing, building and maintaining applications in the current business domain.
[0043] In an optional implementation, in the case that the constraint condition corresponding to the target domain knowledge graph does not exist in the historical code generation constraint condition, the corresponding coding standard is retrieved from the industry knowledge base of the business domain according to the target domain knowledge graph, and the coding standard is converted into the target code generation constraint condition.
[0044] S140. Based on the target code generation constraints and target code template, determine the target requirement code according to the target domain knowledge graph and business domain.
[0045] The target requirement code refers to the code that ultimately conforms to the code requirement document.
[0046] Optionally, based on a preset code layering architecture and taking the target code generation constraints as a benchmark, code is generated layer by layer on the target code template according to the target domain knowledge graph to obtain at least one requirement sub-code; wherein the preset code layering architecture includes an entity class layer, a business processing layer, a business logic layer, and a data access layer; the at least one requirement sub-code is integrated according to the target domain knowledge graph to obtain candidate requirement code; and the target requirement code is determined according to the candidate requirement code and the business domain.
[0047] The preset code layering architecture refers to a pre-configured architecture for generating code in layers; this architecture is manually pre-configured based on actual conditions or experience. Requirement sub-code refers to the code segments generated corresponding to each layer in the preset code layering architecture. The entity class layer defines the data model or entity classes, and may include attribute definitions, getter definitions, setter definitions, validation logic, etc. The business processing layer is responsible for receiving and processing client requests, calling the business logic layer for business processing, and returning response results; it may include defining interface paths, request parameters, and response formats, etc. The business logic layer implements business logic, such as order creation and cancellation processes. The data access layer defines database operation methods, encapsulates SQL statements, and is responsible for data persistence and querying. Candidate requirement code refers to the complete code obtained by integrating all the sub-codes.
[0048] Furthermore, based on the candidate requirement code and the business domain, the target requirement code can be determined by adapting and optimizing the candidate requirement code according to the business domain based on the code adaptation model to obtain the usable requirement code. The code adaptation model is obtained by training a code pre-trained language model based on historical code generation data of the business domain. Static code detection tools and unit testing tools are used to verify and fix the usable requirement code to obtain the target requirement code.
[0049] Code adaptation models, in this context, refer to models that automatically adjust and optimize code to adapt to different business domains or environments using machine learning techniques and historical code data. In these models, historical code data is used to train a language model, enabling it to automatically generate adapted code based on business needs and technology stacks. Pre-trained code language models are models based on natural language processing and deep learning, pre-trained on large-scale code datasets to understand and generate program code. Usable requirement code refers to code that, during development, has been adapted and initially optimized to meet specific business requirements. Static code analysis tools are used to analyze code quality and identify potential problems. They do not execute code but analyze source code to discover potential errors, style issues, performance problems, or security vulnerabilities. Unit testing tools are used to verify the smallest units of code; by writing unit tests, the logical correctness of the code can be ensured, and errors can be detected promptly when changes occur.
[0050] It should be noted that code adaptation and optimization may include at least one of technology stack adaptation, performance optimization, and specification adaptation; this application embodiment does not specifically limit this.
[0051] This application embodiment, upon receiving a code requirement document from a client, performs multimodal extraction on the document based on a multimodal large model to obtain code requirement data for at least one candidate dimension. Based on the code requirement data and the business domain to which the code requirement document belongs, a target domain knowledge graph is determined. Using the target domain knowledge graph, target code generation constraints and a target code template are determined from historical code generation constraints and templates within the business domain. Based on the target code generation constraints and template, and according to the target domain knowledge graph and the business domain, the target requirement code is determined. This scheme, by converting multimodal data into a knowledge graph and combining the knowledge graph with the business domain, helps improve the adaptability of automated code generation.
[0052] Example 2
[0053] Figure 2This is a flowchart of a code generation method for multimodal requirements according to Embodiment 2 of this application. Based on the technical solutions of the above embodiments, this embodiment refines "determining the target domain knowledge graph of the code requirement document based on the code requirement data and the business domain to which the code requirement document belongs" into "extracting key features from the code requirement data based on the business domain to obtain at least two key requirement features; performing business correlation analysis on the key requirement features based on the business domain to obtain the business correlation relationships of each key requirement feature; and determining the target domain knowledge graph of the code requirement document based on the business domain, key requirement features, and business correlation relationships." It should be noted that for parts not detailed in this embodiment, please refer to the relevant descriptions in other embodiments. Figure 2 As shown, the method includes:
[0054] S210. Upon receiving the code requirement document sent by the client, perform multimodal extraction on the code requirement document based on the multimodal large model to obtain code requirement data for at least one candidate dimension.
[0055] S220. Based on the business domain to which the code requirement document belongs, extract key features from the code requirement data to obtain at least two key requirement features of the code requirement data.
[0056] Among them, key requirement features refer to the relevant data features of core business objects in the business domain covered in the code requirement data; such as suppliers, purchase orders, and inventory batches in the ERP field; and credit applications and transaction account numbers in the financial field.
[0057] It should be noted that each key requirement feature includes a unique identifier (such as the order number of a purchase order in the ERP field, or the customer identification in the financial field) and business attributes (such as the amount and delivery date of a purchase order, or the credit limit and repayment period of a credit application).
[0058] S230. Based on the business domain, conduct business correlation analysis on key requirement features to obtain the business correlation relationships of each key requirement feature.
[0059] Among them, business relationships refer to the business connections between key demand characteristics in the business domain; such as the relationships of "purchase order - related - supplier" and "inbound order - reference - purchase order" in the ERP domain; and the causal relationships of "customer - submission - credit application" and "risk control model - assessment - credit application" in the financial domain.
[0060] S240. Based on the business domain, key requirement characteristics, and business relationships, determine the target domain knowledge graph for the code requirements document.
[0061] Optionally, based on the candidate business processes of the business domain, key requirement features and business relationships are linked together to obtain a visual flowchart of the code requirement document; based on the preset four-tuple structure, the visual flowchart is merged with the business logic constraints of the business domain to obtain a candidate domain knowledge graph of the code requirement document; based on the candidate domain knowledge graph, the target domain knowledge graph of the code requirement document is determined.
[0062] Candidate business processes refer to the relevant processes executed by various businesses within a business domain, such as the procurement process in the ERP domain and the credit approval process in the financial domain. Visual flowcharts are tools that graphically represent workflows, processes, systems, or steps. Through visual elements such as icons, arrows, and connecting lines, flowcharts show the flow, sequence, and interrelationships of things or activities, making complex processes or data intuitive and easy to understand. For example, the procurement process in the ERP domain can be represented as "requirement submission → procurement approval → order creation → supplier delivery → warehousing and acceptance → invoice settlement"; similarly, the credit approval process in the financial domain can be represented as "customer application → document verification → credit inquiry → risk control approval → credit limit disbursement". Pre-configured four-tuple structures refer to pre-configured sequential structures composed of entities, relationships, rules, and attributes. Business logic constraints refer to the constraints on related businesses within a business domain; for example, the three-document matching rule in the ERP domain: the purchase order, warehousing document, and invoice amounts must be consistent. Candidate domain knowledge graphs refer to knowledge graphs that have been fully transformed from code requirement data but have not yet been validated.
[0063] In simple terms, taking e-commerce order demand as an example, the system automatically identifies the "order" entity, extracts attributes such as "order status" and "payment amount", establishes relationships such as "order-association-user" and "order-included-product", and transforms them into structured rules such as "automatically cancel the order when the order status is pending payment and more than 24 hours have passed". Finally, the entities, attributes, relationships and rules are integrated to obtain a domain knowledge graph with a four-tuple structure.
[0064] Furthermore, based on the candidate domain knowledge graph, the target domain knowledge graph of the code requirements document can be determined by performing language ambiguity verification on the candidate domain knowledge graph based on the requirement ambiguity identification model, and obtaining the language ambiguity verification result; wherein, the requirement ambiguity identification model is obtained by training a natural language processing model based on historical code generation data of the business domain; if there are no anomalies in the language ambiguity verification result, the candidate domain knowledge graph is determined as the target domain knowledge graph of the code requirements document.
[0065] The requirement ambiguity identification model is a natural language processing model used to detect and resolve ambiguities or vague expressions that may arise during the requirements analysis phase. Its main goal is to help development teams identify unclear or ambiguous language in requirements documents to ensure the clarity, accuracy, and feasibility of the requirements. A natural language processing model is an artificial intelligence model used to understand, analyze, and generate natural language. The language ambiguity verification result is used to characterize the presence of ambiguous expressions in the candidate domain knowledge graph. Anomalies refer to situations where requirements contain ambiguous expressions, such as vague requirements like rapid response or high-concurrency support.
[0066] Furthermore, if there are any anomalies in the language ambiguity check results, then based on the language ambiguity check results, ambiguity correction suggestions are determined and fed back to the developers through the human-computer interaction interface.
[0067] Among them, the ambiguity correction suggestion refers to the suggestion on how to correct the ambiguous expression in the requirement, such as suggesting that "fast response" be clarified as "interface response time less than or equal to 100 milliseconds".
[0068] For example, the requirement ambiguity identification model automatically detects ambiguous statements in the candidate domain knowledge graph; if ambiguous statements exist, ambiguity correction suggestions are generated and fed back to the developers; if no ambiguous statements exist, it indicates that the candidate domain knowledge graph is fine and it is determined as the target domain knowledge graph that can be directly used for code generation.
[0069] S250. Based on the target domain knowledge graph, determine the target code generation constraints and target code template from the historical code generation constraints and historical code templates in the business domain.
[0070] S260. Based on the target code generation constraints and target code template, determine the target requirement code according to the target domain knowledge graph and business domain.
[0071] This application embodiment, upon receiving a code requirement document sent by a client, performs multimodal extraction on the document based on a multimodal large model to obtain code requirement data for at least one candidate dimension. Based on the business domain to which the code requirement document belongs, it extracts key features from the code requirement data to obtain at least two key requirement features. Based on the business domain, it performs business correlation analysis on the key requirement features to obtain the business relationships between each key requirement feature. Based on the business domain, key requirement features, and business relationships, it determines the target domain knowledge graph of the code requirement document. Based on the target domain knowledge graph, it determines the target code generation constraints and target code template from historical code generation constraints and templates within the business domain. Based on the target code generation constraints and target code template, and according to the target domain knowledge graph and the business domain, it determines the target requirement code. This scheme, by converting multimodal data into a knowledge graph and combining the knowledge graph with the business domain, helps improve the adaptability of automated code generation.
[0072] Example 3
[0073] Figure 3 This is a schematic diagram of a code generation device for multimodal requirements according to Embodiment 3 of this application. It is applicable to situations involving multimodal requirements analysis and automated code conversion of code requirements documents. This multimodal requirements code generation device can be implemented in hardware and / or software and can be configured in a computer device, such as a server. Figure 3 As shown, the device includes:
[0074] The data extraction module 310 is used to perform multimodal extraction on the code requirement document sent by the client based on a multimodal large model when the document is received, to obtain code requirement data of at least one candidate dimension; wherein, the candidate dimension includes text, flowchart and data table;
[0075] The knowledge graph determination module 320 is used to determine the target domain knowledge graph of the code requirement document based on the code requirement data and the business domain to which the code requirement document belongs;
[0076] The data filtering module 330 is used to determine the target code generation constraints and target code templates from the historical code generation constraints and historical code templates in the business domain based on the target domain knowledge graph.
[0077] The code generation module 340 is used to generate target code based on the target code constraints and target code template, and to determine the target requirement code according to the target domain knowledge graph and business domain.
[0078] This application embodiment, upon receiving a code requirement document from a client, performs multimodal extraction on the document based on a multimodal large model to obtain code requirement data for at least one candidate dimension. Based on the code requirement data and the business domain to which the code requirement document belongs, a target domain knowledge graph is determined. Using the target domain knowledge graph, target code generation constraints and a target code template are determined from historical code generation constraints and templates within the business domain. Based on the target code generation constraints and template, and according to the target domain knowledge graph and the business domain, the target requirement code is determined. This scheme, by converting multimodal data into a knowledge graph and combining the knowledge graph with the business domain, helps improve the adaptability of automated code generation.
[0079] Optionally, the spectrum determination module 320 includes:
[0080] The feature extraction unit is used to extract key features from the code requirement data based on the business domain to which the code requirement document belongs, and to obtain at least two key requirement features from the code requirement data.
[0081] The correlation analysis unit is used to perform business correlation analysis on key requirement features based on the business domain, and to obtain the business correlation relationships of each key requirement feature;
[0082] The knowledge graph generation unit is used to determine the target domain knowledge graph of the code requirement document based on the business domain, key requirement characteristics, and business relationships.
[0083] Optionally, the map generation unit includes:
[0084] The flowchart defines sub-units and is used to connect key requirement features and business relationships based on candidate business processes in the business domain to obtain a visual flowchart of the code requirement document.
[0085] The first knowledge graph generation subunit is used to merge the visual flowchart with the business logic constraints of the business domain based on the preset four-tuple structure to obtain the candidate domain knowledge graph of the code requirement document; wherein, the preset four-tuple structure is composed of entities, relations, rules and attributes;
[0086] The second knowledge graph generation subunit is used to determine the target domain knowledge graph of the code requirements document based on the candidate domain knowledge graphs.
[0087] Optionally, the second map generation subunit is specifically used for:
[0088] Based on the demand ambiguity identification model, language ambiguity verification is performed on the candidate domain knowledge graph to obtain the language ambiguity verification results; the demand ambiguity identification model is obtained by training a natural language processing model based on historical code generation data of the business domain.
[0089] If no anomalies are found in the language ambiguity check results, the candidate domain knowledge graph will be determined as the target domain knowledge graph for the code requirements document.
[0090] Optionally, the code generation module 340 includes:
[0091] The code layering generation unit is used to generate code layer by layer on the target code template based on a preset code layering architecture, with the target code generation constraints as the benchmark, and according to the target domain knowledge graph, to obtain at least one requirement sub-code; wherein the preset code layering architecture includes an entity class layer, a business processing layer, a business logic layer, and a data access layer.
[0092] The code integration unit is used to integrate at least one requirement sub-code based on the target domain knowledge graph to obtain candidate requirement codes;
[0093] The code determination unit is used to determine the target requirement code based on the candidate requirement codes and the business domain.
[0094] Optional, code-defined unit, specifically used for:
[0095] Based on the code adaptation model, candidate requirement codes are adapted and optimized according to the business domain to obtain usable requirement codes; the code adaptation model is obtained by training a code pre-trained language model based on historical code generation data of the business domain.
[0096] Static code analysis tools and unit testing tools are used to verify and fix the available requirement code to obtain the target requirement code.
[0097] The multimodal requirement code generation apparatus provided in this application embodiment can execute the multimodal requirement code generation method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing the code generation method for each multimodal requirement.
[0098] According to embodiments of this application, this application also provides an electronic device, a readable storage medium, and a computer program product.
[0099] Example 4
[0100] Figure 4This is a schematic diagram of the structure of an electronic device 410 implementing the code generation method for multimodal requirements of embodiments of this application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the application described and / or claimed herein.
[0101] like Figure 4 As shown, the electronic device 410 includes at least one processor 411 and a memory, such as a read-only memory (ROM) 412 or a random access memory (RAM) 413, communicatively connected to the at least one processor 411. The memory stores computer programs executable by the at least one processor. The processor 411 can perform various appropriate actions and processes based on the computer program stored in the ROM 412 or loaded from storage unit 418 into the RAM 413. The RAM 413 may also store various programs and data required for the operation of the electronic device 410. The processor 411, ROM 412, and RAM 413 are interconnected via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.
[0102] Multiple components in electronic device 410 are connected to I / O interface 415, including: input unit 416, such as keyboard, mouse, etc.; output unit 417, such as various types of displays, speakers, etc.; storage unit 418, such as disk, optical disk, etc.; and communication unit 419, such as network card, modem, wireless transceiver, etc. Communication unit 419 allows electronic device 410 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0103] Processor 411 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 411 performs the various methods and processes described above, such as code generation methods for multimodal requirements.
[0104] In some embodiments, the code generation method for multimodal requirements may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 418. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 410 via ROM 412 and / or communication unit 419. When the computer program is loaded into RAM 413 and executed by processor 411, one or more steps of the code generation method for multimodal requirements described above may be performed. Alternatively, in other embodiments, processor 411 may be configured as the code generation method for multimodal requirements by any other suitable means (e.g., by means of firmware).
[0105] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0106] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to the processor of a general-purpose computer, a special-purpose computer, or other code generation device with programmable multimodal requirements, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0107] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0108] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0109] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0110] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0111] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.
[0112] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for code generation of multi-modal requirements, characterized in that, Comprise: When receiving a code requirement document sent by a client, based on a multi-modal large model, multi-modal extraction is performed on the code requirement document to obtain code requirement data of at least one candidate dimension; wherein the candidate dimension includes text, flowchart and data table; According to the code requirement data and the business field to which the code requirement document belongs, a target field knowledge graph of the code requirement document is determined; According to the target field knowledge graph, a target code generation constraint condition and a target code template are determined from the historical code in the business field; Based on the target code generation constraint condition and the target code template, the target requirement code is determined according to the target field knowledge graph and the business field.
2. The method of claim 1, wherein, According to the code requirement data and the business field to which the code requirement document belongs, a target field knowledge graph of the code requirement document is determined, comprising: According to the business field to which the code requirement document belongs, key feature extraction is performed on the code requirement data to obtain at least two key requirement features of the code requirement data; According to the business field, business correlation analysis is performed on the key requirement features to obtain the business correlation relationship of each key requirement feature; According to the business field, the key requirement features and the business correlation relationship, the target field knowledge graph of the code requirement document is determined.
3. The method of claim 2, wherein, According to the business field, the key requirement features and the business correlation relationship, the target field knowledge graph of the code requirement document is determined, comprising: According to the candidate business process of the business field, the key requirement features and the business correlation relationship are concatenated to obtain a visual flowchart of the code requirement document; Based on a preset four-tuple structure, the visual flowchart and the business logic constraint of the business field are merged to obtain a candidate field knowledge graph of the code requirement document; wherein the preset four-tuple structure is composed of entities, relationships, rules and attributes; According to the candidate field knowledge graph, the target field knowledge graph of the code requirement document is determined.
4. The method of claim 3, wherein, According to the candidate field knowledge graph, the target field knowledge graph of the code requirement document is determined, comprising: Based on a requirement ambiguity recognition model, language ambiguity checking is performed on the candidate field knowledge graph to obtain a language ambiguity checking result; wherein the requirement ambiguity recognition model is obtained by training a natural language processing model according to historical code generation data of the business field; If the language ambiguity checking result does not have an abnormal situation, the candidate field knowledge graph is determined as the target field knowledge graph of the code requirement document.
5. The method of claim 1, wherein, Based on the target code generation constraint condition and the target code template, the target requirement code is determined according to the target field knowledge graph and the business field, comprising: The target code is generated based on a preset code hierarchical architecture, and a constraint condition is generated based on the target code. According to the target domain knowledge graph, code is generated on the target code template layer by layer to obtain at least one requirement sub-code; wherein the preset code hierarchical architecture includes an entity class layer, a business processing layer, a business logic layer and a data access layer; According to the target domain knowledge graph, the at least one requirement sub-code is integrated to obtain a candidate requirement code; According to the candidate requirement code and the business domain, a target requirement code is determined.
6. The method of claim 5, wherein, According to the candidate requirement code and the business domain, a target requirement code is determined. Based on the code adaptation model, the candidate requirement code is adapted and optimized according to the business domain to obtain a usable requirement code; wherein the code adaptation model is obtained by training a code pre-training language model according to historical code generation data of the business domain; A static code detection tool and a unit test tool are used to verify and repair the usable requirement code to obtain a target requirement code.
7. A multi-modal demand code generation apparatus, characterized by, It includes: A data extraction module is used to extract at least one candidate dimension code requirement data from a code requirement document sent by a client based on a multi-modal large model; wherein the candidate dimension includes text, flowchart and data table; A graph determination module is used to determine the target domain knowledge graph of the code requirement document according to the code requirement data and the business domain to which the code requirement document belongs; A data filtering module is used to determine the target code generation constraint condition and the target code template from the historical code generation constraint condition and the historical code template in the business domain according to the target domain knowledge graph; A code generation module is used to determine a target requirement code based on the target code generation constraint condition and the target code template according to the target domain knowledge graph and the business domain.
8. An electronic device, comprising: It includes: One or more processors; Memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the multi-modal requirement code generation method of any one of claims 1-6.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the multi-modal requirement code generation method of any one of claims 1-6.
10. A computer program product comprising a computer program which, when executed by a processor, implements the multi-modal requirement code generation method according to any one of claims 1-6.