Methods, devices, equipment, media, and program products for code data completion and annotation.

By annotating and dividing the code data and using code editing tools to directly locate the annotated data segments, the problem of low data annotation efficiency in existing code completion models is solved, achieving efficient and accurate code completion.

CN119718286BActive Publication Date: 2026-04-03BEIJING VOLCANO ENGINE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In existing technologies, the data annotation process for code completion models relies on manual operation, which leads to low efficiency and is prone to introducing syntax and format errors, affecting the model training effect.

Method used

By annotating and dividing the target code data, the annotation data segments can be directly located, and the annotations can be completed using code editing tools, reducing the time spent reading dense code statements. It supports both forward and reverse annotation and provides a comparison function to improve annotation accuracy.

Benefits of technology

It improves code annotation efficiency, reduces errors introduced by human factors, ensures the training effect of the code completion model, and achieves accurate automatic code completion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718286B_ABST
    Figure CN119718286B_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of computer technology and discloses a method, apparatus, device, medium, and program product for code data completion and annotation. The method includes: acquiring target code data to be annotated; dividing the target code data into annotation segments to determine annotation data segments; and, in response to a code annotation operation generated for the annotation data segments, completing and annotating the code statements in the annotation data segments according to the code annotation operation to obtain code completion and annotation results. By implementing the technical solution of this disclosure, the time spent reading code statements is saved, and the efficiency and accuracy of code annotation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, specifically to a method, apparatus, device, medium, and program product for code data completion and annotation. Background Technology

[0002] In the field of computer front-end programming, code completion (such as SQL code completion) is a common and important application scenario. Currently, code completion models are commonly used for code completion. However, the accuracy of these models depends on a large amount of labeled, high-quality datasets as training material. Data labeling is typically done using Excel or general text annotation tools. However, the data annotation process is entirely manual. Not only is reading the code statements time-consuming, but human error is also prone to be introduced, leading to low annotation efficiency and consequently affecting the training effect of the code completion model. Summary of the Invention

[0003] In view of this, this disclosure provides a method, apparatus, device, medium, and program product for code data completion and annotation to solve the problem of low data annotation efficiency.

[0004] In a first aspect, this disclosure provides a method for code data completion annotation, including: obtaining target code data to be annotated; dividing the target code data into annotation segments to determine annotation data segments; responding to code annotation operations generated for the annotation data segments, completing and annotating the code statements in the annotation data segments according to the code annotation operations, and obtaining code completion annotation results.

[0005] Secondly, this disclosure provides a code data completion and annotation device, comprising: an acquisition module for acquiring target code data to be annotated; a division module for dividing the target code data into annotation segments to determine annotation data segments; and an annotation module for responding to code annotation operations generated for the annotation data segments, completing and annotating the code statements in the annotation data segments according to the code annotation operations, and obtaining code completion and annotation results.

[0006] Thirdly, this disclosure provides a computer device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the code data completion annotation method described in the first aspect or any corresponding embodiment.

[0007] Fourthly, this disclosure provides a computer-readable storage medium storing computer instructions for causing a computer to execute the code data completion annotation method described in the first aspect or any corresponding embodiment.

[0008] Fifthly, this disclosure provides a computer program product, including computer instructions, which are used to cause a computer to execute the code data completion annotation method described in the first aspect or any corresponding embodiment.

[0009] The code data completion and annotation method, apparatus, device, medium, and program products disclosed herein divide the acquired target code data to be annotated into annotation data segments. This allows direct location of the annotation data segments requiring annotation, eliminating the need to read dense code statements, thus saving time spent on code statement reading and improving code annotation efficiency. After determining the annotation data segments, code statement completion and annotation can be performed directly on these segments, thereby reducing syntax and format errors introduced by human factors and achieving accurate code annotation. Furthermore, using accurate code completion and annotation results for training the code completion model helps ensure the model's training effect and facilitates accurate automatic code completion through the code completion model. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0011] Figure 1 This is a flowchart illustrating the code data completion and annotation method according to an embodiment of this disclosure;

