Code processing method and apparatus, computing device cluster, and storage medium

By using the code processing model to automatically identify the modification intention and location in the modification opinion information, the problems of high error rate and low efficiency caused by manual understanding are solved, and more efficient and accurate code processing is achieved.

WO2025175746A1PCT designated stage Publication Date: 2025-08-28HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD

Patent Information

Application Number
PCT/CN2024/117958
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-02-23
Filing Date
2024-09-10
Publication Date
2025-08-28

AI Technical Summary

Technical Problem

In the existing code processing methods, the descriptive text of the modification suggestions is unclear, resulting in high error rate and low processing efficiency of manual understanding.

Method used

The pre-trained code processing model is adopted to automatically identify the modification intention and code modification location in the modification opinion information through natural language processing technology to achieve automated understanding and processing.

Benefits of technology

It reduces the error rate during code processing, improves processing efficiency, and ensures the accuracy and consistency of the modification of opinion information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024117958_28082025_PF_FP_ABST
    Figure CN2024117958_28082025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of artificial intelligence, and discloses a code processing method and apparatus, a computing device cluster, and a storage medium. According to the code processing method provided by the present application, in a code processing process, a first code and modification opinion information are obtained, and due to the semantic meaning of the modification opinion information, an association between the first code and the modification opinion information, and the like, a certain rule exists between a modification intent and a code modification position. Therefore, on the basis of the first code and the modification opinion information, the modification intent and the code modification position can be obtained, so as to realize automatic understanding of the modification opinion information. The first code is processed on the basis of the modification intent and the code modification position. Since the amount of codes to be processed may be enormous, compared with manually understanding the modification opinion information and then processing the codes, the code processing method provided by the present application can reduce the error rate in the code processing process, and improve the code processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Code processing method, device, computing device cluster and storage medium

[0001] This application claims priority to Chinese patent application number 202410204960.3, filed on February 23, 2024, entitled “Code processing method, apparatus, computing device cluster, and storage medium,” the entire contents of which are incorporated herein by reference. Technical Field

[0002] The present application relates to the field of artificial intelligence technology, and in particular to a code processing method, apparatus, computing device cluster, and storage medium. Background Art

[0003] Artificial intelligence technology can be applied to code processing. During the code processing process, it can provide users with modification suggestions based on their original code. These modification suggestions typically include a code snippet and descriptive text. The descriptive text indicates how to process the original code. This processing method may include inserting the code snippet in the modification suggestion into the original code, deleting the code snippet in the modification suggestion from the original code, or replacing part of the original code with the code snippet in the modification suggestion. Users then process the original code according to the modification suggestion.

[0004] Currently, one code processing method is to provide users with a one-click insertion function, which provides users with a button. Users can click the button to insert the code segment in the modification suggestion into the cursor position, or replace the code segment in the selected original code with the code segment in the modification suggestion.

[0005] The above code processing method requires manual understanding of the descriptive text in the above modification suggestions and identification of the modification location in the original code corresponding to the code segment in the modification suggestion. The error rate in the code processing process is high and the code processing efficiency is low.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide a code processing method, apparatus, computing device cluster, and storage medium that can reduce the error rate during code processing and improve code processing efficiency. The technical solution is as follows.

[0008] In a first aspect, a code processing method is provided, the method comprising: a code development client acquires a first code obtained by development; the code development client analyzes the acquired first code in response to a code analysis instruction, and obtains modification opinion information for the first code, the modification opinion information comprising a descriptive text and a code segment to be processed, the descriptive text indicating an intention to modify the first code based on the code segment, wherein the modification intention comprises deleting the code segment from the first code, adding the code segment to the first code, and replacing a code segment in the first code with the code segment; the code development client analyzes the modification opinion information obtained based on the analysis and the first code, and obtains the modification intention and a code modification position in the first code corresponding to the modification opinion information; the code development client performs processing corresponding to the modification intention based on the code segment at the code modification position in the first code, based on the modification intention and the code modification position.

[0009] Among them, the descriptive text in the modification opinion information is a modification suggestion generated by a text generation model and described in natural language, which can indicate the cause of the error in the first code, the location where the error occurred, and the modification method for the error, etc. The code segment in the modification opinion information corresponds to the descriptive text. The code segment may be the complete, modified first code, or it may be the modification result at the code modification position in the first code. The modification intentions for the first code include: inserting the code segment in the modification opinion information, deleting the code segment in the modification opinion information, and modifying part of the code in the first code to the code segment in the modification opinion information, etc., which can be simply referred to as addition, deletion and modification. The code modification position can be represented by a line number or a segment number.

[0010] The code processing method provided in the embodiment of the present application obtains the first code and modification opinion information during the code processing process. Since the semantics of the modification opinion information and the association between the first code and the modification opinion information, etc., have certain regularities with the modification intention and the code modification position, the modification intention and the code modification position can be obtained based on the first code and the modification opinion information to achieve automated understanding of the modification opinion information. Based on the modification intention and the code modification position, the first code is processed. Since the amount of code to be processed may be huge, the code processing method provided in the embodiment of the present application can reduce the error rate in the code processing process and improve the processing efficiency of the code, compared with manually understanding the above-mentioned modification opinion information and then processing the code.

[0011] Optionally, the code development client analyzes the modification opinion information and the first code obtained by analysis to obtain the modification intention and the code modification location in the first code corresponding to the modification opinion information, including: the code development client responds to a trigger operation for the modification opinion information, analyzes the modification opinion information and the first code, and obtains the modification intention and the code modification location. Only in response to the trigger operation for the modification opinion information can subsequent code processing be executed, thereby ensuring the accuracy of the modification opinion information used in the subsequent code processing, thereby improving the accuracy of code processing.

[0012] Optionally, the above-mentioned code development client performs processing corresponding to the modification intention based on the code segment at the code modification location in the first code based on the modification intention and the code modification location, including: the code development client performs processing corresponding to the modification intention based on the code segment at the code modification location in the first code based on the modification intention and the code modification location to obtain a second code; the code development client displays the second code in a preview window; if an agreement is received, the code development client replaces the first code with the second code. After obtaining the modification intention and the code modification location, the first code is not automatically modified, but the modification result is provided to the user for preview. After the user agrees, the original code is replaced with the modified code, which can avoid code processing errors caused by incorrect identification of the modification intention or the code modification location.

[0013] Optionally, the above-mentioned code development client performs processing corresponding to the modification intention based on the code segment at the code modification position in the first code based on the modification intention and the code modification position, and obtains the second code including: if the modification intention is to add, the code development client inserts the code segment in the modification opinion information after the code at the code modification position in the first code to obtain the second code; or, if the modification intention is to delete, the code development client deletes the code at the code modification position from the first code to obtain the second code; or, if the modification intention is to modify, the code development client deletes the code at the code modification position from the first code, inserts the code segment in the modification opinion information at the code modification position to obtain the second code.

[0014] Optionally, the above-mentioned modification intentions and code modification locations are obtained through a code processing model, and the training process of the code processing model includes: obtaining a first training data set, the first training data set includes multiple groups of first sample data and a first label, the first sample data includes a group of first codes and modification opinion information, and the first label includes a group of multiple groups of modification intentions and code modification locations corresponding to the first sample data; based on the first training data set, the code processing model is trained. The code processing model has powerful natural language processing capabilities, can simultaneously generate modification intentions and code modification locations, and is highly efficient.

[0015] Optionally, the above-mentioned modification intention is obtained through an intention recognition model, and the training process of the intention recognition model includes: obtaining a second training data set, the second training data set includes multiple groups of second sample data and second labels, the second sample data includes a group of first codes and modification opinion information, and the second label includes a modification intention corresponding to the second sample data; based on the second training data set, the intention recognition model is trained.

[0016] Optionally, the above-mentioned code modification location is obtained through a positioning model, and the training process of the positioning model includes: obtaining a third training data set, the third training data set includes multiple groups of third sample data and third labels, the third sample data includes a group of first codes, modification opinion information and modification intentions, and the third label includes a code modification location corresponding to the third sample data; based on the third training data set, the positioning model is trained.

[0017] The above-mentioned intent recognition model and positioning model are natural language processing (NLP) models that can be used for text generation or classification, such as traditional machine learning models (such as Naive Bayes classification) or deep learning models (such as convolutional neural network models, recurrent neural network models, and transformer models).

[0018] In a second aspect, a code processing device is provided for executing the above-mentioned code processing method. Specifically, the code processing device includes a functional module for executing the code processing method provided in the above-mentioned first aspect or any optional manner of the above-mentioned first aspect.

[0019] In a third aspect, a computing device cluster is provided, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster executes operations performed to implement the code processing method provided in the first aspect or any optional manner of the first aspect.

[0020] In a fourth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the operations performed by the code processing method provided in the first aspect or any optional method of the first aspect.

