Back to Search
Start Over
Holistic Combination of Structural and Textual Code Information for Context Based API Recommendation
- Source :
- IEEE Transactions on Software Engineering. 48:2987-3009
- Publication Year :
- 2022
- Publisher :
- Institute of Electrical and Electronics Engineers (IEEE), 2022.
-
Abstract
- 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%, 81.5%, 87.7% and 69.4%, and significantly outperforms an existing 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. The sensitivity analysis shows that the top-k accuracy and MRR of APIRec-CST are insensitive to the number of APIs to be recommended in a hole. 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.
- Subjects :
- FOS: Computer and information sciences
Source code
Information retrieval
Computer Science - Artificial Intelligence
business.industry
Computer science
media_common.quotation_subject
Usability
Context (language use)
computer.software_genre
Software Engineering (cs.SE)
Computer Science - Software Engineering
Tree (data structure)
Artificial Intelligence (cs.AI)
Graph (abstract data type)
Mean reciprocal rank
Plug-in
business
computer
Software
media_common
Data-flow analysis
Subjects
Details
- ISSN :
- 23263881 and 00985589
- Volume :
- 48
- Database :
- OpenAIRE
- Journal :
- IEEE Transactions on Software Engineering
- Accession number :
- edsair.doi.dedup.....27e4adced16ca1cd291a75dc26fb4d75