Code task processing method, code reading method, code processing method, computing device, computer readable storage medium and computer program product

By incorporating the context and call information of function calls into the code processing model, detailed function descriptions are generated, solving the problem of misleading intelligent coding assistants when lacking context. This enables global analysis of the code repository and improves accuracy, thereby increasing development efficiency.

CN121742844APending Publication Date: 2026-03-27ALIBABA (CHINA) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing intelligent coding assistants, when processing open-source code, are prone to generating incorrect code comments and explanations due to a lack of complete contextual information, which can mislead users. Furthermore, they are unable to perform global analysis and struggle to provide consistent code understanding and suggestions.

Method used

By acquiring the code data to be processed for the target code task, and incorporating function information, context information, and function call information of the called functions into the code processing model, detailed function description information is generated, function call graphs and call trees are constructed, global information of the entire code repository is understood, and the generation of illusions is reduced.

Benefits of technology

It improves the accuracy of code processing and task processing results, helping developers quickly understand unfamiliar coding languages ​​and projects, and improving learning effectiveness and development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121742844A_ABST
    Figure CN121742844A_ABST
Patent Text Reader

Abstract

Embodiments of the invention provide a code task processing method, a code reading method, a code processing method, a computing device, a computer readable storage medium and a computer program product. The code task processing method comprises the steps of obtaining to-be-processed code data of a target code task; the task processing result of the to-be-processed code data is searched from multiple pieces of function description information, the function description information comprises first description information of a calling function, and the first description information is obtained by the code processing model based on function information of the calling function, context information of the calling function and function calling information of the calling function; the function call information is obtained based on grammar analysis of the source code file. The first description information of the calling functions is generated by utilizing the code processing model, so that detailed and context-rich function description information can be generated for each calling function, the generation illusion of the code processing model is reduced, and the accuracy of a task processing result is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present specification relate to the technical field of computer technology, and particularly relate to a code task processing method, a code reading method, a code processing method, a computing device, a computer-readable storage medium, and a computer program product. BACKGROUND

[0002] With the vigorous development of the software development industry, more and more excellent projects have emerged in the open source community. The open source repository is not only a platform for project display, but also an important resource for learning and collaboration. For developers, a large amount of open source code provides valuable learning materials. However, due to the large size and complex technology of open source projects, many new technologies are also involved, and beginners often face some difficulties when reading and understanding these codes.

[0003] At present, code annotations and code explanations for a single function or class can be generated, however, for the case of calling other custom functions, the above scheme cannot fully utilize the complete code context information, resulting in the possibility of generating illusory annotations and explanations during code processing, that is, generating seemingly reasonable but actually incorrect code annotations and explanation contents in the absence of sufficient context, thereby misleading users, therefore, there is an urgent need for a code task processing scheme with high accuracy. SUMMARY

[0004] Therefore, one or more embodiments of the present specification provide a code task processing method. One or more embodiments of the present specification also provide a code reading method, a code processing method, a code task processing device, a code reading device, a code processing device, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects in the prior art.

[0005] According to a first aspect of an embodiment of the present specification, a code task processing method is provided, comprising: obtaining to-be-processed code data of a target code task; finding a task processing result of the to-be-processed code data from a plurality of function description information, wherein the function description information comprises first description information of a calling function, the first description information is obtained by a code processing model based on function information of the calling function, context information of the calling function, and function call information of the calling function, and the function call information is obtained based on syntax analysis of a source code file.

[0006] According to a second aspect of an embodiment of the present specification, a code reading method is provided, comprising: obtaining to-be-processed code data of a code reading task; The first description information is obtained by a code processing model based on function information of the calling function, context information of the calling function, and function call information of the calling function, and the function call information is obtained based on syntax analysis on the source code file.

[0007] According to a third aspect of an embodiment of the present specification, a code processing method is provided, including: obtaining a source code file, wherein the source code file includes a plurality of calling functions; performing syntax analysis on the source code file to determine function call information of the plurality of calling functions respectively; inputting function information of the plurality of calling functions, context information of the plurality of calling functions, and the function call information of the plurality of calling functions into a code processing model to obtain first description information of the plurality of calling functions respectively.

[0008] According to a fourth aspect of an embodiment of the present specification, a code task processing apparatus is provided, including: a first obtaining module configured to obtain to-be-processed code data of a target code task; a first searching module configured to search for task processing results of the to-be-processed code data from a plurality of function description information, wherein the function description information includes first description information of a calling function, the first description information is obtained by a code processing model based on function information of the calling function, context information of the calling function, and function call information of the calling function, and the function call information is obtained based on syntax analysis on a source code file.

[0009] According to a fifth aspect of an embodiment of the present specification, a code reading apparatus is provided, including: a second obtaining module configured to obtain to-be-processed code data of a code reading task; a second searching module configured to search for code reading information of the to-be-processed code data from a plurality of function description information, wherein the function description information includes first description information of a calling function, the first description information is obtained by a code processing model based on function information of the calling function, context information of the calling function, and function call information of the calling function, and the function call information is obtained based on syntax analysis on a source code file.

[0010] According to a sixth aspect of an embodiment of the present specification, a code processing apparatus is provided, including: a third obtaining module configured to obtain a source code file, wherein the source code file includes a plurality of calling functions; a parsing module configured to perform syntax analysis on the source code file to determine function call information of the plurality of calling functions respectively; The input module is configured to input function information of the plurality of calling functions, context information of the plurality of calling functions, and function call information of the plurality of calling functions into the code processing model, and obtain first description information of the plurality of calling functions, respectively.

[0011] According to a seventh aspect of an embodiment of the present specification, a computing device is provided, comprising: a memory and a processor; The memory is configured to store computer programs / instructions, and the processor is configured to execute the computer programs / instructions, which realize the steps of the method provided in the first aspect or the second aspect or the third aspect when executed by the processor.

[0012] According to an eighth aspect of an embodiment of the present specification, a computer readable storage medium is provided, which stores computer programs / instructions, which realize the steps of the method provided in the first aspect or the second aspect or the third aspect when executed by the processor.

[0013] According to a ninth aspect of an embodiment of the present specification, a computer program product is provided, comprising computer programs / instructions, which realize the steps of the method provided in the first aspect or the second aspect or the third aspect when executed by the processor.

