Code program recommendation method, device, electronic device and storage medium

By determining the target code program from the code recommendation knowledge graph, the problem of developers writing code repetitively is solved, and development efficiency and speed are improved.

CN114546360BActive Publication Date: 2025-09-12GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210137831.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-15
Publication Date
2025-09-12
Estimated Expiration
2042-02-15

AI Technical Summary

Technical Problem

Developers repeatedly write code during the software development process, which reduces development speed and efficiency.

Method used

By obtaining the target code feature parameters from the code information edited by the user, the target code program is determined from the code recommendation knowledge graph and recommended to the developer.

Benefits of technology

It reduces developers' writing time and improves development efficiency and speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114546360B_ABST
    Figure CN114546360B_ABST
Patent Text Reader

Abstract

The present application relates to a code program recommendation method, device, electronic device, and storage medium, which are applied to the field of data processing technology. The method includes: obtaining target code feature parameters from code information edited by a user; determining a target code program corresponding to the target code feature parameters from a code recommendation knowledge graph, wherein the code recommendation knowledge graph is constructed based on a code program set and the code feature parameters corresponding to each code program in the code program set; and recommending the target code program. This solves the problem in the prior art that developers perform repetitive writing work during the development process, consuming a large amount of their energy and slowing down both development speed and development results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a code program recommendation method, device, electronic device and storage medium. Background Art

[0002] With the development of software technology, the number of users continues to increase and their demand for software functions continues to increase, which makes the scale of software development continue to increase. Developers often have to rewrite some functions during the software development process.

[0003] However, developers' repetitive writing work during the development process consumes a lot of their energy, slowing down the development speed and effect. Summary of the Invention

[0004] The present application provides a code program recommendation method, device, electronic device and storage medium to solve the problem in the prior art that developers perform repetitive writing work during the development process, which consumes a large amount of developers' energy and slows down the development speed and development effect.

[0005] In a first aspect, an embodiment of the present application provides a code program recommendation method, comprising:

[0006] Obtain target code feature parameters from the code information edited by the user;

[0007] Determining a target code program corresponding to the target code feature parameter from a code recommendation knowledge graph, wherein the code recommendation knowledge graph is constructed based on a code program set and code feature parameters corresponding to each code program in the code program set;

[0008] The object code program is recommended.

[0009] Optionally, the step of obtaining target code characteristic parameters in the code information edited by the user terminal includes:

[0010] Get the code information edited by the user;

[0011] Extract target code feature parameters from the code information.

[0012] Optionally, extracting target code feature parameters from the code information includes:

[0013] Comparing the code information with a preset feature parameter set;

[0014] Determine the parameters in the code information that are consistent with the preset characteristic parameters in the preset characteristic parameter set as the target code characteristic parameters.

[0015] Optionally, the preset feature parameter set includes at least one of a language type feature, a package name, and a function name.

[0016] Optionally, determining the target code program corresponding to the target code feature parameter from the code recommendation knowledge graph includes:

[0017] Determining code feature parameters in the code recommendation knowledge graph that are consistent with the target code feature parameters;

[0018] Determining at least one candidate code program from the code recommendation knowledge graph according to the code feature parameters, the candidate code program being a code program in the code program set;

[0019] The target code program is determined from the candidate code programs.

[0020] Optionally, determining the target code program from the candidate code programs includes:

[0021] determining execution performance parameters of each of the candidate code programs;

[0022] The candidate code program with the best execution performance parameter is determined as the target code program.

[0023] Optionally, the recommending the target code program includes:

[0024] The object code program is displayed on the client.

[0025] Optionally, before obtaining the target code feature parameters in the code information edited by the user terminal, the method further includes:

[0026] Determine whether the user terminal enables the recommended permission.

[0027] Optionally, after recommending the target code program, the method further includes:

[0028] If it is detected that the user terminal has not accepted the target code program, after it is detected that the code information in the user terminal has been edited, the code recommendation knowledge graph is updated according to the edited code information.

[0029] In a second aspect, an embodiment of the present application provides a code program recommendation device, comprising:

[0030] An acquisition module is used to obtain target code feature parameters from the code information edited by the user end;

[0031] a determination module for determining, from a code recommendation knowledge graph, a target code program corresponding to the target code feature parameter, wherein the code recommendation knowledge graph is constructed based on a code program set and the code feature parameters corresponding to each code program in the code program set;

[0032] A recommendation module is used to recommend the target code program.

[0033] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0034] The memory is used to store computer programs;

[0035] The processor is used to execute the program stored in the memory to implement the code program recommendation method described in the first aspect.

