Form code generation method and device, equipment, storage medium and program product

By combining a code generation model with a code knowledge base for semantic matching, target form code is generated, solving the problem of insufficient accuracy in dynamic form code generation. This achieves accurate identification of multi-level linkage logic and code consistency, improving the reliability and maintainability of code generation.

CN121092148APending Publication Date: 2025-12-09BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511232622.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2025-12-09

AI Technical Summary

Technical Problem

Existing technologies struggle to address issues such as insufficient accuracy in dynamic form code generation, difficulty in understanding multi-level linkage logic, poor code consistency and maintainability, lack of structured semantic retrieval capabilities, and inability to effectively reuse historical code resources in complex business logic-driven code generation scenarios.

Method used

By combining a code generation model with a code knowledge base, semantic matching of form generation description information is performed. During the target matching code generation process, semantic matching is performed in conjunction with the target matching code generation description information to generate the target form code.

Benefits of technology

It improves the accuracy of the code generation model in semantic understanding of form generation description information, realizes accurate identification of multi-level linkage logic, improves the accuracy and reliability of form code generation, supports the reuse of form code in the code knowledge base, and enhances the maintainability and consistency of code generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121092148A_ABST
    Figure CN121092148A_ABST
Patent Text Reader

Abstract

The invention discloses a form code generation method and device, equipment, a storage medium and a program product, and relates to the technical field of large language models.The method comprises the steps that form generation description information in a target field and a code knowledge base corresponding to the target field are obtained, and the code knowledge base comprises multiple form codes, each form code corresponds to code description information; performing semantic matching on the form generation description information and the code description information based on a code generation model, and determining a target matching code corresponding to the form generation description information; and guiding a code generation process of a code generation model based on the target matching code and the form generation description information to obtain a target form code corresponding to the form generation description information. According to the method and the device, the target matching code is used for supplementing the necessary context prompt of the code generation model, so that the generation accuracy and reliability of the form code are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of large language model, in particular to a form code generation method and device, equipment, storage medium and program product. BACKGROUND

[0002] With the rapid development of large language model (LLM) technology, automatic code generation based on natural language has attracted more and more attention. This kind of technology mainly realizes the understanding of the developer's intention and the automatic output of the corresponding code through the training of large-scale code corpus, so as to improve the code writing efficiency and the development iteration speed. However, the current automatic code output is mainly for page construction of static structure or general function encapsulation, and there are limitations in the semantic understanding of multi-level linkage logic, which affects the accuracy of dynamic form code generation of multi-level linkage. SUMMARY

[0003] Therefore, the present disclosure provides a form code generation method, device, equipment, storage medium and program product to solve the problem of difficult accurate generation of dynamic form code.

[0004] In a first aspect, the present disclosure provides a form code generation method, comprising: obtaining form generation description information under a target field and a code knowledge base corresponding to the target field, the code knowledge base comprising a plurality of form codes, each form code corresponding to code description information; performing semantic matching on the form generation description information and the code description information based on a code generation model, to determine a target matching code corresponding to the form generation description information; and guiding the code generation process of the code generation model based on the target matching code and the form generation description information, to obtain a target form code corresponding to the form generation description information.

[0005] In a second aspect, the present disclosure provides a form code generation device, comprising: an obtaining module configured to obtain form generation description information under a target field and a code knowledge base corresponding to the target field, the code knowledge base comprising a plurality of form codes, each form code corresponding to code description information; a semantic matching module configured to perform semantic matching on the form generation description information and the code description information based on a code generation model, to determine a target matching code corresponding to the form generation description information; and a code generation module configured to guide the code generation process of the code generation model based on the target matching code and the form generation description information, to obtain a target form code corresponding to the form generation description information.

[0006] In a third aspect, the present disclosure provides an electronic device, comprising a memory and a processor, which are communicatively connected with each other, and the memory stores computer instructions, and the processor executes the computer instructions to perform the form code generation method of the first aspect or any of the corresponding embodiments thereof.

[0007] In a fourth aspect, the present disclosure provides a computer-readable storage medium, which stores computer instructions for causing a computer to perform the form code generation method of the first aspect or any of the corresponding embodiments thereof.

[0008] In a fifth aspect, the present disclosure provides a computer program product, which comprises computer instructions for causing a computer to perform the form code generation method of the first aspect or any of the corresponding embodiments thereof.

[0009] The form code generation method, device, equipment, storage medium and program product provided by the embodiments of the present disclosure can obtain form generation description information in a target field and a code knowledge base corresponding to the target field, perform semantic matching on the form generation description information and code description information, determine a target matching code matched with the form generation description information, use the target matching code as supplementary information of the form generation description information, and supplement necessary context prompts of the code generation model. Then, under the joint action of the target matching code and the form generation description information, the form code generation process of the code generation model is guided, and the target form code corresponding to the form generation description information is generated. Thus, the accuracy of semantic understanding of the code generation model for the form generation description information is improved, the multi-level linkage logic in the form generation description information can be accurately recognized by the code generation model, and the generation accuracy and reliability of the form code are improved. Meanwhile, when generating the form code in the same target field, the corresponding form code can be queried from the code knowledge base, so that the form code in the code knowledge base is reused, and the existing form code can be quickly positioned and the form code can be enhanced based on the semantic similarity. BRIEF DESCRIPTION OF DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the specific embodiments or related art of the present disclosure, the drawings needed to be used in the specific embodiments or related art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present disclosure, and those skilled in the art can also obtain other drawings without creative labor based on these drawings.