[0021] In a fifth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device cluster, the computing device cluster executes the code processing method provided in any optional implementation of the first aspect or any of the above aspects.

[0022] Based on the implementation methods provided in the above aspects, this application can also be further combined to provide more implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] FIG1 is a schematic diagram of an implementation environment of a code processing method provided in an embodiment of the present application;

[0024] FIG2 is a schematic diagram of the structure of a code processing system provided in an embodiment of the present application;

[0025] FIG3 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0026] FIG4 is a schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application;

[0027] FIG5 is a schematic diagram of the structure of another computing device cluster provided in an embodiment of the present application;

[0028] FIG6 is a simplified flowchart of a code processing method provided in an embodiment of the present application;

[0029] FIG7 is a flowchart of a code processing method provided in an embodiment of the present application;

[0030] FIG8 is a schematic diagram of modification suggestion information provided in an embodiment of the present application;

[0031] FIG9 is a flowchart of a code processing model training method provided in an embodiment of the present application;

[0032] FIG10 is a simplified flowchart of another code processing method provided in an embodiment of the present application;

[0033] FIG11 is a flowchart of another code processing method provided in an embodiment of the present application;

[0034] FIG12 is a flowchart of an intent recognition model training method provided in an embodiment of the present application;

[0035] FIG13 is a flow chart of a positioning model training method provided in an embodiment of the present application;

[0036] FIG14 is a schematic diagram of the structure of a code processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0037] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0038] FIG1 is a schematic diagram of an implementation environment for a code processing method according to an embodiment of the present application. As shown in FIG1 , the implementation environment includes a terminal 101 and a server 102, which are connected to each other via a wired network or a wireless network. The number of terminals and servers shown in FIG1 is for example only, and the embodiments of the present application do not limit the number of terminals and servers in the implementation environment.

[0039] The terminal 101 is used as a code development client to obtain the first code and send the first code to the server 102. The terminal 101 includes but is not limited to: a scanner, a smart phone, a smart TV, a TV box, a keyboard, a mouse, a game controller, a smart wearable device, a tablet computer, a portable personal computer, a mobile Internet device, etc. The embodiment of the present application does not limit the type of the terminal 101. The server 102 is used to process the first code according to the code processing method provided in the embodiment of the present application, obtain the modification intention and the code modification location, and send the modification intention and the code modification location to the terminal 101. The server 102 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), big data and artificial intelligence platforms.

[0040] In the embodiment of the present application, the terminal 101 obtains the first code, sends the first code to the server 102, and the server 102 processes the first code. In some embodiments, the terminal 101 or the server 102 can also independently complete the process of obtaining the first code and processing the first code.

[0041] The above-mentioned code processing method can be implemented by a code processing system. As shown in Figure 2, the code processing system includes a code processing device 200, which includes a modification opinion acquisition module 201 and a code intelligent processing module 202, which is used to interact with the server to obtain the modification intention and the code modification location. During the code processing process, the modification opinion acquisition module 201 interacts with the server to obtain the modification opinion information output by the opinion acquisition model on the server for the first code. Based on the modification opinion information and the first code, the code intelligent processing module 202 interacts with the server to obtain the modification intention and code modification location output by the code processing model (or intention recognition model and positioning model) on the server for the modification opinion information, so that the code processing device 200 can further process the first code based on the acquired modification intention and code modification location. It should be noted that the above-mentioned module division is only an example, and the embodiments of the present application are not limited to this. Among them, the opinion acquisition model can be a large language model (LLM) or other natural language processing models. LLM is a large-scale, multi-parameter deep learning model that can learn language structure, grammatical knowledge, and semantics from large-scale data sets to understand and generate human language. The code processing model is a model with powerful natural language processing capabilities such as LLM. The intent recognition model can be an NLP model that can be used for text generation or classification, such as a traditional machine learning model (naive Bayes classification, etc.) or a deep learning model (convolutional neural network model, recurrent neural network model, and Transformers, etc.), which is not limited in the embodiments of this application.

[0042] For example, the code processing device 200 is a programming plug-in in an integrated development environment (IDE) client. During code debugging, the programming plug-in interacts with the server to obtain the modification intention and modification location for the code. The modification intention is the code processing method, such as adding a few lines of code, deleting a few lines of code, or replacing a few lines of code. The code modification location is the line number of the code corresponding to the modification intention.

[0043] The code processing device 200 may be implemented by software or hardware. As an example, the implementation of the code processing device 200 is described below.

[0044] As an example of a software functional unit, the code processing device 200 may include code running on a computing instance. The computing instance may be at least one of a physical host (computing device), a virtual machine, a container, and other computing devices. Furthermore, the above-mentioned computing device may be one or more. For example, the code processing device 200 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the application may be distributed in the same region or in different regions. The multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.

[0045] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.

[0046] As an example of a hardware functional unit, the code processing device 200 may include at least one computing device, such as a server. Alternatively, the code processing device 200 may be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0047] The multiple computing devices included in the code processing apparatus 200 can be distributed in the same region or in different regions. The multiple computing devices included in the code processing apparatus 200 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the code processing apparatus 200 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.

[0048] Figure 3 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. The computing device 300 can be the terminal 101 or the server 102 in the above implementation environment, and the present embodiment does not limit this. It should be understood that the computing device described below can implement any function in any of the following methods.

[0049] As shown in Figure 3, computing device 300 includes a bus 302, a processor 304, a memory 306, and a communication interface 308. Processor 304, memory 306, and communication interface 308 communicate with each other via bus 302. It should be understood that this application does not limit the number of processors and memories in computing device 300.

[0050] Bus 302 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG3 shows a single bus line, but this does not imply a single bus or type of bus. Bus 302 may include a path for transmitting information between various components of computing device 300 (e.g., memory 306, processor 304, and communication interface 308).

[0051] The processor 304 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0052] The memory 306 may include volatile memory, such as random access memory (RAM). The processor 304 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0053] The memory 306 stores executable program codes, and the processor 304 executes the executable program codes to implement the functions of the aforementioned code processing apparatus 200, thereby implementing the code processing method. That is, the memory 306 stores instructions for executing the code processing method.

[0054] The communication interface 308 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 300 and other devices or a communication network.

[0055] Embodiments of the present application also provide a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.

[0056] As shown in Figure 4, the computing device cluster includes at least one computing device 300. The memory 306 of one or more computing devices 300 in the computing device cluster may store the same instructions for executing the code processing method.

[0057] In some possible implementations, the memory 306 of one or more computing devices 300 in the computing device cluster may also store partial instructions for executing the code processing method. In other words, the combination of one or more computing devices 300 can jointly execute the instructions for executing the code processing method.

[0058] It should be noted that the memory 306 in different computing devices 300 in the computing device cluster can store different instructions, each used to execute part of the functions of the code processing apparatus 200. In other words, the instructions stored in the memory 306 in different computing devices 300 can implement the functions of one or more modules in the modification suggestion acquisition module 201 and the code intelligent processing module 202.

[0059] In some possible implementations, one or more computing devices in a computing device cluster may be connected via a network. The network may be a wide area network (WAN) or a local area network (LAN), etc. FIG. 5 shows a possible implementation. As shown in FIG. 5 , two computing devices 300A and 300B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 306 in the computing device 300A stores instructions for executing the functions of the modification opinion acquisition module 201. At the same time, the memory 306 in the computing device 300B stores instructions for executing the functions of the code intelligence processing module 202.

[0060] The connection method between the computing device clusters shown in Figure 5 can be considered to be that the code processing method provided in this application requires a large amount of data storage, so the functions implemented by the code intelligent processing module 202 are considered to be handed over to the computing device 300B for execution.

[0061] It should be understood that the functionality of the computing device 300A shown in FIG5 may also be implemented by multiple computing devices 300. Similarly, the functionality of the computing device 300B may also be implemented by multiple computing devices 300.

[0062] In the related art, the descriptive text is not obtained based on a unified description template, and the code segments in the modification opinion information are not obtained based on a unified modification method. Therefore, the modification opinion information provided is random and diverse, and is relatively vague. It cannot clearly indicate whether the modification intention is to add, delete, or modify, nor can it clearly indicate which position of the code the modification is directed to. As a result, the server cannot identify the modification opinion information through a fixed recognition template to obtain the modification intention or the code modification location. At present, it is usually necessary to manually understand the modification opinion information, obtain the modification intention and the code modification location, and then instruct the computing device to process the first code. When processing a large amount of first code, manual understanding takes a long time and is prone to errors, resulting in a high error rate in code processing and low code processing efficiency.

[0063] To address the above issues, an embodiment of the present application provides a code processing method that uses a pre-trained model to process a first code and modification opinion information to obtain the modification intent and the code modification location, thereby achieving the purpose of understanding the modification opinion information. The model is trained to learn the structure, semantics, and relationship between the first code and the modification opinion information, thereby simulating human thinking to more accurately understand the modification opinion information. Using this model instead of manual labor can reduce the error rate of code processing and improve the efficiency of code processing.

