- Title
- Generating API tags for tutorial fragments from stack overflow
- Creator
- Wu, Di; Jing, Xiao-Yuan; Zhang, Hongyu; Li, Bing; Xie, Yu; Xu, Baowen
- Relation
- Empirical Software Engineering Vol. 26, Issue 4, no. 66
- Publisher Link
- http://dx.doi.org/10.1007/s10664-021-09962-8
- Publisher
- Springer
- Resource Type
- journal article
- Date
- 2021
- Description
- 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 Tag for Tutorial frAgments using Crowd Knowledge), which can automatically generate API tags for tutorial fragments from SO posts. ATTACK first constructs ⟨Q&A pair,tag set⟩ 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&A pair,tag set⟩ 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.
- Subject
- API tags; tutorial fragments; stack overflow; document linking
- Identifier
- http://hdl.handle.net/1959.13/1461421
- Identifier
- uon:46190
- Identifier
- ISSN:1382-3256
- Language
- eng
- Reviewed
- Hits: 1544
- Visitors: 1538
- Downloads: 0
Thumbnail | File | Description | Size | Format |
---|