An intelligent code adoption rate determination method, apparatus, device, and medium

By inserting and encrypting code attribute tags in the intelligently generated code, the problem of large errors in the adoption rate calculation in existing technologies is solved, the reliability and accuracy of the code adoption rate are realized, and accurate tracking is ensured throughout the entire process.

CN122132073APending Publication Date: 2026-06-02INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2026-02-26
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In existing technologies, the calculation of adoption rate of intelligent code generation has problems of large error and high reliability. This is mainly because plug-in level statistics cannot track the actual code written into the project file, manual marking and review rely on the developer's self-discipline and are easily deleted or missed, and code similarity analysis cannot distinguish between code that has been modified and adopted after generation and code independently written by artificial intelligence.

Method used

By obtaining the original attribute tags of the initial code snippet generated by the intelligent code generation model, encrypting them to form ciphertext, and combining the ciphertext of the target code snippet with the version information, the code snippet that is adopted in the initial code is determined, and the code adoption rate is calculated.

Benefits of technology

It enables accurate tracking throughout the entire process from code generation to usage, ensuring the reliability and accuracy of the intelligent code generation adoption rate and avoiding errors and omissions in statistics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122132073A_ABST
    Figure CN122132073A_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, device, and medium for determining the adoption rate of intelligent code generation. The method includes acquiring initial code generated by an intelligent code generation model, comprising multiple first-version code fragments; determining the original attribute tags of the first-version code fragments based on their fragment metadata; encrypting the original attribute tags of the first-version code fragments based on the code version information of the initial code to obtain encrypted attribute tags; acquiring the target code corresponding to the initial code after actual use; determining the adopted target code fragment in the initial code based on the encrypted attribute tags of the second-version code fragment in the target code, the encrypted attribute tags of the first-version code fragment, the first-version code fragment, and the second-version code fragment; and determining the code adoption rate of the initial code based on the target code fragment and the first-version code fragment. This approach improves the accuracy and reliability of determining the sampling rate of intelligent code generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology and can be applied to the field of financial technology, especially to the field of artificial intelligence technology. Specifically, it relates to a method, apparatus, device and medium for determining the adoption rate of intelligent generated code. Background Technology

[0002] In the field of software development, intelligent coding assistance has become an important tool for improving development efficiency. There are three main ways to statistically analyze the adoption rate of intelligent generated code in existing technologies: first, plug-in level statistics; second, manual marking and review; and third, code similarity analysis.

[0003] However, all three methods have certain problems. For example, plugin-level statistics only record the number of code generation and user adoption at the plugin level, and cannot track whether the code is actually written into the project file or committed to the version control system. This makes it impossible to accurately calculate the adoption rate of intelligently generated code. Manual marking and review rely on the developer's self-discipline, and the marking is easily deleted or missed. This leads to a large error in the calculation of the code adoption rate during actual use due to the deletion or omission of markings. Code similarity analysis has a large computational cost and cannot distinguish between code that is "generated and modified for adoption" and code that is "independently written by artificial intelligence". It is impossible to calculate the adoption rate of code that is independently written by artificial intelligence and directly adopted. Summary of the Invention

[0004] This application provides a method, apparatus, device, and medium for determining the adoption rate of intelligent generated code, so as to improve the reliability and accuracy of determining the adoption rate of intelligent generated code.

[0005] According to one aspect of this application, a method for determining the adoption rate of intelligent generated code is provided, the method comprising: Obtain the initial code generated by the intelligent code generation model, which includes multiple first-version code snippets, and determine the original text of the attribute tags of the first-version code snippets based on the snippet metadata of the first-version code snippets; Based on the code version information of the initial code, the original text of the attribute tags of the first version code fragment is encrypted to obtain the ciphertext of the attribute tags; Obtain the target code corresponding to the initial code after actual use; wherein, the target code includes multiple second-version code fragments; at least one second-version code fragment has a corresponding attribute tag ciphertext; Based on the attribute tag ciphertext of the second version code fragment in the target code, the attribute tag ciphertext of the first version code fragment, the first version code fragment, and the second version code fragment, determine the target code fragment in the initial code that was adopted by the target code; The code adoption rate of the initial code is determined based on the target code snippet and the first version code snippet.