[0012] Figure 2 This is a flowchart illustrating another code data completion and annotation method according to an embodiment of the present disclosure;

[0013] Figure 3 This is a schematic diagram showing the differences between different code statement segments according to embodiments of this disclosure;

[0014] Figure 4 This is a schematic diagram illustrating the selection of target keywords according to an embodiment of this disclosure;

[0015] Figure 5 This is a flowchart illustrating another code data completion and annotation method according to an embodiment of the present disclosure;

[0016] Figure 6 This is a schematic diagram with secondary annotations according to an embodiment of the present disclosure;

[0017] Figure 7 This is a schematic diagram illustrating the specific implementation of code data completion annotation according to an embodiment of this disclosure;

[0018] Figure 8 This is a structural block diagram of a code data completion and annotation device according to an embodiment of the present disclosure;

[0019] Figure 9 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present disclosure. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0021] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0022] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0023] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0024] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0025] It is understood 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 related provisions.

[0026] Code completion is a common and important application scenario. Taking SQL code completion as an example, to improve the accuracy of the SQL code completion model, a large amount of high-quality, annotated datasets are needed as training material. Current data annotation methods typically use Excel or general text annotation tools. Using Excel as an example, each row represents annotation-related information for a question, including a Prompt column containing the parts that need annotation. Annotators need to manually read the SQL code in the Prompt, identify the parts that need completion, and mark them as the last column of the current annotation dataset. Finally, this data is saved as the training set.

[0027] However, Prompt content is usually presented in dense text, which is a heavy reading burden and takes a long time to annotate. When annotating manually using Excel, due to the long and complex SQL statements, syntax and formatting errors are more common and difficult to find without an 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 revert to a specified historical version, and data is also easy to be lost.

[0028] In view of this, the technical solution disclosed herein supports one-click location of code statements requiring annotation, enabling annotators to quickly find the code sections that need to be completed in code completion scenarios, thereby improving annotation efficiency. Simultaneously, it provides selection area division for the completed code to achieve one-click annotation, allowing for instant differentiation of different parts of the code data, improving annotation accuracy and efficiency. Furthermore, it supports both positive and negative annotation of the code completion results, providing a comparison function to clearly demonstrate the differences between the two, providing positive and negative training data for the code completion model, which helps ensure the model's training effect and facilitates accurate automatic code completion through the code completion model, thus providing a better user experience.

[0029] According to an embodiment of this disclosure, a method for completing and annotating code data is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0030] This embodiment provides a code data completion and annotation method, which can be used on computer devices such as computers and laptops. Figure 1 This is a flowchart of a code data completion and annotation method according to an embodiment of this disclosure, such as... Figure 1 As shown, the process includes the following steps:

[0031] Step S101: Obtain the target code data to be annotated.

[0032] The target code data consists of complete code statements that require completion annotation, such as SQL or Python code statements. Specifically, the target code data can be generated by a code generation model (such as a large language model); it can also be manually generated, for example, edited in real-time by code editors. The method of obtaining the target code data is not specifically limited here; those skilled in the art can determine it according to actual needs.

[0033] Step S102: The target code data is labeled and divided to determine the labeled data segments.

[0034] The labeled data segment is the code statement segment that needs to be completed and annotated. Specifically, the target code data includes multiple segments. By identifying and understanding the target code data, it is divided into different segments in order to identify the labeled data segment from these different segments.

[0035] Step S103: In response to the code annotation operation generated for the annotation data segment, the code statements in the annotation data segment are completed and annotated according to the code annotation operation to obtain the code completion annotation result.

[0036] Code annotation is an operation where annotators complete and annotate data segments. This operation can be triggered by selecting data using the mouse or keyboard. Specifically, computer equipment provides an annotation page for code annotation, allowing annotators to view and complete code. This annotation page is a code editing page, not a simple text input box, but rather a code editing tool. It supports syntax highlighting and intelligent suggestions, helping annotators identify and correct syntax errors, reducing reading pressure during annotation, and improving the accuracy and efficiency of code annotation.