[0014] The code task processing method provided by one embodiment of the present specification comprises: obtaining to-be-processed code data of a target code task; and searching for a task processing result of the to-be-processed code data from a plurality of function description information, wherein the function description information comprises first description information of a calling function, the first description information being obtained by a code processing model based on function information of the calling function, context information of the calling function, and function call information of the calling function, and the function call information being obtained based on syntax analysis of a source code file. By incorporating the context information of the calling function into the input of the code processing model, detailed and context-rich function description information can be generated for each calling function. Furthermore, by incorporating the function call information of the calling function into the input of the code processing model, the code processing model can understand the global information of the entire code repository, reduce the generation of illusions of the code processing model, and further improve the accuracy of the task processing result, helping developers quickly understand unfamiliar code languages and projects, thereby improving learning effectiveness and development efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0015] Figure 1 is an architectural diagram of a code task processing system provided by one embodiment of the present specification; Figure 2 is an architectural diagram of another code task processing system provided by one embodiment of the present specification; Figure 3 is a flowchart of a code task processing method provided by one embodiment of the present specification; Figure 4 is a schematic diagram of a function call graph provided by one embodiment of the present specification; Figure 5 is a schematic diagram of a function call tree provided by one embodiment of the present specification; Figure 6 is a flowchart of a code reading method provided by one embodiment of the present specification; Figure 7 is a flowchart of a code processing method provided by one embodiment of the present specification; Figure 8 is a flowchart of a processing process of a code processing method provided by one embodiment of the present specification; Figure 9 is a structural schematic diagram of a code task processing apparatus provided by one embodiment of the present specification; Figure 10 is a structural schematic diagram of a code reading apparatus provided by one embodiment of the present specification; Figure 11 is a structural schematic diagram of a code processing apparatus provided by one embodiment of the present specification; Figure 12 is a structural block diagram of a computing device provided by one embodiment of the present specification. DETAILED DESCRIPTION

[0016] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present specification. However, the present specification can be practiced without the specific details, other than in the examples, and it is understood that the present specification will encompass numerous variations beyond those described in the detailed description.

[0017] The terminology used in one or more embodiments of the present specification is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present specification. As used in one or more embodiments of the present specification and the accompanying claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in one or more embodiments of the present specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0018] It should be understood that, although the terms first, second, etc. can be employed in describing various information in one or more embodiments of the present specification, the information should not be limited to such terms. These terms are only used to differentiate one piece of information from another piece of information of the same type. For example, without departing from the scope of one or more embodiments of the present specification, first can also be referred to as second, and similarly, second can also be referred to as first. Depending on the context, the word "if' as used herein can be interpreted as "when" or "upon" or "in response to determining".

[0019] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present specification are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.

[0020] In one or more embodiments of the present specification, a large model refers to a deep learning model with a large number of model parameters, usually containing hundreds of millions, tens of billions, hundreds of billions, thousands of billions or even tens of billions of model parameters. The large model can also be called a foundation model. Through large-scale unlabeled corpus pre-training, a pre-trained model with hundreds of millions of parameters is produced. Such a model can adapt to a wide range of downstream tasks, and the model has good generalization ability. For example, large language models (LLM, Large Language Model), multi-modal pre-training models, etc.

[0021] In actual application, the large model only needs a small amount of sample to fine-tune the pre-trained model and can be applied to different tasks. The large model can be widely applied to natural language processing (NLP, Natural Language Processing) and computer vision fields. Specifically, it can be applied to computer vision field tasks such as visual question answering (VQA, Visual Question Answering), image captioning (IC, Image Caption), image generation, and natural language processing field tasks such as text-based sentiment classification, text summary generation, and machine translation. The main application scenarios of the large model include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.

[0022] First, the terms involved in one or more embodiments of the present specification are explained.

[0023] Intelligent Coding Assistant: Through large model technology, it enables functions such as code completion, documentation generation, code explanation, unit testing, and code repair, improving programmers' development efficiency, code quality, and development experience.

[0024] Static code analysis is a method that analyzes the semantics and behavior of code without executing the program. It uses code structure analysis to detect potential errors, analyze code logic relationships, identify coding style violations, and identify performance issues.

[0025] Bottom-up traversal refers to a traversal method used when processing tree-structured data (such as binary or multi-way trees). In bottom-up traversal, the bottom-level nodes of the tree are visited first, and then each level is visited upwards until the root node is reached. This method is the opposite of the common top-down level-up traversal (which starts from the root node and visits each level downwards).

[0026] Function call graph: A function call graph is a directed graph that represents the call relationships between functions in a program. In this graph, each node represents a function, and each directed edge represents a function calling another function. Function call graphs are widely used in program optimization, debugging, and code understanding, helping developers find function call paths, detect recursive calls, and analyze the scope of impact.

[0027] Abstract Syntax Tree (AST): A tree-like data structure representing the structure of source code. It is primarily used in compilers and interpreters, but can also be applied to static code analysis, code generation, and code transformation. An AST consists of a series of nodes, each representing a syntactic component of the source code, such as a function call, variable declaration, or loop structure.

[0028] A dictionary is a mutable container model that stores data in key-value pairs. Each element in a dictionary contains a key and a corresponding value. The key is an immutable type (such as a string, number, or tuple), while the value can be of any data type.

[0029] Custom classes allow you to define your own data types. Classes can contain attributes (data members) and methods (behaviors). Classes are the foundation of object-oriented programming; in Python, encapsulation, inheritance, and polymorphism can be achieved by defining classes.

[0030] Code comments are textual explanations added to the source code. These texts are not executed by the compiler or interpreter, but they can help other developers (including your future self) understand the purpose and function of the code.

[0031] Code function: refers to the function or purpose of the code, that is, what effect the code will achieve after execution.

[0032] Code explanation: refers to the description of code logic, used to express the purpose of the code, how it works, and why it does so, which helps others understand the intent of the code, especially for complex algorithms or project logic.

[0033] Intelligent coding assistants can generate code comments and explanations for individual functions or classes, playing a positive role in improving development efficiency and facilitating code readability. However, these products also have the following drawbacks: First, insufficient context dependency: When calling other custom functions, due to the inability to fully utilize complete context information, the intelligent coding assistant may experience "illusions," generating seemingly reasonable but actually incorrect content without sufficient context, thus misleading the user. Second, limited repository-level understanding: Current intelligent coding assistants cannot process and understand the entire code repository at once, typically generating comments and explanations for only a single function or class at a time. This means it cannot perform a global analysis of the codebase, making it difficult to provide consistent overall understanding and suggestions.

[0034] To address the aforementioned issues, this specification proposes an intelligent coding assistant solution based on a code processing model. This solution acquires the code data to be processed for a target code task. It then searches for the task processing result of the code data from multiple function descriptions. The function descriptions include first descriptions of the calling functions, obtained by the code processing model based on the function information, context information, and function call information of the calling functions. The function call information is obtained through syntax parsing of the source code file. By incorporating the context information of the calling functions into the input of the code processing model, detailed and context-rich function descriptions can be generated for each calling function. Furthermore, incorporating the function call information into the input of the code processing model allows it to understand the global information of the entire code repository, reducing the illusion of data generation and further improving the accuracy of task processing results. This helps developers quickly understand unfamiliar coding languages ​​and projects, thereby improving learning effectiveness and development efficiency.

[0035] This specification provides a code task processing method, and also relates to a code reading method, a code processing method, a code task processing device, a code reading device, a code processing device, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.

[0036] See Figure 1 ,Figure 1 This specification illustrates an architecture diagram of a code task processing system according to an embodiment of the present specification. The code task processing system may include a client 100 and a server 200. Client 100 is used to send the code data to be processed for the target code task to server 200; Server 200 is used to find the task processing result of the code data to be processed from multiple function description information. The function description information includes the first description information of the calling function. The first description information is obtained by the code processing model based on the function information of the calling function, the context information of the calling function, and the function call information of the calling function. The function call information is obtained based on the syntax parsing of the source code file.