[0006] According to another aspect of this application, an intelligent code generation adoption rate determination apparatus is provided, the apparatus comprising: The tag determination module is used to obtain the initial code generated by the intelligent code generation model, which includes multiple first-version code snippets, and determine the original text of the attribute tags of the first-version code snippets based on the snippet metadata of the first-version code snippets; The tag encryption module is used to encrypt the original text of the attribute tags of the first version code fragment according to the code version information of the initial code, so as to obtain the ciphertext of the attribute tags; The code acquisition module is used to acquire the target code corresponding to the initial code after actual use; wherein, the target code includes multiple second-version code fragments; at least one second-version code fragment has a corresponding attribute tag ciphertext; The fragment determination module is used to determine the target code fragment adopted by the target code in the initial code based on the attribute tag ciphertext of the second version code fragment in the target code, the attribute tag ciphertext of the first version code fragment, the first version code fragment, and the second version code fragment. The adoption rate determination module is used to determine the code adoption rate of the initial code based on the target code snippet and the first version code snippet.

[0007] According to another aspect of this application, an electronic device is provided, the electronic device comprising: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement any of the intelligent code generation adoption rate determination methods provided in the embodiments of this application.

[0008] According to another aspect of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements any of the intelligent code generation adoption rate determination methods provided in the embodiments of this application.

[0009] According to another aspect of this application, a computer program product is provided, including a computer program that, when executed by a processor, implements any of the intelligent code generation adoption rate determination methods provided in the embodiments of this application.

[0010] This application obtains initial code, including multiple first-version code snippets, generated by an intelligent code generation model. Based on the snippet metadata of the first-version code snippets, it determines the original attribute tags of the first-version code snippets. Based on the code version information of the initial code, it encrypts the original attribute tags of the first-version code snippets to obtain ciphertext attribute tags. It then obtains the target code corresponding to the initial code after actual use. The target code includes multiple second-version code snippets; at least one second-version code snippet has a corresponding ciphertext attribute tag. Based on the ciphertext attribute tags of the second-version code snippets in the target code, the ciphertext attribute tags of the first-version code snippets, and the first and second-version code snippets, it determines the target code snippets in the initial code that are adopted by the target code. Based on the target code snippets and the first-version code snippets, it determines the code adoption rate of the initial code. This technical solution, by inserting code attribute tags into the intelligently generated code, can track the code throughout the entire process from code generation to use, accurately calculate the proportion of intelligently generated code in the final code, and ensure the reliability and accuracy of the determined code adoption rate. Attached Figure Description

[0011] Figure 1 This is a flowchart of a method for determining the adoption rate of intelligent generated code according to Embodiment 1 of this application; Figure 2 This is a flowchart of a method for determining the adoption rate of intelligent generated code according to Embodiment 2 of this application; Figure 3 This is a schematic diagram of a smart code generation adoption rate determination device according to Embodiment 3 of this application; Figure 4 This is a schematic diagram of the structure of an electronic device that implements the intelligent code generation adoption rate determination method of Embodiment 4 of this application. Detailed Implementation

[0012] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0013] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0014] Furthermore, it should be noted that the collection, storage, use, processing, transmission, provision, and disclosure of related data such as fragment metadata and code version information involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0015] Example 1 Figure 1 This is a flowchart of a method for determining the adoption rate of intelligent generated code according to Embodiment 1 of this application. This embodiment is applicable to situations where the adoption rate of intelligently generated code is calculated. It can be executed by an intelligent generated code adoption rate determination device, which can be implemented in hardware and / or software and can be configured in a computer device, such as a server. Figure 1 As shown, the method includes: S110. Obtain the initial code generated by the intelligent code generation model, which includes multiple first-version code snippets, and determine the original text of the attribute tags of the first-version code snippets based on the snippet metadata of the first-version code snippets.

