A Combinatorial Strategy for API Completion: Deep Learning and Heuristics

被引:0
作者
Liu, Yi [1 ,2 ]
Yin, Yiming [1 ]
Deng, Jia [1 ]
Li, Weimin [2 ]
Peng, Zhichao [2 ]
机构
[1] Hunan Univ Sci & Technol, Sch Comp Sci & Engn, Xiangtan 411201, Peoples R China
[2] Hunan Univ Humanities, Sch Informat Sci & Technol, Loudi 417000, Peoples R China
关键词
API completion; transformer; n-gram; combinatorial strategy; deep learning;
D O I
10.3390/electronics13183669
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Remembering software library components and mastering their application programming interfaces (APIs) is a daunting task for programmers, due to the sheer volume of available libraries. API completion tools, which predict subsequent APIs based on code context, are essential for improving development efficiency. Existing API completion techniques, however, face specific weaknesses that limit their performance. Pattern-based code completion methods that rely on statistical information excel in extracting common usage patterns of API sequences. However, they often struggle to capture the semantics of the surrounding code. In contrast, deep-learning-based approaches excel in understanding the semantics of the code but may miss certain common usages that can be easily identified by pattern-based methods. Our insight into overcoming these challenges is based on the complementarity between these two types of approaches. This paper proposes a combinatorial method of API completion that aims to exploit the strengths of both pattern-based and deep-learning-based approaches. The basic idea is to utilize a confidence-based selector to determine which type of approach should be utilized to generate predictions. Pattern-based approaches will only be applied if the frequency of a particular pattern exceeds a pre-defined threshold, while in other cases, deep learning models will be utilized to generate the API completion results. The results showed that our approach dramatically improved the accuracy and mean reciprocal rank (MRR) in large-scale experiments, highlighting its utility.
引用
收藏
页数:18
相关论文
共 41 条
[1]  
AIDanial, 2021, Count Lines of Code
[2]  
Al-Rfou R, 2019, AAAI CONF ARTIF INTE, P3159
[3]   API Code Recommendation using Statistical Learning from Fine-Grained Changes [J].
Anh Tuan Nguyen ;
Hilton, Michael ;
Codoban, Mihai ;
Hoan Anh Nguyen ;
Mast, Lily ;
Rademacher, Eli ;
Nguyen, Tien N. ;
Dig, Danny .
FSE'16: PROCEEDINGS OF THE 2016 24TH ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON FOUNDATIONS OF SOFTWARE ENGINEERING, 2016, :511-522
[4]   Graph-based Statistical Language Model for Code [J].
Anh Tuan Nguyen ;
Nguyen, Tien N. .
2015 IEEE/ACM 37TH IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING, VOL 1, 2015, :858-868
[5]  
[Anonymous], 1994, P SDAIR 94 3 ANN S D
[6]   Learning from Examples to Improve Code Completion Systems [J].
Bruch, Marcel ;
Monperrus, Martin ;
Mezini, Mira .
7TH JOINT MEETING OF THE EUROPEAN SOFTWARE ENGINEERING CONFERENCE AND THE ACM SIGSOFT SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING, 2009, :213-222
[7]   Generative API usage code recommendation with parameter concretization [J].
Chen, Chi ;
Peng, Xin ;
Sun, Jun ;
Xing, Zhenchang ;
Wang, Xin ;
Zhao, Yifan ;
Zhang, Hairui ;
Zhao, Wenyun .
SCIENCE CHINA-INFORMATION SCIENCES, 2019, 62 (09)
[8]   Collective Intelligence for Smarter API Recommendations in Python']Python [J].
D'Souza, Andrea Renika ;
Yang, Di ;
Lopes, Cristina V. .
2016 IEEE 16TH INTERNATIONAL WORKING CONFERENCE ON SOURCE CODE ANALYSIS AND MANIPULATION (SCAM), 2016, :51-60
[9]  
Devlin J, 2019, Arxiv, DOI arXiv:1810.04805
[10]  
Gao L., 2023, INT C MACHINE LEARNI, V202, P10764