[0037] Optionally, the server 200 is also used to send the task processing result of the code data to be processed to the client 100; the client 100 is also used to receive the task processing result of the code data to be processed sent by the server 200.

[0038] The solution implemented in this specification generates first description information of the calling function based on the function information, context information, and function call information of the calling function using a code processing model. This generates detailed and context-rich function description information for each calling function, reducing the generation illusion of the code processing model and further improving the accuracy of task processing results.

[0039] See Figure 2 , Figure 2This specification illustrates an architecture diagram of another code task processing system according to an embodiment. The system may include multiple clients 100 and a server 200. Clients 100 may include edge devices, and the server 200 may include cloud devices. Multiple clients 100 can establish communication connections through the server 200. In the code task processing scenario, the server 200 provides code task processing services among the clients 100. Each client 100 can act as a sender or receiver, communicating through the server 200. Users can interact with the server 200 through clients 100 to receive data from other clients 100 or send data to other clients 100. In the code task processing scenario, a user may publish a data stream to the server 200 through a client 100. The server 200 generates task processing results based on the data stream and pushes the results to other communicating clients. The client 100 and server 200 establish a network connection. The network provides a communication link between client 100 and server 200. The network can include various connection types, such as wired or wireless communication links or fiber optic cables. Data transmitted by client 100 may need to be encoded, transcoded, compressed, or otherwise processed before being published to server 200.

[0040] Client 100 can be a browser, application (APP), web application such as HyperText Markup Language 5 (H5) application, or a lightweight application (also known as a mini-program) or cloud application, etc. Client 100 can be developed based on the software development kit (SDK) of the corresponding service provided by server 200, such as based on the Real Time Communication (RTC) SDK. Client 100 can be deployed in electronic devices and depends on the device to run or some APP on the device to run. Electronic devices may have a display screen and support information browsing, such as personal mobile terminals such as mobile phones, tablets, and personal computers. Various other types of applications can also be configured in electronic devices, such as human-computer interaction applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0041] Server 200 may include servers providing various services, such as servers providing communication services to multiple clients, servers supporting backend training of models used on clients, and servers processing data sent by clients. It should be noted that server 200 can be implemented as a distributed server cluster composed of multiple servers, or as a single server. The server can also be a server in a distributed system, or a server integrated with blockchain. The server can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0042] It is worth noting that the code task processing methods provided in the embodiments of this specification are generally executed by the server. However, in other embodiments of this specification, the client may also have similar functionality to the server, thereby executing the code task processing methods provided in the embodiments of this specification. In other embodiments, the code task processing methods provided in the embodiments of this specification may also be executed jointly by the client and the server.

[0043] See Figure 3 , Figure 3 This specification shows a flowchart of a code task processing method according to an embodiment, which specifically includes the following steps: Step 302: Obtain the code data to be processed for the target code task.

[0044] It should be noted that the target code task can be of different types, such as code reading tasks, code comment generation tasks, code explanation tasks, code function generation tasks, etc. The code data to be processed refers to the object being processed during the code task. The code data to be processed can be code fragments, syntax elements, etc., depending on the actual situation; this specification does not impose any limitations on this aspect in the embodiments.

[0045] In practical applications, there are various ways to obtain the code data to be processed for a target code task, and the specific method should be selected according to the actual situation. This specification does not impose any limitations on these methods in the embodiments. In one possible implementation, the system can receive operations from the client regarding the code data to be processed, and in response to these operations, obtain the code data to be processed for the target code task. In another possible implementation, the system can periodically read the code data to be processed for the target code task from other data acquisition devices or a database.

[0046] In one optional embodiment of this specification, the above-described method for obtaining the code data to be processed for the target code task may include the following steps: In response to client operations on code data to be processed, retrieve the code data to be processed for the target code task.

[0047] It should be noted that the client can display the source code file corresponding to the target code task, which includes the code data to be processed. The client can perform operations on the code data to be processed within the source code file. After the server detects the client's operation on the code data to be processed, it responds to the operation and obtains the code data to be processed for the target code task.

[0048] In practical applications, the client can perform operations on the code data to be processed using any of the following methods: clicking, double-clicking, touch, mouse hovering, swiping, long-pressing, voice control, or shaking. The specific method to be selected depends on the actual situation, and this specification does not limit the specific methods used in the embodiments.

[0049] The solution implemented in the embodiments of this specification, in response to the client's operation on the code data to be processed, obtains the code data to be processed for the target code task, thereby accurately determining the code data to be processed and improving the interactivity of the user when processing code tasks.

[0050] Step 304: Find the task processing result of the code data to be processed from multiple function description information. The function description information includes the first description information of the calling function. The first description information is obtained by the code processing model based on the function information of the calling function, the context information of the calling function, and the function call information of the calling function. The function call information is obtained based on the syntax parsing of the source code file.

[0051] It should be noted that the task processing result corresponds to the target code task. If the target code task is a code comment generation task, the code processing result is the comment information of the code data to be processed; if the target code task is a code interpretation task, the code processing result is the interpretation information of the code data to be processed.

[0052] Function descriptions of multiple functions in the source code file can be stored in a repository. Optionally, when storing multiple function descriptions in the repository, the function descriptions can be stored at the nodes corresponding to the function call tree. After obtaining the code data to be processed for the target code task, the task processing result of the code data to be processed can be found from the multiple function descriptions included in the repository. Multiple functions include calling functions and non-calling functions. A calling function is a function that directly or indirectly calls other functions; it not only contains its own logic but also executes more complex tasks by calling other functions. A non-calling function is a function that does not call any other functions; it only executes its own defined logic and does not depend on calls from other functions. Function descriptions are used to describe the corresponding functions in natural language. Function descriptions include at least one of function explanation information, function purpose information, and function comment information. Since functions include both calling and non-calling functions, function descriptions include first descriptions of calling functions and second descriptions of non-calling functions. The second description is obtained by the code processing model based on the function information of the non-calling functions.

[0053] The code processing model is used to analyze and understand code based on the model's input information and output function description information. The code processing model can be a large model for code data, or a deep learning model obtained through supervised fine-tuning based on the function information of sample function calls, the context information of sample function calls, the function call information of sample function calls, and the first description information of sample function calls, and / or a deep learning model obtained through supervised fine-tuning based on the function information of sample non-function calls and the second description information of sample non-function calls.

[0054] By applying the scheme of the embodiments of this specification, the first description information of the calling function is generated by the code processing model based on the function information, context information and function call information of the calling function. This can generate detailed and context-rich function description information for each calling function, reduce the generation illusion of the code processing model, and further improve the accuracy of task processing results.

[0055] In practical applications, there are various ways to find the task processing result of the code data to be processed from multiple function descriptions. The specific method is selected according to the actual situation, and this specification does not limit this approach. In one possible implementation, the task processing result of the code data to be processed can be found from multiple function descriptions based on the data identifier of the code data to be processed and the information identifiers carried by the multiple function descriptions. In another possible implementation, the similarity between the code data to be processed and each function in the code library can be calculated. The function description information corresponding to the functions with higher similarity can be determined as the target function description information of the code data to be processed. Based on the target code task, the task processing result of the code data to be processed can be extracted from the target function description information.

