PyART: Python API Recommendation in Real-Time

02/09/2021
by   Xincheng He, et al.
0

API recommendation in real-time is challenging for dynamic languages like Python. Many existing API recommendation techniques are highly effective, but they mainly support static languages. A few Python IDEs provide API recommendation functionalities based on type inference and training on a large corpus of Python libraries and third-party libraries. As such, they may fail to recommend or make poor recommendations when type information is missing or target APIs are project-specific. In this paper, we propose a novel approach, PyART, to recommend APIs for Python programs in real-time. It features a light-weight analysis to derives so-called optimistic data-flow, which is neither sound nor complete, but simulates the local data-flow information humans can derive. It extracts three kinds of features: data-flow, token similarity, and token co-occurrence, in the context of the program point where a recommendation is solicited. A predictive model is trained on these features using the Random Forest algorithm. Evaluation on 8 popular Python projects demonstrates that PyART can provide effective API recommendations. When historic commits can be leveraged, which is the target scenario of a state-of-the-art tool ARIREC, our average top-1 accuracy is over 50 average top-10 accuracy over 70 the recommendation component in Visual Studio) by 28.48 accuracy and 24.41 when historic comments are not available and cross-project recommendation, PyART also shows better overall performance. The time to make a recommendation is less than a second on average, satisfying the real-time requirement.

READ FULL TEXT

page 1

page 10

research
02/18/2021

APIScanner – Towards Automated Detection of Deprecated APIs in Python Libraries

Python libraries are widely used for machine learning and scientific com...
research
10/15/2020

Holistic Combination of Structural and Textual Code Information for Context based API Recommendation

Context based API recommendation is an important way to help developers ...
research
01/03/2023

Uptrendz: API-Centric Real-time Recommendations in Multi-Domain Settings

In this work, we tackle the problem of adapting a real-time recommender ...
research
09/02/2021

Python Crypto Misuses in the Wild

Background: Previous studies have shown that up to 99.59 using crypto A...
research
06/11/2023

ARIST: An Effective API Argument Recommendation Approach

Learning and remembering to use APIs are difficult. Several techniques h...
research
02/04/2020

Boosting API Recommendation with Implicit Feedback

Developers often need to use appropriate APIs to program efficiently, bu...
research
04/02/2021

Plot2API: Recommending Graphic API from Plot via Semantic Parsing Guided Neural Network

Plot-based Graphic API recommendation (Plot2API) is an unstudied but mea...

Please sign up or login with your details

Forgot password? Click here to reset