Target code generation method, device, equipment and medium based on HALO platform

By obtaining and replacing code templates on the HALO platform and generating target code, the problem of developers writing highly repetitive and low-value code is solved, and the consistency of code quality is improved, which facilitates later operation and maintenance.

CN113986245BInactive Publication Date: 2024-11-05PING AN BANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111265066.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2024-11-05
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

During the project research and development process based on the HALO platform, developers need to spend a lot of time writing code with high repetitiveness and low value, and due to the different levels of developers, the code quality and styles are different, which affects later operation and maintenance.

Method used

By obtaining code information, extracting various dimensions and function information, obtaining multiple code templates from the preset template database of the HALO platform, detecting the similarity between the template and the function information, selecting the template with the highest similarity as the target code template, and using the code The dimension values ​​in the information are replaced into the template to generate the target code.

Benefits of technology

It realizes automatic code generation, reduces the time for developers to write repetitive code, improves the consistency of code quality, and facilitates later operation and maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986245B_ABST
    Figure CN113986245B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, equipment and medium for generating a target code based on a HALO platform, wherein the method comprises: obtaining code information for generating the target code, obtaining multiple code templates from a preset template database of the HALO platform, and selecting a target code template by a preset method, extracting dimension values ​​of each dimension in the code information, and replacing the corresponding code in the target code template with each dimension value to obtain the target code. The beneficial effects of the present invention are as follows: the automatic generation of code is realized by the above method, and developers do not need to spend extra time writing highly repetitive code, and the code generated by the code template will unify the quality of the code written by each developer, which is convenient for later operation and maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method, device, equipment and medium for generating target code based on a HALO platform. Background Art

[0002] At present, in the project development process based on the HALO platform (an application platform based on CQRS (Command Query Responsibility Segment) + extension points + process orchestration), from interface definition to business implementation, four levels are defined, namely, API, server, service, and entity, and each level requires annotations, interfaces, annotations, and class definitions. In this process, there are usually many repeated configuration items. The inventors realized that developers need to spend time writing highly repetitive and low-value code, and the developers have different levels, and the quality and style of the code they write are different, which is not conducive to later operation and maintenance. Summary of the invention

[0003] The main purpose of the present invention is to provide a method, device, equipment and medium for generating target code based on the HALO platform, aiming to solve the problem that developers need to spend time writing codes with high repetitiveness and low value.

[0004] The present invention provides a method for generating target code based on a HALO platform, comprising:

[0005] Obtaining code information for generating the target code;

[0006] Extracting various dimensions and first function information involved in the target code from the code information;

[0007] Based on the dimensions, a plurality of code templates are obtained from a preset template database of the HALO platform; wherein each of the code templates includes the dimensions;

[0008] Detecting the similarity between the second function information implemented by each of the code templates and the first function information;

[0009] Select the code template with the highest similarity as the target code template;

[0010] The dimension value of each dimension in the code information is extracted, and the corresponding code in the target code template is replaced by each dimension value to obtain the target code.

[0011] Furthermore, the step of extracting the dimension value of each dimension in the code information and replacing the corresponding code in the target code template with each dimension value to obtain the target code includes:

[0012] Determine the target field in the target code template according to the dimensions;

[0013] Convert the target field into preset variables corresponding to each dimension to obtain an intermediate code;

[0014] The dimension value of each dimension in the code information is extracted, and the corresponding preset variable in the intermediate code is replaced to obtain the target code.

[0015] Furthermore, after the step of selecting the code template with the highest similarity as the target code template, the method further includes:

[0016] Counting the historical number of times the target code template is called;

[0017] According to the formula t = f(x i )+b calculates the automatic deletion time of the target code template in the preset template database; wherein, when the target code template is not selected after the automatic deletion time, it is automatically deleted from the preset template database; wherein, t is the automatic deletion time, x i is the historical number, b is a constant, f(x i ) is a function.

[0018] Furthermore, after the step of acquiring a plurality of code templates from a preset template database of the HALO platform based on the various dimensions, the step further includes:

[0019] Get the developer's unique identification information;

[0020] Obtaining permission information of the developer from a preset permission table based on the unique identification information;

[0021] Detecting whether each of the code templates is within the scope of the developer's permission information;

[0022] If they are all within the scope of the developer's permission information, it is determined that the step of detecting the similarity between the second function information implemented by each of the code templates and the first function information is satisfied.

[0023] Furthermore, before the step of acquiring a plurality of code templates from a preset template database of the HALO platform based on the various dimensions, the step further includes:

[0024] Get the original code files uploaded by employees;

[0025] Input the original code file into the preset BERT model to obtain multiple code segment vectors corresponding to each code segment;

[0026] Selecting a code segment vector from the original code file in order as a temporary code segment vector, performing weighted sum calculation on the code segment vectors corresponding to each code segment vector from the beginning of the original code file to the end of the temporary code segment vector to obtain a first vector, and performing weighted sum calculation on each code segment vector from the end of the temporary code segment vector to the end of the original code file to obtain a second vector; wherein the dimension of the first vector is equal to the dimension of the second vector;

[0027] Calculate the similarity value between the first vector and the second vector using a preset similarity calculation formula, and nonlinearly map the calculated similarity value sigmoid to the interval (0, 1) to find the linear distance from 1;

[0028] Compare the linear distance with a set threshold, and use the end position of the temporary code segment vector whose linear distance is higher than the set threshold as a truncation point;

[0029] Selecting a preset number of target truncation points from each of the truncation points to truncate the original code file, thereby obtaining a plurality of initial code templates;

[0030] Input each of the initial code templates into the preset template database.

[0031] Furthermore, the step of selecting a preset number of target truncation points from each of the truncation points to truncate the original code file to obtain a plurality of initial code templates includes:

[0032] Record the set consisting of all the truncation points as the first set;

[0033] A set consisting of the preset number of truncation points selected from the first set is recorded as a second set;

[0034] The score value of each second set is calculated by a calculation formula; wherein the calculation formula is: w and m are the preset weight parameters; h1, h2, ..., h n is the first similarity value corresponding to the element in the second set; ΔR i is the difference between the first similarity values ​​corresponding to the two elements selected from the second set in the i-th group; n represents the number of elements in the second set, and F(n) represents the score value;

[0035] Select the second set with the highest score value, and use the cutoff point in the set as the target cutoff point;

[0036] The original code file is truncated based on the target truncation point to obtain a plurality of initial code templates.

[0037] Furthermore, after the step of extracting the dimension value of each dimension in the code information and replacing the corresponding code in the target code template with each dimension value to obtain the target code, the step further includes:

[0038] Obtaining the operating system of the HALO platform;

[0039] Determining whether all codes in the target code can be executed by the operating system;

[0040] If it can be run by the operating system, it is uploaded to the HALO platform.

[0041] The present invention also provides a target code generation device based on the HALO platform, comprising:

[0042] A first acquisition module, used to acquire code information for generating the target code;

[0043] An extraction module, used for extracting various dimensions and first function information involved in the target code from the code information;

[0044] A second acquisition module is used to acquire multiple code templates from a preset template database of the HALO platform based on the various dimensions; wherein each of the code templates includes the various dimensions;

[0045] A detection module, used for detecting the similarity between the second function information implemented by each of the code templates and the first function information;

[0046] A selection module, used for selecting the code template with the highest similarity as a target code template;

[0047] The replacement module is used to extract the dimension value of each dimension in the code information, and replace the corresponding code in the target code template with each dimension value to obtain the target code.

[0048] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.

[0049] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.

[0050] The beneficial effects of the present invention are as follows: by obtaining the code information for generating the target code, obtaining multiple code templates from the preset template database of the HALO platform, and selecting the target code template by a preset method, extracting the dimension values ​​of each dimension in the code information, and replacing the corresponding code in the target code template with each dimension value, the target code is obtained. The above method realizes the automatic generation of code, and developers do not need to spend extra time writing highly repetitive code. Moreover, the code generated by the code template will unify the quality of the code written by each developer, which is convenient for later operation and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 It is a flowchart of a method for generating target code based on the HALO platform according to an embodiment of the present invention;

