Why not Just Look for Answers? Using a More Direct Way for API Recommendation
Automated API recommendation technology can help developers quickly find target APIs that meet their require-ments. Some retrieval-based API recommendation approaches, such as BIKER and CLEAR, adopt an indirect API recommen-dation strategy. Although these approaches have shown good performance, we observed two limitations in these approaches: (1) These approaches heavily relies on the coverage of the collected question titles proposed by developers; (2) These approaches ignore the API source code information. To overcome the two limitations, we propose an approach named AnsAPIRec (Answer- directed API Recommendation), which leverages a pre-trained model and joint-attention mechanism in this paper. In addition to the fully qualified name of the API, AnsAPIRec extracts the corresponding source code from the JDK as an additional feature. AnsAPIRec adopts a direct API recommendation strategy, which directly calculates the similarity between user queries and API features, i.e., API fully qualified name and API source code, to find the target API, alleviating the reliance on question titles. To further enhance AnsAPIRec's ability to understand the semantics of the inputs, we propose a joint-attention mechanism to learn the interdependent representations between the queries and API features. This deep semantic fusion mechanism enables AnsAPIRec to perform well in understanding user intent and API functionality. We reused the APIBench-Q dataset, containing 5885 queries for training and 653 queries for testing. The experimental result shows that AnsAPIRec achieved an MRR of 0.473, significantly outperforming the baseline approaches, BIKER and CLEAR.
Authors
- Wei Mu (ORCID: https://orcid.org/0000-0002-9836-478X)
- Changxin Liu (ORCID: https://orcid.org/0000-0001-7353-9830)
- Ling Xu (ORCID: https://orcid.org/0000-0002-7203-511X)
- Rui Qin (ORCID: https://orcid.org/0000-0003-2753-5972)
Institutions
- Ministry of Education of the People's Republic of China (CN)
Publication Details
- Published
- 2024-12-03
- DOI
- https://doi.org/10.1109/apsec65559.2024.00048
- Primary Topic
- Web Data Mining and Analysis
- Type
- article
- Field-Weighted Citation Impact
- 0.00