Title
Generating Api Tags For Tutorial Fragments From Stack Overflow
Abstract
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.
Year
DOI
Venue
2021
10.1007/s10664-021-09962-8
EMPIRICAL SOFTWARE ENGINEERING
Keywords
DocType
Volume
API tags, Tutorial fragments, Stack Overflow, Document linking
Journal
26
Issue
ISSN
Citations 
4
1382-3256
1
PageRank 
References 
Authors
0.34
0
6
Name
Order
Citations
PageRank
Di Wu1636117.73
Xiao-Yuan Jing276955.18
Hongyu Zhang386450.03
Bing Li438040.45
Yu Xie510.34
Xu, Baowen62476165.27