[0052] Figure 2 It is a schematic block diagram of the structure of a target code generation device based on the HALO platform according to an embodiment of the present invention;

[0053] Figure 3 A schematic block diagram of the structure of a computer device according to an embodiment of the present application.

[0054] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0055] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0056] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly. The connection can be a direct connection or an indirect connection.

[0057] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone.

[0058] In addition, in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0059] Reference Figure 1 The present invention proposes a target code generation method based on the HALO platform, comprising:

[0060] S1: Obtain code information for generating the target code;

[0061] S2: extracting various dimensions and first function information involved in the target code from the code information;

[0062] S3: acquiring a plurality of code templates from a preset template database of the HALO platform based on the dimensions; wherein each of the code templates includes the dimensions;

[0063] S4: Detecting the similarity between the second function information implemented by each of the code templates and the first function information;

[0064] S5: Select the code template with the highest similarity as the target code template;

[0065] S6: extracting dimension values ​​of the dimensions in the code information, and replacing corresponding codes in the target code template with the dimension values ​​to obtain the target code.

[0066] As described in the above step S1, the code information for generating the target code is obtained. The code information is the code information uploaded by the developer. The code information includes the functions to be implemented by the code and the dimension information of each dimension in the code. The dimension information refers to the corresponding dimensions and the values ​​corresponding to each dimension. Each dimension can be a specific parameter, such as time, location information of calling data, etc., and its corresponding value is a specific value.

[0067] As described in step S2 above, the various dimensions and the first functional information involved in the target code are extracted from the code information. For example, if the target code is to calculate the salary expenditure of a company in August 2021, the corresponding dimensions are the company and time. The dimension corresponding to the company is a value pre-set for the company. For example, if the dimension value corresponding to the company is 1, the corresponding dimension value 1 can be directly obtained according to the code information, and the time dimension can be 202108. Here, you only need to know the dimensions involved, namely the time dimension and the company dimension, and its first functional information is the company's salary expenditure.

[0068] As described in the above step S3, multiple code templates are obtained from the preset template database of the HALO platform based on the various dimensions; wherein each of the code templates contains the various dimensions. The HALO platform is a design concept based on business identity + extension point, and a reusable business asset library is formed by orchestrating internal application processes. In order to facilitate the smooth operation of the HALO platform, its code is generally implemented in the same language. Therefore, a corresponding preset template database can be pre-built. The code templates in the preset template database can be obtained based on the existing code developed by the developer. There will be detailed instructions for obtaining code templates later, which will not be repeated here. Therefore, multiple code templates can be obtained from the preset template database.

