CN-114139028-B - API (application program interface) combination recommendation method and device, computer equipment and storable medium
Abstract
The invention is applicable to the technical field of computers, and provides an API (application program interface) combination recommendation method, an API combination recommendation device, computer equipment and a storage medium, wherein the API combination recommendation method comprises the steps of receiving function keyword information input by a user; and calculating the diversity degree among the candidate API combinations, and recommending the API combination with the highest diversity degree in the preset recommendation number to the user. According to the method, the novel API association diagram is constructed based on the function key elements of the API and the historical call times, compatibility is considered, popularity factors are also considered in an important way in the process of recommending the API to the user, and therefore the recommended API has higher efficiency and usability; in addition, the API combination recommended by the method has higher diversity, is beneficial to widening the selection space of developers, improves the satisfaction of the developers, and reduces the redundancy of recommendation results.
Inventors
- QI LIANYONG
- WU SHENGQI
- YAN CHAO
- DONG ZHAOAN
- HUANG WANLI
- WANG SIFENG
Assignees
- 曲阜师范大学
- 曲阜师范大学
Dates
- Publication Date
- 20260421
- Application Date
- 20211203
- Priority Date
- 20211203
Claims (4)
- 1. An API group recommendation method, comprising: receiving function keyword information input by a user, wherein the function keyword information comprises at least one function keyword element; Determining candidate API combinations according to the function key elements and a preset API association diagram, wherein the preset API association diagram is constructed based on the function key elements and the historical call times of the APIs; Calculating the diversity degree among the candidate API combinations, and recommending the API combination with the highest diversity degree in the preset recommendation number to the user; The step of determining candidate API combinations according to the function key elements and the preset API association diagram includes: determining an API combination containing any one of the functional key elements in a preset API association diagram; acquiring a functional keyword element set corresponding to the API combination and sum of edge weights and point weights; Determining candidate API combinations according to the functional keyword element sets corresponding to the API combinations and the sum of the edge weights and the point weights; The construction step of the preset API association graph comprises the following steps: counting the historical call times of each API corresponding to each APP to obtain edge weights and point weights; Normalizing the edge weights and the point weights; according to the function key word elements, the edge weights and the point weights of the APIs, constructing an API association graph by taking the APIs as nodes; the step of counting the historical call times of each API corresponding to each APP to obtain the edge weight and the point weight comprises the following steps: Acquiring the number of times that any two APIs are called by the same APP at the same time, and obtaining edge weights; counting the calling times of each API corresponding to each APP, and summing the calling times to obtain point weights; The step of calculating the diversity degree among the candidate API combinations and recommending the API combination with the highest diversity degree in the preset recommended number to the user comprises the following steps: carrying out hash function processing on each function key element corresponding to each candidate API combination to obtain a hash value of each function key element; Changing the hash value into a hash vector and giving weight to each functional keyword element to obtain a weight vector of each keyword element; accumulating the weight vectors of each keyword element to obtain a combined result, and performing dimension reduction on the combined result to obtain a dimension reduction result of each candidate API combination; And calculating the Hamming distance value between any two candidate API combinations according to the dimension reduction result of the candidate API combinations, and recommending the API combination with the biggest Hamming distance value in the preset recommendation number to the user.
- 2. An API group recommendation device, comprising: a function keyword information receiving unit, configured to receive function keyword information input by a user, where the function keyword information includes at least one function keyword element; A candidate API combination determining unit for determining candidate API combinations according to the function key elements and a preset API association diagram which is constructed based on the function key elements and the historical call times of the API, and The recommending unit is used for calculating the diversity degree among the candidate API combinations and recommending the API combination with the highest diversity degree in the preset recommending number to the user; The candidate API combination determining unit includes: the first determining module is used for determining an API combination containing any one of the function key elements in a preset API association diagram; An acquisition module for acquiring the function keyword element set and the sum of the edge weight and the point weight corresponding to the API combination, and The second determining module is used for determining candidate API combinations according to the functional keyword element sets corresponding to the API combinations and the sum of the edge weights and the point weights; the recommendation unit includes: The hash value determining module is used for carrying out hash function processing on each function key element corresponding to each candidate API combination to obtain a hash value of each function key element; the weight vector determining module is used for changing the hash value into a hash vector and giving weight to each functional keyword element to obtain a weight vector of each keyword element; the dimension reduction result determining module is used for accumulating the weight vectors of each keyword element to obtain a combined result, carrying out dimension reduction processing on the combined result to obtain a dimension reduction result of each candidate API combination, and The recommendation module is used for calculating the Hamming distance value between any two candidate API combinations according to the dimension reduction result of the candidate API combinations and recommending the API combination with the largest Hamming distance value in the preset recommendation number to the user; The construction step of the preset API association graph comprises the following steps: counting the historical call times of each API corresponding to each APP to obtain edge weights and point weights; Normalizing the edge weights and the point weights; according to the function key word elements, the edge weights and the point weights of the APIs, constructing an API association graph by taking the APIs as nodes; the step of counting the historical call times of each API corresponding to each APP to obtain the edge weight and the point weight comprises the following steps: Acquiring the number of times that any two APIs are called by the same APP at the same time, and obtaining edge weights; and counting the calling times of each API corresponding to each APP, and summing the calling times to obtain the point weight.
- 3. A computer device comprising a memory and a processor, the memory having stored therein a computer program which, when executed by the processor, causes the processor to perform the steps of the API gravity recommendation method of any one of claims 1.
- 4. A computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, which when executed by a processor causes the processor to perform the steps of the API gravity recommendation method according to any of the claims 1.
Description
API (application program interface) combination recommendation method and device, computer equipment and storable medium Technical Field The invention belongs to the technical field of computers, and particularly relates to an API (application program interface) combination recommendation method, an API combination recommendation device, computer equipment and a storable medium. Background An Application Programming Interface (API) is a basic component of an APP developer, and because the API has the characteristics of combinability, programmability and flexibility, selecting an appropriate API can enable the development work of the APP developer to be more convenient and efficient. Generally, APP developers search for their own desired APIs by inputting a demand keyword to the API sharing platform, but in recent years, the number of APIs is increasing and the functions are becoming more complex, so how to recommend an appropriate API to an APP developer becomes a major challenge of a recommendation system. Currently, popular API recommendation methods are keyword-based Steiner tree search algorithms (K-CAR and WARtext) and ATD algorithms. The K-CAR algorithm firstly establishes an API association diagram, performs Steiner search according to a demand keyword input by an APP developer, and finds a group of APIs with the best compatibility to recommend to a user, but in the method, popularity and diversity factors of the APIs are ignored. The WARtext algorithm considers compatibility and API number, but also does not consider popularity and diversity. The ATD algorithm considers both API compatibility and diversity, but it ignores popularity factors and is inferior in accuracy to the Steiner tree search technique. Disclosure of Invention The embodiment of the invention aims to provide an API combination recommendation method, which aims to solve the problems of poor accuracy and high redundancy of recommendation results in the existing API recommendation method. The embodiment of the invention is realized in such a way that an API combination recommendation method comprises the following steps: receiving function keyword information input by a user, wherein the function keyword information comprises at least one function keyword element; Determining candidate API combinations according to the function key elements and a preset API association diagram, wherein the preset API association diagram is constructed based on the function key elements and the historical call times of the APIs; And calculating the diversity degree among the candidate API combinations, and recommending the API combination with the highest diversity degree in the preset recommendation number to the user. Another object of an embodiment of the present invention is to provide an API group recommendation apparatus, including: a function keyword information receiving unit, configured to receive function keyword information input by a user, where the function keyword information includes at least one function keyword element; A candidate API combination determining unit for determining candidate API combinations according to the function key elements and a preset API association diagram which is constructed based on the function key elements and the historical call times of the API, and And the recommending unit is used for calculating the diversity degree among the candidate API combinations and recommending the API combination with the highest diversity degree in the preset recommending number to the user. Another object of an embodiment of the present invention is a computer device comprising a memory and a processor, the memory storing a computer program, which when executed by the processor, causes the processor to perform the steps of the API combination recommendation method. Another object of an embodiment of the present invention is a computer-readable storage medium, on which a computer program is stored, which when executed by a processor causes the processor to perform the steps of the API combination recommendation method. According to the API combination recommendation method provided by the embodiment of the invention, the novel API association graph is constructed based on the function key elements of the APIs and the historical call times, in addition to compatibility, popularity factors are also emphasized in consideration of the API recommendation process for users, so that the recommended APIs have higher efficiency and usability, in addition, the recommended APIs have higher diversity among the API combinations, the selection space of developers is widened, the satisfaction degree of the developers is improved, and the redundancy of recommendation results is reduced. Drawings FIG. 1 is a flowchart of an implementation of an API combination recommendation method provided by an embodiment of the present invention; FIG. 2 is an API association diagram and an optimal Steiner tree search diagram provided by an embodiment of t