[0011] Figure 1 is a schematic diagram of an application scenario according to an embodiment of the present disclosure;

[0012] Figure 2is a flowchart of a form code generation method according to an embodiment of the present disclosure;

[0013] Figure 3 is a flowchart of another form code generation method according to an embodiment of the present disclosure;

[0014] Figure 4 is a flowchart of a code knowledge base generation method according to an embodiment of the present disclosure;

[0015] Figure 5 is a flowchart of another code knowledge base generation method according to an embodiment of the present disclosure;

[0016] Figure 6 is a generation schematic diagram of an advertisement form code according to an embodiment of the present disclosure;

[0017] Figure 7 is a structural block diagram of a form code generation device according to an embodiment of the present disclosure;

[0018] Figure 8 is a hardware structure schematic diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0019] In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work, fall within the scope of protection of the present disclosure.

[0020] It can be understood that, before using the technical solutions disclosed in the embodiments of the present disclosure, the type, use range, use scenario, etc. of the personal information involved in the present disclosure should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.

[0021] For example, when responding to the active request of the user, prompt information is sent to the user to explicitly prompt the user that the operation requested to be executed will need to obtain and use the personal information of the user. Thus, the user can voluntarily choose whether to provide the personal information to the electronic device, application program, server or storage medium, etc. software or hardware that executes the operation of the technical solutions of the present disclosure according to the prompt information.

[0022] As an optional but non-limiting implementation, in response to receiving the active request of the user, the prompt information can be sent to the user in the form of a pop-up window, and the prompt information can be presented in the form of text in the pop-up window. In addition, the pop-up window can also carry a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.

[0023] It can be understood that the above notification and user authorization process is only illustrative and does not limit the implementation of the present disclosure, and other methods that meet the relevant laws and regulations can also be applied to the implementation of the present disclosure.

[0024] It can be understood that the data involved in the technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of the relevant laws and regulations and the relevant provisions.

[0025] In the code generation scenario of artificial intelligence, when the natural language description text of the Internet computing advertising placement creation product function is directly converted and generated into form code, the model context is insufficient in the code generation process, the semantic understanding is not accurate, there are problems such as inaccurate code linkage, dependency relationship, field definition, optional items in the generated code results, poor accuracy and insufficient usability, lack of consistency and maintainability, and inability to accurately recall existing domain code segments for reuse.

[0026] Current code generation technology has been preliminarily applied in front-end page building, interface call encapsulation, test script generation and other subfields. However, in the face of code generation scenarios driven by complex business logic, existing technologies still have significant defects. For example, an advertising placement platform or a business management platform, the system often contains a large number of interlinked form fields, there are multi-level triggering and dependency relationships between different fields, for example, the change of the options of a field will dynamically affect the display, validation rules or data source of the lower level fields. The linkage logic of such forms is not only complex, but also strongly dependent on domain knowledge and business conventions. However, existing code generation schemes mainly face static structure page construction or general function encapsulation, and still have the following deficiencies for high-coupling, multi-level linkage dynamic form generation scenarios:

[0027] (1) Semantic understanding limitation: the model is difficult to accurately identify the semantic dependency and linkage logic between fields, especially when more than three levels of field cascading are involved, often resulting in logic omission or incorrect linkage.

[0028] (2) Insufficient rule expression capability: current generation methods mostly use natural language or code snippets as input, lack of structured rule expression and explicit modeling means, and it is difficult to accurately express the association logic between business fields.

[0029] (3) Code consistency and maintainability are poor: the model generation result is greatly affected by context changes, which easily leads to inconsistent naming styles, repeated logic, and increased subsequent manual maintenance costs.

[0030] (4) Lack of structured semantic retrieval capability: existing code generation tools cannot effectively reuse historical code resources, and it is difficult to achieve fast positioning and enhanced generation of existing code snippets based on structural semantic similarity.

[0031] Based on this, the technical scheme of the present disclosure references a code knowledge base as the code knowledge base, combines the semantic similarity between the form generation description information and the code description information, recalls the target matching code from the code knowledge base as additional supplementary information for code generation, and plays an additional prompting and guiding role for the code generation model to generate the target advertising form code. Thus, the accuracy of the code generation model for semantic understanding of the form generation description information is improved, which is conducive to the code generation model accurately identifying the multi-level linkage logic in the form generation description information and improving the generation accuracy and reliability of the form code. At the same time, the same target field can query the corresponding form code from the code knowledge base when generating the form code, thereby realizing the reuse of the form code in the code knowledge base and facilitating the fast positioning and enhanced generation of the existing form code based on semantic similarity.

[0032] As an optional application scenario of the embodiments of the present disclosure, as shown in Figure 1 The application scenario includes a code knowledge base 101, a code generation model 102, and an electronic device 103. The code generation model 102 is deployed in the electronic device 103, and the code knowledge base 101 is in communication connection with the code generation model 102, serving as a knowledge base for code generation and providing additional guidance for the code generation process.

[0033] The code generation model 102 is trained based on model training data 104, which can be a large language model, and is used to receive the form generation description information input by the developer through the interactive interface of the electronic device 103, and then recall the corresponding target matching code from the code knowledge base according to the form generation description information. Under the joint guidance of the form generation description information and the target matching code, the code generation model 102 can generate the target form code matching the form generation description information.

