跳到主要导航 跳到搜索 跳到主要内容

Leveraging Stack Overflow to detect relevant tutorial fragments of APIs

  • Di Wu
  • , Xiao-Yuan Jing*
  • , Hongyu Zhang
  • , Yuming Zhou
  • , Baowen Xu
  • *此作品的通讯作者
  • Nanjing University
  • University of Newcastle

科研成果: 期刊稿件 › 论文 › 同行评审

12 引用 (Scopus)

摘要

Developers often use learning resources such as API tutorials and Stack Overflow (SO) to learn how to use an unfamiliar API. An API tutorial can be divided into a number of consecutive units that describe the same topic, denoted as tutorial fragments. We consider a tutorial fragment explaining the API usage knowledge as a relevant fragment of the API. Discovering relevant tutorial fragments of APIs can facilitate API understanding, learning, and application. However, existing approaches, based on supervised or unsupervised approaches, often suffer from either high manual efforts or lack of consideration of the relevance information. In this paper, we propose a novel approach, called SO2RT, to detect relevant tutorial fragments of APIs based on SO posts. SO2RT first automatically extracts relevant and irrelevant (API, QA) pairs (QA stands for question and answer) and (API, FRA) pairs (FRA stands for tutorial fragment). It then trains a semi-supervised transfer learning based detection model, which can transfer the API usage knowledge in SO Q&A pairs to tutorial fragments by utilizing the easy-to-extract (API, QA) pairs. Finally, relevant fragments of APIs can be discovered by consulting the trained model. In this way, the effort for labeling the relevance between tutorial fragments and APIs can be reduced. We evaluate SO2RT on Java and Android datasets containing 21,008 (API, QA) pairs. Experimental results show that SO2RT improves the state-of-the-art approaches in terms of F-Measure on both datasets. Our user study further confirms the effectiveness of SO2RT in practice. We also show a successful application of the relevant fragments to API recommendation.
源语言英语
期刊论文编号12
页数37
期刊Empirical Software Engineering
卷28
期1
DOI
出版状态已出版 - 1月 2023

基金资助

The authors would like to thank the anonymous reviewers for their constructive comments and suggestions. This work was supported by the NSFC Project under Grant No. 62176069 and 61933013, the Innovation Group of Guangdong Education Department under Grant No. 2020KCXTD014, the 2019 Key Discipline project of Guangdong Province, and Jiangsu Funding Program for Excellent Postdoctoral Talent No. 20220ZB43. Hongyu Zhang is supported by Australian Research Council (ARC) Discovery Project DP220103044.

关键词

  • API tutorials
  • Stack overflow
  • Semi-supervised
  • Transfer learning

收录

  • Scopus
  • EI
  • SCIE

学术指纹

探究 'Leveraging Stack Overflow to detect relevant tutorial fragments of APIs' 的科研主题。它们共同构成独一无二的学术指纹。

引用此