[0064] The embodiments of the present application provide two implementation methods for understanding modification opinion information using models. The first one is that the code processing process uses a model, namely the code processing model, which can output the modification intention and the code modification location at the same time based on the first code and the modification opinion information. The second one is that the code processing process uses two models, namely the intention recognition model and the positioning model. The intention recognition model can output the modification intention based on the modification opinion information of the first code, and the positioning model can output the code modification location based on the first code, the modification opinion information and the modification intention. The above two implementation methods are respectively described below in conjunction with Figures 6 to 13.

[0065] Figure 6 is a schematic diagram of the code processing process based on the code processing model. Figure 6 includes two processes: one is to obtain the first code and modification suggestion information, then input the first code and modification suggestion information into the code processing model to output the modification intention and the code modification location, and then process the first code based on the modification intention and the code modification location. The other is to train the code processing model based on the training dataset. These two processes are further explained below based on Figures 7 to 9.

[0066] FIG7 is a flowchart of a code processing method provided according to an embodiment of the present application. Below, with reference to FIG7 , a code development client obtains a first code, and a server obtains a modification intention and a code modification location as an example to describe the code processing method implemented based on the code processing model in more detail. The method includes the following steps:

[0067] 700. The code development client displays a code processing interface, which is used to provide a code processing function.

[0068] Among them, the code processing interface is a functional interface provided by the code development client, which includes multiple function buttons, each function button corresponds to a different code processing function, and can assist in code processing.

[0069] For example, the code processing interface is a functional interface for code debugging and can be implemented as a programming plug-in of an IDE client, so that a user can open the code processing interface in the IDE client to process the code.

[0070] 701. The code development client obtains a developed first code in response to an operation on the code processing function on the code processing interface.

[0071] Among them, the code processing function can provide multiple input methods to obtain the first code. For example, the code processing function can provide an input interface, which displays different code input methods, such as entering the first code or entering relevant information of the first code. If the code input method is to enter the first code, the code development client directly obtains the input first code through the input interface. If the code input method is to enter relevant information of the first code, the relevant information of the first code is first obtained through the input interface, and then the first code is obtained based on the relevant information of the first code. The relevant information of the first code includes the address of the first code and the identification information of the first code, etc., which is not limited in this embodiment of the present application.

[0072] For example, you can open a code processing interface in an IDE client, enter code into the input interface provided by the code processing interface, and the IDE client will retrieve the entered code from the input interface. Alternatively, you can open a code processing interface in an IDE client, enter the address of the code into the input interface provided by the code processing interface, and the IDE client will retrieve the address of the code from the input interface, and then retrieve the code from the address.

[0073] 702. In response to a submission operation on the first code, the code development client sends a code processing instruction to the server, where the code processing instruction carries the first code.

[0074] In the embodiment of the present application, the code processing interface provides a submit button for the user, and the user clicks the button to initiate a submit operation. In response to the submit operation, the code development client sends a code processing instruction carrying the first code to the server.

[0075] The above steps 700 to 702 are described using the example of a code processing instruction carrying the first code. In some embodiments, the code processing instruction carries information related to the first code. After the user enters information related to the first code in the input interface, the code development client does not obtain the first code based on the information. Instead, in response to the submission of the first code, the code processing instruction carrying the information related to the first code is sent to the server.

[0076] 703. The server receives the code processing instruction.

[0077] The embodiment of the present application is described by taking the example of a server receiving a code processing instruction sent by a code development client. In some embodiments, the server periodically triggers the code processing instruction to process the first code stored in the server itself.

[0078] 704. The server obtains a first code based on the code processing instruction.

[0079] In an embodiment of the present application, the code processing instruction carries the first code, and the server directly obtains the first code carried by the code processing instruction. In some embodiments, the code processing instruction carries relevant information of the first code, and the server obtains the first code through the relevant information.

[0080] 705. Based on the first code, the server obtains modification opinion information for the first code through the opinion acquisition model, and returns the modification opinion information of the first code to the code development client, where the modification opinion information includes descriptive text and a code segment to be processed, and the descriptive text indicates the modification intention of the first code based on the code segment, where the modification intention includes deleting the code segment from the first code, adding the code segment to the first code, and replacing the code segment in the first code with the code segment.

[0081] In an embodiment of the present application, the server invokes the opinion acquisition model, processes the first code, and obtains modification opinion information for the first code. When returning the modification opinion information to the code development client, the modification opinion information can take the form shown in Figure 8. Referring to Figure 8, area A is the display area for the modification opinion information, areas B1 and B2 contain descriptive text, and area C contains the modified code segment. This embodiment of the present application does not limit the form of the modification opinion information.

[0082] For example, the opinion acquisition model can check the variable settings, data structures, system and standard library calls, redundant code and loop conditions in the code based on the learned code structure and programming syntax, find out the problems in the code, generate modification opinion information for the problem, and return the modification opinion information to the code development client. The modification opinion information includes the modified code segment and descriptive text for the modification. The opinion acquisition model is stored in the server. The code development client can interact with the server to enable the opinion acquisition model in the server to process the code and output modification opinion information.

[0083] The embodiment of the present application is described by taking the example of a server obtaining modification opinion information through an opinion acquisition model and returning the modification opinion information to a code development client. By providing modification opinion information to the code development client for display to the user, the accuracy of code processing is improved. In some embodiments, after the server obtains the modification opinion information, it directly obtains the modification intention and the code modification location based on the modification opinion information, that is, the server can automatically execute the subsequent code processing process, thereby avoiding problems such as time delays caused by manual inspection, and is more efficient.

[0084] The above process is explained by taking the example of the server obtaining the modification opinion information through the opinion acquisition model. In some embodiments, the server may not obtain the modification opinion information through the opinion acquisition model, but directly receive the modification opinion information generated by other devices, that is, the server receives the first code and the modification opinion information. The first code and the modification opinion information may be carried by the code processing instruction issued by the code development client, or may be carried by the code processing instruction issued by other devices. For example, the code development client sends the first code to other devices, and the other devices return the modification opinion information to the code development client. If the code development client receives a continue processing instruction for the modification opinion information, it sends the code processing instruction carrying the first code and the modification opinion information to the server. For another example, the code development client sends the first code to other devices, and after the other devices obtain the modification opinion information based on the first code, they directly send the code processing instruction carrying the first code and the modification opinion information to the server.

[0085] The above steps 702 to 705 are a possible implementation method of analyzing the acquired first code in response to the code analysis instruction to obtain modification opinion information for the first code. This implementation method obtains the modification opinion information through interaction between the code development client and the server, and can handle larger-scale code processing tasks.

[0086] 706. The code development client displays modification suggestion information for the first code, and in response to a trigger operation for the modification suggestion information, sends a continue processing instruction to the server, or, in response to a trigger operation for the modification suggestion information, stops the code processing process.

[0087] In some embodiments, the modification suggestion information for the first code displayed by the code development client can adopt the format of Figure 8 above. When displayed, the code development client not only displays the modification suggestion information, but also displays a continue processing button and a stop processing button. The continue processing button is used to respond to a trigger operation and instruct the code development client to send a continue processing instruction to the server, and the stop processing button is used to respond to a trigger operation and instruct the code development client to stop the code processing process.

[0088] In some embodiments, the code development client sends a continue processing instruction to the server in response to a trigger operation for the modification opinion information via a continue processing button. Alternatively, the code development client stops the code processing process in response to a trigger operation for the modification opinion information via a stop processing button. Herein, stopping the code processing process may be that the code development client sends a stop processing instruction to the server so that the server no longer executes the subsequent code processing process, or it may be that the code development client no longer executes the subsequent code processing process. If the server does not receive a continue processing instruction for the modification opinion information within a preset time period, the subsequent code processing process is no longer executed. The above-mentioned stopping of the code processing process may also be that the code development client opens a manual modification interface, displays the first code in the manual modification interface, and receives a modification operation for the first code. This is not limited in the embodiments of the present application.

[0089] 707. If a continue processing instruction is received, the server obtains the modification intention for the first code and the code modification position in the first code corresponding to the modification opinion information based on the first code and the modification opinion information for the first code through the code processing model.

[0090] In an embodiment of the present application, if a continue processing instruction is received, the server splices the first code and the modification opinion information in a preset order, calls the code processing model, processes the spliced ​​first code and the modification opinion information, and obtains the modification intention and the code modification position. The preset order is consistent with the splicing order of the first code and the modification opinion information in the training data of the code processing model. The code processing model has language understanding and text generation capabilities, and can analyze the first code and the modification opinion information to understand the modification intention for the first code, and find the code modification position corresponding to the modification opinion information in the first code, and then output the modification intention and the code modification position in a fixed format based on the pre-trained output format or the learned language knowledge.