[0016] The code intelligent generation model refers to a system that uses machine learning or artificial intelligence algorithms to automatically generate code based on input context information. The first-version code snippet refers to the code snippet generated by the intelligent code generation model after receiving user input or context information. The initial code refers to the code consisting of multiple sets of code snippets generated by the intelligent generation model after receiving user input or context information. Snippet metadata refers to additional information related to the code snippet, including but not limited to the code type, function description, author, creation time, dependencies, performance metrics, etc. The attribute tag text refers to the descriptive tags set for each first-version code snippet based on the metadata.

[0017] Optionally, a hash calculation is performed on the first version code snippet to obtain the snippet hash value of the first version code snippet; the snippet hash value of the first version code snippet, along with the code generation time and code generation tool in the snippet metadata, are integrated to obtain the original text of the attribute tag of the first version code snippet.

[0018] Here, the fragment hash value refers to a unique identifier obtained by hashing the code fragment. Code generation time refers to the specific time the code fragment was generated, typically used for version control and tracking code updates. Code generation tool refers to the tool or model used to generate the code fragment.

[0019] In one alternative implementation, the development environment plugin can be invoked to perform a hash calculation on the first version code fragment when it detects that the user has called the intelligent code generation model to generate the initial code, thereby obtaining the fragment hash value of the first version code fragment; the fragment hash value of the first version code fragment, as well as the code generation time and code generation tool in the fragment metadata, are integrated to obtain the original text of the attribute tag of the first version code fragment.

[0020] Among them, development environment plugins refer to additional components in the system used to extend the functionality of the integrated development environment.

[0021] It should be noted that the original text of the attribute tags can be embedded in the first version of the code snippet using Extensible Markup Language (EXPLAIN) comments, without interfering with the code compilation process; at the same time, the original text of the attribute tags is usually hidden and not displayed along with the code snippet, but is only displayed through a special shortcut key, so that the user is unaware of it.

[0022] S120. Based on the code version information of the initial code, encrypt the original text of the attribute tags of the first version code fragment to obtain the ciphertext of the attribute tags.

[0023] Code version information refers to metadata that records the history of code snippet changes, typically including version number, author, timestamp, and a detailed description of the modifications. Attribute tag ciphertext refers to the result of encrypting the original attribute tag text; this ciphertext can include at least one of the following: snippet hash value, code generation time, and code generation tool.

[0024] For example, using a preset encryption algorithm, the original text of the attribute tags of the first version code fragment is encrypted according to the code version information of the initial code to obtain the attribute tag ciphertext, and the attribute tag ciphertext and its corresponding first version code fragment are stored in different locations or structures.

[0025] In one alternative implementation, the attribute tag text of the first version code snippet can be persisted before the attribute tag text is encrypted.

[0026] Tag persistence refers to the process of storing attribute tags in a persistent storage medium to ensure that they remain available after system restarts, updates, or other operations.

[0027] S130. Obtain the target code corresponding to the initial code after actual use; wherein, the target code includes multiple second-version code fragments; at least one second-version code fragment has a corresponding attribute tag ciphertext.

[0028] The target code refers to the improved version of the code after the initial code has been used and feedback has been received. It typically includes fixed vulnerabilities, added new features, or performance optimizations. The second-version code snippet refers to the code segment that constitutes the target code.

[0029] S140. Based on the attribute tag ciphertext of the second version code fragment, the attribute tag ciphertext of the first version code fragment, the first version code fragment, and the second version code fragment in the target code, determine the target code fragment adopted by the target code in the initial code.

[0030] The target code snippet refers to the code snippet in the initial code that is directly adopted and used by the target code.