[0037] Once the labeled data segment is identified, it is displayed on the labeling page, where labelers annotate the code within it. The labeling page responds to these annotations, completing and annotating the code statements within the labeled data segment, generating and saving the completed annotations. This prevents data loss and allows for reverting to a specified historical version for re-annotation based on the saved annotations.

[0038] Subsequently, a code annotation dataset is constructed using the code completion annotation results. The code completion model is then trained using the code annotation dataset so that the code completion model can achieve accurate automatic code completion during code editing, thereby improving code development efficiency.

[0039] The code completion and annotation method provided in this embodiment divides the acquired target code data to be annotated into annotation data segments. This allows for direct location of the annotation data segments that need to be annotated, eliminating the need to read dense code statements and saving time spent on code reading, thus improving code annotation efficiency. After determining the annotation data segments, code statement completion and annotation can be performed directly on these segments, reducing syntax and format errors introduced by human factors and achieving accurate code annotation. Furthermore, using accurate code completion and annotation results for training the code completion model helps ensure the model's training effect and facilitates accurate automatic code completion through the code completion model.

[0040] This embodiment provides a code data completion and annotation method, which can be used on computer devices such as computers and laptops. Figure 2 This is a flowchart of a code data completion and annotation method according to an embodiment of this disclosure, such as... Figure 2 As shown, the process includes the following steps:

[0041] Step S201: Obtain the target code data to be annotated. For details, please refer to the relevant descriptions of the corresponding steps in the above embodiments, which will not be repeated here.

[0042] Step S202: The target code data is labeled and divided to determine the labeled data segments.

[0043] Specifically, 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 annotations of the annotated data segments and the unannotated data segments are different.

[0045] Labeling features are the code attribute characteristics possessed by labeled data segments, such as the start and end positions of code, keywords, operators, variable definitions, function calls, and data types. By identifying and understanding the target code data, the code attribute characteristics carried within the target code data can be determined. Based on these code attribute characteristics, the statements in the target code data can be divided into labeled data segments and unlabeled data segments.

[0046] Specifically, labeled data segments are code statement segments that require completion annotations, while unlabeled data segments are code statement segments that do not require completion annotations. Labeled data segments are placed between unlabeled data segments, and unlabeled data segments include the preceding and following data segments of the labeled data segments. Different data segments use different marking methods; for example, labeled data segments, preceding data segments, and following data segments are marked and distinguished using different colors and different fonts. Figure 3 As shown, the labeled data segment (code_middle), the preceding data segment (code_before), and the following data segment (code_after) are marked and distinguished using different colors.

[0047] Step S2022, in response to a jump operation for the labeled data segment, jump from the non-labeled data segment to the labeled data segment.

[0048] The jump operation is an operation to jump to the labeled data segment. This jump operation can be achieved by triggering a preset shortcut key or by clicking the jump button set on the label page. There are no specific restrictions on the triggering method of the jump operation here.

[0049] Because the target code data is extensive, when the annotator is currently viewing a non-annotated data segment, they can trigger a shortcut key or jump button. Correspondingly, the annotation page can respond to this jump, directly transitioning from the non-annotated data segment to the annotated data segment, thus avoiding the need to browse through excessive content to reach the annotated data segment.

[0050] In some optional implementations, step S202 may further include:

[0051] Step a1: In response to the keyword selection operation for the target code data, determine the target keyword.

[0052] Step a2: Distinguish and display the target keywords in the target code data.

[0053] Keywords are predefined words with special meanings in programming languages ​​or database query languages, used to control program flow, define data structures, and set conditions. Target code data contains multiple different keywords to achieve specific code functions; target keywords are those selected by the annotator. Specifically, annotators can select keywords from the target code data using mouse or keyboard selection methods. Correspondingly, the annotation page responds to the annotator's keyword selection operation, selecting 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 differently from the rest of the code data. For example, all target keywords can be selected by drawing a box, such as... Figure 4 As shown. Of course, target keywords can also be highlighted to make it easier for annotators to view the location of the target keywords.

