Code data completion labeling method and device, equipment, medium and program product
By labeling, dividing and completing the code data, the problems of low data labeling efficiency and poor accuracy in the existing technology are solved, and the training effect of the code completion model and the accuracy of automatic completion are improved.
Patent Information
- Application Number
- CN202411794514.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-06
AI Technical Summary
In the prior art, the training of the code completion model relies on a large number of labeled high-quality data sets, but the data labeling process is completely manual, resulting in inefficient labeling, easy to introduce syntax and format errors, affecting the model training effect.
By labeling and dividing the target code data to be marked, the annotation data segment is determined, and in response to the code labeling operation generated for the annotation data segment, the code statements in the annotation data segment are completed, and the code parts that need to be completed are directly positioned and marked, reducing the time to read intensive code statements and reducing the introduction of human errors.
It improves the efficiency and accuracy of code labeling, reduces syntax and format errors introduced by human factors, ensures the training effect of the code completion model, and facilitates accurate automatic code completion.
Smart Images

Figure CN119718286A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, equipment, medium and program product for completing and marking code data. Background Art
[0002] In the field of computer front-end programming, code completion (such as SQL code completion) is a common and important application scenario. At present, code completion models are usually used for code completion, but the accuracy of code completion models depends on a large number of annotated high-quality data sets as training materials, and data annotation is usually implemented using Excel or general text annotation tools. However, the data annotation process is completely manual. Not only is the code statement reading process time-consuming, but it is also easy to introduce errors due to human factors, resulting in low annotation efficiency, which in turn affects the training effect of the code completion model. Summary of the invention
[0003] In view of this, the present disclosure provides a code data completion and annotation method, apparatus, device, medium and program product to solve the problem of low data annotation efficiency.
[0004] In a first aspect, the present disclosure provides a method for completing and annotating code data, comprising: obtaining target code data to be annotated; annotating and dividing the target code data to determine annotated data segments; in response to a code annotation operation generated for the annotated data segment, completing and annotating code statements in the annotated data segment according to the code annotation operation to obtain a code completion annotation result.
[0005] In a second aspect, the present disclosure provides a device for completing and annotating code data, including: an acquisition module, used to obtain target code data to be annotated; a division module, used to annotate and divide the target code data to determine the annotated data segment; and an annotation module, used to respond to a code annotation operation generated for the annotated data segment, complete and annotate the code statements in the annotated data segment according to the code annotation operation, and obtain a code completion annotation result.
[0006] In a third aspect, the present disclosure provides a computer device, including: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the code data completion and annotation method of the above-mentioned first aspect or any corresponding implementation method thereof by executing the computer instructions.
[0007] In a fourth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the code data completion and annotation method of the first aspect or any corresponding implementation manner thereof.
[0008] In a fifth aspect, the present disclosure provides a computer program product, including computer instructions, which are used to enable a computer to execute the code data completion and annotation method of the above-mentioned first aspect or any corresponding implementation method thereof.
[0009] The code data completion and annotation method, device, equipment, medium and program product provided by the present disclosure, by annotating and dividing the acquired target code data to be annotated to obtain annotated data segments, can directly locate the annotated data segments that need to be annotated without reading dense code statements, saving time-consuming code statement reading and facilitating improving code annotation efficiency. After determining the annotated data segment, the annotated data segment can be directly annotated to complete the code statements, thereby reducing syntax and format errors introduced by human factors and achieving accuracy in code annotation. Furthermore, using accurate code completion annotation results to train the code completion model is conducive to ensuring the model training effect and facilitating accurate automatic code completion through the code completion model. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0011] Figure 1 is a flowchart of a method for completing and annotating code data according to an embodiment of the present disclosure;
[0012] Figure 2 is a flowchart of another code data completion and annotation method according to an embodiment of the present disclosure;
[0013] Figure 3 is a schematic diagram showing the difference between different code statement segments according to an embodiment of the present disclosure;
[0014] Figure 4 is a schematic diagram of selecting a target keyword according to an embodiment of the present disclosure;
[0015] Figure 5 is a flowchart of another method for completing and marking code data according to an embodiment of the present disclosure;
[0016] Figure 6 is a schematic diagram of secondary annotation according to an embodiment of the present disclosure;
[0017] Figure 7 is a schematic diagram of a specific implementation of the completion annotation of code data according to an embodiment of the present disclosure;
[0018] Figure 8 is a structural block diagram of a device for completing and annotating code data according to an embodiment of the present disclosure;
[0019] Fig. 9 It is a schematic diagram of the hardware structure of the computer device of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0021] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0022] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0023] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0024] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0025] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0026] Code completion is a common and important application scenario. Taking the SQL code completion scenario as an example, in order to improve the accuracy of the SQL code completion model, a large number of annotated high-quality data sets are required as training materials. In the current data annotation method, Excel or general text annotation tools are usually used for annotation. Taking Excel as an example, each row represents the annotation-related information of a question, which contains the Prompt data content column, which is the part that needs to be annotated. The annotator needs to manually read the SQL code in the Prompt, identify the part of the code that needs to be completed, and mark it as the last column of the current annotated data set, and finally save this data as a training set.
[0027] However, prompt content is usually presented in dense text form, which is heavy to read and time-consuming to annotate. In the process of manual annotation using Excel, since SQL statements are long and complex, syntax and format errors are more common and difficult to find without a SQL editor, and errors are easily introduced due to human factors. When using tools such as Excel for annotation data management, it is impossible to roll back to a specified historical version, and data is easily lost.
[0028] In view of this, the technical solution disclosed in the present invention supports one-click positioning of code statements that need to be annotated, which is convenient for annotators to quickly find the code parts that need to be completed in the code completion scenario, thereby improving the annotation efficiency. At the same time, it provides selection division for the completed code to achieve one-click annotation, so that different parts of the code data can be distinguished in real time, improving the accuracy and efficiency of annotation. At the same time, it supports forward and reverse annotation of the code completion annotation results, and provides a comparison function to clearly show the difference between the two, providing positive and negative training data for the code completion model, which is conducive to ensuring the model training effect, and facilitating accurate code automatic completion through the code completion model, so as to provide a better user experience.
[0029] According to an embodiment of the present disclosure, an embodiment of a method for completing and marking code data is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] In this embodiment, a method for completing and marking code data is provided, which can be used in computer devices, such as computers, laptops, etc. Figure 1 is a flowchart of a method for completing and annotating code data according to an embodiment of the present disclosure. Figure 1 As shown, the process includes the following steps:
[0031] Step S101, obtaining target code data to be marked.
[0032] The target code data is a complete code statement that needs to be completed and annotated, such as an SQL code statement, a Python code statement, etc. Specifically, the target code data can be generated by a code generation model (such as a large language model); or it can be manually generated, for example, it can be edited in real time by a code editor through a code editor. The method for obtaining the target code data is not specifically limited here, and those skilled in the art can determine it according to actual needs.
[0033] Step S102, marking and dividing the target code data to determine the marked data segments.
[0034] The annotated data segment is a code sentence segment that needs to be completed and annotated. Specifically, the target code data includes multiple segments, and the target code data is divided into different segments by identifying and understanding the target code data, so as to identify the annotated data segment from the different segments of the target code data.
[0035] Step S103, in response to the code annotation operation generated for the annotated data segment, the code statements in the annotated data segment are completed and annotated according to the code annotation operation to obtain a code completion and annotation result.
[0036] The code annotation operation is an operation in which the annotator completes the annotation of the annotated data segment, and the code annotation operation can be triggered by swiping the mouse or the keyboard. Specifically, the computer device provides an annotation page for code annotation, and the annotator can view the code and complete the code annotation through the annotation page. Among them, the annotation page is a code editing page, and the annotation page is not a simple text input box, but is implemented based on a code editing tool. The annotation page can support the highlighting display and intelligent prompts of the code syntax, which helps the annotator to identify and correct code syntax errors, can reduce the reading pressure of the annotator in the process of completing the annotation, and improve the accuracy and efficiency of code annotation.
[0037] When the annotated data segment is determined, the annotated data segment is displayed on the annotation page, and the annotator performs code annotation on the annotated data segment on the annotation page. Accordingly, the annotation page can respond to the code annotation operation of the annotator, and complete the code statements in the annotated data segment according to the code annotation operation, generate corresponding code completion annotation results, and save the code completion annotation results, so as to avoid the loss of code completion annotation data and facilitate rolling back to the specified historical version in combination with the saved code completion annotation results for re-annotation.
[0038] Then, the code completion annotation results are used to build a code annotation dataset, and the code annotation dataset is used to train the code completion model, so that the code completion model can achieve accurate code automatic completion during the code editing process and improve code development efficiency.
[0039] The code data completion and annotation method provided in the present embodiment, by annotating and dividing the acquired target code data to be annotated to obtain annotated data segments, can directly locate the annotated data segments that need to be annotated without reading dense code statements, saving time-consuming code statement reading and facilitating improving code annotation efficiency. After determining the annotated data segment, the annotated data segment can be directly annotated to complete the code statements, thereby reducing syntax and format errors introduced by human factors and achieving accuracy in code annotation. Furthermore, using accurate code completion annotation results to train the code completion model is conducive to ensuring the model training effect and facilitating accurate automatic code completion through the code completion model.
[0040] In this embodiment, a method for completing and marking code data is provided, which can be used in computer devices, such as computers, laptops, etc. Figure 2 is a flowchart of a method for completing and annotating code data according to an embodiment of the present disclosure. Figure 2 As shown, the process includes the following steps:
[0041] Step S201, obtaining the target code data to be annotated. Please refer to the relevant description of the corresponding steps in the above embodiment for details, which will not be repeated here.
[0042] Step S202: annotate and divide the target code data to determine annotated data segments.
[0043] Specifically, the above step S202 includes:
[0044] Step S2021 , based on the annotation features of the target code data, the target code data is divided into annotated data segments and unannotated data segments; wherein the annotation data segments and the unannotated data segments have different labels.
[0045] The annotation features are the code attribute features possessed by the annotated data segment, such as the code start position, code end position, keywords, operators, variable definitions, function calls, data types, etc. By identifying and understanding the target code data, the code attribute features carried in the target code data can be determined, and the statements in the target code data can be divided based on the code attribute features to obtain annotated data segments and non-annotated data segments.
[0046] Specifically, the annotated data segment is a code statement segment that needs to be completed and annotated, and the non-annotated data segment is a code statement segment that does not need to be completed and annotated. The annotated data segment is set between the non-annotated data segments, and the non-annotated data segment includes the preceding data segment of the annotated data segment and the following data segment of the annotated data segment. Different data segments are marked in different ways, for example, the annotated data segment, the preceding data segment, and the following data segment are marked and distinguished by different colors, different fonts, etc. Figure 3 As shown, the marked data segment (code_middle), the preceding data segment (code_before), and the following data segment (code_after) are marked and distinguished by different colors.
[0047] Step S2022: In response to a jump operation on the marked data segment, jump from the non-marked data segment to the marked data segment.
[0048] The jump operation is an operation to jump to the annotated data segment. The jump operation can be achieved by triggering a pre-set shortcut key or by clicking a jump button set on the annotation page. The triggering method of the jump operation is not specifically limited here.
[0049] Since the target code data has a lot of content, when the annotator is currently browsing in the non-annotated data segment, the annotator can trigger a jump shortcut key or jump button. Accordingly, the annotated page can respond to the jump operation triggered by the annotator and directly jump from the non-annotated data segment to the annotated data segment, so as to avoid browsing more content to reach the annotated data segment.
[0050] In some optional implementations, the above step S202 may further include:
[0051] Step a1, in response to a keyword selection operation on target code data, determining a target keyword.
[0052] Step a2, distinguishing and displaying the target keywords in the target code data.
[0053] Keywords are words with special meanings that are predefined in programming languages or database query languages and are used to control program flow, define data structures, set conditions, etc. The target code data has multiple different keywords to implement specific code functions, and the target keywords are the keywords selected by the annotator. Specifically, the annotator can select keywords from the target code data by selecting areas with the mouse or keyboard, and correspondingly, the annotation page can respond to the annotator's keyword selection operation on the target code data and select the currently selected target keyword. Then, all target keywords in the target code data are queried, and all target keywords in the target code data are displayed separately from the rest of the code data. For example, all target keywords are box-selected, such as Figure 4 As shown. Of course, the target keyword can also be highlighted to facilitate the annotation staff to browse the location of the target keyword.
[0054] In the above implementation, by distinguishing the target keyword from the remaining code data, it is helpful for the annotation personnel to accurately locate the location of the target keyword, making it easier for the annotation personnel to identify the target keyword, avoiding missing the target keyword due to manual reading, reducing the pressure of manual reading, and helping to improve the accuracy and efficiency of annotation.
[0055] In some optional implementations, the above method further includes: displaying the target code data in a first area of the annotated page, and displaying the annotated data segment in a second area of the annotated page.
[0056] like Figure 3 and Figure 4 As shown, in order to facilitate the comparison and viewing of the original code data and the annotated code data, the target code data and the annotated data segment are displayed in different areas of the annotation page. Specifically, the target code data is displayed in the first area of the annotation page, such as the left side of the annotation page, so as to show the complete code statement of the current annotation task to the annotator; the annotated data segment is displayed in the second area of the annotation page, such as the right side of the annotation page, so that the annotator can complete the code annotation. In this way, the annotation comparison of the code data can be realized through the first area and the second area, which is convenient for the management of the annotation data and avoids data loss and difficulty in annotation proofreading.
[0057] In some optional implementations, before step S202, the method may further include:
[0058] Step b1, in response to a marking configuration operation on target code data, generating at least one marking task for the target code data, and determining at least one marking object for performing a code marking operation.
[0059] Step b2: Push the annotation task to the annotation object so that the annotation object performs the code annotation operation.
[0060] The annotation configuration operation is an operation for configuring the annotation of the target code data. The annotation configuration operation determines the annotation task for the target code data at that time, wherein the annotation task includes the selection of the annotation field and the setting of the annotation object. If the annotation quality inspection is required, the corresponding quality inspection object can also be set.
[0061] After completing the annotation configuration for the target code data, the annotation task corresponding to the target code data is pushed to the corresponding annotation object, whereby the annotation object can receive the annotation task and perform code annotation operations for the annotation task.
[0062] In the above implementation, by pre-configuring the annotation tasks and annotation objects, the automatic push of the annotation tasks is realized, which helps the annotators to understand the annotation tasks they need to complete, and improves the automatic triggering of code annotation to a certain extent.
[0063] In some optional implementations, the above method may further include: detecting a target annotation task that the annotation object is currently annotating, and locking the annotation permissions of the annotation object and the target annotation task.
[0064] The annotation tasks corresponding to the target code data will be pushed to multiple annotation objects for code annotation. When there are many annotation tasks corresponding to the target code data, the target annotation tasks being annotated by each annotation object will be detected in real time, and the annotation permissions of the target annotation tasks will be locked with the corresponding annotation objects to avoid multiple annotation objects annotating the same annotation task at the same time, which is conducive to improving the efficiency of code statement completion annotation.
[0065] Step S203, in response to the code annotation operation generated for the annotated data segment, the code statements in the annotated data segment are completed and annotated according to the code annotation operation to obtain a code completion and annotation result. For details, please refer to the relevant description of the corresponding steps in the above embodiment, which will not be repeated here.
[0066] The code data completion and annotation method provided in this embodiment divides the annotated data segment and the non-annotated data segment into annotated data segments in combination with the annotation features of the target code data. When in the non-annotated data segment, it supports jumping to the annotated data segment, thereby realizing the positioning of the annotated data segment, facilitating quick finding of the annotated data segment that needs to be annotated, and helping to improve the annotation efficiency.
[0067] In this embodiment, a method for completing and marking code data is provided, which can be used in computer devices, such as computers, laptops, etc. Figure 5 is a flowchart of a method for completing and annotating code data according to an embodiment of the present disclosure. Figure 5As shown, the process includes the following steps:
[0068] Step S301, obtaining the target code data to be annotated. Please refer to the relevant description of the corresponding steps in the above embodiment for details, which will not be repeated here.
[0069] Step S302: mark and divide the target code data to determine the marked data segments. Please refer to the description of the corresponding steps in the above embodiment for details, which will not be repeated here.
[0070] Step S303, in response to the code annotation operation generated for the annotated data segment, the code statements in the annotated data segment are completed and annotated according to the code annotation operation to obtain a code completion and annotation result.
[0071] Specifically, the above step S303 includes:
[0072] Step S3031, in response to the code annotation operation generated for the annotation data segment, the annotation data segment is redefined according to the code annotation operation to obtain a target annotation data segment.
[0073] The annotator detects the initialized annotated data segment displayed in the annotation page to determine whether the initialized annotated data segment meets the actual programming completion requirement. If the annotated data segment meets the programming completion requirement, the initialized annotated data segment is determined as the target annotated data segment.
[0074] If the annotated data segment does not meet the programming completion requirements, further check whether the annotated data segment is missing a key statement segment. If the annotated data segment is missing a key statement segment, the annotator can redefine the annotated data segment according to the preceding data segment and the following data segment corresponding to the annotated data segment, such as Figure 3 Accordingly, the annotation page can respond to the code annotation operation of the annotator to obtain the corresponding target annotation data segment.
[0075] If there are redundant statement segments in the annotated data segment, the annotator can reselect the segment from the annotated data segment. Accordingly, the annotation page can respond to the annotator's code annotation operation and reselect the target annotated data segment from the annotated data segment.
[0076] Step S3032: determine the code statement in the target annotated data segment as a code completion annotation result.
[0077] Identify multiple code statements contained in the target annotated data segment, and determine these multiple code statements as code completion annotated results. Therefore, during the code editing process, the code editor only needs to input the first character or a few characters at the starting position in the target annotated data segment to automatically fill in multiple code statements.
[0078] In some optional implementations, the above method further includes: updating the non-annotated data segment in the target code data according to the target annotated data segment.
[0079] If the target annotated data segment is updated compared to the initialized annotated data segment, then after the target annotated data segment is redefined, the non-annotated data segment in the annotation page can be automatically re-divided according to the target annotated data segment, thereby realizing automatic updating of non-annotated data segments and annotated data segments without manual division, thereby reducing the error rate caused by manual operation.
[0080] In some optional implementations, the above method further includes:
[0081] Step c1, in response to a secondary marking operation on a code statement in a target marked data segment, changing the code statement in the target marked data segment into an abnormal code statement according to the secondary marking operation.
[0082] Step c2, comparing and displaying the code statements in the target annotated data segment with the abnormal code statements.
[0083] The secondary annotation operation is an operation for adjusting the code statements in the target annotation data segment. The secondary annotation operation can be triggered by a pre-set shortcut key or a secondary annotation button set on the annotation page.
[0084] The abnormal code statement is an erroneous code statement, that is, the abnormal code statement is an erroneous example of the code statement in the target annotated data segment. The annotator can trigger a secondary annotation operation for the code statement in the target annotated data segment. Accordingly, the annotation page can respond to the annotator's secondary annotation operation and pop up a secondary annotation page in the annotation page to adjust the code statement in the secondary annotation page, and compare and display the code statement and its corresponding abnormal code statement in the secondary annotation page.
[0085] like Figure 6 As shown, the code statements of the target annotated data segment are displayed on the left side of the secondary annotation page, and the code statements displayed on the left side are not allowed to be adjusted. The code statements of the target annotated data segment are displayed on the right side of the secondary annotation page, and the code statements displayed on the right side are allowed to be adjusted, and the annotator can adjust them to abnormal code statements.
[0086] The abnormal code statements obtained by adjusting the code statements of the target annotated data segment are used as negative samples, and the code statements in the target annotated data segment are used as positive samples. Thus, the code completion model can be trained using positive and negative samples to obtain the output of the code completion model. The output of the code completion model with negative sample training is compared and analyzed with the output of the code completion model without negative sample training to determine the code completion difference of the code completion model, so that the code completion model can be trained in a targeted manner based on the code completion difference to ensure that the code completion model can achieve accurate code annotation.
[0087] In some optional implementations, the above method further includes:
[0088] Step d1, in response to a quality inspection operation on the code completion annotation result, a quality inspection result is generated.
[0089] Step d2: If the quality inspection result indicates that the code completion annotation result is correct, the code completion annotation result is exported.
[0090] The quality inspection operation is an operation in which the quality inspection object performs inspection and quality review on the code completion annotation results. As described above, the quality inspection object is configured before the code completion annotation. After the code completion operation is completed and the code completion annotation results are obtained, the code completion annotation results can be automatically pushed to the pre-configured quality inspection object for inspection and quality review to obtain the quality inspection results of the code completion annotation results by the quality inspection object. If the quality inspection results indicate that the code completion annotation results are correct, the code completion annotation results can be exported for use in subsequent code completion model training, which is conducive to improving the training effect of the code completion model and ensuring the accuracy of the code annotation of the code completion model.
[0091] The code data completion and annotation method provided in this embodiment re-defines the annotated data segment according to the code annotation operation to obtain the target annotated data segment, thereby avoiding code annotation errors caused by the annotated data segment not meeting actual requirements, which is beneficial to improving the accuracy of code annotation.
[0092] As a specific application example of the present disclosure, Figure 7 The data annotation process of the SQL completion scenario shown in the figure starts from the data source, goes through a series of strict annotation steps, and finally generates a high-quality annotated dataset for training the SQL code completion model. The specific process is as follows:
[0093] (1) SQL code data collection. The SQL code dataset to be annotated comes from two aspects: SQL code generated by large models; and SQL code generated manually.
[0094] (2) Configuration of annotation tasks. Before executing code annotation, you need to configure the annotation task, including the selection of annotation fields, annotation objects, and the setting of quality inspection objects. After the configuration is completed, the system will automatically push the annotation task to the specified annotation object; after the annotation object completes the annotation task, the code completion annotation results generated by the annotation task will be pushed to the specified quality inspection object for inspection and quality review.
[0095] (3) Completion and annotation of code data: The annotation object clicks on the annotation task to realize task preemption, so as to avoid the situation where multiple annotation objects are annotating the same annotation task at the same time. In the process of code completion and annotation, a combination of label annotation (such as keywords, operators, etc.), segmentation and annotation of the target code data in the annotation area (selecting the target code data to highlight the key completion code) and secondary annotation (i.e. DPO annotation, to annotate correct and incorrect cases separately, and provide positive and negative training data for the SQL code completion model) is adopted to ensure that the SQL code of each annotation task can be accurately annotated.
[0096] (4) Inspection and quality inspection. After the annotation is completed, the quality inspector needs to inspect and review the code completion annotation results to ensure the accuracy of the code completion annotation results.
[0097] (5) Acceptance and export. The code completion annotation results that pass the quality inspection will be finally accepted, and the annotated data set can be exported for subsequent SQL code completion model training.
[0098] In the present embodiment, a device for completing and marking code data is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0099] This embodiment provides a device for completing and marking code data. Figure 8 As shown, including:
[0100] The acquisition module 401 is used to acquire the target code data to be marked.
[0101] The division module 402 is used to mark and divide the target code data to determine the marked data segments.
[0102] The annotation module 403 is used to respond to the code annotation operation generated for the annotated data segment and perform completion annotation on the code statements in the annotated data segment according to the code annotation operation to obtain a code completion annotation result.
[0103] In some optional implementations, the partitioning module 402 includes:
[0104] The data segment division unit is used to divide the target code data into a marked data segment and a non-marked data segment based on the marked features of the target code data, and the marks of the marked data segment and the non-marked data segment are different.
[0105] The jump unit is used to jump from the non-marked data segment to the marked data segment in response to a jump operation on the marked data segment.
[0106] In some optional implementations, the division module 402 further includes:
[0107] The selection unit is configured to determine a target keyword in response to a keyword selection operation on the target code data.
[0108] The distinguishing display unit is used to distinguish and display the target keywords in the target code data.
[0109] In some optional embodiments, the above device further includes:
[0110] The code display module is used to display the target code data in the first area of the marked page, and to display the marked data segment in the second area of the marked page.
[0111] In some optional embodiments, the above device further includes:
[0112] The configuration module is used to generate at least one annotation task for the target code data in response to the annotation configuration operation for the target code data, and determine at least one annotation object for performing the code annotation operation.
[0113] The push module is used to push the annotation task to the annotation object so that the annotation object performs the code annotation operation.
[0114] In some optional embodiments, the above device may further include:
[0115] The permission locking module is used to detect the target annotation task that the annotation object is currently annotating, and lock the annotation permissions of the annotation object and the target annotation task.
[0116] In some optional implementations, the marking module 403 includes:
[0117] The code marking unit is used to respond to the code marking operation generated for the marked data segment, re-define the marked data segment according to the code marking operation, and obtain the target marked data segment.
[0118] The annotation result determination unit is used to determine the code statement in the target annotation data segment as the code completion annotation result.
[0119] In some optional embodiments, the above device further includes:
[0120] The updating module is used to update the non-annotated data segment in the target code data according to the target annotated data segment.
[0121] In some optional embodiments, the above device further includes:
[0122] The secondary marking module is used to respond to the secondary marking operation on the code statement in the target marked data segment and change the code statement in the target marked data segment into an abnormal code statement according to the secondary marking operation.
[0123] The comparison module is used to compare and display the code statements in the target annotated data segment with the abnormal code statements.
[0124] In some optional embodiments, the above device further includes:
[0125] The quality inspection module is used to generate a quality inspection result in response to a quality inspection operation on the code completion annotation result.
[0126] The export module is used to export the code completion annotation result if the quality inspection result indicates that the code completion annotation result is correct.
[0127] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0128] The code data completion and annotation device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0129] The code data completion and annotation device provided in this embodiment, by annotating and dividing the acquired target code data to be annotated to obtain annotated data segments, can directly locate the annotated data segments that need to be annotated without reading dense code statements, saving time-consuming code statement reading and facilitating the improvement of code annotation efficiency. After determining the annotated data segment, the annotated data segment can be directly annotated to complete the code statements, thereby reducing syntax and format errors introduced by human factors and achieving accuracy in code annotation. Furthermore, using accurate code completion annotation results to train the code completion model is conducive to ensuring the model training effect and facilitating accurate automatic code completion through the code completion model.
[0130] The present disclosure also provides a computer device having the above Figure 8 The code data is shown as a completion and annotation device.
[0131] See also Fig. 9 , Fig. 9 is a schematic diagram of a computer device provided by an optional embodiment of the present disclosure, such as Fig. 9 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig. 9 A processor 10 is taken as an example.
[0132] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0133] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0134] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0135] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0136] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Fig. 9 The example of connecting through bus is taken in the following.
[0137] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0138] The computer device also includes a communication interface, which is used for the computer device to communicate with other devices or a communication network.
[0139] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0140] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0141] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for completing and marking code data, characterized in that: The method comprises: Obtain target code data to be annotated; Marking and dividing the target code data to determine marked data segments; In response to a code annotation operation generated for the annotated data segment, code statements in the annotated data segment are completed and annotated according to the code annotation operation to obtain a code completion and annotation result.
2. The method according to claim 1, characterized in that The step of marking and dividing the target code data to determine the marked data segments includes: Based on the annotation features of the target code data, the target code data is divided into an annotated data segment and a non-annotated data segment; wherein the annotated data segment and the non-annotated data segment have different marks; In response to a jump operation on the marked data segment, a jump is made from the non-marked data segment to the marked data segment.
3. The method according to claim 2, characterized in that Also includes: In response to a keyword selection operation on the target code data, determining a target keyword; The target keywords in the target code data are displayed distinctively.
4. The method according to any one of claims 1 to 3, characterized in that: Also includes: The target code data is displayed in a first area of the annotation page, and the annotation data segment is displayed in a second area of the annotation page.
5. The method according to claim 1, characterized in that In response to the code annotation operation generated for the annotated data segment, completing and annotating the code statements in the annotated data segment according to the code annotation operation to obtain a code completion and annotation result, including: In response to a code annotation operation generated for the annotated data segment, re-delineating the annotated data segment according to the code annotation operation to obtain a target annotated data segment; The code statement in the target annotated data segment is determined as the code completion annotating result.
6. The method according to claim 5, characterized in that Also includes: The non-annotated data segment in the target code data is updated according to the target annotated data segment.
7. The method according to claim 5, characterized in that Also includes: In response to a secondary marking operation on a code statement in the target marked data segment, changing the code statement in the target marked data segment into an abnormal code statement according to the secondary marking operation; The code statements in the target annotated data segment are compared and displayed with the abnormal code statements.
8. The method according to claim 1, characterized in that Before marking and dividing the target code data and determining the marked data segments, the method further includes: In response to the annotation configuration operation for the target code data, generating at least one annotation task for the target code data, and determining at least one annotation object for performing a code annotation operation; The annotation task is pushed to the annotation object, so that the annotation object performs a code annotation operation.
9. The method according to claim 8, characterized in that Also includes: The target marking task currently being marked by the marking object is detected, and the marking authority of the marking object and the target marking task is locked.
10. The method according to claim 1, characterized in that Also includes: In response to a quality inspection operation on the code completion annotation result, generating a quality inspection result; If the quality inspection result indicates that the code completion and annotation result is correct, the code completion and annotation result is exported.
11. A device for completing and marking code data, characterized in that: The device comprises: An acquisition module, used for acquiring target code data to be annotated; A division module, used to mark and divide the target code data to determine the marked data segments; The annotation module is used to respond to the code annotation operation generated for the annotated data segment, complete and annotate the code statements in the annotated data segment according to the code annotation operation, and obtain a code completion and annotation result.
12. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the code data completion and annotation method according to any one of claims 1 to 10 by executing the computer instructions.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the code data completion and annotation method according to any one of claims 1 to 10.
14. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the code data completion and marking method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Code completion method, device and equipment and storage medium
CN109683907A
Code completion strategy generation method and device and electronic equipment
CN116301782A
Training sample construction method and device, electronic equipment and medium
CN116521866A
Code labeling method and device and computer readable storage medium
CN118333020A
Code completion method and device, related equipment and computer program product
CN118708222A