[0091] The process for obtaining the modification intent and code modification location can include performing text segmentation on the concatenated first code and modification suggestion information to obtain multiple words, converting these multiple words into multiple vectors, invoking a code processing model to calculate these multiple vectors to obtain multiple combinations and their probabilities, selecting one of the multiple combinations, and outputting the combination in a fixed format. Each combination includes a pair of modification intent and code modification location, and the probability indicates the probability of outputting the corresponding combination given the first code input. Selecting a combination from the multiple combinations can include selecting the combination with the highest probability or randomly sampling a combination from multiple combinations with a probability threshold above the threshold. The fixed format includes the order of the modification intent and the code modification location, the format of the modification intent, and the format of the code modification location. The modification intent can be the modification intent itself or an identifier corresponding to the modification intent. The code modification location can be in the form of an array or list. Each vector indicates the position of the corresponding word in the first code or modification suggestion information and information such as the correlation between the corresponding word and other words.

[0092] Taking the use of line numbers to represent the location of the code as an example, the server splices the code and the modification opinion information in the order of code first and modification opinion information later. The code processing model is called to analyze the code with line numbers and the modification opinion information for the code to obtain the combination of modification intentions and line numbers and the probability of each combination. Among multiple combinations greater than the probability threshold, a combination is randomly sampled and the combination is output in the format of "Modification intention: XXX; Code modification location: [XX, XX, ...]". For example, after analysis, the code processing model obtains the modification intention of "deletion", and the line numbers corresponding to the code modification locations are 21, 22, 23, 24 and 25. Then the output of the code processing model is "Modification intention: deletion; Code modification location: [21, 22, 23, 24, 25]", indicating that the code from lines 21 to 25 should be deleted.

[0093] The embodiments of this application illustrate a pair of modification intent and code modification location with a corresponding probability. In some embodiments, each modification intent corresponds to a probability, and each code modification location also corresponds to a probability. From multiple modification intents and multiple code modification locations, one modification intent and one code modification location are selected, and the modification intent and code modification location are output in a fixed format.

[0094] The above steps 706 to 707 are a possible implementation method based on analyzing the modification opinion information and the first code to obtain the modification intention and the code modification position corresponding to the modification opinion information in the first code. This implementation method performs subsequent processing after the user confirms the modification opinion information, which can ensure the accuracy of the modification opinion information and thus improve the accuracy of code processing.

[0095] 708. The server sends the modification intention and code modification location of the modification suggestion information of the first code to the code development client.

[0096] In an embodiment of the present application, a server interacts with a code development client, sending the modification intent and code modification location output by the code processing model to the code development client. Subsequent code processing is then performed by the code development client, which can distribute the server's workload and reduce the server's burden. In some embodiments, the server processes the first code based on the modification intent and code modification location to obtain a second code, and sends the second code to the code development client. This can achieve user-unawareness during the code processing process, allowing the user to directly obtain the second code after entering the first code.

[0097] The above steps 705 to 708 are a possible implementation method for the server to obtain modification opinion information and further obtain modification intentions and code modification locations through interaction between the server and the code development client based on the modification opinion information. In this implementation method, after obtaining the modification opinion information, the server will first return the modification opinion information to the code development client, and the user on the code development client will decide whether to proceed to the next step of obtaining the modification intentions and code modification locations. After receiving the continue processing instruction triggered by the code development client, the server will obtain the modification intentions and code modification locations and execute the subsequent code processing process, which can be more in line with the user's code processing habits and thus improve the accuracy of code processing. In some embodiments, the server may not return the modification opinion information to the code development client, and the user does not need to determine whether to perform code processing based on the modification opinion information. Instead, after obtaining the modification opinion information, the server directly obtains the modification intentions and code modification locations based on the modification opinion information, and then returns the modification intentions and code modification locations to the code development client through step 708 to execute the subsequent code processing process, which can avoid problems such as time delays caused by manual inspection and is more efficient.

[0098] 709. The code development client performs processing corresponding to the modification intention based on the code segment at the code modification location in the first code based on the modification intention and the code modification location to obtain a second code.

[0099] In an embodiment of the present application, the code development client processes the first code based on the modification intention and code modification location output by the code processing model to obtain the second code. If the modification intention is to add, the code segment in the modification opinion information is inserted after the code at the code modification location in the first code to obtain the second code; or, if the modification intention is to delete, the code at the code modification location is deleted from the first code to obtain the second code; or, if the modification intention is to modify, the code at the code modification location is deleted from the first code and the code segment in the modification opinion information is inserted at the code modification location to obtain the second code.

[0100] In some embodiments, if the modification intention is to add, the code development client adds a new blank line after the code modification position, and inserts the code segment in the modification opinion information into the blank line. If the modification intention is to delete, the code development client deletes the code line corresponding to the code modification position. If the modification intention is to modify, the code development client deletes the code corresponding to the code modification position, and inputs the code segment in the modification opinion information into the code modification position, or the code development client deletes the code line corresponding to the code modification position, adds a new blank line after the cursor position after the deletion, and inserts the code segment in the modification opinion information into the blank line. The above-mentioned method of modifying the code, inserting the code segment in the modification opinion information into the newly added blank line, complies with programming specifications and can avoid syntax errors in the code.

[0101] For example, the code modification location is represented by a line number. If the modification intent output by the code processing model is to add, and the code modification location is line 21, the code development client adds a new blank line after line 21 of the code, i.e., the newly added line 22, and inserts the code segment in the modification opinion information into line 22. If the modification intent output by the code processing model is to delete, and the code modification location is lines 21 to 25, the code development client deletes lines 21 to 25 from the code. If the modification intent output by the code processing model is to modify, and the code modification location is lines 21 to 25, the code development client deletes lines 21 to 25 from the code and inserts the code segment in the modification opinion information into lines 21 to 25. Alternatively, the code development client deletes lines 21 to 25 from the code, and after deletion, the cursor stays at the end of line 20, adds a new blank line after line 20, i.e., the newly added line 21, and inserts the code segment in the modification opinion information into line 21.

[0102] 710. The code development client displays the second code in a preview window of the code processing interface.

[0103] In some embodiments, the preview window displays not only the second code but also an approval button and a rejection button. The approval button is used to trigger an approval instruction in response to a click operation, and the rejection button is used to trigger a rejection instruction in response to a click operation. Of course, the approval instruction and the rejection instruction can also be triggered based on other methods, such as voice commands, etc., which are not limited in this embodiment of the present application.

[0104] In an embodiment of the present application, after obtaining the second code, the code development client provides a preview function. By generating the second code for the user to preview and then performing modifications after inspection, the impact of errors in the output results of the opinion acquisition model or the code processing model can be reduced, thereby improving the accuracy of code processing. Especially for code, there are some special grammatical rules in the code. Since these special grammatical rules are rarely used, it is difficult for the opinion acquisition model or the code processing model to learn the relevant knowledge of these special grammatical rules, resulting in code processing errors. Through this preview function, it is possible to determine whether there are errors caused by these special grammatical rules in the processed code, thereby ensuring the accuracy of code processing.

[0105] In some embodiments, the code processing interface also provides a manual modification option. In response to triggering the manual modification option, the code development client displays a manual modification interface, displays the second code in the manual modification interface, and receives a modification operation for the second code. After receiving the submission operation for the modified second code, the code development client replaces the first code with the modified second code to complete the processing of the first code.

[0106] 711. If the code development client receives an approval instruction for the second code displayed in the preview window, the first code is replaced with the second code.

[0107] In some embodiments, the code development client replaces the first code with the second code in response to an approval instruction for the second code triggered by an approval button. Alternatively, the code development client performs an operation corresponding to the rejection instruction in response to a rejection instruction for the second code triggered by a rejection button. The operation corresponding to the rejection instruction may be obtaining feedback information for the second code, and sending the feedback information of the second code and the modification opinion information of the first code together to the server. The server executes the subsequent code processing process again based on the feedback information of the second code and the modification opinion information of the first code. The operation corresponding to the above-mentioned rejection instruction may also be opening a manual modification interface, displaying the first code in the manual modification interface, and receiving modification operations for the first code.

[0108] Among them, replacing the first code with the second code can be that the code development client replaces the first code in the above input interface with the second code, or, based on the relevant information of the first code in the above input interface, replaces the first code with the second code, etc., and the embodiment of the present application is not limited to this.