[0034] According to the embodiments of the present disclosure, a form code generation method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a group of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from here.

[0035] In the embodiment, a form code generation method is provided, which can be used in the electronic device as described above, such as a computer, a server, etc. Figure 2 The flowchart of the form code generation method according to the embodiment of the present disclosure is shown in FIG. 2, which includes the following steps: Figure 2

[0036] In step S201, form generation description information under a target field and a code knowledge base corresponding to the target field are obtained, wherein the code knowledge base includes a plurality of form codes, and each form code corresponds to code description information.

[0037] The target field is a selected business field for which form code generation is to be performed, such as an advertising field, a medical field, etc.; the form generation description information is a description for a form to be generated, which is edited by a developer according to business requirements, for example, "in the case of a change in form field A, the display of form field B"; the code knowledge base is a pre-generated knowledge base containing code knowledge of the target field, and the code knowledge base includes a plurality of form codes, and each form code has corresponding semantic tagging information, which is code description information, and the function that can be implemented by the form code is represented by the code description information.

[0038] Specifically, a code generation model is deployed in the electronic device, and the code generation model provides an interactive page including a field selection control, a code generation page, and a description information editing page. When form code generation is needed for a form under a target field, a developer can select the target field (such as advertising) required by the current business through the field selection control, and input the corresponding form description information in the description information editing page to represent the business requirements through the form description information. Correspondingly, the code generation tool obtains the form generation description information under the target field input by the developer, and links the corresponding code knowledge base in combination with the target field selected by the developer.

[0039] In step S202, the code generation model is used to perform semantic matching between the form generation description information and the code description information, to determine the target matching code corresponding to the form generation description information.

[0040] The code generation model is used to understand the developer's intention and automatically generate corresponding code. The code generation model can be trained based on a large language model (LLM) model architecture, or can be trained based on a machine learning model architecture. The model architecture of the code generation model is not limited here, as long as it can realize the understanding of the developer's intention and the automatic generation of code.

[0041] ​The form generation description information edited by the developer in the target field is input into the code generation model, the form generation description information is semantically matched with the code description information through the code generation model, the code description information matched with the semantic similarity of the form generation description information is determined, and the form code corresponding to the semantically matched code description information is determined as the target matching code.

[0042] It should be noted that the target matching code can be modified or updated here to make the target matching code more matched with the form generation description information, and to improve the subsequent form code generation accuracy.

[0043] In step S203, the code generation process of the code generation model is guided based on the target matching code and the form generation description information, and the target form code corresponding to the form generation description information is obtained.

[0044] In the process of generating the target form code by using the code generation model, the form generation description information is used as the main prompt information of the code generation process, the target matching code is introduced as the context prompt of the code generation process, that is, the target matching code is used as the additional prompt information of the code generation model. The main code generation process of the code generation model is guided by using the form generation description information, and the target matching code is introduced to play an additional prompting and guiding role on the code generation model, so as to generate the target form code matched with the form generation description information.

[0045] The form code generation method provided in the embodiment can improve the accuracy of the semantic understanding of the code generation model for the form generation description information, and is beneficial to the accurate identification of the multi-level linkage logic in the form generation description information by the code generation model, thereby improving the generation accuracy and reliability of the form code. At the same time, the same target field can query the corresponding form code from the code knowledge base when generating the form code, thereby realizing the reuse of the form code in the code knowledge base, and facilitating the rapid positioning and enhanced generation of the existing form code based on the semantic similarity.

[0046] In the embodiment, a form code generation method is provided, which can be used in the above-mentioned electronic devices such as computers, servers, etc. Figure 3is a flowchart of a form code generation method according to an embodiment of the present disclosure, as shown in Figure 3 The flowchart includes the following steps:

[0047] In step S301, form generation description information in a target field and a code knowledge base corresponding to the target field are obtained, the code knowledge base including a plurality of form codes, each form code corresponding to code description information. For details, please refer to the related description of the corresponding step of the above-mentioned embodiment, which will not be repeated here.

[0048] In step S302, the code generation model is used to perform semantic matching on the form generation description information and the code description information to determine a target matching code corresponding to the form generation description information.

[0049] Specifically, step S302 includes:

[0050] In step S3021, the code generation model is used to parse the form generation description information according to a preset association dimension to obtain association description information of the form generation description information in each association dimension.

[0051] The preset association dimension refers to a dimension set for form logic linkage. Specifically, the preset association dimension can include dependency relationship, linkage relationship, form field definition, and field selectable value, etc.

[0052] After the form generation description information is input into the code generation model, the intention understanding capability of the code generation model is used to split the form generation description information according to the preset association dimension, such as dependency relationship, linkage relationship, form field definition, and field selectable value, to obtain association description information corresponding to each association dimension.

[0053] In one specific example, if the form generation description information is "the first three forms are selected under the XX option, and the fourth form shows what option", the code generation model can determine the dependency relationship as follows: the fourth form depends on the first three forms, and the option shown by the fourth form depends on the first three forms; the linkage relationship is that the option of the first three forms changes and the option shown by the fourth form changes; the form field definition is the field title of all forms; and the field selectable value is the XX option and the display option corresponding to the XX option.

[0054] In step S3022, the code knowledge base in each association dimension is obtained.