[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the code program recommendation method described in the first aspect.

[0037] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art: the method provided by the embodiment of the present application obtains the target code feature parameters in the code information edited by the user; determines the target code program corresponding to the target code feature parameters from the code recommendation knowledge graph, and the code recommendation knowledge graph is constructed based on the code program set and the code feature parameters corresponding to each code program in the code program set; and recommends the target code program. In this way, during the developer's writing process, the target code program can be determined from the code recommendation knowledge graph based on the target code feature parameters in the code information edited by the user, and recommended to the developer. Therefore, when the target code program meets the developer's development needs, the developer's writing time can be reduced, thereby improving development efficiency and development speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0040] Figure 1 This is an application scenario diagram of the code program recommendation method provided in one embodiment of the present application;

[0041] Figure 2 A flowchart of a code program recommendation method provided in one embodiment of the present application;

[0042] Figure 3 A partial schematic diagram of a code recommendation knowledge graph provided in one embodiment of the present application;

[0043] Figure 4 A structural diagram of a code program recommendation device provided in one embodiment of the present application;

[0044] Figure 5 A structural diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0045] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0046] Before further describing the embodiments of the present invention in detail, the nouns and terms involved in the embodiments of the present invention are explained. The nouns and terms involved in the embodiments of the present invention are subject to the following explanations.

[0047] Knowledge graph: The knowledge graph aims to describe various entities or concepts and their relationships that exist in the real world. It constitutes a huge semantic network graph, where nodes represent entities or concepts and edges are composed of attributes or relationships.

[0048] Entity: An entity refers to something that is distinguishable and exists independently, such as a person's name, a city name, a plant name, a product name, a field name, a platform name, etc. Entities are the most basic elements in a knowledge graph, and different entities have different relationships. For example, in a knowledge graph, Zhang San and Li Si are a couple, and both Zhang San and Li Si are entities.

[0049] Association relationship: In the knowledge graph, edges represent association relationships in the knowledge graph, which are used to identify a certain connection between different entities. For example, in a knowledge graph, Zhang San and Li Si are husband and wife, where husband and wife is the association relationship between the two.

[0050] Attributes: Entities and relationships in the knowledge graph can have their own attributes. From an entity to its attribute value, different attribute types correspond to edges of different types of attributes. Attributes mainly refer to the characteristic information of the object. For example, "area", "population", and "capital" are several different attributes. Attribute values ​​mainly refer to the value of the attribute, such as 9.6 million square kilometers.

[0051] According to an embodiment of the present application, a code program recommendation method is provided. Optionally, in the embodiment of the present application, the code program recommendation method can be applied to Figure 1 In the hardware environment composed of the terminal 101 and the server 102 shown in FIG. Figure 1 As shown, the server 102 is connected to the terminal 101 via a network, and can be used to provide services (such as video services, application services, etc.) for the terminal or a client installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for the server 102. The above-mentioned network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, etc.

[0052] The code program recommendation method of the embodiment of the present application can be executed by the server 102, or by the terminal 101, or by both the server 102 and the terminal 101. The code program recommendation method of the embodiment of the present application can be executed by the terminal 101 or by a client installed thereon.

[0053] Taking the server executing the code program recommendation method of the embodiment of the present application as an example, Figure 2 This is a flow chart of an optional code program recommendation method according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:

[0054] Step 201: Obtain target code feature parameters from the code information edited by the user.

[0055] In some embodiments, when a user writes code on a user terminal, the user may enter relevant code into a code editor on the user terminal.

[0056] Among them, developers can edit according to actual needs in the code editor. During the developer's editing process, the user end can extract features of the code information input and edited by the user at preset intervals, obtain target code feature parameters, and send them to the server; or, the user end can directly send the code information to the server at preset intervals, so that the server can extract the target code feature parameters in the code information after obtaining the code information.

[0057] The code information may be code data input by a developer in a code editor, including characters, symbols, or signal code elements.

[0058] In an optional embodiment, extracting target code feature parameters from the code information includes:

[0059] The code information is compared with a preset feature parameter set; and a parameter in the code information that is consistent with a preset feature parameter in the preset feature parameter set is determined as the target code feature parameter.

[0060] Specifically, after obtaining the code information edited by the user terminal, the server compares the code information with the preset feature parameter set, and determines whether there are parameters in the code information that are consistent with the preset feature parameters in the preset feature parameter set. If so, the consistent parameters are used as the target code feature parameters.

[0061] Among them, the preset feature parameters in the preset feature parameter set can be entities in the code recommendation knowledge graph.

