CN-122018956-A - Code data management method and related device based on artificial intelligence
Abstract
One or more situations provide herein provide a code data management method and related device based on artificial intelligence, wherein the code data management method comprises the steps of obtaining a first code processing request, searching a first code graph based on the first code processing request to obtain a first node set, and processing the first code processing request according to a first sub-graph corresponding to a plurality of first nodes in the first code graph to obtain a data management result corresponding to the first code processing request. The complex project codes are converted into the form of the code graph to be expressed, graph searching is carried out from the code graph to obtain the nodes which are strongly related to the code requests, and then the data treatment is carried out on the code requests by combining with the subgraphs formed by the strongly related nodes, so that a set of general and efficient code data treatment logic is provided for different types of code processing requests, partial codes which are related to the code processing requests in the project codes are rapidly focused, the code data treatment efficiency is improved, and the accuracy of the code data treatment is improved.
Inventors
- LIU BIN
- LU YIFENG
- LI YINGCHAO
- LIN CHENXI
Assignees
- 北京火山引擎科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260413
Claims (14)
- 1. A code data governance method based on artificial intelligence, comprising: acquiring a first code processing request, wherein the first code processing request is used for carrying out data management on a first project code; Searching a first code graph based on the first code processing request to obtain a first node set, wherein nodes in the first code graph represent code entities in the first project code, edges in the first code graph represent relations among the code entities, the first node set comprises a plurality of first nodes, and the association degree between each first node in the plurality of first nodes and the first code processing request meets a first setting condition; And processing the first code processing request according to the first subgraphs corresponding to the plurality of first nodes in the first code diagram to obtain a data treatment result corresponding to the first code processing request.
- 2. The method of claim 1, wherein a degree of association between each of the plurality of first nodes and the first code processing request is measured by at least one of: The text matching degree of the first node and the first code processing request; The degree of association between the first node and other nodes in the first code map; The distance between the first node and other first nodes in the first code diagram; the first node is arranged to generate a first code processing request, the first node is arranged to generate a first node, the first node is arranged to generate a frequency of occurrence in a historical data processing result, wherein the historical data processing result is a data processing result corresponding to a historical code processing request, the historical code processing request corresponds to the same task type as the first code processing request, and The degree of association between the external data associated with the first node and the first code processing request.
- 3. The method of claim 2, wherein the degree of association between the external data associated with the first node and the first code processing request is obtained by: identifying semantic information of the first code processing request; acquiring an external data type matched with the semantic information of the first code processing request; calling a tool corresponding to the external data type to obtain external data associated with the first node; And analyzing the external data based on the semantic information of the first code processing request to obtain the association degree between the external data associated with the first node and the first code processing request.
- 4. The method of claim 1, wherein the searching the first code pattern based on the first code processing request to obtain the first node set comprises: screening at least one initial node from the first code graph based on the first code processing request; And searching the first code graph by taking the at least one initial node as a starting point to obtain at least one associated node connected with the at least one initial node, and obtaining the first node set according to the at least one initial node and the at least one associated node, wherein the association degree between each associated node in the at least one and the first code processing request meets the first setting condition.
- 5. The method of claim 4, wherein the screening at least one initial node from the first code graph based on the first code processing request comprises: Searching in the first code diagram based on the first code processing request by using at least one of a text index, a structure index and a semantic index to obtain at least one initial node; The text index comprises mapping relations between attribute information of a plurality of code entities and node identifications of a plurality of nodes, the structure index comprises mapping relations between relation types among the code entities and edge identifications of a plurality of edges, the semantic index comprises mapping relations between a plurality of space vectors and the node identifications of the plurality of nodes, and the plurality of space vectors are obtained by converting the attribute information of the plurality of code entities into vectors.
- 6. The method of claim 4, wherein the searching the first code graph with the at least one initial node as a starting point to obtain at least one associated node connected with the at least one initial node, and obtaining the first node set according to the at least one initial node and the at least one associated node, comprises: Executing a multi-round searching process in the first code graph by taking the at least one initial node as a starting point, and obtaining the first node set according to the searching result of the multi-round searching process; Each round of the searching process is used for judging whether to add a second node to the first node set based on the association degree between the second node and the first code processing request, wherein the second node is the at least one initial node or the at least one association node.
- 7. The method of claim 6, wherein the performing a multi-round search process in the first code graph starting from the at least one initial node, and obtaining the first set of nodes according to search results of the multi-round search process, comprises: According to the association degree between the at least one initial node and the first code processing request, the at least one initial node is arranged in a descending order, and the at least one initial node after the descending order is added to a first queue in sequence; The following steps are circularly executed until the termination condition is satisfied: acquiring the second node positioned at the head of the first queue in the first queue; In response to the degree of association between the second node and the first code processing request meeting the first set condition, adding the second node to the first set of nodes; Traversing neighbor nodes of the second node, and adding the neighbor nodes to a first position of the first queue based on the association degree between the neighbor nodes and the first code processing request in response to the fact that the neighbor nodes are first accessed nodes and the association degree between the neighbor nodes and the first code processing request meets a second set condition, so that the association degree between the first queue head-to-tail nodes of the first queue and the first code processing request is gradually reduced.
- 8. The method of claim 1, wherein the first code pattern is constructed by: Acquiring a first project code; extracting a plurality of code entities of the first project code according to the abstract syntax tree of the first project code; and constructing the first code graph according to the plurality of code entities of the first project code.
- 9. The method of claim 8, wherein the acquiring the first item code comprises: scanning a code warehouse to obtain a plurality of code files; And taking the code file with the file type belonging to the source code file as the first project code according to the file types of the plurality of code files.
- 10. The method of any of claims 1 to 9, wherein the task type to which the first code processing request corresponds includes at least one of a code writing task, a code optimizing task, and a problem troubleshooting task.
- 11. A code data governance device based on artificial intelligence, comprising: The acquisition module is configured to acquire a first code processing request, wherein the first code processing request is used for carrying out data management on a first project code; the searching module is configured to search a first code graph based on the first code processing request to obtain a first node set, wherein nodes in the first code graph represent code entities in the first project code, edges in the first code graph represent the relation between the code entities, the first node set comprises a plurality of first nodes, and the association degree between each first node in the plurality of first nodes and the first code processing request meets a first setting condition; And the processing module is configured to process the first code processing request according to the first subgraphs corresponding to the plurality of first nodes in the first code diagram to obtain a data management result corresponding to the first code processing request.
- 12. An electronic device, comprising: at least one processor, and At least one memory including one or more computer program instructions; Wherein the one or more computer program instructions, when executed by the processor, perform the method of any of claims 1 to 10.
- 13. A computer readable storage medium, non-transitory storing computer readable instructions, wherein the computer readable instructions when executed by a processor implement the method of any one of claims 1 to 10.
- 14. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1 to 10.
Description
Code data management method and related device based on artificial intelligence Technical Field One or more aspects herein relate to an artificial intelligence based code data governance method, an artificial intelligence based code data governance apparatus, an electronic device, a computer readable storage medium, and a computer program product. Background Along with the continuous increase of the scale of software development projects, the number of project codes is gradually increased, the code logic is gradually complicated, and the process of treating the code data by developers is increasingly complicated, so that the improvement of the efficiency of treating the code data is particularly important. Disclosure of Invention This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter. At least one situation of the present disclosure provides an artificial intelligence-based code data governance method, which includes obtaining a first code processing request, searching a first code graph based on the first code processing request to obtain a first node set, wherein nodes in the first code graph represent code entities in the first project code, edges in the first code graph represent relationships between the code entities, the first node set includes a plurality of first nodes, a degree of association between each first node in the plurality of first nodes and the first code processing request meets a first setting condition, and processing the first code processing request according to a first sub-graph corresponding to the plurality of first nodes in the first code graph to obtain a data governance result corresponding to the first code processing request. At least one situation of the present disclosure provides an artificial intelligence-based code data governance device, which comprises an acquisition module configured to acquire a first code processing request, wherein the first code processing request is used for conducting data governance on a first project code, a search module configured to search a first code graph based on the first code processing request to obtain a first node set, wherein nodes in the first code graph represent code entities in the first project code, edges in the first code graph represent relations among the code entities, the first node set comprises a plurality of first nodes, the association degree between each first node in the plurality of first nodes and the first code processing request meets a first setting condition, and a processing module configured to process the first code processing request according to a first sub-graph corresponding to the plurality of first nodes in the first code graph to obtain a data governance result corresponding to the first code processing request. At least one aspect herein provides an electronic device comprising at least one processor and at least one memory including one or more computer program instructions that, when executed by the processor, perform the artificial intelligence based code data governance method provided by at least one aspect herein. At least one aspect herein provides a computer-readable storage medium that non-transitory stores computer-readable instructions, wherein the artificial intelligence-based code data governance method provided by at least one aspect herein is implemented when the computer-readable instructions are executed by a processor. At least one aspect herein provides a computer program product comprising a computer program that, when executed by a processor, implements the artificial intelligence based code data governance method provided by at least one aspect herein. In at least one embodiment of the present disclosure, an artificial intelligence-based code data management method is provided that transcodes a complex project into a representation in the form of a code graph, performs a graph search from the code graph for a code processing request to obtain nodes that are strongly related to the code request, and performs data management on the code request in combination with a subgraph formed by the strongly related nodes. Therefore, a set of general and efficient code data governance logic is provided for different types of code processing requests, partial codes related to the code processing requests in project codes are rapidly focused in a graph searching mode, the code data governance efficiency is improved, and the context information in a sub-graph form is utilized for code data governance, so that the accuracy of code data governance is improved. Drawings The above and other features, advantages and aspects of each of the circumstances herein will become more apparent by reference to the following detailed