[0031] For example, based on the attribute tag ciphertext of the second version code snippet in the target code, the second version code snippet is filtered, and the code snippet with the attribute tag ciphertext is determined as the first code snippet adopted by the target code in the initial code; for the code snippets that are not adopted, further filtering is performed based on the attribute tag ciphertext of the first version code snippet and the first version code snippet to obtain the second code snippet adopted by the target code in the initial code; the first code snippet and the second code snippet are integrated to obtain the target code snippet adopted by the target code in the initial code.

[0032] S150. Determine the code adoption rate of the initial code based on the target code snippet and the first version code snippet.

[0033] The code adoption rate refers to the proportion of initial code that is adopted as target code.

[0034] For example, the code adoption rate of the initial code is obtained by dividing the total number of lines in the target code snippet by the total number of lines in the first version code snippet.

[0035] This application embodiment obtains initial code, including multiple first-version code fragments, generated by a code intelligent generation model. Based on the fragment metadata of the first-version code fragments, the original text of the attribute tags for each first-version code fragment is determined. The original text of the attribute tags for each first-version code fragment is encrypted based on the code version information of the initial code, resulting in encrypted attribute tags. The target code corresponding to the initial code after actual use is obtained. The target code includes multiple second-version code fragments; at least one second-version code fragment has a corresponding encrypted attribute tag. Based on the encrypted attribute tags of the second-version code fragments in the target code, the encrypted attribute tags of the first-version code fragments, and the first and second-version code fragments, the target code fragments adopted by the target code in the initial code are determined. Based on the target code fragments and the first-version code fragments, the code adoption rate of the initial code is determined. This technical solution, by inserting code attribute tags into the intelligently generated code, allows for tracking of the code throughout the entire process from code generation to use, accurately calculating the proportion of intelligently generated code in the final code, and ensuring the reliability and accuracy of the determined code adoption rate.

[0036] Example 2 Figure 2 This is a flowchart of a method for determining the adoption rate of intelligent generated code according to Embodiment 2 of this application. Based on the technical solutions of the above embodiments, this embodiment refines the process of "determining the target code segment adopted by the target code in the initial code based on the attribute tag ciphertext of the second version code segment, the attribute tag ciphertext of the first version code segment, the first version code segment, and the second version code segment" to "determining the second version code segment with attribute tag ciphertext as the first code segment to be verified, and determining the second version code segment without attribute tag ciphertext as the second code segment to be verified; determining the target code segment adopted by the target code in the initial code based on the segment hash value of the first code segment to be verified, the second code segment to be verified, the segment hash value of the first version code segment, and the first version code segment." It should be noted that for parts not detailed in this embodiment, please refer to the relevant descriptions in other embodiments. For example... Figure 2 As shown, the method includes: S210. Obtain the initial code generated by the intelligent code generation model, which includes multiple first-version code snippets, and determine the original text of the attribute tags of the first-version code snippets based on the snippet metadata of the first-version code snippets.

[0037] S220. Based on the code version information of the initial code, encrypt the original text of the attribute tags of the first version code fragment to obtain the ciphertext of the attribute tags.

[0038] S230. Obtain the target code corresponding to the initial code after actual use; wherein, the target code includes multiple second-version code fragments; at least one second-version code fragment has a corresponding attribute tag ciphertext.

[0039] S240. The second version code fragment with attribute tag ciphertext is determined as the first code fragment to be verified, and the second version code fragment without attribute tag ciphertext is determined as the second code fragment to be verified.

[0040] The first code segment to be verified refers to the code segment with attribute-labeled ciphertext selected from the second version code segment. The second code segment to be verified refers to the code segment without attribute-labeled ciphertext selected from the second version code segment.

[0041] For example, identify whether there is a code snippet carrying attribute label ciphertext in the second version code snippet; if so, it indicates that the code snippet is the first version code snippet generated by the code generation model, indicating that the code has been adopted, and the code snippet can be identified as the first code snippet to be verified; however, considering the possibility that the label is lost or modified, the second version code snippet without attribute label ciphertext is identified as the second code snippet to be verified, so as to further determine whether the code snippet is the first version code snippet adopted.

