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

10/15/2020
by   Chi Chen, et al.
0

Context based API recommendation is an important way to help developers find the needed APIs effectively and efficiently. For effective API recommendation, we need not only a joint view of both structural and textual code information, but also a holistic view of correlated API usage in control and data flow graph as a whole. Unfortunately, existing API recommendation methods exploit structural or textual code information separately. In this work, we propose a novel API recommendation approach called APIRec-CST (API Recommendation by Combining Structural and Textual code information). APIRec-CST is a deep learning model that combines the API usage with the text information in the source code based on an API Context Graph Network and a Code Token Network that simultaneously learn structural and textual features for API recommendation. We apply APIRec-CST to train a model for JDK library based on 1,914 open-source Java projects and evaluate the accuracy and MRR (Mean Reciprocal Rank) of API recommendation with another 6 open-source projects. The results show that our approach achieves respectively a top-1, top-5, top-10 accuracy and MRR of 60.3 graph-based statistical approach and a tree-based deep learning approach for API recommendation. A further analysis shows that textual code information makes sense and improves the accuracy and MRR. We also conduct a user study in which two groups of students are asked to finish 6 programming tasks with or without our APIRec-CST plugin. The results show that APIRec-CST can help the students to finish the tasks faster and more accurately and the feedback on the usability is overwhelmingly positive.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/03/2022

API Usage Recommendation via Multi-View Heterogeneous Graph Representation Learning

Developers often need to decide which APIs to use for the functions bein...
research
06/11/2023

ARIST: An Effective API Argument Recommendation Approach

Learning and remembering to use APIs are difficult. Several techniques h...
research
03/29/2021

Embedding API Dependency Graph for Neural Code Generation

The problem of code generation from textual program descriptions has lon...
research
03/15/2021

Embedding Code Contexts for Cryptographic API Suggestion:New Methodologies and Comparisons

Despite recent research efforts, the vision of automatic code generation...
research
02/04/2020

Boosting API Recommendation with Implicit Feedback

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

PyART: Python API Recommendation in Real-Time

API recommendation in real-time is challenging for dynamic languages lik...
research
03/18/2022

How Do Programmers Express High-Level Concepts using Primitive Data Types?

We investigated how programmers express high-level concepts such as path...

Please sign up or login with your details

Forgot password? Click here to reset