[0069] As described in step S4 above, the similarity between the second function information implemented by each code template and the first function information is detected. The similarity calculation method can be any algorithm, such as WMD algorithm (word mover's distance), simhash algorithm, and algorithm based on cosine similarity, preferably: using formula:

[0070]

[0071] Calculate the similarity value between the specified second function information and the first function information, and determine whether the similarity value is greater than a preset similarity threshold; where similarity is the similarity value, A is the first function information, B is the second function information, Ai is the number of times the i-th code of the first function information appears, and Bi is the number of times the i-th code of the second function information appears.

[0072] As described in step S5 above, the code template with the highest similarity is selected as the target code template. The code template with the highest similarity indicates that the code template has a higher degree of conformity with the corresponding first function information, so it can be selected as the target code template.

[0073] As described in step S6 above, the dimension values ​​of each dimension in the code information are extracted, and each dimension value replaces the corresponding code in the target code template to obtain the target code. The replacement method is to replace each dimension value with the corresponding code language in the target code template. The specific replacement method will be described in detail later and will not be repeated here.

[0074] The above method realizes automatic code generation, and developers do not need to spend extra time writing highly repetitive code. In addition, the code generated by the code template will unify the quality of the code written by each developer, which is convenient for subsequent operation and maintenance.

[0075] In one embodiment, the step S6 of extracting the dimension values ​​of the various dimensions in the code information and replacing the corresponding codes in the target code template with the various dimension values ​​to obtain the target code includes:

[0076] S601: Determine a target field in the target code template according to the dimensions;

[0077] S602: Convert the target field into preset variables corresponding to each dimension to obtain an intermediate code;

[0078] S603: extracting the dimension value of each dimension in the code information, and replacing the corresponding preset variable in the intermediate code to obtain the target code.

[0079] As described in the above steps S601-S603, the switching of the target field in the target code template is realized to generate the target code. Specifically, the target field can be determined first. The determination method is to use a preset text recognition method, such as the BERT text recognition model to identify the target field in the target code template, and then replace it with a special identifier, that is, a variable, wherein the variable has several attributes, specifically including a variable description, a variable data type and an initial value of the variable. It is equivalent to a description of the dimension. Then extract the dimension values ​​of each dimension, and replace the corresponding preset variables in the intermediate code to obtain the target code. It should be noted that the variables of each dimension are different to facilitate the distinction during replacement.

[0080] In one embodiment, after the step S5 of selecting the code template with the highest similarity as the target code template, the method further includes:

[0081] S611: Counting the historical number of times the target code template is called;

[0082] S612: According to the formula t=f(x i)+b calculates the automatic deletion time of the target code template in the preset template database; wherein, when the target code template is not selected after the automatic deletion time, it is automatically deleted from the preset template database, x i represents the historical number of the i-th target code template, t is the automatic deletion time, and b is the preset parameter; f(x i ) is a function, wherein the function is not limited and can be any function, and an increasing function that increases with the increase of the number of historical times can be used.

[0083] As described in the above steps S611-S612, the target code template is automatically deleted, and the preset template database is automatically updated. Based on the formula t=f(x i )+b calculates the automatic deletion time corresponding to each target code template, where f(x i ) function can be a linear function, a quadratic function, or a composite function, and this application does not limit this. It should be noted that the f(x i ) function should be as x i An increasing function that increases with the value of , that is, as the number of historical times increases, the corresponding automatic deletion duration also becomes longer.

[0084] In one embodiment, after the step S3 of acquiring a plurality of code templates from a preset template database of the HALO platform based on the various dimensions, the method further includes:

[0085] S401: Acquire the unique identification information of the developer;

[0086] S402: Obtaining the permission information of the developer from a preset permission table based on the unique identification information;

[0087] S403: Detecting whether each of the code templates is within the scope of the developer's permission information;

[0088] S404: If they are all within the scope of the developer's permission information, it is determined that the step of detecting the similarity between the second function information implemented by each of the code templates and the first function information is satisfied.

[0089] As described in the above steps S711-S714, the detection of user permissions is achieved and the security of data is guaranteed, wherein the user's unique identification information can be the user's account, the user's identity information, the user's fingerprint information, etc. The preset permission table is a weight table manually set for each developer in advance, and the code templates that can be selected for developers of different levels are not the same. Detect whether each of the code templates is within the user's permission information range. If they are all within the user's permission information range, it is determined that the step of detecting the similarity between the second function information implemented by each of the code templates and the first function information is satisfied. If there is a code template that is not within the user's permission information range, the code template that is not within the user's permission information range is eliminated.

[0090] In one embodiment, before the step S3 of acquiring a plurality of code templates from a preset template database of the HALO platform based on the various dimensions, the step further includes:

[0091] S201: Obtain the original code file uploaded by the employee;

[0092] S202: Input the original code file into a preset BERT model to obtain multiple code segment vectors corresponding to each code segment;

[0093] S203: selecting a code segment vector from the original code file in order as a temporary code segment vector, performing weighted sum calculation on the code segment vectors corresponding to each code segment vector from the beginning of the original code file to the end of the temporary code segment vector to obtain a first vector, and performing weighted sum calculation on each code segment vector from the end of the temporary code segment vector to the end of the original code file to obtain a second vector; wherein the dimension of the first vector is equal to the dimension of the second vector;

[0094] S204: Calculate the similarity value between the first vector and the second vector using a preset similarity calculation formula, and nonlinearly map the calculated similarity value sigmoid to the interval (0, 1) to obtain a linear distance from 1;

[0095] S205: comparing the linear distance with a set threshold, and taking the end position of the temporary code segment vector whose linear distance is higher than the set threshold as a truncation point;

[0096] S206: Selecting a preset number of target truncation points from each of the truncation points to truncate the original code file, thereby obtaining a plurality of initial code templates;

[0097] S207: Input each of the initial code templates into the preset template database.

[0098] As described in the above steps S201-S203, the original code file is the code written by the developer himself, rather than the code file generated by the code template database. A code segment vector is selected from the original code file, wherein the selection of the code segment vector can be to select each code segment vector in the original code file in turn, and then the target vector corresponding to each code segment vector from the beginning of the original code file to the end of the code segment vector is weighted and calculated to obtain a first vector, and the target vector corresponding to each code segment vector from the end of the code segment vector to the end of the original code file is weighted and calculated to obtain a second vector, wherein the weighted and calculated includes performing dimensionality increase or dimensionality reduction calculations on the first vector and / or the second vector, etc., in order to keep the dimensions of the first vector and the second vector consistent, so as to facilitate subsequent similarity calculations.

[0099] As described in step S204, the similarity calculation is performed on the first vector and the second vector, wherein the formula for similarity calculation can be a WMD algorithm (word mover's distance), a simhash algorithm, an algorithm based on cosine similarity, a calculation based on a SVM (Support Vector Machine) vector model, etc., and the similarity between the first vector and the second vector can be calculated. Then, the calculated first similarity value is mapped to a value (0, 1) interval, so that the similarity value can be reflected in the linear distance from 1, which is convenient for subsequent judgment between the threshold value.

[0100] As described in the above step S205, by comparing the similarity value with the set threshold, it can be determined whether the end of each code segment vector meets the initial condition of segmentation. When the initial condition is met, the end position of the corresponding code segment vector can be used as the truncation point. Subsequently, the truncation point can be directly used as the final truncation point to truncate the original code file. When multiple truncation points are included, one or more truncation points can be selected to truncate the original code file.

[0101] As described in the above steps S206-S207, a preset number of target truncation points are selected from each of the truncation points to truncate the original code file, thereby obtaining a plurality of initial code templates. The selection rule is not limited, for example, the truncation points may be selected so that the number of code words in each code segment after truncation is as close as possible, or the truncation points with the smallest similarity may be selected for truncation. Then, each of the initial code templates is input into the preset template database, thereby obtaining a plurality of corresponding initial code templates.

[0102] In one embodiment, the step S208 of selecting a preset number of target truncation points from each of the truncation points to truncate the original code file to obtain a plurality of initial code templates includes:

[0103] S2081: Record the set consisting of all the truncation points as the first set;

[0104] S2082: Selecting a set consisting of the preset number of truncation points from the first set as a second set;

[0105] S2083: Calculate the score value of each second set by a calculation formula; wherein the calculation formula is: w and m are the preset weight parameters; h1, h2, ..., h n is the first similarity value corresponding to the element in the second set; ΔR i is the difference between the first similarity values ​​corresponding to the two elements selected from the second set in the i-th group; n represents the number of elements in the second set, and F(n) represents the score value;

[0106] S2084: Select the second set with the highest score, and use the cutoff point in the set as the target cutoff point;

[0107] S2085: Truncating the original code file based on the target truncation point to obtain multiple initial code templates.

[0108] As described in the above steps S2081-S2085, the set composed of each truncation point is recorded as the first set. When the original code file is relatively long, the number of truncation points will be relatively large, and the required target truncation points will also be correspondingly relatively large. Therefore, different combinations can be screened out from the first set as the second set according to the required number of truncation points, that is, the preset number, and then the score value of the second set is calculated by the formula. Then, different weight coefficients w and m are assigned to the first similarity value and the second similarity value. It should be understood that when the factor affecting the position score is relatively large, the weight coefficient w can be increased, and when the factor affecting the first similarity is relatively large, the weight coefficient m can be increased. Then, the score value of each truncation point is calculated, and the target truncation point is selected according to the score value. The original code file is truncated according to the target truncation point to obtain multiple initial code templates, thereby completing the establishment of the preset template database.

[0109] In an embodiment, after the step S6 of extracting the dimension values ​​of each dimension in the code information and replacing the corresponding code in the target code template with each dimension value to obtain the target code, the step further includes:

[0110] S701: Acquire the operating system of the HALO platform;

[0111] S702: Determine whether all codes in the target code can be executed by the operating system;

[0112] S703: If the program can be run by the operating system, upload the program to the HALO platform.

[0113] As described in the above steps S701-S703, the compatibility test between the target code and the operating system is implemented. That is, the operating system of the HALO platform is first obtained, and then the compiler in the operating system is obtained. The compiler in the operating system generally includes multiple compilers, and the syntax that can be recognized by each compiler is detected. Then, according to the syntax that can be recognized, the module data is preliminarily judged. If there is a target code containing syntax that cannot be recognized by the operating system, the target code is sent to the relevant developers for confirmation and modification. If the operating system can run, the target code can be directly put into use.

[0114] The beneficial effects of the present invention are as follows: by obtaining the code information for generating the target code, obtaining multiple code templates from the preset template database of the HALO platform, and selecting the target code template by a preset method, extracting the dimension values ​​of each dimension in the code information, and replacing the corresponding code in the target code template with each dimension value, the target code is obtained. The above method realizes the automatic generation of code, and developers do not need to spend extra time writing highly repetitive code. Moreover, the code generated by the code template will unify the quality of the code written by each developer, which is convenient for later operation and maintenance.

[0115] Reference Figure 2 The present invention also provides a target code generation device based on the HALO platform, comprising:

[0116] A first acquisition module 10, used to acquire code information for generating the target code;

[0117] An extraction module 20, configured to extract various dimensions and first function information involved in the target code from the code information;

[0118] A second acquisition module 30 is used to acquire a plurality of code templates from a preset template database of the HALO platform based on the dimensions; wherein each of the code templates includes the dimensions;

[0119] A detection module 40, configured to detect the similarity between the second function information implemented by each of the code templates and the first function information;

[0120] A selection module 50, configured to select the code template with the highest similarity as a target code template;

[0121] The replacement module 60 is used to extract the dimension value of each dimension in the code information, and replace the corresponding code in the target code template with each dimension value to obtain the target code.

[0122] Reference Figure 3 In an embodiment of the present application, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store various code templates, etc. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the target code generation method based on the HALO platform described in any of the above embodiments can be implemented.

[0123] Those skilled in the art will understand that Figure 3 The structure shown in is merely a block diagram of a portion of the structure related to the present application solution and does not constitute a limitation on the computer device to which the present application solution is applied.

[0124] The embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the target code generation method based on the HALO platform described in any of the above embodiments can be implemented.

[0125] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0126] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.

[0127] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0128] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0129] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention shall be included in the scope of the claims of the present invention.