[0055] The association code library is a code library composed of at least one form code corresponding to each association dimension. Specifically, all form codes under the target field are included in the code knowledge base. Based on each association dimension, the plurality of form codes in the code knowledge base are classified by code implementation to obtain one or more form codes matched with each association dimension. The one or more form codes matched with the association dimension are determined as the association code library corresponding to the association dimension.

[0056] In a specific example, if the code knowledge base includes code1, code2, code3, code4, code5, code6, code7 and a plurality of form codes, through code implementation classification, it can be determined that the form code representing the dependency relationship is code1 and code3, the form code representing the linkage relationship is code2 and code5, the form code representing the form field definition is code7, and the form code representing the field optional value is code4 and code6. Then, code1 and code3 constitute the association code library under the dependency relationship dimension, code2 and code5 constitute the association code library under the linkage relationship dimension, code7 constitutes the association code library under the form field definition dimension, and code4 and code6 constitute the association code library under the field optional value dimension.

[0057] In step S3023, the association description information is semantically matched with the code description information of each form code in the association code library to obtain the target matching code corresponding to each association description information.

[0058] For any one association dimension, the association description information corresponding to the association dimension is semantically matched with the code description information of each form code in the association code library corresponding to the association dimension. The code description information matched with the association description information is determined from the semantic similarity. Combined with the corresponding relationship between the code description information and the form code, the target matching code matched with the association description information is determined.

[0059] Specifically, when performing semantic matching, the text vector corresponding to the association description information and the text vector corresponding to the code description information are used to calculate the vector distance, and the semantic similarity between the association description information and the code description information is represented by the text vector distance. The smaller the text vector distance, the greater the semantic similarity, and the more matched the association description information and the code description information.

[0060] In some optional embodiments, the above step S3023 includes:

[0061] In step a1, the association description information is semantically matched with the code description information of each form code to determine the semantic matching degree of the association description information and each form code.

[0062] Step a2, determining the candidate code corresponding to the associated description information from each form code based on the ranking result of the semantic matching degree.

[0063] Step a3, combining the candidate codes corresponding to each associated dimension to obtain the target candidate code and the target candidate description information corresponding to the target candidate code.

[0064] Step a4, if the form generation description information and the target candidate description information satisfy the semantic matching condition, determining the target candidate code as the target matching code.

[0065] The semantic matching degree represents the semantic similarity between the associated description information and the code description information of the form code. Specifically, for any one associated description information, the associated dimension in which it is located and the code description information corresponding to each form code in the associated dimension can be determined. Then, the text vector of the associated description information and the text vector of each code description information in the associated dimension are calculated to obtain the semantic similarity between the associated description information and each code description information in the associated dimension, and the semantic similarity is used as the semantic matching degree between the associated description information and the form code.

[0066] In each associated dimension, the semantic matching degrees corresponding to the associated description information are sorted, and the form code with the highest semantic matching degree is determined as the candidate code from the associated code library in the associated dimension where the associated description information is located.

[0067] The candidate codes determined in each associated dimension are assembled according to the code implementation logic to obtain the target candidate code, and the code description information corresponding to each candidate code is assembled to obtain the target candidate description information corresponding to the target candidate code.

[0068] Since the target candidate description information is assembled from each code description information, the overall semantics of the target candidate description information and the form generation description information may not match, and then the target candidate code does not match the form code generation. In order to ensure the accuracy of subsequent form code generation, the text vector of the target candidate description information and the overall text vector of the form generation description information are calculated to determine the semantic matching degree between the target candidate description information and the form generation description information.

[0069] The semantic matching condition is used to represent that the semantic similarity between the target candidate description information and the form generation description information exceeds the semantic similarity threshold, and the semantic similarity threshold is a pre-set minimum semantic similarity for representing semantic consistency, such as 90%, 95%, 98%, etc.

[0070] If the semantic matching degree between the target candidate description information and the form generation description information meets the semantic matching condition, it indicates that the intention represented by the target candidate description information is consistent with the intention represented by the form generation description information, and at this time, the target candidate code can be determined as the target matching code to supplement the code generation context of the code generation model with the target matching code, thereby ensuring the code generation accuracy of the code generation model. Figure 1

[0071] In the above embodiments, the most matched candidate code is recalled from the associated code library corresponding to each associated dimension through the semantic matching degree, and then the candidate codes under each associated dimension are assembled to generate the target candidate code. In combination with the semantic similarity between the target candidate description information corresponding to the target candidate code and the form generation description information, the target matching code is determined to optimize the code generation process of the code generation model with the target matching code, improve the semantic understanding ability of the code generation model for the form generation description information, and avoid logical omission or error linkage in the code generation process.

[0072] In some optional embodiments, the step S3023 further includes: if the form generation description information and the target candidate description information do not meet the semantic matching condition, the target matching code is filtered from the associated code library under each associated dimension based on the form generation description information and the sorting result of the semantic matching degree.

[0073] If the semantic matching degree between the target candidate description information and the form generation description information does not meet the semantic matching condition, it indicates that the intention represented by the target candidate description information is inconsistent with the intention represented by the form generation description information, and at this time, the candidate code can be re-screened in combination with the sorting result of the semantic matching degree, and the candidate code obtained through the re-screening is assembled to update the target candidate code and the target candidate description information corresponding to the target candidate code. If the form generation description information and the updated target candidate description information meet the semantic matching condition, the updated target candidate code is determined as the target matching code.

[0074] Through the re-screening, the target matching code most similar to the form generation description information is filtered, thereby improving the retrieval accuracy of the target matching code.