[0056] In one optional embodiment of this specification, the function description information carries an information identifier; the task processing result of searching for the code data to be processed from multiple function description information may include the following steps: Based on the data identifier of the code data to be processed, the target function description information is determined from multiple function description information, wherein the information identifier of the target function description information is the same as the data identifier; Based on the target code task, extract the task processing result from the target function description information to extract the code data to be processed.

[0057] It should be noted that the information identifier is used to uniquely identify the corresponding function description information. The information identifier can be the identifier of the function corresponding to the function description information, such as the function number. The data identifier is used to uniquely identify the code data to be processed. The data identifier can be the number of the code data to be processed. If the code data to be processed includes multiple functions, the data identifier can be a sequence of identifiers composed of the identifiers of each of the included functions.

[0058] For example, suppose the data identifier of the code data to be processed is 'a', and the information database includes function description information for three functions, namely function description information 1, function description information 2, and function description information 3. Function description information 1 carries information identifier 1 as 'a', function description information 2 carries information identifier 2 as 'b', and function description information 3 carries information identifier 3 as 'c'. When determining the target function description information from multiple function description information based on the data identifier of the code data to be processed, the data identifier can be matched with information identifier 1, information identifier 2, and information identifier 3 respectively. If the data identifier matches information identifier 1, then function description information 1 is determined as the target function description information.

[0059] Furthermore, the target function description information may include function explanation information, function function information, and function comment information. If the target code task is a code reading task, then the function explanation information, function function information, and function comment information are determined as the task processing results of the code data to be processed. If the target code task is a code interpretation task, then the function explanation information is determined as the task processing result of the code data to be processed.

[0060] By applying the scheme of the embodiments of this specification, the target function description information is determined from the multiple function description information by utilizing the information identifiers carried by the multiple function description information and the data identifiers of the code data to be processed, making the target function description information more accurate. Furthermore, according to the task type of the target code task, the task processing result of the code data to be processed is extracted from the target function description information, making the task processing result more consistent with the target code task and improving the accuracy of the task processing result.

[0061] In one optional embodiment of this specification, the function description information further includes second description information of non-calling functions; before searching for the task processing result of the code data to be processed from multiple function description information, the second description information of non-calling functions can be generated using the code processing model, and the second description information can be stored in the information database. That is, before searching for the task processing result of the code data to be processed from multiple function description information, the following steps may also be included: Input the function information of the non-calling function into the code processing model to obtain the second description information of the non-calling function.

[0062] It should be noted that the function information of a non-called function refers to the function's own attribute information, including its function name, parameter list, return type, and code logic within the function body. The secondary descriptive information of a non-called function is used to describe its explanation, function, and comments in natural language.

[0063] In practical applications, before inputting the function information of the non-calling function into the code processing model to obtain the second descriptive information of the non-calling function, it is also possible to obtain the function information of the non-calling function directly by viewing the function definition in the source code file. After obtaining the second descriptive information of the non-calling function, this second descriptive information can be stored in an information database.

[0064] By applying the solution of the embodiments in this specification, a second description of non-calling functions is generated based on the function information of non-calling functions using a code processing model, so that the information database includes complete function description information from the source code files, thereby improving the comprehensiveness of the function description information.

[0065] In one optional embodiment of this specification, before searching for the task processing result of the code data to be processed from multiple function description information, a code generation model can be used to generate the first description information of the calling function. That is, before searching for the task processing result of the code data to be processed from multiple function description information, the following steps can be included: Obtain the source code file, which contains multiple function calls; Perform syntax parsing on the source code file to determine the function call information of the called functions; Construct a function call tree based on multiple calling functions and function call information; The function call tree is traversed hierarchically to determine the context information of the calling function; Input the function information of the called function, the context information of the called function, and the function call information of the called function into the code processing model to obtain the first description information of the called function.

[0066] It should be noted that source code files refer to the code files used to write software projects. The file extensions for source code files include, but are not limited to, ".py", ".c", ".cpp", and ".js", depending on the actual project; this specification does not impose any limitations on this. Function information for a called function refers to the attribute information of the called function itself, including but not limited to function name, parameter list, return type, scope, etc. The function information of multiple functions (including called and non-called functions) included in the source code file can be obtained by parsing the source code file, such as by traversing the syntax structure graph obtained from the parsing. The function information of each function can be stored in the code library using a dictionary or a custom class; therefore, the function information of each function can be obtained from the code library. The first descriptive information of the called function is used to describe the explanation, function, and comments of the called function in natural language. The context information of the called function refers to the function description information of the function called by the called function. The function called by the called function is called the context of the called function. Function call information refers to the function call relationships between a calling function and other functions when the calling function calls other functions (such as direct calls, recursive calls, nested calls, circular calls, etc.) and the function information of other functions (such as the file, line number, name, class, parameters, etc. of other functions).

[0067] In practical applications, there are multiple ways to obtain source code files, and the specific method should be chosen according to the actual situation. This specification does not impose any limitations on this method in its embodiments. One possible implementation of this specification involves traversing the repository directory of the code repository to search for source code files. Another possible implementation of this specification involves receiving source code files sent by the user through a client.

[0068] Furthermore, there are multiple ways to perform syntax parsing on the source code file to determine the function call information of the called functions. The specific method chosen depends on the actual situation, and this specification does not impose any limitations on this approach. In one possible implementation of this specification, static code analysis tools can be directly used to perform syntax parsing on the source code file to obtain the function call information of each called function. In another possible implementation of this specification, syntax parsing can be performed on the source code file to obtain a syntax structure diagram, and the function call information of each called function can be determined based on the syntax structure diagram.

[0069] By applying the scheme of the embodiments in this specification, the function call information of each called function is determined by parsing the source code file. This enables the code processing model to understand the global information of the entire source code file, reducing the generation illusion of the code processing model. Furthermore, by incorporating the context information of the called functions into the input of the code processing model, detailed and context-rich function description information can be generated for each called function. This helps developers quickly understand unfamiliar code languages ​​and projects, thereby improving learning effectiveness and development efficiency.

[0070] In one optional embodiment of this specification, the above-described syntax parsing of the source code file to determine the function call information may include the following steps: The source code file is parsed to obtain a syntax structure graph, which is constructed by using the syntax elements in the source code file as nodes and the relationships between the syntax elements as edges. Traverse the syntax structure graph to determine the function calls and their relationships. Based on the function information and function call relationships of the called function, determine the function call information of the called function.

[0071] It should be noted that the syntax structure diagram can be in the form of an abstract syntax tree. Function call relationships refer to the relationship between the caller and the callee. In programming, a function is a block of code that performs a specific task and can be called by other parts of the program. When one function directly or indirectly calls another function during its execution, a function call relationship is formed. Function call relationships include, but are not limited to, direct calls, recursive calls, nested calls, and circular calls; the specific choice depends on the actual situation, and this specification does not impose any limitations on these aspects in the embodiments.