Claims

1. A target code generation method based on HALO platform, characterized in that: include: Obtaining code information for generating the target code; Extracting various dimensions and first function information involved in the target code from the code information; Based on the dimensions, a plurality of code templates are obtained from a preset template database of the HALO platform; wherein each of the code templates includes the dimensions; Detecting the similarity between the second function information implemented by each of the code templates and the first function information; Select the code template with the highest similarity as the target code template; Extracting dimension values ​​of the dimensions in the code information, and replacing corresponding codes in the target code template with the dimension values ​​to obtain the target code; The step of extracting the dimension value of each dimension in the code information and replacing the corresponding code in the target code template with each dimension value to obtain the target code includes: Determine the target field in the target code template according to the dimensions; Convert the target field into preset variables corresponding to each dimension to obtain an intermediate code; Extracting the dimension value of each dimension in the code information, and replacing the corresponding preset variable in the intermediate code to obtain the target code; Before the step of acquiring a plurality of code templates from a preset template database of the HALO platform based on the various dimensions, the step further includes: Get the original code files uploaded by employees; Input the original code file into the preset BERT model to obtain multiple code segment vectors corresponding to each code segment; Selecting a code segment vector from the original code file in order as a temporary code segment vector, performing weighted sum calculation on the code segment vectors corresponding to each code segment vector from the beginning of the original code file to the end of the temporary code segment vector to obtain a first vector, and performing weighted sum calculation on each code segment vector from the end of the temporary code segment vector to the end of the original code file to obtain a second vector; wherein the dimension of the first vector is equal to the dimension of the second vector; Calculate the similarity value between the first vector and the second vector using a preset similarity calculation formula, and nonlinearly map the calculated similarity value sigmoid to the interval (0,1) to find the linear distance from 1; Compare the linear distance with a set threshold, and use the end position of the temporary code segment vector whose linear distance is higher than the set threshold as a truncation point; Selecting a preset number of target truncation points from each of the truncation points to truncate the original code file, thereby obtaining a plurality of initial code templates; Input each of the initial code templates into the preset template database.