[0075] It should be noted that if the form generation description information and the updated target candidate description information do not meet the semantic matching condition, the screening is performed again until the target matching code meeting the form generation description information is filtered.

[0076] In step S303, the code generation process of the code generation model is guided based on the target matching code and the form generation description information to obtain the target form code corresponding to the form generation description information. For details, please refer to the related description of the corresponding steps in the above embodiments, which will not be described here. ​

[0077] The form code generation method provided in this embodiment decomposes the form generation description information to obtain the associated description information under various related dimensions. It then combines this associated description information with semantic matching of the code description information to determine the corresponding target matching code. Thus, by parsing the linked logic across multiple related dimensions, the accuracy of target matching code retrieval is ensured. Furthermore, guiding the code generation process of the code generation model with the target matching code helps maintain consistency in code naming style, avoids logical duplication, and ensures the consistency and maintainability of the form code.

[0078] This embodiment provides a method for generating a code knowledge base, which can be used in the code generation process of the above-described code generation model. Figure 4 This is a flowchart of a method for generating a code knowledge base according to an embodiment of this disclosure, such as... Figure 4 As shown, the process includes the following steps:

[0079] Step S401: Obtain multiple form codes associated with the target domain.

[0080] Form code is an atomic code snippet that can achieve a specific function. Different domains have different form creation logics, and correspondingly, the form code required will be the same for the specific needs of the specific domain.

[0081] Specifically, for any target domain, when building a code knowledge base, the corresponding form code can be retrieved from multiple code data sources such as public code repositories, public knowledge bases, open-source code repositories generated based on models, or historically generated form code repositories according to the target domain.

[0082] Step S402: Semantic tagging is performed on the form code to generate code description information corresponding to the form code.

[0083] Semantic tagging is performed on each form code, and the function implemented by the form code is semantically mapped and associated with the code implementation to obtain the function description information of the function implemented by each form code. This function description information is the code description information corresponding to the form code.

[0084] Step S403: Based on the semantic mapping relationship between form codes and code description information, construct a code knowledge base.

[0085] The form code and its corresponding code description information are vectorized to generate code vector data for the form code and text vector data for the code description information. A semantic mapping relationship is established between the code vector data and the text vector data, and the form code under each associated dimension is indexed and candidate primary keys are set, which are then persistently stored in a code knowledge base, which can be a vector database.

[0086] In one specific example, the dependency relationship, linkage relationship, form field definition and field optional value are respectively taken as a separate vector data index, and all associated form code vector data (including code vector data and its corresponding text vector data) are stored under the index, and each form code has a unique candidate primary key under the index.

[0087] The code knowledge base generation method provided by the embodiment constructs a semantic mapping relationship between the form code and the code description information by performing semantic tagging on the form code, generates a corresponding code knowledge base, and stores the form code in a structured manner through the code knowledge base, improves the structured semantic retrieval capability and the rule expression capability in the code generation process, provides recall data basis for enhancing the retrieval and generation process, and accurately expresses the code association logic in the code generation process.

[0088] In some optional embodiments, as shown in Figure 5 The step S401 includes:

[0089] In step S4011, at least one field code associated with the target field is obtained.

[0090] The field code is a code segment capable of implementing a specific function. As described above, different target fields have different functions to be implemented, and thus different field codes are required. Therefore, when constructing the code knowledge base, one or more field codes associated with the target field can be extracted from multiple code data sources according to the target field.

[0091] In step S4012, each field code is atomized and sliced to obtain form codes corresponding to each field code.

[0092] Each field code is atomized and sliced according to the atomic granularity to obtain a plurality of atomic slices corresponding to each field code, and each atomic slice is taken as a form code. Then, a vectorization method or model conversion mode is used to convert each form code into vector data to support semantic similarity matching during retrieval enhancement.

[0093] In one specific example, the domain codes collected under the target domain are classified according to the associated dimensions. For the domain codes of the dependency relationship, each dependency condition is an atomic slice, such as "promotion purpose" == "application promotion", which is an atomic slice of the dependency relationship. For the domain codes of the linkage relationship, the modification of one attribute of one field in each linkage relationship is an atomic slice, such as, when "promotion purpose" == "application promotion", the "maximum conversion" field is not displayed in the bidding strategy, which is an atomic slice of the dependency relationship. For the domain codes of the form field definition, each field is an atomic slice, such as "promotion purpose", "ad type", "delivery mode", and the like. For the domain codes of the field optional value, each optional value of each field is an atomic slice, such as "application promotion" and "lead sales" under "promotion purpose", and "application promotion" under "promotion purpose" is one of the atomic slices. Then, each atomic slice under each associated dimension is taken as the form code under each associated dimension.

[0094] The code knowledge base generation method provided by the embodiment can support semantic similarity matching in enhanced retrieval by atomizing and slicing each domain code to obtain form codes corresponding to the domain codes, thereby improving the enhanced retrieval capability.

[0095] In some optional embodiments, as shown in Figure 5 The step S402 includes the following steps.

[0096] In step S4021, the associated dimensions corresponding to the form codes are obtained.

[0097] As described above, each form code has a corresponding associated dimension, such as a dependency relationship, a linkage relationship, a form field definition, and a field optional item. Since different associated dimensions have corresponding tagging strategies, when performing semantic tagging on any form code, the code implementation of the form code needs to be parsed to determine the associated dimension to which the form code belongs.