[0042] S250. Based on the fragment hash value of the first code fragment to be verified, the fragment hash value of the second code fragment to be verified, the first version code fragment, and the first version code fragment, determine the target code fragment adopted by the target code in the initial code.

[0043] Optionally, a hash value consistency check is performed on the hash value of the first code segment to be verified and the hash value of the first version code segment. The first code segment to be verified that passes the hash value consistency check is determined as the first adopted code segment, and the first code segment to be verified that fails the hash value consistency check is determined as the third code segment to be verified. Based on the second code segment to be verified, the third code segment to be verified, and the first version code segment, the second adopted code segment is determined. The first adopted code segment and the second adopted code segment are integrated to obtain the target code segment adopted by the target code in the initial code.

[0044] The first accepted code segment refers to the code segment whose hash value, after hash value verification, matches the hash value corresponding to the first version of the code segment. The third code segment to be verified refers to the code segment whose hash value, after hash value verification, does not match the hash value corresponding to the first version of the code segment. The second accepted code segment refers to the code segment that was accepted by the target code but did not undergo hash value verification.

[0045] Furthermore, based on the second code segment to be verified, the third code segment to be verified, and the first version code segment, the second adopted code segment can be determined by integrating the second code segment to be verified and the third code segment to be verified to obtain the target code segment to be verified; performing code similarity analysis on the target code segment to be verified and the first version code segment to obtain the code segment similarity between the target code segment to be verified and the first version code segment; and determining the code segment in the target code segment whose code similarity meets the code adoption condition as the second adopted code segment.

[0046] The target code segment to be verified refers to a code segment in the target code that lacks attribute tag ciphertext or fails hash value consistency verification, and is the first version of the initial code segment that needs further verification before adoption. Code segment similarity refers to the overall similarity between the target code segment to be verified and the first version code segment in terms of structure, syntax, logic, and functionality. Code adoption criteria are pre-set manually based on actual circumstances or experience; for example, the code adoption criteria could be a code segment similarity greater than or equal to a similarity threshold, such as 80%.

[0047] S260. Determine the code adoption rate of the initial code based on the target code snippet and the first version code snippet.

[0048] Optionally, a weighted sum of the total number of lines in the first adopted code segment and the total number of lines in the second adopted code segment in the target code segment is performed to obtain the number of adopted lines in the initial code; the code adoption rate of the initial code is obtained by dividing the number of adopted lines by the total number of lines in the first version code segment.

[0049] Here, the number of lines of code adopted refers to the number of lines of code in the initial code that are adopted by the target code.

[0050] This application embodiment obtains initial code, including multiple first-version code fragments, generated by a code intelligent generation model, and determines the original text of the attribute tags of the first-version code fragments based on the fragment metadata of the first-version code fragments; encrypts the original text of the attribute tags of the first-version code fragments based on the code version information of the initial code to obtain attribute tag ciphertext; obtains the target code corresponding to the initial code after actual use; wherein, the target code includes multiple second-version code fragments; at least one second-version code fragment has a corresponding attribute tag ciphertext; the second-version code fragment with attribute tag ciphertext is determined as the first code fragment to be verified, and the second-version code fragment without attribute tag ciphertext is determined as the second code fragment to be verified; the target code fragment adopted by the target code is determined in the initial code based on the fragment hash value of the first code fragment to be verified, the second code fragment to be verified, the fragment hash value of the first-version code fragment, and the first-version code fragment; the code adoption rate of the initial code is determined based on the target code fragment and the first-version code fragment. The above technical solution, by using fragment hash values ​​and code segment similarity analysis, filters out code segments in the target code that adopt the initial code, effectively avoiding the problem of missing statistics caused by changes or loss of attribute tags for some code segments, and can ensure the reliability and accuracy of the code adoption rate determination.

