4.4 Article

Generating API tags for tutorial fragments from Stack Overflow

Journal

EMPIRICAL SOFTWARE ENGINEERING
Volume 26, Issue 4, Pages -

Publisher

SPRINGER
DOI: 10.1007/s10664-021-09962-8

Keywords

API tags; Tutorial fragments; Stack Overflow; Document linking

Funding

  1. NSFC-Key Project of General Technology Fundamental Research United Fund [U1736211, 61933013, 62032016]
  2. Natural Science Foundation of Guangdong Province [2019A1515011076]
  3. Innovation Group of Guangdong Education Department [2020KCXTD014, 2018KCXTD019]
  4. Key Project of Natural Science Foundation of Hubei Province [2018CFA024]

Ask authors/readers for more resources

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.

Authors

I am an author on this paper
Click your name to claim this paper and add it to your profile.

Reviews

Primary Rating

4.4
Not enough ratings

Secondary Ratings

Novelty
-
Significance
-
Scientific rigor
-
Rate this paper

Recommended

No Data Available
No Data Available