[0109] Different code replacement methods are used for different scenarios. For example, the code processing method provided in the embodiments of the present application can be a code debugging method during code release, code launch, and code testing, which can replace the original code with the debugged code. If the code development client provides a code release function, the code before processing can be code to be released to the code library. After the code development client receives the consent instruction, it publishes the processed code to the code library to replace the code before processing. The code before processing can also be code already stored in the code library. After the code development client receives the consent instruction, it replaces the code in the code library with the processed code. If the code development client provides a code launch function, the code before processing can be code to be launched. After the code development client receives the consent instruction, it launches the processed code to the platform to replace the code before processing and increase the platform functionality. The processed code can also be code already launched on the platform. After the code development client receives the consent instruction, it replaces the code with the code of the corresponding position, name, or function in the platform with the processed code. If the code before processing can be code to be tested, after the code development client receives the consent instruction, it replaces the code before processing with the processed code for code testing. Another way to replace the code is that the code development client runs an IDE client, and the IDE client includes an editing area for inputting code, and the editing area contains the code before processing. During the code debugging process, if the code development client receives an approval instruction, the code development client replaces the code in the editing area with the processed code. The above process shows that the code processing method provided in the embodiment of the present application can provide corresponding code debugging functions for different stages of programming, and can also make different processing of the code at different stages, and has a wide range of applications.

[0110] The embodiments of the present application are illustrated by taking the replacement of the first code with the second code as an example. In some embodiments, after the code development client receives the consent instruction, it does not replace the first code with the second code, but processes the first code according to the modification intention and modification location returned by the server. This can reduce the CPU resources occupied by code processing when the second code is large.

[0111] The above steps 709 to 711 are a possible implementation method for processing the first code based on the modification intention and the code modification location. This implementation method enables the user to check the second code by providing the second code to the user, thereby ensuring the accuracy of the code processing. According to the inspection results fed back by the user, you can choose to use a new data set to train the model used for code processing, or you can modify the model structure and re-train it to adjust the model used for code processing to achieve model optimization and thus improve the accuracy of the model. The above are all explained by taking the code development client providing a preview function as an example. The preview function can improve the accuracy of code processing through user inspection. In some embodiments, the code development client does not provide a preview function and directly processes the first code, which can avoid problems such as time delays caused by manual inspection and is more efficient.

[0112] The embodiment shown in FIG7 above is illustrated by taking the example of a code development client obtaining a first code and a server obtaining the modification intention and the code modification location. This scenario is merely an exemplary scenario. In some embodiments, the computing device has the ability to independently complete code processing tasks. The entire code processing function is performed on the computing device without interacting with other devices, resulting in high code processing efficiency. In other embodiments, multiple computing devices are each responsible for part of the steps in the code processing task and collaborate to complete the code processing task. In particular, when implementing code processing tasks based on cloud services, the cloud servers work together to achieve user-unaware processing, allowing users to directly obtain the second code after entering the first code.

[0113] The code processing method provided in the embodiment of the present application obtains the first code and modification opinion information during the code processing process. Since the semantics of the modification opinion information and the association between the first code and the modification opinion information, etc., have certain regularities with the modification intention and the code modification position, the modification intention and the code modification position can be obtained based on the first code and the modification opinion information to achieve automated understanding of the modification opinion information. Based on the modification intention and the code modification position, the first code is processed. Since the amount of code to be processed may be huge, the code processing method provided in the embodiment of the present application can reduce the error rate in the code processing process and improve the processing efficiency of the code, compared with manually understanding the above-mentioned modification opinion information and then processing the code.

[0114] The code processing method shown in Figure 7 above obtains the modification intention and code modification location through the code processing model. Taking the code processing model as LLM as an example, the training process of the code processing model includes a pre-training stage and a fine-tuning stage. In the pre-training stage, a large amount of training data is used to train the language model to obtain a code processing model. The code processing model at this time is a general language model that has learned basic language knowledge and can be used in a variety of application scenarios. In the fine-tuning stage, text data from related fields is used to fine-tune the code processing model obtained in the pre-training stage, so that the code processing model learns knowledge in a specific field, and can then more accurately process the code processing tasks in the specific field. Figure 9 is a flow chart of a code processing model training method provided according to an embodiment of the present application. In conjunction with Figure 9, the following will be explained by taking the server executing the model training method as an example. Among them, step 900 is the pre-training stage, and steps 901 to 904 are the fine-tuning stage. The above method includes the following steps:

[0115] 900. The server obtains a code processing model.

[0116] Among them, the code processing model is a language model that is trained through a large amount of training data and can learn language patterns and representations such as language structure, grammar and semantics during the training process. In an embodiment of the present application, the server obtains a previously downloaded language model, or receives the language model sent by other devices, and uses the language model as a code processing model for subsequent training. Fine-tuning is performed based on the language model, and only knowledge in related fields is needed based on general language knowledge, without having to train a new model from scratch, thereby saving time and computing resources.

[0117] The embodiment of the present application is illustrated by taking the server using a language model that has been pre-trained as a code processing model as an example. In some embodiments, the server re-pre-trains the language model based on a large amount of training data to obtain a code processing model. Pre-training is unsupervised training and includes multiple rounds of training. Before training, the server performs text segmentation on a large amount of training data to obtain multiple words, and converts these multiple words into vectors. Each vector indicates the position of the corresponding word in the large amount of training data and the correlation between the corresponding word and other words. In any round of training, the server calls the language model, calculates the vector, and obtains multiple next words and corresponding probabilities for each word. If the probability meets the training stop condition, the corresponding language model is used as the code processing model. If the probability does not meet the training stop condition, the language model is back-propagated based on the probability to adjust the parameters in the language model and then conduct the next round of training. The training stop condition can be that the above probability is within a certain numerical range, or that the number of rounds of model training reaches a preset number of rounds. This is not limited in the embodiment of the present application. The server uses a large amount of training data to re-pre-train the language model, which can make the knowledge learned by the text processing model more consistent with the field corresponding to the code processing task, making the code processing more accurate.

[0118] 901. The server obtains a first training data set, which includes multiple groups of first sample data and first labels. The first sample data includes a group of first codes and modification opinion information. The first label of the group includes a group of modification intentions and code modification locations corresponding to the group of first sample data.

[0119] Among them, the first sample data is the input data of the code processing model, and the first label is the real label corresponding to the first sample data. The first sample data can be manually collected, and the first label can be manually annotated. In an embodiment of the present application, the server locally reads the pre-downloaded first training data set, or obtains the first training data set from an open source library. The embodiment of the present application is explained by manually annotating the first sample data to obtain the first training data set. In some embodiments, the server records relevant information in the historical code processing process to obtain the first training data set, and the embodiment of the present application is not limited to this.

[0120] In some embodiments, the server divides the acquired data into a first training dataset and a first test dataset, referred to as the training set and the test set, according to a preset ratio. The training set is used to train the model, and the test set is used to verify the model training results. The model training results can be used to further train the model, thereby improving model performance.

[0121] The process of training the code processing model includes multiple rounds of training, and the following steps 902 to 904 are an explanation of one round of training process.

[0122] 902. During each round of training, the server inputs the first sample data into the code processing model to obtain first output data.

[0123] Among them, the first output data is a plurality of combinations and the probabilities of each combination, each combination includes a set of modification intentions and code modification positions, and the probability indicates that when the input is the first sample data, the output is the probability of the corresponding combination. In some embodiments, the server fine-tunes the code processing model based on the first training data set through each round of training, so that the fine-tuned model can be applied to the preset field. Before training, the server performs text segmentation on the first sample data to obtain multiple words, and converts these multiple words into vectors. Each vector indicates the position of the corresponding word in the first sample data and the correlation between the corresponding word and other words. During each round of training, the server calls the code processing model, calculates the vector corresponding to the first sample data, and obtains the first output data.

[0124] The embodiments of the present application are described by taking the first output data as multiple combinations and the probabilities of each combination as an example. In some embodiments, the first output data is a set of modification intentions and modification positions.

[0125] 903. The server obtains a first loss function value based on the first output data and the first label.

[0126] The first output data is the modification intent and code modification location predicted by the code processing model, the first label is the actual modification intent and code modification location, and the first loss function value indicates the accuracy of the code processing model's prediction. In this embodiment of the application, the server obtains the probability distribution of multiple combinations of the first output data and the probability distribution of the actual label of the first sample data, and transforms these two probability distributions according to a preset function to obtain the first loss function value.

[0127] The embodiments of the present application are illustrated by taking the first output data as multiple combinations and the probabilities of each combination as an example. In some embodiments, the above-mentioned first output data is a set of modification intentions and modification positions, and the server uses the error between the first output data and the first label as the first loss function value.

[0128] 904. If the round of training does not meet the training stop condition, the server adjusts the parameters in the code processing model based on the first loss function value. If the round of training meets the training stop condition, the server outputs the model as the code processing model.

[0129] Among them, the adjusted parameters can be some parameters in the code processing model, or they can be newly added parameters in the code processing model, and the embodiments of the present application do not limit this. The first loss function value indicates: the difference between the predicted probability distribution and the true probability distribution, that is, the difference between the probability distribution of multiple combinations of the first output data and the probability distribution of the true label of the first sample data. If this round of training does not meet the training stop condition, the server adjusts the parameters in the code processing model based on the first loss function value, and then conducts the next round of training, so that the difference indicated by the first loss function value is smaller until the training stop condition is met. The training stop condition can be that the first loss function value is within a certain numerical range, or that the number of rounds of model training reaches a preset number of rounds, and the embodiments of the present application do not limit this. If this round of training meets the training stop condition, the model is output as a code processing model.