[0051] Example 3 Figure 3 This is a schematic diagram of a smart code generation adoption rate determination device according to Embodiment 3 of this application. It is applicable to situations where the adoption rate of smart generated code is calculated. This smart code generation adoption rate determination device can be implemented in hardware and / or software, and can be configured in a computer device, such as a server. Figure 3 As shown, the device includes: The tag determination module 310 is used to obtain the initial code generated by the intelligent code generation model, which includes multiple first-version code snippets, and to determine the original text of the attribute tags of the first-version code snippets based on the snippet metadata of the first-version code snippets. The tag encryption module 320 is used to encrypt the original text of the attribute tags of the first version code fragment according to the code version information of the initial code, so as to obtain the ciphertext of the attribute tags. The code acquisition module 330 is used to acquire the target code corresponding to the initial code after actual use; wherein, the target code includes multiple second-version code fragments; at least one second-version code fragment has a corresponding attribute tag ciphertext; The fragment determination module 340 is used to determine the target code fragment adopted by the target code in the initial code based on the attribute tag ciphertext of the second version code fragment, the attribute tag ciphertext of the first version code fragment, the first version code fragment, and the second version code fragment in the target code. The adoption rate determination module 350 is used to determine the code adoption rate of the initial code based on the target code snippet and the first version code snippet.

[0052] This application embodiment obtains initial code, including multiple first-version code fragments, generated by a code intelligent generation model. Based on the fragment metadata of the first-version code fragments, the original text of the attribute tags for each first-version code fragment is determined. The original text of the attribute tags for each first-version code fragment is encrypted based on the code version information of the initial code, resulting in encrypted attribute tags. The target code corresponding to the initial code after actual use is obtained. The target code includes multiple second-version code fragments; at least one second-version code fragment has a corresponding encrypted attribute tag. Based on the encrypted attribute tags of the second-version code fragments in the target code, the encrypted attribute tags of the first-version code fragments, and the first and second-version code fragments, the target code fragments adopted by the target code in the initial code are determined. Based on the target code fragments and the first-version code fragments, the code adoption rate of the initial code is determined. This technical solution, by inserting code attribute tags into the intelligently generated code, allows for tracking of the code throughout the entire process from code generation to use, accurately calculating the proportion of intelligently generated code in the final code, and ensuring the reliability and accuracy of the determined code adoption rate.

[0053] Optionally, the attribute tag ciphertext includes a fragment hash value; correspondingly, the fragment determination module 340 includes: The segmentation unit is used to identify the second version code segment with attribute label ciphertext as the first code segment to be verified, and to identify the second version code segment without attribute label ciphertext as the second code segment to be verified. The segment determination unit is used to determine the target code segment adopted by the target code in the initial code based on the segment hash value of the first code segment to be verified, the second code segment to be verified, the segment hash value of the first version code segment, and the first version code segment.

[0054] Optionally, the fragment determination unit includes: The first segment determination subunit is used to perform hash value consistency verification on the segment hash value of the first code segment to be verified and the segment hash value of the first version code segment, and to determine the first code segment to be verified that passes the hash value consistency verification as the first adopted code segment, and to determine the first code segment to be verified that fails the hash value consistency verification as the third code segment to be verified. The second segment determination subunit is used to determine the second adopted code segment based on the second code segment to be verified, the third code segment to be verified, and the first version code segment; The third segment determines the sub-unit, which is used to integrate the first adopted code segment and the second adopted code segment to obtain the target code segment adopted by the target code in the initial code.

[0055] Optionally, the second segment determines the sub-unit, specifically used for: The second and third code segments to be verified are integrated to obtain the target code segment to be verified; Code similarity analysis is performed on the target code snippet to be verified and the first version code snippet to obtain the code segment similarity between the target code snippet to be verified and the first version code snippet; The code segment whose code similarity meets the code adoption criteria among the target code segments to be verified is identified as the second code segment to be adopted.

[0056] Optional, the adoption rate determination module 350, specifically used for: The total number of lines in the first adopted code segment and the total number of lines in the second adopted code segment in the target code segment are weighted and summed to obtain the number of adopted lines in the initial code. The code adoption rate of the initial code is obtained by dividing the number of adopted lines of code by the total number of lines of code in the first version.