[0054] In the above implementation, by distinguishing the target keyword from the rest of the code data, it helps the annotator to accurately locate the target keyword, makes it easier for the annotator to identify the target keyword, avoids missing the target keyword due to human reading, reduces the human reading burden, and helps improve the accuracy and efficiency of annotation.

[0055] In some alternative implementations, the method further includes displaying the target code data in a first area of ​​the annotation page and displaying the annotation data segment in a second area of ​​the annotation page.

[0056] like Figure 3 and Figure 4 As shown, to facilitate comparison and viewing of the original code data and the annotated code data, the target code data and the annotated data segments 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, to show annotators the complete code statements for the current annotation task; the annotated data segments are displayed in the second area of ​​the annotation page, such as the right side, to allow annotators to complete the code annotations. Thus, the first and second areas enable comparison of the annotated code data, facilitating the management of annotated data and preventing data loss that would hinder annotation and verification.

[0057] In some optional embodiments, prior to step S202, the above method may further include:

[0058] Step b1: In response to the annotation configuration operation for the target code data, generate at least one annotation task for the target code data and determine at least one annotation object to perform the code annotation operation.

[0059] Step b2 pushes the annotation task to the annotation object so that the annotation object can perform code annotation operations.

[0060] The annotation configuration operation is used to configure the annotation of target code data. The annotation configuration operation determines the annotation task for the current target code data annotation, which includes the selection of annotation fields and the setting of annotation objects. If annotation quality inspection is required, corresponding quality inspection objects 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. The annotation object can then receive the annotation task and perform code annotation operations on the annotation task.

[0062] In the above implementation, by pre-configuring annotation tasks and annotation objects, the automatic push of annotation tasks can be realized, which helps annotators understand the annotation tasks they need to complete and improves the automation of code annotation to a certain extent.

[0063] In some optional implementations, the above method may further include: detecting the 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 that each annotation object is annotating 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 will help improve 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 the code completion annotation result. For details, please refer to the relevant descriptions of the corresponding steps in the above embodiments, 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 by combining the annotation features of the target code data. When in the non-annotated data segment, it supports jumping to the annotated data segment, realizing the location of the annotated data segment, which makes it easier to quickly find the annotated data segment that needs to be annotated and helps to improve annotation efficiency.

[0067] This embodiment provides a code data completion and annotation method, which can be used on computer devices such as computers and laptops. Figure 5 This is a flowchart of a code data completion and annotation method according to an embodiment of this disclosure, such as... Figure 5As shown, the process includes the following steps:

[0068] Step S301: Obtain the target code data to be annotated. For details, please refer to the relevant descriptions of the corresponding steps in the above embodiments, which will not be repeated here.

[0069] Step S302: The target code data is labeled and divided to determine the labeled data segments. For details, please refer to the relevant descriptions of the corresponding steps in the above embodiments, which will not be repeated here.

[0070] Step S303: In response to the code annotation operation generated for the annotation data segment, the code statements in the annotation data segment are completed and annotated according to the code annotation operation to obtain the code completion annotation result.

[0071] Specifically, 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 the target annotation data segment.

[0073] The annotator checks the initial annotation data segment displayed on the annotation page to determine if it meets the actual programming completion requirements. If the annotation data segment meets the programming completion requirements, then the initial annotation data segment is determined as the target annotation data segment.

[0074] If the labeled data segment does not meet the programming completion requirements, further check whether the labeled data segment is missing key statement segments. If the labeled data segment is missing key statement segments, the annotator can redefine the labeled data segment based on the preceding and following data segments. Figure 3 As shown. Accordingly, the annotation page can respond to the code annotation operations of the annotator to obtain the corresponding target annotation data segment.

[0075] If there are redundant statement segments in the labeled data segment, the annotator can reselect the area from the labeled data segment. Accordingly, the annotation page can respond to the annotator's code annotation operation and reselect the target labeled data segment from the labeled data segment.

[0076] Step S3032: The code statements in the target labeled data segment are identified as code completion annotation results.

[0077] The system identifies multiple code statements contained within the target labeled data segment and determines these statements as code completion annotation results. Therefore, during code editing, the code editor only needs to input the first character or a few characters at the beginning of the target labeled data segment to automatically fill in multiple code statements.