[0062] The target code characteristic parameter may be any one or more of the computer language type adopted by the code information, the package name and the function name in the code.

[0063] The computer language type may include but is not limited to Python, Java, Go, and .NET.

[0064] Step 202: Determine the target code program corresponding to the target code feature parameters from the code recommendation knowledge graph, wherein the code recommendation knowledge graph is constructed based on a code program set and the code feature parameters corresponding to each code program in the code program set.

[0065] In some embodiments, after obtaining the target code characteristic parameters, the target code program corresponding to the target code characteristic parameters can be determined through the code recommendation knowledge graph.

[0066] Among them, since the code recommendation knowledge graph is obtained through the code feature parameters corresponding to each code program during construction, after obtaining the target code feature parameters, the target code program corresponding to the target code feature parameters can be obtained from the code recommendation knowledge graph.

[0067] In an optional embodiment, determining the target code program corresponding to the target code feature parameter from the code recommendation knowledge graph includes:

[0068] Determine code feature parameters in the code recommendation knowledge graph that are consistent with the target code feature parameters; determine at least one candidate code program from the code recommendation knowledge graph based on the code feature parameters, the candidate code program being a code program in the code program set; and determine the target code program from the candidate code programs.

[0069] In some embodiments, after determining the target code feature parameters, the server is enabled to first determine the code feature parameters consistent therewith from the code recommendation knowledge graph. Since the code recommendation knowledge graph is constructed by the code feature parameters corresponding to each code program, after determining the code feature parameters in the code recommendation knowledge graph, at least one candidate code program can be determined by the code feature parameters, and then, the server can determine the target code program from the at least one candidate code program.

[0070] Specifically, the candidate code programs determined by the code feature parameters are code programs associated with the code feature parameters, and the determined target code programs may be all candidate code programs, or may be determined by selecting from at least one candidate code program.

[0071] In an optional embodiment, determining the target code program from the candidate code programs includes:

[0072] Determine the execution performance parameters of each candidate code program; and determine the candidate code program with the best execution performance parameters as the target code program.

[0073] In some embodiments, the execution performance parameters may include, but are not limited to, the query rate per second of the code program, the number of transactions processed per second, the time complexity, and the space complexity.

[0074] Usually, running a program once to count the code execution time and the amount of memory occupied to judge the code execution efficiency will be affected by the test environment machine configuration and the scale of test data; therefore, a method is needed to roughly estimate the execution efficiency of the program without actually executing the code. This method is complexity analysis, which specifically includes time complexity and space complexity.

[0075] Among them, time complexity can be simply understood as the number of times the code is repeatedly executed. For example, the time complexity of a for loop is the number of for loops; usually, big O is used to express time complexity; if a for loop is executed n times, the time complexity of this for loop is O(n); but if a for loop is executed a fixed number of times, then its time complexity is O(1); so time complexity represents a trend of change (the full name of time complexity is asymptotic time complexity, which indicates the growth relationship between the execution time of the algorithm and the data size). Space complexity indicates the growth relationship between the storage space of the algorithm and the data size; space complexity is usually expressed in big O; for example, if int[]a=new int[n], the code space complexity is O(n); but if int[]a=new int[3], the code space complexity is O(1).

[0076] Among them, the execution performance parameters can be used as attribute information of the code program when constructing the code recommendation knowledge graph.

[0077] By determining the execution performance parameters of each candidate code program and comparing the execution performance parameters of all candidate code programs, the candidate code program with the best execution performance parameter is selected as the target code program.

[0078] It is understandable that the top N candidate code programs with the best execution performance parameters may also be selected as the target code programs, where N is a positive integer greater than 1.

[0079] Step 203: Recommend the target code program.

[0080] In some embodiments, after the target code program is determined, the target code program may be recommended to the user end, so that the developer can choose whether to adopt the recommended target code program based on actual conditions.

[0081] In an optional embodiment, the object code program is recommended to include:

[0082] The object code program is displayed on the client.

[0083] In some embodiments, when recommending a target code program, the server may send the target code program to the client and display the target code program on the client, so that the developer can select the target code program according to the actual editing situation.

[0084] In an optional embodiment, before obtaining the target code characteristic parameters in the code information edited by the user terminal, the method further includes:

[0085] Determine whether the user terminal enables the recommended permission.

[0086] In some embodiments, some developers may not need the recommended code program when editing code information. Therefore, before recommending the target code program to the user terminal, it is first determined whether the user terminal has enabled the recommended permission. If it is enabled, the target code program is recommended to the user terminal. If it is not enabled, the recommendation operation is not performed.

[0087] In an optional embodiment, after recommending the target code program, the method further includes:

[0088] If it is detected that the user terminal has not accepted the target code program, after it is detected that the code information in the user terminal has been edited, the code recommendation knowledge graph is updated according to the edited code information.

[0089] In some embodiments, after the server recommends the target code program to the user terminal, if the developer does not adopt the recommended target code program, he will continue to write in the code editor. After the developer completes the editing, the user terminal sends a signal indicating that the editing is completed to the server. After the server receives the signal indicating that the editing is completed and determines that the code information in the user terminal has been edited, it obtains the edited code information sent by the user terminal, and then updates the code information to the code recommendation knowledge graph so that it can be recommended the next time the developer edits.

[0090] In this way, during the developer's writing process, the target code program can be determined from the code recommendation knowledge graph based on the target code feature parameters in the code information edited by the user, and recommended to the developer. Therefore, when the target code program meets the developer's development needs, the developer's writing time can be reduced, thereby improving development efficiency and speed.

[0091] In a specific embodiment, the present application provides a code program recommendation method in which the server establishes a corresponding knowledge graph by classifying the project code and recording and analyzing the historical code. For example: the project code is classified according to function or performance, and is divided into display class, middleware class and back-end service class, and the classified code is further subdivided, such as the back-end code is divided into python, java, go, .net language, etc., and various analyses are performed on each type of code, such as running time, QPS / TPS, etc. Through this classification, a connection is established between the input code and the related project code, and then the corresponding knowledge graph is established using this connection, and then the knowledge graph is analyzed and retrieved to ensure the effective implementation of the strategy.

[0092] Among them, the entities in the constructed knowledge graph can be but are not limited to package names or function names, the relationships between entities can be but are not limited to the similarity or feature values ​​between entities, and the attributes of the entities can be but are not limited to local packages or remote packages in the package name, and specific logical codes in the function.

[0093] The specific steps for implementing the recommended method strategy of the code program are:

[0094] First, the user edits the code through the code editor;

[0095] Second, the code editor occasionally transfers user code to the cloud server;

[0096] Third, the cloud server performs analysis and screening by scanning the user code;

[0097] Specifically, the cloud server analyzes the content edited by the user in the compiler. Different codes have different features, and keywords are one of them. Codes in different languages ​​have different coding styles. The coding style can be used to determine the specific language type used in the edited code information.

[0098] Fourth, combine historical data and the user's current input data to perform the knowledge graph search mentioned above and return the corresponding results.

[0099] See also Figure 3 The user enters a package name, and the code compiler uploads the code features entered by the user to the cloud server in real time. The cloud server parses the user's code and obtains the result of the local package that the user needs to import - local package name 2. The server then searches the knowledge graph and recommends the code completion of local package name 2 to the user, allowing the user to choose whether to use it or continue editing the code.

[0100] For example, a user enters a function name. After the code editor uploads the data to the cloud server, the cloud service analyzes the code and searches the knowledge graph. If it finds related code with better performance, it will send the better quality code back to the user's editor. However, after analyzing the user's code, it finds no exact match in the database. Therefore, multiple similar codes are sent to the user for selection. The cloud service also records the code that the user wrote when they did not select it and uploads it to the server for backup analysis, so that it can be recommended for subsequent users.

[0101] The similar codes may be determined by the function name input by the user and the control conditions in the code or the code structure.

[0102] Based on the same concept, a code program recommendation device is provided in the embodiment of the present application. The specific implementation of the device can be found in the description of the method embodiment part, and the repeated parts will not be repeated. Figure 4 As shown, the device mainly includes:

[0103] The acquisition module 401 is used to obtain target code feature parameters in the code information edited by the user end;

[0104] A determination module 402 is configured to determine a target code program corresponding to the target code feature parameter from a code recommendation knowledge graph, wherein the code recommendation knowledge graph is constructed based on a code program set and code feature parameters corresponding to each code program in the code program set;

[0105] The recommendation module 403 is used to recommend the target code program.

[0106] Based on the same concept, an electronic device is also provided in the embodiment of the present application, such as Figure 5 As shown, the electronic device mainly includes: a processor 501, a memory 502 and a communication bus 503, wherein the processor 501 and the memory 502 communicate with each other via the communication bus 503. The memory 502 stores a program that can be executed by the processor 501, and the processor 501 executes the program stored in the memory 502 to implement the following steps:

[0107] Obtain target code feature parameters from the code information edited by the user;

[0108] Determining a target code program corresponding to the target code feature parameter from a code recommendation knowledge graph, wherein the code recommendation knowledge graph is constructed based on a code program set and code feature parameters corresponding to each code program in the code program set;