[0057] Optionally, the label determination module 310 is specifically used for: Perform a hash calculation on the first version of the code snippet to obtain the snippet hash value of the first version of the code snippet; By integrating the fragment hash value of the first version code fragment with the code generation time and code generation tool in the fragment metadata, the original text of the attribute tag of the first version code fragment is obtained.

[0058] The intelligent code generation adoption rate determination device provided in this application embodiment can execute the intelligent code generation adoption rate determination method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing each intelligent code generation adoption rate determination method.

[0059] According to embodiments of this application, this application also provides an electronic device, a readable storage medium, and a computer program product.

[0060] Example 4 Figure 4This is a schematic diagram of the structure of an electronic device 410 implementing the intelligent code generation acceptance rate determination method of the embodiments of this application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.

[0061] like Figure 4 As shown, the electronic device 410 includes at least one processor 411 and a memory, such as a read-only memory 412 or a random access memory 413, communicatively connected to the at least one processor 411. The memory stores computer programs executable by the at least one processor. The processor 411 can perform various appropriate actions and processes based on the computer program stored in the read-only memory 412 or loaded from storage unit 418 into the random access memory 413. The random access memory 413 can also store various programs and data required for the operation of the electronic device 410. The processor 411, read-only memory 412, and random access memory 413 are interconnected via a bus 414. An input / output interface 415 is also connected to the bus 414.

[0062] Multiple components in electronic device 410 are connected to input / output interface 415, including: input unit 416, such as keyboard, mouse, etc.; output unit 417, such as various types of monitors, speakers, etc.; storage unit 418, such as disk, optical disk, etc.; and communication unit 419, such as network card, modem, wireless transceiver, etc. Communication unit 419 allows electronic device 410 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0063] Processor 411 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 411 include, but are not limited to, central processing units, graphics processing units, various special-purpose artificial intelligence computing chips, various processors running machine learning model algorithms, digital signal processors, and any suitable processor, controller, microcontroller, etc. Processor 411 performs the various methods and processes described above, such as the intelligent code generation adoption rate determination method.

[0064] In some embodiments, the intelligent code generation acceptance rate determination method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 418. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 410 via read-only memory 412 and / or communication unit 419. When the computer program is loaded into random access memory 413 and executed by processor 411, one or more steps of the intelligent code generation acceptance rate determination method described above may be performed. Alternatively, in other embodiments, processor 411 may be configured as the intelligent code generation acceptance rate determination method by any other suitable means (e.g., by means of firmware).

[0065] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays, application-specific integrated circuits (ASICs), application-specific standard products (ASICs), systems-on-a-chip (SoCs), payload programmable logic devices, computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0066] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable intelligent code generation and adoption determination device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0067] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, optical fibers, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0068] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a cathode ray tube or liquid crystal display monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0069] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0070] A computing system can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product within the cloud computing service system to address the shortcomings of traditional physical hosts and virtual private servers, such as high management difficulty and weak business scalability.

[0071] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.

[0072] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for determining the adoption rate of intelligent generated code, characterized in that, include: Obtain the initial code generated by the intelligent code generation model, which includes multiple first-version code snippets, and determine the original text of the attribute tags of the first-version code snippets based on the snippet metadata of the first-version code snippets; Based on the code version information of the initial code, the original text of the attribute tags of the first version code fragment is encrypted to obtain the ciphertext of the attribute tags; Obtain the target code corresponding to the initial code after actual use; wherein, the target code includes multiple second-version code fragments; at least one second-version code fragment has a corresponding attribute tag ciphertext; Based on the attribute tag ciphertext of the second version code fragment in the target code, the attribute tag ciphertext of the first version code fragment, the first version code fragment, and the second version code fragment, determine the target code fragment in the initial code that was adopted by the target code; The code adoption rate of the initial code is determined based on the target code snippet and the first version code snippet.