[0098] In step S4022, the form code is semantically tagged based on the tagging strategy corresponding to the associated dimension, and code description information corresponding to the form code is generated.

[0099] The tagging strategy is used to determine the natural language tagging content corresponding to the associated dimension. Specifically, different associated dimensions have corresponding tagging strategies, each form code is traversed in turn to determine the associated dimension to which the form code belongs, and the semantic tagging of the form code is determined according to the tagging strategy corresponding to the associated dimension to obtain the semantic tagging content generated based on the natural language, which is the code description information.

[0100] Taking an advertisement as a specific example, then the form code for the dependency relationship can be tagged with natural language in combination with the advertisement semantics, for example, the form code with the dependency relationship is:

[0101] “GLOBAL_VAR?.advertiser?.first_industry_id===

[0102] AdvertiserFirstIndustryIdEnum.Communication”, which can correspond to the semantic tag “the purpose of promotion is application promotion”;

[0103] The form code for the linkage relationship can be tagged with natural language in combination with the influence relationship between the multiple forms of the advertisement creation, for example, the form code is “api.setData(videoListValue.value, result)”, which can correspond to the semantic tag “influence the value attribute of the advertisement material list field”;

[0104] The form code for the form field definition can be tagged with natural language in combination with the advertisement field semantics, for example, the form code is “ <browradio / > ”, which can correspond to the semantic tag “advertisement budget field”;

[0105] The form code for the field optional value can be tagged with natural language in combination with the semantics of the optional value under the advertisement field, for example, the form code is “landingTypeOptions.STANDARD”, which can correspond to the semantic tag “application promotion optional item under the purpose of promotion”.

[0106] The method for generating the code knowledge base provided in this embodiment tags the form code with semantics in combination with the tagging strategy corresponding to the associated dimension, so that the corresponding code description information of the form code is generated, and the generation accuracy of the code description information is improved.

[0107] In some optional implementations, the above method further includes:

[0108] Step b1, in response to a semantic tagging instruction for the form code, generating a tagged field corresponding to the form code.

[0109] Step b2, generating code description information corresponding to the form code in the tagged field.

[0110] The semantic labeling instruction is an instruction triggered by a labeling model or a developer for form code; each form code corresponds to a labeling field, and the value of the labeling field is the code description information. Specifically, any form code can respond to the semantic labeling instruction to generate a corresponding labeling field in JSON, that is, the form code in the code field (i.e., the code field) corresponds to the labeling content (i.e., the code description information) of the form code in the labeling field (such as the "_label_" field) in JSON.

[0111] The code knowledge base generation method provided in the embodiment realizes semantic mapping of the form code and the code description information by generating the code description information in the corresponding labeling field when labeling the form code, thereby facilitating the structured storage of the form code and the code description information thereof.

[0112] As a specific application embodiment of the present disclosure, taking an advertising creation form as an example, as shown in Figure 6 The developer inputs a natural language text with advertising semantics as form generation description information, and based on the semantic similarity matching of vector retrieval, the natural language text is semantically matched with the semantic labeling content of each form code in the code knowledge base, and the form code with the highest semantic similarity is recalled from the code knowledge base.

[0113] As shown in Figure 6 The form codes in the code knowledge base have been classified based on the code implementation of the advertising creation form linkage relationship, including dependency relationship (i.e., scenario code or condition code, such as whether the current "promotion purpose" == "application promotion" is true), linkage relationship (i.e., side effect code, such as when "promotion purpose" == "application promotion", the bid strategy does not display the "maximum conversion" field), form field definition (i.e., field module code, such as the title of the "promotion purpose" field is "promotion purpose", which is a radiogroup type form), and field optional value (i.e., field attribute code, such as "promotion purpose" has "application promotion", "lead sales", etc. optional items). The classified form codes are structured and semantically labeled in text form using the natural language of the advertising semantics, so as to be semantically vector-matched with the form generation description information in the natural language text to retrieve the most relevant form code. The form code and its associated semantic labeling content are processed in a text vector, and are persistently stored in a vector database as a code knowledge base, providing recall data basis for the enhanced retrieval generation process.

[0114] The form generation description information of the natural language text is matched with the semantic tagging content of the form code of each associated dimension through vector similarity calculation. Specifically, for the form code of the dependency relationship, the form generation description information is matched with the target field and the corresponding selected value in the semantic tagging description. For example, the natural language text is matched with the semantic tagging content "the purpose of promotion is application promotion" in terms of semantic similarity. For the form code of the linkage relationship, the form generation description information is matched with the field linkage relationship in the tagging description. For example, the natural language text is matched with the semantic tagging content "the value attribute of the advertisement material list field is affected" in terms of semantic similarity. For the form code of the form field definition, the form generation description information is matched with the field implementation definition in the tagging description. For example, the natural language text is matched with the semantic tagging content "advertisement budget field" in terms of semantic similarity. For the form code of the field optional value, the form generation description information is matched with the field series optional value in the tagging description. For example, the natural language text is matched with the semantic tagging content "sales lead optional item under the purpose of promotion" in terms of semantic similarity.

[0115] Before the code generation model generates the form code, the most similar form code recalled is used as additional supplementary information of the code generation model to supplement the necessary context prompt for the code automatic generation of the advertisement field. Thus, the code generation process of the code generation model is optimized in combination with the form code, so as to play an additional prompt and guide role for the code generation model to generate the advertisement form code, thereby generating the target advertisement form code.