[0130] The embodiments of the present application are illustrated by taking the difference between the predicted probability distribution and the true probability distribution indicated by the first loss function value as an example. In some embodiments, the first loss function value indicates the error between the predicted label of the code processing model and the first label.

[0131] In some embodiments, the server adjusts the code processing model through model supervised fine-tuning (SFT) and prompt engineering, so that the code processing model has end-to-end processing capabilities, thereby being able to simultaneously generate modification intentions and code modification locations.

[0132] Steps 902 to 904 above are one possible implementation for training a code processing model based on the first training dataset. In this implementation, the code processing model is an LLM, which can be trained on an existing language model, eliminating the need to train the model from scratch, thus saving computing time and resources. In some embodiments, the code processing model can also be another model with natural language processing capabilities or strong classification capabilities.

[0133] The code processing model shown in Figure 9 above is obtained through training with a large amount of basic training data and training data in specific fields. It has powerful natural language processing capabilities for specific fields and can accurately output modification intentions and code modification locations based on the first code and modification opinion information, thereby improving the efficiency of code processing.

[0134] Figure 10 is a flowchart of code processing based on the intent recognition model and the positioning model. Figure 10 includes three processes. One is to obtain the first code and modification opinion information, input the first code and modification opinion information into the intent recognition model to obtain the modification intention, then input the first code, modification opinion information and modification intention into the positioning model to obtain the code modification position, and then process the first code according to the modification intention and the code modification position. Another is the process of training the intent recognition model based on the training data set. The last one is the process of training the positioning model based on the training data set. Below, these three processes are further explained based on Figures 11 to 13.

[0135] Figure 11 is a flow chart of a code processing method provided according to an embodiment of the present application. Below, with reference to Figure 11, a code development client is used as the code development client, the code development client obtains the first code, and the server executes the above code processing method as an example to explain the code processing method based on the intent recognition model and the positioning model in more detail. The method includes the following steps:

[0136] 1100. The code development client displays a code processing interface, which is used to provide a code processing function.

[0137] 1101. The code development client obtains a developed first code in response to an operation on the code processing function on the code processing interface.

[0138] 1102. In response to a submission operation on the first code, the code development client sends a code processing instruction to the server, where the code processing instruction carries the first code.

[0139] 1103. The server receives the code processing instruction.

[0140] 1104. The server obtains a first code based on the code processing instruction.

[0141] 1105. Based on the first code, the server obtains modification opinion information for the first code through the opinion acquisition model, and returns the modification opinion information of the first code to the code development client, wherein the modification opinion information includes descriptive text and a code segment to be processed, and the descriptive text indicates the modification intention of the first code based on the code segment, wherein the modification intention includes deleting the code segment from the first code, adding the code segment to the first code, and replacing the code segment in the first code with the code segment.

[0142] 1106. The code development client displays modification suggestion information for the first code, and in response to a trigger operation for the modification suggestion information, sends a continue processing instruction to the server, or, in response to a trigger operation for the modification suggestion information, stops the code processing process.

[0143] The above steps 1100 to 1106 are similar to steps 700 to 706, and are not described in detail in this embodiment of the present application.

[0144] 1107. If a continue processing instruction is received, the server obtains the modification intention for the first code based on the first code and the modification suggestion information for the first code through the intention recognition model.

[0145] In an embodiment of the present application, if a continue processing instruction is received, the server splices the first code and the modification opinion information in a preset order, calls the intent recognition model, processes the spliced ​​first code and modification opinion information, and obtains the modification intention. The preset order is consistent with the splicing order of the first code and the modification opinion information in the data for training the intent recognition model. The intent recognition model is used to obtain the modification intention, that is, to determine whether the modification intention is in the category of addition, deletion, and modification. The input of the model is the first code and the modification opinion information, and the output is one of the three categories of modification intentions: addition, deletion, and modification. The above process of obtaining the modification intention can be to perform text segmentation on the spliced ​​first code and modification opinion information to obtain multiple words, convert these multiple words into multiple vectors, call the intent recognition model, calculate these multiple vectors, and obtain the modification intention.

[0146] For example, the server concatenates the code and the modification opinion information in the order of code first and modification opinion information later, calls the intent recognition model, analyzes the code with line numbers and the modification opinion information for the code, and obtains the modification intention.

[0147] The embodiments of the present application are described by taking the example of the intention recognition model directly outputting a modification intention. In some embodiments, the intention recognition model first obtains multiple modification intentions and the probabilities of each modification intention, then selects a modification intention from the multiple modification intentions and outputs the modification intention. Among them, selecting a modification intention from multiple modification intentions can be selecting the modification intention with the highest probability, or randomly sampling a modification intention from multiple modification intentions with a probability greater than a threshold, and the probability indicates that when the input is the first code and the corresponding modification opinion information, the output is the probability of the corresponding modification intention.

[0148] The above embodiments are all explained by taking the intention recognition model outputting a modification intention as an example. In other embodiments, the intention recognition model outputs multiple modification intentions and the probabilities corresponding to each modification intention. The server will select a modification intention from multiple modification intentions based on the probability, and continue to execute subsequent code processing according to the modification intention. The embodiments of the present application do not limit this.

[0149] 1108. The server obtains a code modification position in the first code corresponding to the modification opinion information based on the first code, the modification opinion information for the first code, and the modification intention.

[0150] In an embodiment of the present application, the server splices the first code, modification opinion information and modification intention in a preset order, calls the positioning model, processes the spliced ​​first code, modification opinion information and modification intention, and obtains the code modification position corresponding to the modification opinion information. The positioning model is used to obtain the code modification position, that is, to determine at which position of the first code the modification should be implemented. The input of the positioning model is the first code, modification opinion information and modification intention, and the output is the code modification position. The above process of obtaining the code modification position can be to perform text segmentation on the spliced ​​first code, modification opinion information and modification intention to obtain multiple words, convert these multiple words into multiple vectors, call the positioning model, calculate these multiple vectors, and obtain the code modification position.

[0151] For example, using line numbers to represent code locations. The server concatenates the code, modification suggestion information, and modification intent in the order they appear. It then calls the location model to analyze the code, modification suggestion information, and modification intent with line numbers to determine the code modification location, i.e., the line number.

[0152] The embodiments of the present application are described using the output of the positioning model as a code modification location as an example. In some embodiments, the positioning model analyzes the first code, modification opinion information, and modification intention to first obtain multiple code modification locations and the probabilities of each code modification location, and then selects a code modification location from the multiple code modification locations and outputs the code modification location. Selecting a code modification location from the multiple code modification locations can be selecting the code modification location with the highest probability, or randomly sampling a code modification location from multiple code modification locations with a probability greater than a threshold. The probability indicates the probability of outputting the corresponding code modification location when the input is the first code, the corresponding modification opinion information, and the modification intention.

[0153] The above embodiments are all explained by taking the positioning model outputting a code modification location as an example. In other embodiments, the positioning model outputs multiple code modification locations and the probabilities corresponding to each code modification location. The server will select a code modification location from the multiple code modification locations based on the probability, and continue to execute the subsequent code processing process according to the code modification location. The embodiments of the present application are not limited to this.

[0154] 1109. The server sends the modification intention and code modification location of the modification suggestion information of the first code to the code development client.

[0155] 1110. The code development client performs processing corresponding to the modification intention based on the code segment at the code modification location in the first code based on the modification intention and the code modification location to obtain a second code.

[0156] 1111. Display the second code in the preview window of the code processing interface.

[0157] 1112. If the code development client receives an approval instruction for the second code displayed in the preview window, the first code is replaced with the second code.

[0158] The above steps 1109 to 1112 are similar to steps 708 to 711, and are not described in detail in this embodiment of the present application.

[0159] The code processing method shown in Figure 10 above obtains modification intent through an intent recognition model, which can be a variety of natural language processing models. Figure 12 is a flowchart of an intent recognition model training method provided according to an embodiment of the present application. The following description uses Figure 12 as an example of a server executing this model training method. The method includes the following steps:

[0160] 1201. The server obtains a second training data set, which includes multiple groups of second sample data and second labels. The second sample data includes a group of first codes and modification opinion information. The second label of the group includes a modification intention corresponding to the group of second sample data.

[0161] The second sample data is the input data of the intent recognition model, and the second label is the true label corresponding to the second sample data. The process of obtaining the second training data set in step 1201 is similar to the process of obtaining the first training data set in step 901 above, and will not be repeated in this embodiment of the application.

[0162] The process of training the intent recognition model includes multiple rounds of training. The following steps 1202 to 1204 illustrate one round of training process.