2. The target code generation method based on the HALO platform according to claim 1, characterized in that: After the step of selecting the code template with the highest similarity as the target code template, the method further includes: Counting the historical number of times the target code template is called; According to the formula Calculate the automatic deletion time of the target code template in the preset template database; wherein the target code template is automatically deleted from the preset template database when the automatic deletion time has passed without being selected; wherein t is the automatic deletion time, is the historical number, is a constant, is an increasing function that increases as the value of xi increases.

3. The target code generation method based on the HALO platform as claimed in claim 1, characterized in that: After the step of acquiring a plurality of code templates from a preset template database of the HALO platform based on the various dimensions, the method further includes: Get the developer's unique identification information; Obtaining permission information of the developer from a preset permission table based on the unique identification information; Detecting whether each of the code templates is within the scope of the developer's permission information; If they are all within the scope of the developer's permission information, it is determined that the step of detecting the similarity between the second function information implemented by each of the code templates and the first function information is satisfied.

4. The target code generation method based on the HALO platform as claimed in claim 3, characterized in that: The step of selecting a preset number of target truncation points from each of the truncation points to truncate the original code file to obtain a plurality of initial code templates includes: Record the set consisting of all the truncation points as the first set; A set consisting of the preset number of truncation points selected from the first set is recorded as a second set; The score value of each second set is calculated by a calculation formula; wherein the calculation formula is: , and are the preset weight parameters respectively; , , …, is a first similarity value corresponding to the element in the second set; is the difference between the first similarity values ​​of the two elements selected from the second set in the i-th group; n represents the number of elements in the second set, Indicates the score value; Select the second set with the highest score value, and use the cutoff point in the set as the target cutoff point; The original code file is truncated based on the target truncation point to obtain a plurality of initial code templates.

5. The target code generation method based on the HALO platform as claimed in claim 1, characterized in that: After the step of extracting the dimension value of each dimension in the code information and replacing the corresponding code in the target code template with each dimension value to obtain the target code, the step further includes: Obtaining the operating system of the HALO platform; Determining whether all codes in the target code can be executed by the operating system; If it can be run by the operating system, it is uploaded to the HALO platform.

6. A target code generation device based on the HALO platform, used to execute the method according to any one of claims 1 to 5, characterized in that: include: A first acquisition module, used for acquiring code information for generating the target code; An extraction module, used for extracting various dimensions and first function information involved in the target code from the code information; A second acquisition module is used to acquire multiple code templates from a preset template database of the HALO platform based on the various dimensions; wherein each of the code templates includes the various dimensions; A detection module, used for detecting the similarity between the second function information implemented by each of the code templates and the first function information; A selection module, used for selecting the code template with the highest similarity as a target code template; The replacement module is used to extract the dimension value of each dimension in the code information, and replace the corresponding code in the target code template with each dimension value to obtain the target code.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.