[0116] In the embodiment, a form code generation device is also provided, which is used to implement the above-described embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware or a combination of software and hardware is also possible and is contemplated.

[0117] The embodiment provides a form code generation device, as shown in Figure 7 , which comprises:

[0118] The acquisition module 501 is configured to acquire form generation description information under a target field and a code knowledge base corresponding to the target field. The code knowledge base comprises a plurality of form codes, and each form code corresponds to code description information.

[0119] The semantic matching module 502 is configured to perform semantic matching on the form generation description information and the code description information based on a code generation model, and determine a target matching code corresponding to the form generation description information.

[0120] The code generation module 503 is configured to guide a code generation process of the code generation model based on the target matching code and the form generation description information, to obtain a target form code corresponding to the form generation description information.

[0121] In some optional embodiments, the semantic matching module 502 includes:

[0122] The parsing unit is configured to parse the form generation description information according to a preset association dimension based on the code generation model, to obtain association description information of the form generation description information under each association dimension.

[0123] The association code obtaining unit is configured to obtain an association code base of the code knowledge base under each association dimension.

[0124] The matching unit is configured to perform semantic matching between the association description information and code description information of each form code in the association code base, to obtain a target matching code corresponding to each association description information.

[0125] In some optional embodiments, the matching unit includes:

[0126] The matching degree determining subunit is configured to perform semantic matching between the association description information and the code description information of each form code, to determine a semantic matching degree between the association description information and each form code.

[0127] The candidate code determining subunit is configured to determine a candidate code corresponding to the association description information from each form code based on a sorting result of the semantic matching degrees.

[0128] The assembling subunit is configured to combine the candidate codes corresponding to each association dimension, to obtain a target candidate code and target candidate description information corresponding to the target candidate code.

[0129] The target code determining subunit is configured to determine the target candidate code as the target matching code if the form generation description information and the target candidate description information satisfy a semantic matching condition.

[0130] In some optional embodiments, the matching unit further includes:

[0131] The secondary screening subunit is configured to screen the target matching code from the association code base under each association dimension based on the form generation description information and the sorting result of the semantic matching degrees, if the form generation description information and the target candidate description information do not satisfy the semantic matching condition.

[0132] In some optional embodiments, the apparatus described above further includes:

[0133] The material base generation module is configured to generate the code knowledge base.

[0134] Specifically, the material library generation module comprises:

[0135] a code material acquisition unit configured to acquire a plurality of form codes associated with the target domain.

[0136] a semantic tagging unit configured to perform semantic tagging on the form codes to generate code description information corresponding to the form codes.

[0137] a semantic mapping unit configured to construct a code knowledge base based on a semantic mapping relationship between the form codes and the code description information.

[0138] In some optional embodiments, the code material acquisition unit comprises:

[0139] a domain code acquisition subunit configured to acquire at least one domain code associated with the target domain.

[0140] a slicing subunit configured to atomically slice each domain code to obtain a form code corresponding to each domain code.

[0141] In some optional embodiments, the semantic tagging unit comprises:

[0142] an associated dimension acquisition subunit configured to acquire an associated dimension corresponding to the form code.

[0143] a tagging subunit configured to perform semantic tagging on the form code based on a tagging strategy corresponding to the associated dimension to generate the code description information corresponding to the form code.

[0144] In some optional embodiments, the tagging subunit is specifically further configured to generate a tagging field corresponding to the form code in response to a semantic tagging instruction for the form code; and the tagging field generates the code description information corresponding to the form code.

[0145] The form code generation apparatus provided by the embodiments of the present disclosure can perform the form code generation method provided by any of the embodiments of the present disclosure, and has the corresponding function modules and beneficial effects of the execution method. By obtaining form generation description information under a target field and a code knowledge base corresponding to the target field, the form generation description information and the code description information are semantically matched to determine the target matching code matched with the form generation description information, and the target matching code is used as the supplementary information of the form generation description information to supplement the necessary context prompt of the code generation model. Then, under the joint action of the target matching code and the form generation description information, the form code generation process of the code generation model is guided, and the target form code corresponding to the form generation description information is generated, thereby improving the accuracy of the semantic understanding of the code generation model for the form generation description information, and facilitating the code generation model to accurately identify the multi-level linkage logic in the form generation description information, and improving the generation accuracy and reliability of the form code. At the same time, when generating the form code in the same target field, the corresponding form code can be queried from the code knowledge base, thereby realizing the reuse of the form code in the code knowledge base, and facilitating the rapid positioning of the existing form code and the enhanced generation of the form code based on the semantic similarity.

[0146] Further function descriptions of the above-mentioned modules and units are the same as those of the corresponding embodiments described above, and will not be described here.

[0147] Figure 8 A structural schematic diagram of an electronic device provided by the embodiments of the present disclosure.

[0148] The following will be specifically referred to Figure 8 which shows a structural schematic diagram of an electronic device suitable for implementing the electronic device in the embodiments of the present disclosure. The electronic device can include a processor (such as a central processor, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 602 or programs loaded from a storage 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device are also stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0149] Generally, the following devices can be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although not shown, the electronic device can further include a power supply for supplying power to each component of the electronic device.Figure 8 The electronic device is shown with various devices, but it should be understood that all of the shown devices are not required, and that more or fewer devices can be implemented.