[0072] In practical applications, a parser corresponding to the code language (such as the AST module provided by Python) can be used to parse the source code file and obtain a syntax structure diagram. For example, if the syntax structure diagram includes function A and function B, and there is a direct call relationship between function A and function B, then the function call information of function A can be determined as follows: function A directly calls function B, function B's function name is C, and function B belongs to file D.

[0073] Optionally, after parsing the source code file to obtain the syntax structure graph, you can also traverse the syntax structure graph to extract all function definitions and class definitions, record the attribute information of each function and class, including the file, line number, name, class, parameters, etc., and you can also define data structures (such as dictionaries or custom classes) to store this information.

[0074] By applying the scheme of the embodiments in this specification, the function call information of multiple calling functions is determined from the syntax structure diagram, thereby realizing the analysis and collection of the structural information of the entire code library, providing a global and consistent code understanding, facilitating the construction of detailed function call graphs and function call trees, ensuring the integrity and accuracy of the context, solving the problem of insufficient context dependency, enabling the code processing model to understand the global information of the entire source code file, and reducing the generation illusion of the code processing model.

[0075] In one optional embodiment of this specification, constructing a function call tree based on multiple calling functions and function call information may include the following steps: Construct a function call graph for the source code file, using multiple function calls as nodes and the function call relationships as edges. For any function call, the function call graph is split with the function call as the root node to obtain the function call tree of the function call.

[0076] It should be noted that since the context information of a function call refers to the function description information of the function called by the function call, the function called by the function call can be determined by the function call tree of the function call, and the function description information of the called function can be further determined as the context information. That is, the context information of the function call is obtained based on the function call tree of the function call, which is obtained by splitting the function call graph with the function call as the root node.

[0077] In practical applications, after constructing a function call graph using multiple calling functions as nodes and function call relationships as edges, for each specific calling function, the function call graph can be split, and a function call tree for that function can be extracted. Specifically, the function call graph can be recursively traversed: taking any calling function as the root node, all other functions called by that calling function are recursively traversed to construct the function call tree for that function. Optionally, for each node in the function call tree, code-related information such as the node's specific code content, file address, class, and number of times it has been called can be stored as function information on the node. Furthermore, the function information stored on the nodes can be dynamically adjusted, such as through addition, deletion, modification, and retrieval.

[0078] In practical applications, function information, function call context information, and function call information can be displayed and stored. When storing, you can choose to store it in JSON, relational database, or graph database format, depending on the actual situation. This specification does not impose any limitations on this.

[0079] By applying the scheme of the embodiments of this specification, the function call graph is split with any calling function as the root node to obtain the function call tree of the calling function, making the function call tree more detailed and accurate. Furthermore, based on the function call tree of the calling function, the context information of the calling function is determined, thereby improving the accuracy and comprehensiveness of the context information.

[0080] See Figure 4 , Figure 4 This specification illustrates a schematic diagram of a function call graph provided in one embodiment, as shown below. Figure 4 As shown, the function call graph uses 15 functions (function 1, function 2, function 3, ..., function 15) as nodes, and the function call relationships between these 15 functions are... Figure 4 The solid line (single arrow shown) is constructed from the edges. See also Figure 5 , Figure 5 This specification shows a schematic diagram of a function call tree provided in one embodiment, with function 4 as the root node, and so on. Figure 4 The function call diagram shown recursively traverses all other functions called by function 4, resulting in the following: Figure 5 The function call tree shown includes one root node (function 4), four child nodes (function 5, function 6, function 7 and function 8), and three leaf nodes (function 9, function 10 and function 11).

[0081] In one optional embodiment of this specification, the above-mentioned hierarchical traversal of the function call tree to determine the context information of the calling function may include the following steps: The function call tree of the calling function is traversed hierarchically to determine the child nodes of the calling function; When the child node is a leaf node, the function information of the child node is input into the code processing model to obtain the context information of the function call; When the child node is not a leaf node, the function information, function call information, and context information of the child node are input into the code processing model to obtain the context information of the called function.

[0082] It's important to note that leaf nodes are the terminal nodes in the function call tree, and they have no child nodes. Non-leaf nodes are any nodes in the function call tree other than the leaf nodes. Figure 5 Taking the function call tree shown as an example, assuming the calling function is function 4, then the child nodes of function 4 are function 5 and function 6.

[0083] In practical applications, if the child node of the calling function is a leaf node, it means that the child node does not call any other functions and is therefore a non-calling function. In this case, the function information of the child node can be input into the code processing model to obtain the function description information of the child node, and this function description information can be used as the context information for the calling function. If the child node of the calling function is not a leaf node, it means that the child node calls other functions and is therefore a calling function. In this case, the function information of the child node, the function call information of the child node, and the context information of the child node can be input into the code processing model to obtain the function description information of the child node, and this function description information can be used as the context information for the calling function.

[0084] It is worth noting that when the child node is a non-leaf node, it is also necessary to determine the context information of the child node. Therefore, a bottom-up hierarchical traversal method can be used to determine the context information of non-leaf nodes in the function call tree. When traversing any node, it can be ensured that all child nodes of that node have generated and stored the generated context information.

[0085] The scheme implemented in this specification adopts a bottom-up hierarchical traversal method to generate function description information for each node, and uses the function description information as the context information of its parent node, thereby generating higher quality function description information. This achieves the gradual accumulation and generation of context information, ensuring that each function node obtains comprehensive and rich context information.

[0086] In one optional embodiment of this specification, when processing large-scale codebases, a problem arises where nodes (such as the main function) call numerous child nodes (such as sub-functions). Excessively redundant model input data (such as function information, context information, and function call information) can negatively impact the output and generation speed of the code processing model. Therefore, the model input data can be pruned. Specifically, before inputting the function information, context information, and function call information of the calling function into the code processing model and obtaining the first descriptive information of the calling function, the following steps may be included: The input length of the model input data is determined based on the function information of the called function, the context information of the called function, and the function call information. If the input length is greater than the preset input length, the model input data is pruned to obtain updated model input data; The function information, context information, and function call information of the called function are input into the code processing model to obtain the first description information of the called function, including: The updated model input data is fed into the code to process the model and obtain the first descriptive information of the called function.

[0087] It should be noted that the preset input length is determined based on the type of model the code processes. For example, the preset input length is 4096 tokens. If the input length exceeds the preset length, it indicates that the model input data is too long, which will affect the output results and the result generation speed of the code processing model. In this case, the model input data can be pruned to obtain updated model input data. The length of the updated model input data should be less than or equal to the preset input length.

[0088] In practical applications, random pruning can be used when pruning model input data, but this may result in poor quality and low effectiveness of the input data. Therefore, while controlling the overall length of the model input data within a reasonable range, it is also necessary to ensure the quality and effectiveness of the input information. Thus, appropriate pruning strategies and sorting algorithms can be employed to effectively filter important information from the model input data.

[0089] The solution implemented in this specification involves cropping the model input data when the input length exceeds a preset input length to obtain updated model input data. This updated model input data is then input into the code to process the model, obtaining the first description information of the called function. This ensures the length of the model input and improves the efficiency of model generation.