[0078] In some alternative implementations, the method further includes updating the non-labeled data segments in the target code data according to the target labeled data segments.

[0079] If the target annotation data segment is updated compared to the initial annotation data segment, the non-annotated data segment in the annotation page can be automatically re-divided according to the target annotation data segment after the target annotation data segment is redefined. This achieves automatic updating of non-annotated data segments and annotation data segments without the need for manual division, reducing the error rate caused by manual operation.

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

[0081] Step c1: In response to the secondary annotation operation on the code statements in the target labeled data segment, the code statements in the target labeled data segment are changed to abnormal code statements according to the secondary annotation operation.

[0082] Step c2 involves comparing and displaying the code statements and exception code statements in the target labeled data segment.

[0083] Secondary annotation is an operation that adjusts the code statements in the target annotation data segment. This secondary annotation operation can be triggered by a pre-set shortcut key or the secondary annotation button set on the annotation page.

[0084] An exception code statement is an incorrect code statement, specifically an erroneous example of a code statement within the target labeled data segment. Annotators can trigger a secondary annotation operation on the code statements within the target labeled data segment. Correspondingly, the annotation page can respond to this secondary annotation operation by popping up a secondary annotation page, allowing for adjustments to the code statements. The secondary annotation page also provides a comparison display of the original code statements and their corresponding exception code statements.

[0085] like Figure 6 As shown, the code statements for the target labeled data segment are displayed on the left side of the secondary annotation page, and these statements cannot be adjusted. The code statements for the target labeled data segment are displayed on the right side of the secondary annotation page, and these statements can be adjusted; annotators can modify them to represent exception code statements.

[0086] Abnormal code statements obtained by adjusting the code statements in the target annotated data segment are used as negative samples, while the code statements in the target annotated data segment are used as positive samples. This allows the code completion model to be trained using both positive and negative samples, yielding its output. The output of the code completion model trained with negative samples is compared and analyzed with that trained without negative samples to identify differences in code completion. This allows for targeted training of the code completion model based on these differences, ensuring accurate code annotation.

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

[0088] Step d1: In response to the quality control operation on the code completion annotation results, generate the quality control results.

[0089] Step d2: If the quality inspection result indicates that the code completion annotation result is correct, then export the code completion annotation result.

[0090] The quality inspection operation is the process by which a quality inspection object checks and reviews the code completion annotation results. As described above, the quality inspection object is configured before code completion annotation. After the code completion operation is completed and the code completion annotation results are obtained, the results can be automatically pushed to the pre-configured quality inspection object for inspection and quality review, resulting in the quality inspection object's assessment of the code completion annotation results. If the quality inspection result indicates that the code completion annotation results are correct, the results can be exported for use in subsequent code completion model training, which helps improve the training effect of the code completion model and ensures the accuracy of the code annotation.

[0091] The code data completion and annotation method provided in this embodiment redefines the annotation data segment according to the code annotation operation to obtain the target annotation data segment, thereby avoiding code annotation errors caused by the annotation data segment not meeting the actual needs and improving the accuracy of code annotation.

[0092] As a specific application embodiment of this disclosure, such as Figure 7 The data annotation process for the SQL completion scenario shown here starts from the data source, goes through a series of rigorous 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 labeled comes from two sources: SQL code generated by large models; and SQL code generated manually.

[0094] (2) Configuration of annotation tasks. Before executing code annotation, the annotation task needs to be configured, including the selection of annotation fields, annotation objects, and quality inspection objects. After configuration, 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) Code completion annotation: The annotation object clicks on the annotation task to achieve task preemption, so as to avoid the situation where multiple annotation objects annotate the same annotation task at the same time. In the code completion annotation process, a combination of label annotation (such as keywords, operators, etc.), segmentation annotation of target code data in the annotation area (selecting and highlighting key completion code in the target code data), and secondary annotation (i.e., DPO annotation, to annotate correct and incorrect cases separately, to provide positive and negative training data for the SQL code completion model) is used to ensure that the SQL code of each annotation task can be accurately annotated.