[0163] 1202. During each round of training, the server inputs the second sample data into the intent recognition model to obtain second output data.

[0164] The intent recognition model is selected based on the code processing task. Before training, the server performs text segmentation on the second sample data to obtain multiple words. These words are then converted into vectors, each of which indicates information such as the position of the corresponding word in the second sample data and its relevance to other words. During each round of training, the server invokes the intent recognition model and calculates the vector corresponding to the second sample data, obtaining the second output data, which is the modification intent predicted by the intent recognition model.

[0165] In some embodiments, the intent recognition model is a recurrent neural network (RNN) model. During a training cycle, the vector corresponding to the second sample data is forward propagated through the RNN model to obtain second output data. The vector corresponding to the second sample data is then computed through neural network layers in the RNN model, including recurrent layers, hidden layers, and fully connected layers, to obtain the second output data.

[0166] In some embodiments, the intent recognition model is a Transformers model. The Transformers model includes multiple encoding modules (encoders) and decoding modules (decoders). The encoder module is used to encode the input data, thereby converting the input data into intermediate data, and the decoder module is used to decode the intermediate data, thereby converting the intermediate data into output data. The encoder module and the decoder module have the same structure, but the parameters may be different. Each encoder module or decoder module includes a self-attention layer (SA) and a feed forward neural network layer (FFNN). Taking the encoder module as an example, the SA layer is used to encode words in the input data so that the encoded words contain information about other words in the input data, that is, the relationship between the word and other words. The FFNN layer is a forward network layer, which is used to perform further feature extraction on the output of the SA layer. During a round of training, the encoder module is called to process the vector corresponding to the second sample data to obtain intermediate data, and the decoder module is called to process the intermediate data to obtain the second output data.

[0167] In some embodiments, the intent recognition model is a Naive Bayesian classification model. During a training round, the Naive Bayesian classification model is invoked to calculate the vector corresponding to the second sample data to obtain at least one modification intent and the probability corresponding to each modification intent. The probability indicates the probability of outputting the corresponding modification intent when the second sample data is input, and the modification intent with the highest probability among the at least one modification intent is used as the second output data.

[0168] 1203. The server obtains a second loss function value based on the second output data and the second label.

[0169] The second output data is the modification intent predicted by the intent recognition model, the second label is the actual modification intent, and the second loss function value indicates the error between the second output data and the second label. The server invokes a preset loss function and calculates the second loss function value based on the second output data and the second label.

[0170] 1204. If this round of training does not meet the training stop condition, the server adjusts the parameters in the intent recognition model based on the second loss function value. If this round of training meets the training stop condition, the model is output as an intent recognition model.

[0171] In an embodiment of the present application, if the training stop condition is not met in this round of training, the server calculates the error of each parameter in the model based on the second loss function value. Based on the error, the parameters in the intent recognition model are adjusted, and the next round of training is performed to make the second loss function value smaller until the training stop condition is met. The training stop condition can be that the second loss function value is within a certain numerical range, or that the number of rounds of model training reaches a preset number of rounds, which is not limited in this embodiment of the present application. If the training stop condition is met in this round of training, the model is output as an intent recognition model.

[0172] The above steps 1202 to 1204 are a possible implementation method for training the intent recognition model based on the second training data set. This implementation method provides a variety of models that can be used as intent recognition models. The models mentioned in this implementation method are only exemplary, and the intent recognition model can also be other natural language processing models.

[0173] The code processing method shown in FIG10 above obtains the code modification location through a positioning model, which can be a variety of natural language processing models. FIG13 is a flowchart of a positioning model training method provided according to an embodiment of the present application. The following description uses FIG13 as an example of a server executing the model training method. The method includes the following steps:

[0174] 1301. The server obtains a third training data set, which includes multiple groups of third sample data and third labels. The third sample data includes a group of first codes, modification opinion information and modification intentions. The third label of the group includes a code modification position corresponding to the group of third sample data.

[0175] The third sample data is the input data of the positioning model, and the third label is the true label corresponding to the third sample data. The process of obtaining the third training data set in step 1301 is similar to the process of obtaining the first training data set in step 901 above, and will not be repeated in this embodiment of the application.

[0176] The process of training the positioning model includes multiple rounds of training. The following steps 1302 to 1304 illustrate one round of training.

[0177] 1302. During each round of training, the server inputs the third sample data into the positioning model to obtain third output data.

[0178] 1303. The server obtains a third loss function value based on the third output data and the third label.

[0179] 1304. If the round of training does not meet the training stop condition, the server adjusts the parameters in the positioning model based on the third loss function value. If the round of training meets the training stop condition, the server outputs the model as the positioning model.

[0180] The above steps 1302 to 1304 are a possible implementation method for training the positioning model based on the third training data set. This implementation method provides a variety of models that can be used as positioning models. The models mentioned in this implementation method are only exemplary, and the positioning model can also be other natural language processing models.

[0181] The positioning model training method of the above steps 1301 to 1304 is similar to the intention recognition model training method of steps 1201 to 1204, and will not be repeated in the embodiment of the present application.

[0182] The code processing method illustrated in FIG11 to FIG13 above uses two models to respectively determine the modification intention and the code modification location. The model's objectives are relatively clear and the prediction accuracy is relatively high.

[0183] The above describes the method of the embodiment of the present application, and the following describes the device of the embodiment of the present application. It should be understood that the device described below has any function of the computing device in the above method. The above describes in detail the code processing method provided according to the embodiment of the present application and the training method of the model used by the code processing method in combination with Figures 6 to 13. Based on the same inventive concept, the code processing device provided according to the embodiment of the present application will be described below in combination with Figure 14. It should be understood that the technical features described in the method embodiment are also applicable to the following device embodiment.

[0184] Referring to FIG14 , an embodiment of the present application provides a code processing device, the device comprising:

[0185] The code acquisition module 1401 is used to acquire the first code developed;

[0186] A modification suggestion information acquisition module 1402 is configured to analyze the acquired first code in response to the code analysis instruction to obtain modification suggestion information for the first code, wherein the modification suggestion information includes descriptive text and a code segment to be processed, wherein the descriptive text indicates an intended modification of the first code based on the code segment, wherein the intended modification includes deleting the code segment from the first code, adding the code segment to the first code, and replacing a code segment in the first code with the code segment;

[0187] The opinion recognition module 1403 is configured to analyze the modification opinion information and the first code obtained by analysis to obtain the modification intention and the code modification position in the first code corresponding to the modification opinion information;

[0188] The code processing module 1404 is configured to perform processing corresponding to the modification intention based on the code segment at the code modification location in the first code based on the modification intention and the code modification location.

[0189] In some embodiments, the opinion identification module 1403 is used to:

[0190] In response to a trigger operation on the modification opinion information, an analysis is performed based on the modification opinion information and the first code to obtain the modification intention and the code modification location.

[0191] In some embodiments, the code processing module 1404 includes:

[0192] a second code acquisition unit configured to, based on the modification intention and the code modification location, perform processing corresponding to the modification intention based on the code segment at the code modification location in the first code to obtain a second code;

[0193] a display unit, configured to display the second code in a preview window;

[0194] The replacing unit is configured to replace the first code with the second code if an approval instruction is received.

[0195] In some embodiments, the second code acquisition unit is configured to:

[0196] If the modification intention is to add, then insert the code segment in the modification opinion information after the code at the code modification position in the first code to obtain the second code; or

[0197] If the modification intention is deletion, the code at the code modification position is deleted from the first code to obtain the second code; or

[0198] If the modification intention is modification, the code at the code modification position is deleted from the first code, and the code segment in the modification opinion information is inserted at the code modification position to obtain the second code.

[0199] In some embodiments, the code processing device further includes:

[0200] The code processing model training module is used to obtain a first training data set, the first training data set includes multiple groups of first sample data and first labels, the first sample data includes a group of first codes and modification opinion information, and the first label includes a group of multiple groups of modification intentions and code modification locations corresponding to the first sample data; based on the first training data set, the code processing model is trained.

[0201] In some embodiments, the code processing device further includes:

[0202] The intention recognition model training module is used to obtain a second training data set, the second training data set includes multiple groups of second sample data and second labels, the second sample data includes a group of first codes and modification opinion information, and the second label includes a modification intention corresponding to the second sample data; based on the second training data set, the intention recognition model is trained.

[0203] In some embodiments, the code processing device further includes:

[0204] The positioning model training module is used to obtain a third training data set, which includes multiple sets of third sample data and third labels. The third sample data includes a set of first codes, modification opinion information and modification intentions, and the third label includes a code modification location corresponding to the third sample data; based on the third training data set, the positioning model is trained.

[0205] It should be understood that the code processing device corresponds to the code development client in the above-mentioned method embodiment, and the various modules in the device and the above-mentioned other operations and / or functions are respectively for implementing the various steps and methods implemented by the code development client in the method embodiment. For specific details, please refer to the above-mentioned method embodiment. For the sake of brevity, they will not be repeated here.