[0090] In one optional embodiment of this specification, the above-mentioned pruning of the model input data to obtain updated model input data when the input length is greater than the preset input length may include the following steps: If the input length is greater than the preset input length, the child nodes of the called function are determined based on the context information and function call information; The priority of child nodes is determined according to the node classification strategy, wherein the node classification strategy is based on at least one of code length, code call frequency, code function, and code location; Based on priority, the context information is pruned to obtain updated model input data.

[0091] It's important to note that since code length directly affects the length of the model's input data, a node classification strategy based on code length can be used to determine the priority of child nodes, with shorter child nodes having higher priority than longer ones. Because frequently called functions are generally more important, a node classification strategy based on code call frequency can be used to determine the priority of child nodes, with more frequently called child nodes having higher priority than less frequently called ones. For example, the more descendant nodes a child node has, the more functions it involves, indicating higher core functionality and thus higher priority. Therefore, a node classification strategy based on code location can be used to determine the priority of child nodes. Finally, a node classification strategy based on code function indicates that child nodes whose code function is closely related to and important to the currently analyzed function have higher priority. Code function can be determined through multiple dimensions of information, such as function name, code comments, and documentation comments.

[0092] For example, child nodes can be sorted based on both code length and the number of times they are called. Child nodes with more calls and shorter code lengths will be ranked higher, and the model input data can be pruned according to the ranking results. During pruning, the context information of child nodes with high core functionality can be preserved first. If the context information of a single child node is too long, only the essential content of the function can be retained. For example, the function header and key logic can be preserved, along with the function description information generated by the model, while omitting internal implementation details.

[0093] Optionally, after determining the priority of child nodes according to the node classification strategy, function call information can be pruned, or both context information and function call information can be pruned simultaneously. The specific pruning method can be selected according to the actual situation, and this specification does not limit it in any way.

[0094] In practical applications, the function call tree can be pruned according to a node classification strategy, starting with high-priority nodes and gradually adding them to the model input data until a preset input length limit is reached. If the model input data exceeds the limit, the model input data can be dynamically adjusted. For example, some information from low-priority nodes can be omitted, retaining only the most critical information.

[0095] By applying the solutions in the embodiments of this specification, the priority of child nodes is distinguished from multiple dimensions, and the context information and / or function call information is pruned based on the priority to obtain updated model input data. This can effectively filter information from a large number of child nodes, reduce the length of model input data, ensure the quality and validity of model input data, and improve the efficiency of model generation and the accuracy of results.

[0096] The following is in conjunction with the appendix Figure 6 Taking the application of the code task processing method provided in this specification in a code reading scenario as an example, the code task processing method will be further explained. Among other things, Figure 6 This specification shows a flowchart of a code reading method according to an embodiment, which specifically includes the following steps: Step 602: Obtain the code data to be processed for the code reading task.

[0097] Step 604: From multiple function description information, search for the code reading information of the code data to be processed. The function description information includes the first description information of the calling function. The first description information is obtained by the code processing model based on the function information of the calling function, the context information of the calling function, and the function call information of the calling function. The function call information is obtained based on the syntax parsing of the source code file.

[0098] It should be noted that the code reading task refers to the task of analyzing, understanding, commenting on, and explaining code. Code reading information is used to help developers better understand, analyze, and improve code. Code reading information includes code explanation information, code function information, and code comment information. The implementation methods of steps 602 and 604 are the same as those of steps 302 and 304, and will not be described again in the embodiments of this specification.

[0099] The solution implemented in this specification generates first description information of a calling function based on the function information, context information, and function call information of the calling function using a code processing model. This generates detailed and context-rich function description information for each calling function, reducing the generation illusion of the code processing model, further improving the accuracy of code reading information, and realizing a high-quality code reading task processing solution based on the code processing model.

[0100] In one optional embodiment of this specification, the code reading method can also be used for code writing tasks. After searching for code reading information of the code data to be processed from multiple function description information, the method may further include the following steps: Input code writing prompts and code reading information into the code processing model to obtain the target code output by the code processing model.

[0101] It should be noted that code writing prompts guide the code processing model to write code based on the code reading information, outputting the target code. The target code refers to code generated based on the code reading information, such as new code that matches the information, or code data obtained by continuing or completing the code data to be processed. The code processing model can be a large model in the code domain, possessing a certain level of code processing capabilities.

[0102] In practical applications, code writing prompts, code reading information, and code data to be processed can also be input into the code processing model to obtain the target code output by the code processing model.

[0103] The solution implemented in the embodiments of this specification enhances the code processing model's understanding of the code data to be processed by leveraging the code processing capabilities of the code processing model and writing code based on code reading information, thereby further improving the accuracy of the target code writing.

[0104] See Figure 7 , Figure 7 This specification shows a flowchart of a code processing method according to an embodiment, which specifically includes the following steps: Step 702: Obtain the source code file, which contains multiple function calls.

[0105] Step 704: Perform syntax parsing on the source code file to determine the function call information of multiple calling functions.

[0106] Step 706: Input the function information, context information, and function call information of multiple calling functions into the code processing model to obtain the first description information of multiple calling functions.

[0107] It should be noted that steps 702 to 706 are related to... Figure 3The implementation of the code task processing method shown, which includes "obtaining source code files, where the source code files include multiple calling functions; performing syntax parsing on the source code files to determine the function call information of the calling functions; constructing a function call tree of the calling functions based on the multiple calling functions and the function call information; traversing the function call tree of the calling functions hierarchically to determine the context information of the calling functions; and inputting the function information of the calling functions, the context information of the calling functions, and the function call information of the calling functions into the code processing model to obtain the first description information of the calling functions", is the same, and will not be described again in the embodiments of this specification.

[0108] By applying the scheme of the embodiments in this specification, the function call information of each called function is determined through syntax parsing of the source code file. This allows the code processing model to understand the global information of the entire source code file, reducing the generation illusion of the code processing model. Furthermore, by incorporating the context information of the called functions into the input of the code processing model, detailed and context-rich natural language function description information can be generated for each called function, no longer limited to the display of simple flowchart call relationships. This enables even novice developers to quickly understand the code structure and logic, significantly reducing the learning curve and code reading threshold, helping developers quickly understand unfamiliar code languages ​​and projects, thereby improving learning effectiveness and development efficiency.

[0109] See Figure 8 , Figure 8 This specification illustrates a flowchart of a code processing method according to one embodiment, as shown below. Figure 8 As shown, the code processing method includes four stages: static code analysis, function call tree construction, tree node hierarchical traversal, and reading information generation. The following sections will provide a detailed explanation of each of these four stages.