[0096] (4) Inspection and quality control. After the annotation is completed, the quality control personnel need to check and audit 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 dataset can be exported for subsequent training of the SQL code completion model.

[0098] This embodiment also provides a code data completion and annotation device, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0099] This embodiment provides a code data completion and annotation device, such as... Figure 8 As shown, it includes:

[0100] The acquisition module 401 is used to acquire the target code data to be annotated.

[0101] The segmentation module 402 is used to annotate and segment the target code data to determine the annotated data segments.

[0102] The annotation module 403 is used to respond to the code annotation operation generated for the annotation data segment, and to complete the code statements in the annotation data segment according to the code annotation operation to obtain the code completion annotation result.

[0103] In some alternative implementations, the partitioning module 402 includes:

[0104] The data segmentation unit is used to divide the target code data into labeled data segments and unlabeled data segments based on the annotation features of the target code data. The labeled data segments and unlabeled data segments have different labels.

[0105] A jump unit is used to respond to a jump operation on a labeled data segment, jumping from a non-labeled data segment to a labeled data segment.

[0106] In some alternative implementations, the partitioning module 402 further includes:

[0107] The selection unit is used to determine the 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 target keywords in the target code data.

[0109] In some alternative embodiments, the above-described apparatus further includes:

[0110] The code display module is used to display the target code data in the first area of ​​the annotation page and the annotation data segment in the second area of ​​the annotation page.

[0111] In some alternative embodiments, the above-described apparatus 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 to determine at least one annotation object to perform the code annotation operation.

[0113] The push module is used to push annotation tasks to annotation objects so that the annotation objects can perform code annotation operations.

[0114] In some alternative embodiments, the above-described apparatus may further include:

[0115] The permission locking module is used to detect the target annotation task that the annotation object is currently annotating, and to lock the annotation permissions of the annotation object and the target annotation task.

[0116] In some alternative implementations, the annotation module 403 includes:

[0117] The code annotation unit is used to respond to the code annotation operation generated for the annotation data segment, and to redefine the annotation data segment according to the code annotation operation to obtain the target annotation data segment.

[0118] The annotation result determination unit is used to determine the code statements in the target annotation data segment as code completion annotation results.

[0119] In some alternative embodiments, the above-described apparatus further includes:

[0120] The update module is used to update the non-labeled data segments in the target code data according to the target labeled data segments.

[0121] In some alternative embodiments, the above-described apparatus further includes:

[0122] The secondary annotation module is used to respond to secondary annotation operations on code statements in the target annotation data segment, and to change the code statements in the target annotation data segment into abnormal code statements according to the secondary annotation operations.

[0123] The comparison module is used to compare and display the code statements and abnormal code statements in the target labeled data segment.

[0124] In some alternative embodiments, the above-described apparatus further includes:

[0125] The quality inspection module is used to respond to quality inspection operations on the code completion annotation results and generate quality inspection results.

[0126] The export module is used to export the code completion and annotation results if the quality inspection results indicate that the code completion and annotation results are correct.

[0127] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0128] In this embodiment, the code data completion and annotation device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute 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 divides the acquired target code data to be annotated into annotation data segments. This allows for direct location of the annotation data segments that need to be annotated, eliminating the need to read dense code statements, thus saving time spent on code statement reading and improving code annotation efficiency. After determining the annotation data segments, code statement completion and annotation can be performed directly on these segments, thereby reducing syntax and format errors introduced by human factors and achieving accurate code annotation. Furthermore, using accurate code completion and annotation results for training the code completion model helps ensure the model's training effect and facilitates accurate automatic code completion through the code completion model.

[0130] This disclosure also provides a computer device having the above-described features. Figure 8 The code data completion annotation device shown.

[0131] Please see Figure 9 , Figure 9 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of this disclosure, such as... Figure 9 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 9 Take a processor 10 as an example.

[0132] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GPA), or any combination thereof.

[0133] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.

