期刊
EMPIRICAL SOFTWARE ENGINEERING
卷 26, 期 4, 页码 -出版社
SPRINGER
DOI: 10.1007/s10664-021-09962-8
关键词
API tags; Tutorial fragments; Stack Overflow; Document linking
资金
- NSFC-Key Project of General Technology Fundamental Research United Fund [U1736211, 61933013, 62032016]
- Natural Science Foundation of Guangdong Province [2019A1515011076]
- Innovation Group of Guangdong Education Department [2020KCXTD014, 2018KCXTD019]
- Key Project of Natural Science Foundation of Hubei Province [2018CFA024]
API tutorials and Stack Overflow posts both contain API tags to help understand and navigate code snippets. ATTACK is a novel approach that uses deep neural network with attention mechanism to automatically generate API tags from Stack Overflow posts.
API tutorials are important learning resources as they explain how to use certain APIs in a given programming context. An API tutorial can be split into a number of units. Consecutive units that describe a same topic are often called a tutorial fragment. We consider the API explained by a tutorial fragment as an API tag. Generating API tags for a tutorial fragment can help understand, navigate, and retrieve the fragment. Existing approaches often do not perform well on API tag generation due to high manual effort and low accuracy. Like API tutorials, Stack Overflow (SO) is also an important learning resource that provides the explanations of APIs. Thus, SO posts also contain API tags. Besides, API tags of SO posts are abundant and can be extracted easily. In this paper, we propose a novel approach ATTACK (stands for A PI T ag for T utorial frA gments using C rowd K nowledge), which can automatically generate API tags for tutorial fragments from SO posts. ATTACK first constructs Q&Apair,tagset pairs by extracting API tags of SO posts. Then, it trains a deep neural network with the attention mechanism to learn the semantic relatedness between Q&A pairs and the associated API tags, taking into consideration both textual descriptions and code in a Q&A pair. Finally, the trained model is used to generate API tags for tutorial fragments. We evaluate ATTACK on public Java and Android datasets containing 43,132 Q&Apair,tagset pairs. Experimental results show that ATTACK is effective and outperforms the state-of-the-art approaches in terms of F-Measure. Our user study further confirms the effectiveness of ATTACK in generating API tags for tutorial fragments. We also apply ATTACK to document linking and the results confirm the usefulness of API tags generated by ATTACK.
作者
我是这篇论文的作者
点击您的名字以认领此论文并将其添加到您的个人资料中。
推荐
暂无数据