[0110] Static code analysis: Obtain source code files; perform syntax parsing on source code files to obtain a syntax structure diagram; traverse the syntax structure diagram to determine multiple function calls in the source code files and the function call relationships between these functions; based on the function information and function call relationships of the multiple function calls, determine the function call information of each function call. Function call tree construction: Construct a function call graph using multiple calling functions as nodes and the function call relationships between multiple calling functions as edges; then split the function call graph with the calling function as the root node to obtain the function call tree of the calling functions; Tree node level traversal: Using a bottom-up level traversal method, the function call tree of the calling function is traversed to determine the function description information of each node in the function call tree, and the function description information of the current node is determined as the context information of the parent node of the current node; Reading information generation: Based on the function information of the calling function, the context information of the calling function, and the function call information, the input length of the model input data is determined; if the input length is greater than the preset input length, the model input data is pruned to obtain updated model input data; the updated model input data is input into the code processing model to obtain the reading information of the calling function, which includes code explanation information, code comment information, and code function information.

[0111] By applying the solutions in the embodiments of this specification, combining static code analysis and code processing models, and using a bottom-up hierarchical traversal method, detailed and context-rich function description information is generated for each function, effectively reducing the generation of model illusions and generating code information for the entire code repository, making it convenient for developers to read.

[0112] Corresponding to the above-described code task processing method embodiments, this specification also provides embodiments of code task processing apparatus. Figure 9 A schematic diagram of a code task processing apparatus according to one embodiment of this specification is shown. Figure 9 As shown, the device includes: The first acquisition module 902 is configured to acquire the code data to be processed for the target code task; The first search module 904 is configured to search for the task processing result of the code data to be processed from multiple function description information. The function description information includes the first description information of the calling function. The first description information is obtained by the code processing model based on the function information of the calling function, the context information of the calling function, and the function call information of the calling function. The function call information is obtained based on the syntax parsing of the source code file.

[0113] Optionally, the function description information may further include second description information of the non-calling function; the device may further include: a first processing module configured to input the function information of the non-calling function into a code processing model to obtain the second description information of the non-calling function.

[0114] Optionally, the device further includes: a fourth acquisition module configured to acquire a source code file, wherein the source code file includes multiple calling functions; perform syntax parsing on the source code file to determine the function call information of the calling functions; construct a function call tree of the calling functions based on the multiple calling functions and the function call information; perform a level-wise traversal of the function call tree of the calling functions to determine the context information of the calling functions; and input the function information of the calling functions, the context information of the calling functions, and the function call information of the calling functions into the code processing model to obtain the first description information of the calling functions.

[0115] Optionally, the fourth acquisition module is further configured to perform syntax parsing on the source code file to obtain a syntax structure graph, wherein the syntax structure graph is constructed using syntax elements in the source code file as nodes and the relationships between syntax elements as edges; traverse the syntax structure graph to determine the called functions and their function call relationships; and determine the function call information of the called functions based on their function information and function call relationships.

[0116] Optionally, the fourth acquisition module is further configured to construct a function call graph of the source code file using multiple calling functions of the source code file as nodes and the function call relationship of the calling functions as edges; for any calling function, the function call graph is split with the calling function as the root node to obtain the function call tree of the calling function.

[0117] Optionally, the fourth acquisition module is further configured to perform a hierarchical traversal of the function call tree of the calling function to determine the child nodes of the calling function; if the child node is a leaf node, the function information of the child node is input into the code processing model to obtain the context information of the calling function; if the child node is a non-leaf node, the function information of the child node, the function call information of the child node, and the context information of the child node are input into the code processing model to obtain the context information of the calling function.

[0118] Optionally, the device further includes: a trimming module, configured to determine the input length of the model input data based on the function information of the called function, the context information of the called function, and the function call information of the called function; trimming the model input data to obtain updated model input data if the input length is greater than a preset input length; and a fourth acquisition module, further configured to input the updated model input data into the code processing model to obtain the first description information of the called function.

[0119] Optionally, the pruning module is further configured to, when the input length is greater than a preset input length, determine the child nodes of the calling function based on context information and function call information; determine the priority of the child nodes based on a node classification strategy, wherein the node classification strategy is obtained based on at least one of code length, code call frequency, code function, and code position; and prune the context information according to the priority to obtain updated model input data.

[0120] Optionally, the function description information carries an information identifier; the first search module 904 is further configured to determine the target function description information from multiple function description information based on the data identifier of the code data to be processed, wherein the information identifier of the target function description information is the same as the data identifier; and extract the task processing result of the code data to be processed from the target function description information according to the target code task.

[0121] By applying the scheme of the embodiments of this specification, the first description information of the calling function is generated by the code processing model based on the function information, context information and function call information of the calling function. This can generate detailed and context-rich function description information for each calling function, reduce the generation illusion of the code processing model, and further improve the accuracy of task processing results.

[0122] The above is an illustrative scheme of a code task processing device according to this embodiment. It should be noted that the technical solution of this code task processing device and the technical solution of the above-described code task processing method belong to the same concept. For details not described in detail in the technical solution of the code task processing device, please refer to the description of the technical solution of the above-described code task processing method.

[0123] Corresponding to the above-described code reading method embodiments, this specification also provides embodiments of a code reading device. Figure 10 A schematic diagram of the structure of a code reading device according to one embodiment of this specification is shown. Figure 10 As shown, the device includes: The second acquisition module 1002 is configured to acquire the code data to be processed for the code reading task; The second search module 1004 is configured to search for code reading information of the code data to be processed from multiple function description information. The function description information includes the first description information of the calling function. The first description information is obtained by the code processing model based on the function information of the calling function, the context information of the calling function, and the function call information of the calling function. The function call information is obtained based on the syntax parsing of the source code file.

[0124] Optionally, the device further includes a second processing module configured to input code writing prompts and code reading information into the code processing model to obtain the target code to be written output by the code processing model.

[0125] The solution implemented in this specification generates first description information of a calling function based on the function information, context information, and function call information of the calling function using a code processing model. This generates detailed and context-rich function description information for each calling function, reducing the generation illusion of the code processing model, further improving the accuracy of code reading information, and realizing a high-quality code reading task processing solution based on the code processing model.

[0126] The above is an illustrative scheme of a code reading device according to this embodiment. It should be noted that the technical solution of this code reading device and the technical solution of the code reading method described above belong to the same concept. For details not described in detail in the technical solution of the code reading device, please refer to the description of the technical solution of the code reading method described above.

[0127] Corresponding to the above-described code processing method embodiments, this specification also provides embodiments of a code processing apparatus. Figure 11 A schematic diagram of the structure of a code processing apparatus according to one embodiment of this specification is shown. Figure 11 As shown, the device includes: The third acquisition module 1102 is configured to acquire source code files, wherein the source code files include multiple function calls; Parsing module 1104 is configured to perform syntax parsing on source code files to determine function call information for multiple calling functions. The input module 1106 is configured to input the function information of multiple called functions, the context information of multiple called functions, and the function call information of multiple called functions into the code processing model, so as to obtain the first description information of multiple called functions respectively.

[0128] By applying the scheme of the embodiments in this specification, the function call information of each called function is determined by parsing the source code file. This enables the code processing model to understand the global information of the entire source code file, reducing the generation illusion of the code processing model. Furthermore, by incorporating the context information of the called functions into the input of the code processing model, detailed and context-rich function description information can be generated for each called function. This helps developers quickly understand unfamiliar code languages ​​and projects, thereby improving learning effectiveness and development efficiency.