2. The method according to claim 1, characterized in that, The attribute tag ciphertext includes a fragment hash value; correspondingly, determining the target code fragment adopted by the target code in the initial code based on the attribute tag ciphertext of the second version code fragment in the target code, the attribute tag ciphertext of the first version code fragment, the first version code fragment, and the second version code fragment includes: The second version code fragment with attribute tag ciphertext is identified as the first code fragment to be verified, and the second version code fragment without attribute tag ciphertext is identified as the second code fragment to be verified. Based on the fragment hash value of the first code fragment to be verified, the second code fragment to be verified, the fragment hash value of the first version code fragment, and the first version code fragment, the target code fragment adopted by the target code in the initial code is determined.

3. The method according to claim 2, characterized in that, The step of determining the target code segment adopted by the target code in the initial code based on the segment hash value of the first code segment to be verified, the second code segment to be verified, the segment hash value of the first version code segment, and the first version code segment includes: A hash value consistency check is performed on the hash value of the first code segment to be checked and the hash value of the first version code segment. The first code segment to be checked that passes the hash value consistency check is determined as the first adopted code segment, and the first code segment to be checked that fails the hash value consistency check is determined as the third code segment to be checked. The second adopted code segment is determined based on the second code segment to be verified, the third code segment to be verified, and the first version code segment; The first adopted code fragment and the second adopted code fragment are integrated to obtain the target code fragment adopted by the target code in the initial code.

4. The method according to claim 3, characterized in that, The step of determining the second adopted code segment based on the second code segment to be verified, the third code segment to be verified, and the first version code segment includes: The second and third code segments to be verified are integrated to obtain the target code segment to be verified; A code similarity analysis is performed on the target code segment to be verified and the first version code segment to obtain the code segment similarity between the target code segment to be verified and the first version code segment. The code segment whose code similarity meets the code adoption criteria among the target code segments to be verified is determined as the second adopted code segment.

5. The method according to claim 3, characterized in that, Determining the code adoption rate of the initial code based on the target code snippet and the first version code snippet includes: The total number of lines in the first adopted code segment and the total number of lines in the second adopted code segment in the target code segment are weighted and summed to obtain the number of adopted lines in the initial code. The code adoption rate of the initial code is obtained by dividing the number of adopted lines of code by the total number of lines of the first version code snippet.

6. The method according to claim 1, characterized in that, Based on the fragment metadata of the first version code fragment, determine the original text of the attribute tags for the first version code fragment, including: Perform a hash calculation on the first version code fragment to obtain the fragment hash value of the first version code fragment; The fragment hash value of the first version code fragment, as well as the code generation time and code generation tool in the fragment metadata, are integrated to obtain the original text of the attribute tag of the first version code fragment.

7. A device for determining the adoption rate of intelligent generated code, characterized in that, include: The tag determination module is used to obtain the initial code generated by the intelligent code generation model, which includes multiple first-version code snippets, and determine the original text of the attribute tags of the first-version code snippets based on the snippet metadata of the first-version code snippets; The tag encryption module is used to encrypt the original text of the attribute tags of the first version code fragment according to the code version information of the initial code, so as to obtain the ciphertext of the attribute tags; The code acquisition module is used to acquire the target code corresponding to the initial code after actual use; wherein, the target code includes multiple second-version code fragments; at least one second-version code fragment has a corresponding attribute tag ciphertext; The fragment determination module is used to determine the target code fragment adopted by the target code in the initial code based on the attribute tag ciphertext of the second version code fragment in the target code, the attribute tag ciphertext of the first version code fragment, the first version code fragment, and the second version code fragment. The adoption rate determination module is used to determine the code adoption rate of the initial code based on the target code snippet and the first version code snippet.

8. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the intelligent code generation adoption rate determination method as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the intelligent code generation adoption rate determination method as described in any one of claims 1-6.

10. A computer program product comprising a computer program that, when executed by a processor, implements the intelligent code generation adoption rate determination method according to any one of claims 1-6.