[0109] The object code program is recommended.

[0110] The communication bus 503 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 503 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0111] The memory 502 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor 501.

[0112] The above-mentioned processor 501 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0113] In another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program runs on a computer, the computer executes the code program recommendation method described in the above embodiment.

[0114] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction is transmitted from a website, computer, server or data center to another website, computer, server or data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (such as a floppy disk, hard disk, tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk), etc.

[0115] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0116] The foregoing description is intended only to provide specific embodiments of the present invention, which will enable those skilled in the art to understand and implement the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not intended to be limited to the embodiments shown herein, but is intended to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A code program recommendation method, characterized in that: include: Obtain target code feature parameters from the code information edited by the user; Determining a target code program corresponding to the target code feature parameter from a code recommendation knowledge graph, wherein the code recommendation knowledge graph is constructed based on a code program set and code feature parameters corresponding to each code program in the code program set; recommending said object code program; The method further includes constructing the code recommendation knowledge graph in the following manner: performing a primary classification on the historical project codes according to their functions to obtain a primary classification code; performing a secondary classification on each of the primary classification codes according to their programming languages ​​to obtain a secondary classification code; Performing performance analysis on each of the secondary classification codes to obtain execution performance parameters of each of the secondary classification codes; The code recommendation knowledge graph is established by taking the package name or function name of each secondary classification code as the entity, the execution performance parameters, local package, remote package and specific logic code of each secondary classification code as the attribute information of the entity, and the similarity or feature value between entities as the association relationship between entities.

2. The code program recommendation method according to claim 1, characterized in that: The step of obtaining target code characteristic parameters from the code information edited by the user terminal includes: Get the code information edited by the user; Extract target code feature parameters from the code information.

3. The code program recommendation method according to claim 2, characterized in that: The extracting target code feature parameters from the code information includes: Comparing the code information with a preset feature parameter set; Determine the parameters in the code information that are consistent with the preset characteristic parameters in the preset characteristic parameter set as the target code characteristic parameters.

4. The code program recommendation method according to claim 3, characterized in that: The preset feature parameter set includes at least one of a language type feature, a package name, and a function name.

5. The code program recommendation method according to claim 1, characterized in that: The step of determining the target code program corresponding to the target code feature parameter from the code recommendation knowledge graph includes: Determining code feature parameters in the code recommendation knowledge graph that are consistent with the target code feature parameters; Determining at least one candidate code program from the code recommendation knowledge graph according to the code feature parameters, the candidate code program being a code program in the code program set; The target code program is determined from the candidate code programs.

6. The code program recommendation method according to claim 5, characterized in that: Determining the target code program from the candidate code programs includes: determining execution performance parameters of each of the candidate code programs; The candidate code program with the best execution performance parameter is determined as the target code program.

7. The code program recommendation method according to claim 1, characterized in that: The object code program is recommended to include: The object code program is displayed on the user terminal.

8. The code program recommendation method according to claim 1, characterized in that: Before obtaining the target code characteristic parameters in the code information edited by the user terminal, the method further includes: Determine whether the user terminal enables the recommended permission.

9. The code program recommendation method according to claim 1, characterized in that: After recommending the target code program, the method further includes: If it is detected that the user terminal has not accepted the target code program, after it is detected that the code information in the user terminal has been edited, the code recommendation knowledge graph is updated according to the edited code information.

10. A code program recommendation device, characterized in that: include: An acquisition module is used to obtain target code feature parameters from the code information edited by the user end; a determination module for determining, from a code recommendation knowledge graph, a target code program corresponding to the target code feature parameter, wherein the code recommendation knowledge graph is constructed based on a code program set and the code feature parameters corresponding to each code program in the code program set; A recommendation module, configured to recommend the target code program; A construction module is used to: classify historical project codes into first-level classifications according to their functions to obtain first-level classification codes; Performing secondary classification on each of the first-level classification codes according to the programming language to obtain a second-level classification code; Performing performance analysis on each of the secondary classification codes to obtain execution performance parameters of each of the secondary classification codes; The code recommendation knowledge graph is established by taking the package name or function name of each secondary classification code as the entity, the execution performance parameters, local package, remote package and specific logic code of each secondary classification code as the attribute information of the entity, and the similarity or feature value between entities as the association relationship between entities.

11. An electronic device, characterized in that: include: A processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to execute the program stored in the memory to implement the code program recommendation method according to any one of claims 1 to 9.

12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the code program recommendation method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Code recommendation

    CN106462399A

  • Method and system for providing source code suggestion to a user in real-time

    US20170371629A1