[0129] The above is an illustrative scheme of a code processing device according to this embodiment. It should be noted that the technical solution of this code processing device and the technical solution of the above-described code processing method belong to the same concept. For details not described in detail in the technical solution of the code processing device, please refer to the description of the technical solution of the above-described code processing method.

[0130] Figure 12 A structural block diagram of a computing device according to one embodiment of this specification is shown. The components of the computing device 1200 include, but are not limited to, a memory 1210 and a processor 1220. The processor 1220 is connected to the memory 1210 via a bus 1230, and a database 1250 is used to store data.

[0131] The computing device 1200 also includes an access device 1240, which enables the computing device 1200 to communicate via one or more networks 1260. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 1240 may include one or more of any type of wired or wireless network interface (e.g., Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Networks (WLAN) interface, a Wi-MAX (World Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0132] In one embodiment of this specification, the aforementioned components of the computing device 1200 and Figure 12 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 12 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0133] The computing device 1200 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 1200 can also be a mobile or stationary server.

[0134] The processor 1220 is used to execute computer programs / instructions, which, when executed by the processor, implement the steps of the above-mentioned code task processing method, code reading method, or code processing method.

[0135] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device belongs to the same concept as the technical solutions of the code task processing method, code reading method, and code processing method described above. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solutions of the code task processing method, code reading method, or code processing method described above.

[0136] An embodiment of this specification also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the above-described code task processing method, code reading method, or code processing method.

[0137] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium belongs to the same concept as the technical solutions of the code task processing method, code reading method, and code processing method described above. Details not described in detail in the technical solution of the storage medium can be found in the descriptions of the technical solutions of the code task processing method, code reading method, or code processing method described above.

[0138] An embodiment of this specification also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps of the above-described code task processing method, code reading method, or code processing method.

[0139] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product belongs to the same concept as the technical solutions of the code task processing method, code reading method, and code processing method described above. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solutions of the code task processing method, code reading method, or code processing method described above.

[0140] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0141] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0142] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0143] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0144] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A code task processing method, comprising: Obtain the code data to be processed for the target code task; The task processing result of the code data to be processed is found from multiple function description information. The function description information includes first description information of the calling function. The first description information is obtained by the code processing model based on the function information of the calling function, the context information of the calling function, and the function call information of the calling function. The function call information is obtained based on the syntax parsing of the source code file.

2. The method according to claim 1, wherein the function description information further includes second description information that is not a called function; Before searching for the task processing result of the code data to be processed from multiple function description information, the process further includes: The function information of the non-calling function is input into the code processing model to obtain the second description information of the non-calling function.

3. The method according to claim 1, further comprising, before searching for the task processing result of the code data to be processed from multiple function description information: Obtain the source code file, wherein the source code file includes multiple function calls; The source code file is parsed to determine the function call information of the called function; Based on the multiple calling functions and the function call information, construct the function call tree of the calling functions; The function call tree of the called function is traversed hierarchically to determine the context information of the called function; The function information of the called function, the context information of the called function, and the function call information of the called function are input into the code processing model to obtain the first description information of the called function.

4. The method according to claim 3, wherein parsing the source code file to determine the function call information of the called function includes: The source code file is parsed to obtain a syntax structure graph, wherein the syntax structure graph is constructed using the syntax elements in the source code file as nodes and the relationships between the syntax elements as edges; Traverse the syntax structure graph to determine the called functions and their function call relationships; Based on the function information of the called function and the function call relationship, the function call information of the called function is determined.

5. The method according to claim 3, wherein constructing the function call tree of the calling functions based on the plurality of calling functions and the function call information comprises: Using multiple function calls in the source code file as nodes and the function call relationships of the function calls as edges, construct a function call graph for the source code file; For any function call, the function call graph is split with the function call as the root node to obtain the function call tree of the function call.

6. The method according to claim 3, wherein the hierarchical traversal of the function call tree of the called function to determine the context information of the called function includes: The function call tree of the called function is traversed hierarchically to determine the child nodes of the called function; When the child node is a leaf node, the function information of the child node is input into the code processing model to obtain the context information of the called function; When the child node is a non-leaf node, the function information of the child node, the function call information of the child node, and the context information of the child node are input into the code processing model to obtain the context information of the called function.

7. The method according to claim 3, before inputting the function information of the called function, the context information of the called function, and the function call information of the called function into the code processing model to obtain the first description information of the called function, further comprising: The input length of the model input data is determined based on the function information of the called function, the context information of the called function, and the function call information of the called function. If the input length is greater than the preset input length, the model input data is truncated to obtain updated model input data; The step of inputting the function information of the called function, the context information of the called function, and the function call information of the called function into the code processing model to obtain the first description information of the called function includes: The updated model input data is input into the code processing model to obtain the first description information of the called function.

8. The method according to claim 7, wherein when the input length is greater than a preset input length, pruning the model input data to obtain updated model input data includes: If the input length is greater than the preset input length, the child nodes of the called function are determined based on the context information and the function call information; The priority of the child nodes is determined according to the node classification strategy, wherein the node classification strategy is obtained based on at least one of code length, code call frequency, code function, and code location; Based on the priority, the context information is pruned to obtain updated model input data.

9. The method according to claim 1, wherein the function description information carries an information identifier; The task processing result of searching for the code data to be processed from multiple function description information includes: Based on the data identifier of the code data to be processed, the target function description information is determined from multiple function description information, wherein the information identifier of the target function description information is the same as the data identifier; Based on the target code task, the task processing result is obtained by extracting the code data to be processed from the target function description information.

10. A code reading method, comprising: Retrieve the code data to be processed for the code reading task; From multiple function description information, the code reading information of the code data to be processed is searched. The function description information includes first description information of the calling function. The first description information is obtained by the code processing model based on the function information of the calling function, the context information of the calling function, and the function call information of the calling function. The function call information is obtained based on the syntax parsing of the source code file.

11. The method according to claim 10, further comprising, after searching for the code reading information of the code data to be processed from multiple function description information, the method further comprises: Input the code writing prompts and the code reading information into the code processing model to obtain the target code output by the code processing model.

12. A code processing method, comprising: Obtain the source code file, wherein the source code file includes multiple function calls; The source code file is parsed to determine the function call information of the multiple calling functions. The function information, context information, and function call information of the multiple calling functions are input into the code processing model to obtain the first description information of the multiple calling functions.

13. A code task processing system, comprising a client and a server; The client is used to send the code data to be processed for the target code task to the server; The server is used to find the task processing result of the code data to be processed from multiple function description information, wherein... The function description information includes first description information of the calling function, which is obtained by the code processing model based on the function information of the calling function, the context information of the calling function, and the function call information of the calling function. The function call information is obtained based on the syntax parsing of the source code file.

14. A computing device, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the method described in any one of claims 1 to 9, any one of claims 10 to 11, or claim 12.

15. A computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the method of any one of claims 1 to 9, any one of claims 10 to 11, or claim 12.

16. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of any one of claims 1 to 9, any one of claims 10 to 11, or the method of claim 12.