[0150] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program which, when executed using a processor 601, implements the above-described functions defined in the form code generation method of embodiments of the present disclosure. The computer program can be downloaded and installed from a network via the communication device 609, or installed from the memory 608, or installed from the ROM 602. When the computer program is executed by the processor 601, the above-described functions defined in the form code generation method of embodiments of the present disclosure are implemented.

[0151] Figure 8 The electronic device shown is merely an example and should not limit the function and scope of use of embodiments of the present disclosure.

[0152] Embodiments of the present disclosure also provide a computer-readable storage medium, the above-mentioned method according to embodiments of the present disclosure can be implemented in hardware, firmware, or as computer code recordable on a storage medium, or as computer code originally stored in a remote storage medium or non-transitory machine-readable storage medium downloaded through a network and to be stored in a local storage medium, so that the method described herein can be processed by such software on a storage medium using a general-purpose computer, a special-purpose processor, or programmable or special-purpose hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk or a solid state disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that the computer, processor, microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code, when the software or computer code is accessed and executed by the computer, processor or hardware, the form code generation method shown in the above embodiments is implemented.

[0153] Part of the present disclosure can be applied as a computer program product, for example, computer program instructions, when executed by a computer, through the operation of the computer, the method and / or technical solutions according to the present disclosure can be invoked or provided. Those skilled in the art should understand that the form of computer program instructions in computer readable medium includes but is not limited to source file, executable file, installation package file and the like, and accordingly, the way of computer program instructions executed by computer includes but is not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer readable medium can be any available computer readable storage medium or communication medium accessible to the computer.

[0154] Although the embodiments of the present disclosure are described in conjunction with the drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present disclosure, and such modifications and changes fall within the scope defined by the appended claims.

Claims

1. A method for generating form code, characterized in that, The method includes: Obtain form generation description information under the target domain and the code knowledge base corresponding to the target domain. The code knowledge base includes multiple form codes, and each form code has corresponding code description information. Based on the code generation model, semantic matching is performed between the form generation description information and the code description information to determine the target matching code corresponding to the form generation description information; Based on the target matching code and the form generation description information, the code generation model is guided to generate the target form code corresponding to the form generation description information.

2. The method according to claim 1, characterized in that, The step of semantically matching the form-generated description information with the code description information based on the code generation model to determine the target matching code corresponding to the form-generated description information includes: Based on the code generation model, the form generation description information is parsed according to the preset association dimensions to obtain the association description information of the form generation description information under each association dimension; Obtain the associated code libraries of the code knowledge base under each associated dimension; The association description information is semantically matched with the code description information of each form code in the association code library to obtain the target matching code corresponding to each association description information.

3. The method according to claim 2, characterized in that, The step of semantically matching the association description information with the code description information of each form code in the association code library to obtain the target matching code corresponding to each association description information includes: The association description information is semantically matched with the code description information of each form code to determine the semantic matching degree between the association description information and each form code; Based on the ranking result of the semantic matching degree, candidate codes corresponding to the associated description information are determined from each of the form codes; The candidate codes corresponding to each associated dimension are combined to obtain the target candidate code and the target candidate description information corresponding to the target candidate code; If the form-generated description information and the target candidate description information satisfy the semantic matching condition, then the target candidate code is determined as the target matching code.

4. The method according to claim 3, characterized in that, Also includes: If the form-generated description information and the target candidate description information do not meet the semantic matching conditions, then based on the ranking results of the form-generated description information and the semantic matching degree, the target matching code is filtered from the associated code library under each associated dimension.

5. The method according to any one of claims 1-4, characterized in that, The generation of the code knowledge base includes: Obtain multiple form codes associated with the target domain; Semantic tagging is performed on the form code to generate code description information corresponding to the form code; The code knowledge base is constructed based on the semantic mapping relationship between the form code and the code description information.

6. The method according to claim 5, characterized in that, Obtain multiple form codes associated with the target domain, including: Obtain at least one domain code associated with the target domain; Atomic slices are performed on the code of each domain to obtain the form code corresponding to each domain code.

7. The method according to claim 5 or 6, characterized in that, The step of semantically tagging the form code to generate code description information corresponding to the form code includes: Obtain the associated dimension corresponding to the form code; Based on the tagging strategy corresponding to the associated dimension, the form code is semantically tagged to generate code description information corresponding to the form code.

8. The method according to claim 7, characterized in that, The step of semantically tagging the form code to generate code description information corresponding to the form code includes: In response to a semantic tagging instruction for the form code, a tagging field corresponding to the form code is generated; The tagging field generates code description information corresponding to the form code.

9. A form code generation device, characterized in that, The device includes: The acquisition module is used to acquire form generation description information under the target domain and the code knowledge base corresponding to the target domain. The code knowledge base includes multiple form codes, and each form code corresponds to code description information. The semantic matching module is used to perform semantic matching between the form generation description information and the code description information based on the code generation model, and determine the target matching code corresponding to the form generation description information; The code generation module is used to guide the code generation process of the code generation model based on the target matching code and the form generation description information, so as to obtain the target form code corresponding to the form generation description information.

10. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the form code generation method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the form code generation method according to any one of claims 1 to 8.

12. A computer program product, characterized in that, Includes computer instructions for causing a computer to execute the method for generating form codes according to any one of claims 1 to 8.

Citation Information

Cited By

  • Form generation method, form generation system, storage medium and program product

    CN121680850A