[0206] The code acquisition module 1401, the modification opinion information acquisition module 1402, the opinion identification module 1403, and the code processing module 1404 can all be implemented via software or hardware. For example, the implementation of the code acquisition module 1401 will be described below using the code acquisition module 1401 as an example. Similarly, the implementation of the modification opinion information acquisition module 1402, the opinion identification module 1403, and the code processing module 1404 can refer to the implementation of the code acquisition module 1401.

[0207] As an example of a software functional unit, the code acquisition module 1401 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the code acquisition module 1401 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same AZ or in different AZs, and each AZ includes one data center or multiple geographically close data centers. Generally, a region may include multiple AZs.

[0208] Similarly, the multiple hosts / virtual machines / containers running the code can be distributed within the same VPC or across multiple VPCs. Typically, a VPC is located within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.

[0209] As an example of a hardware functional unit, code acquisition module 1401 may include at least one computing device, such as a server. Alternatively, code acquisition module 1401 may be implemented using an ASIC or a PLD. The PLD may be implemented using a CPLD, FPGA, GAL, or any combination thereof.

[0210] The multiple computing devices included in the code acquisition module 1401 can be distributed in the same region or in different regions. The multiple computing devices included in the code acquisition module 1401 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the code acquisition module 1401 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0211] It should be noted that, in other embodiments, the code acquisition module 1401 can be used to execute any step in the code processing method, the modification opinion information acquisition module 1402 can be used to execute any step in the code processing method, the opinion identification module 1403 can be used to execute any step in the code processing method, and the code processing module 1404 can be used to execute any step in the code processing method. The steps that the code acquisition module 1401, the modification opinion information acquisition module 1402, the opinion identification module 1403 and the code processing module 1404 are responsible for implementing can be specified as needed. The code acquisition module 1401, the modification opinion information acquisition module 1402, the opinion identification module 1403 and the code processing module 1404 respectively implement different steps in the code processing method to realize the full functions of the code processing device.

[0212] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that includes one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a high-density digital video disc (DVD)), or a semiconductor medium (for example, a solid-state drive). The computer-readable storage medium includes computer program instructions, and when the computer program instructions are executed by a computing device cluster, the computing device cluster executes a code processing method.

[0213] The present application also provides a computer program product comprising instructions, which can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the code processing method.

[0214] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer execution instructions, and when the device is running, the processor can execute the computer execution instructions stored in the memory to enable the chip to execute the code processing method in the above-mentioned method embodiments.

[0215] Among them, the device, computing device cluster, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0216] Through the description of the above embodiments, those skilled in the art will understand that for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the code processing method embodiment provided in the above embodiment belongs to the same concept. Its specific implementation process is detailed in the method embodiment and will not be repeated here.

[0217] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0218] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0219] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0220] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

[0221] In the description of this application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, "at least one" means one or more, and "a plurality" means two or more. Words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not limit them to be necessarily different.

[0222] In this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0223] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, storage, display, etc.), and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the code involved in this application was obtained with full authorization.

[0224] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.

[0225] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the protection scope of the technical solutions of the embodiments of the present application.

[0226] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.

[0227] The above description is merely an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A code processing method, characterized in that: The method comprises: The code development client obtains the first code developed; The code development client analyzes the acquired first code in response to the code analysis instruction to obtain modification suggestion information for the first code, wherein the modification suggestion information includes descriptive text and a code segment to be processed, wherein the descriptive text indicates a modification intention for the first code based on the code segment, wherein the modification intention includes deleting the code segment from the first code, adding the code segment to the first code, and replacing a code segment in the first code with the code segment; The code development client analyzes the modification suggestion information and the first code to obtain the modification intention and the code modification position in the first code corresponding to the modification suggestion information; The code development client performs processing corresponding to the modification intention based on the code segment at the code modification location in the first code based on the modification intention and the code modification location.

2. The method according to claim 1, characterized in that The code development client analyzes the modification suggestion information and the first code obtained by analysis to obtain the modification intention and the code modification position corresponding to the modification suggestion information in the first code, including: The code development client responds to a trigger operation on the modification opinion information, analyzes the modification opinion information and the first code, and obtains the modification intention and the code modification position.

3. The method according to claim 1, characterized in that The code development client performs processing corresponding to the modification intention based on the modification intention and the code modification location in the first code and based on the code segment, including: The code development client performs processing corresponding to the modification intention based on the code segment at the code modification location in the first code based on the modification intention and the code modification location to obtain a second code; The code development client displays the second code in a preview window; If an approval instruction is received, the code development client replaces the first code with the second code.

4. The method according to claim 3, characterized in that The code development client performs processing corresponding to the modification intention based on the modification intention and the code modification location in the first code and based on the code segment to obtain the second code, which includes: If the modification intention is to add, the code development client inserts the code segment in the modification suggestion information after the code at the code modification position in the first code to obtain the second code; or If the modification intention is deletion, the code development client deletes the code at the code modification position from the first code to obtain the second code; or If the modification intention is modification, the code development client deletes the code at the code modification position from the first code, and inserts the code segment in the modification opinion information at the code modification position to obtain the second code.

5. The method according to any one of claims 1 to 4, characterized in that The modification intention and the code modification location are obtained through a code processing model. The training process of the code processing model includes: Obtaining a first training data set, the first training data set including multiple sets of first sample data and first labels, the first sample data including a set of first codes and modification suggestion information, the first labels including a set of multiple sets of modification intentions and code modification locations corresponding to the first sample data; The code processing model is trained based on the first training data set.

6. The method according to any one of claims 1 to 4, characterized in that The modification intention is obtained through an intention recognition model, and the training process of the intention recognition model includes: Obtain a second training data set, the second training data set including multiple sets of second sample data and second labels, the second sample data packet The second tag includes a set of first codes and modification opinion information, and the second tag includes a modification intention corresponding to the second sample data; The intent recognition model is trained based on the second training data set.

7. The method according to any one of claims 1 to 4, characterized in that The code modification location is obtained through a positioning model, and the training process of the positioning model includes: Obtaining a third training data set, the third training data set including multiple sets of third sample data and third labels, the third sample data including a set of first codes, modification suggestion information, and modification intentions, and the third label including a code modification location corresponding to the third sample data; The positioning model is trained based on the third training data set.

8. A code processing device, characterized in that: The device comprises: A code acquisition module is used to acquire the first code developed; a modification suggestion information acquisition module, configured to analyze the acquired first code in response to a code analysis instruction to obtain modification suggestion information for the first code, the modification suggestion information including descriptive text and a code segment to be processed, the descriptive text indicating an intended modification of the first code based on the code segment, wherein the intended modification includes deleting the code segment from the first code, adding the code segment to the first code, and replacing a code segment in the first code with the code segment; An opinion recognition module is used to analyze the modification opinion information and the first code obtained by analysis to obtain the modification intention and the code modification position corresponding to the modification opinion information in the first code; A code processing module is used to perform processing corresponding to the modification intention based on the code segment at the code modification location in the first code based on the modification intention and the code modification location.

9. The device according to claim 8, characterized in that The opinion recognition module is used to: In response to a triggering operation on the modification opinion information, an analysis is performed based on the modification opinion information and the first code to obtain the modification intention and the code modification position.

10. The device according to claim 8, characterized in that The code processing module includes: a second code acquiring unit configured to, based on the modification intention and the code modification position, perform processing corresponding to the modification intention based on the code segment at the code modification position in the first code to obtain a second code; a display unit, configured to display the second code in a preview window; A replacing unit is configured to replace the first code with the second code if a consent instruction is received.

11. The device according to claim 10, characterized in that The second code acquisition unit is used for: If the modification intention is to add, the code development client inserts the code segment in the modification suggestion information after the code at the code modification position in the first code to obtain the second code; or, If the modification intention is deletion, the code development client deletes the code at the code modification position from the first code to obtain the second code; or, If the modification intention is modification, the code development client deletes the code at the code modification position from the first code, and inserts the code segment in the modification opinion information at the code modification position to obtain the second code.

12. A computing device cluster, characterized in that: comprising at least one computing device, each computing device including a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in a memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 7.

13. A computer-readable storage medium, characterized in that The method comprises computer program instructions, which, when executed by a computing device cluster, perform the method according to any one of claims 1 to 7.

14. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster is caused to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Code modification method and device, storage medium and computer equipment

    CN115629745A

  • Code repairing method and device and computing equipment cluster

    CN116521225A

  • Code modification method and device, all-in-one machine and program product

    CN117130644A

  • Code reconstruction method and device, electronic equipment and storage medium

    CN117311800A

  • Provision of Code Base Modification Using Automatic Learning of Code Changes

    US20120079452A1

Cited By

  • Code automatic generation method and system based on algorithm model

    CN121116382A