[0134] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0135] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or 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, memory 20, input device 30, and output device 40 can be connected via a bus or other means. Figure 9 Taking the example of a connection between China and Israel via a bus.

[0137] Input device 30 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the computer device, such as a touchscreen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 40 may include display devices, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors). The aforementioned display devices include, but are not limited to, liquid crystal displays, light-emitting diodes, displays, and plasma displays. In some alternative embodiments, the display device may be a touchscreen.

[0138] The computer device also includes a communication interface for communicating with other devices or communication networks.

[0139] This disclosure also provides a computer-readable storage medium in which the methods described in this disclosure can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium after being downloaded over a network. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium may be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code that, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0140] A portion of this disclosure can be applied to computer program products, such as computer program instructions, which, when executed by a computer, can invoke or provide methods and / or technical solutions according to this disclosure through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, and installation package files. Accordingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions; the computer compiling the instructions and then executing the corresponding compiled program; the computer reading and executing the instructions; or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0141] Although embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method for code data completion and annotation, characterized in that, The method includes: Obtain the target code data to be annotated; The target code data is labeled and divided to determine the labeled data segments; 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 the code completion annotation result; The step of annotating and dividing the target code data to determine the annotated data segments includes: 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; In response to a jump operation for the labeled data segment, jump from the unlabeled data segment to the labeled data segment.

2. The method according to claim 1, characterized in that, Also includes: In response to a keyword selection operation on the target code data, a target keyword is determined; The target keywords in the target code data are displayed in a differentiated manner.

3. The method according to any one of claims 1-2, characterized in that, Also includes: The target code data is displayed in the first area of ​​the annotation page, and the annotation data segment is displayed in the second area of ​​the annotation page.

4. The method according to claim 1, characterized in that, The step of responding to the code annotation operation generated for the annotated data segment, and completing and annotating the code statements in the annotated data segment according to the code annotation operation to obtain the code completion annotation result, includes: In response to the code annotation operation generated for the annotated data segment, the annotated data segment is redefined according to the code annotation operation to obtain the target annotated data segment; The code statements in the target labeled data segment are identified as the code completion labeling results.

5. The method according to claim 4, characterized in that, Also includes: Update the unlabeled data segments in the target code data according to the target labeled data segments.

6. The method according to claim 4, characterized in that, Also includes: In response to a secondary annotation operation on the code statements in the target annotated data segment, the code statements in the target annotated data segment are changed into abnormal code statements according to the secondary annotation operation; The code statements in the target labeled data segment are compared and displayed with the abnormal code statements.

7. The method according to claim 1, characterized in that, Before the step of annotating and dividing the target code data and determining the annotated data segments, the method further includes: In response to a labeling configuration operation for the target code data, at least one labeling task for the target code data is generated, and at least one labeling object for performing the code labeling operation is determined; The annotation task is pushed to the annotation object so that the annotation object can perform code annotation operations.

8. The method according to claim 7, characterized in that, Also includes: The annotation object is currently annotating a target annotation task, and the annotation permissions of the annotation object and the target annotation task are locked.

9. The method according to claim 1, characterized in that, Also includes: In response to the quality inspection operation on the code completion annotation results, a quality inspection result is generated; If the quality inspection result indicates that the code completion annotation result is correct, then the code completion annotation result is exported.

10. A code data completion and annotation device, characterized in that, The device includes: The acquisition module is used to acquire the target code data to be labeled; The segmentation module is used to annotate and segment the target code data to determine the annotated data segments; The annotation module is used to respond to the code annotation operation generated for the annotation data segment, and to complete and annotate the code statements in the annotation data segment according to the code annotation operation to obtain the code completion annotation result; The step of annotating and dividing the target code data to determine the annotated data segments includes: 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; In response to a jump operation for the labeled data segment, jump from the unlabeled data segment to the labeled data segment.

11. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the code data completion annotation method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the code data completion annotation method according to any one of claims 1 to 9.

13. A computer program product, characterized in that, It includes computer instructions for causing a computer to execute the code data completion annotation method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Training sample construction method and device, electronic equipment and medium

    CN116521866A