Retrieving API Knowledge from Tutorials and Stack Overflow Based on Natural Language Queries

被引:8
作者
Wu, Di [1 ,2 ]
Jing, Xiao-Yuan [1 ,2 ,3 ,4 ,5 ]
Zhang, Hongyu [6 ,7 ]
Feng, Yang [2 ]
Chen, Haowen [8 ]
Zhou, Yuming [2 ]
Xu, Baowen [2 ]
机构
[1] Wuhan Univ, Sch Comp Sci, Wuhan 430072, Hubei, Peoples R China
[2] Nanjing Univ, State Key Lab Novel Software Technol, Nanjing 210023, Jiangsu, Peoples R China
[3] Zhejiang Sci Tech Univ, Sch Comp Sci & Technol, Hangzhou 310018, Zhejiang, Peoples R China
[4] Guangdong Univ Petrochem Technol, Guangdong Prov Key Lab Petrochem Equipment Fault, Maoming 525099, Guangdong, Peoples R China
[5] Guangdong Univ Petrochem Technol, Sch Comp, Maoming 525099, Guangdong, Peoples R China
[6] Univ Newcastle, Sch Informat & Phys Sci, Callaghan, NSW 2308, Australia
[7] Chongqing Univ, Sch Big Data & Software Engn, Chongqing 400044, Peoples R China
[8] Wuhan Univ, Sch Comp Sci, Wuhan 430072, Hubei, Peoples R China
基金
澳大利亚研究理事会;
关键词
API tutorial; Stack Overflow; deep transfer metric learning; natural language queries; FACE;
D O I
10.1145/3565799
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
When encountering unfamiliar APIs, developers tend to seek help from API tutorials and Stack Overflow (SO). API tutorials help developers understand the API knowledge in a general context, while SO often explains the API knowledge in a specific programming task. Thus, tutorials and SO posts together can provide more API knowledge. However, it is non-trivial to retrieve API knowledge from both API tutorials and SO posts based on natural language queries. Two major problems are irrelevant API knowledge in two different resources and the lexical gap between the queries and documents. In this article, we regard a fragment in tutorials and a Question and Answering (Q&A) pair in SO as a knowledge item (KI). We generate < API, FRA > pairs (FRA stands for fragment) from tutorial fragments and APIs and build < API, QA > pairs based on heuristic rules of SO posts. We fuse < API, FRA > pairs and < API, QA > pairs to generate API knowledge (AK for short) datasets, where each data item is an < API, KI > pair. We propose a novel approach, called PLAN, to automatically retrieve API knowledge from both API tutorials and SO posts based on natural language queries. PLAN contains three main stages: (1) API knowledge modeling, (2) query mapping, and (3) API knowledge retrieving. It first utilizes a deep-transfer-metric-learning-based relevance identification (DTML) model to effectively find relevant < API, KI > pairs containing two different knowledge items (< API, QA > pairs and < API, FRA > pairs) simultaneously. Then, PLAN generates several potential APIs as a way to reduce the lexical gap between the query and < API, KI > pairs. According to potential APIs, we can select relevant < API, KI > pairs to generate potential results. Finally, PLAN returns a list of ranked < API, KI > pairs that are related to the query. We evaluate the effectiveness of PLAN with 270 queries on Java and Android AK datasets containing 10,072 < API, KI > pairs. Our experimental results show that PLAN is effective and outperforms the state-of-the-art approaches. Our user study further confirms the effectiveness of PLAN in locating useful API knowledge.
引用
收藏
页数:36
相关论文
共 88 条
  • [1] [Anonymous], 2013, ADV NEURAL INFORM PR
  • [2] Generating API Call Rules from Version History and Stack Overflow Posts
    Azad, Shams
    Rigby, Peter C.
    Guerrouj, Latifa
    [J]. ACM TRANSACTIONS ON SOFTWARE ENGINEERING AND METHODOLOGY, 2017, 25 (04)
  • [3] Bacchelli A., 2012, 2012 Third International Workshop on Recommendation Systems for Software Engineering (RSSE), P26, DOI 10.1109/RSSE.2012.6233404
  • [4] psc2code: Denoising Code Extraction from Programming Screencasts
    Bao, Lingfeng
    Xing, Zhenchang
    Xia, Xin
    Lo, David
    Wu, Minghui
    Yang, Xiaohu
    [J]. ACM TRANSACTIONS ON SOFTWARE ENGINEERING AND METHODOLOGY, 2020, 29 (03)
  • [5] Mining StackOverflow to Filter out Off-topic IRC Discussion
    Chowdhury, Shaiful Alam
    Hindle, Abram
    [J]. 12TH WORKING CONFERENCE ON MINING SOFTWARE REPOSITORIES (MSR 2015), 2015, : 422 - 425
  • [6] Cliff N., 2014, Ordinal Methods for Behavioral Data Analysis
  • [7] commons apache, 2018, MATH LIB
  • [8] Dagenais B, 2012, PROC INT CONF SOFTW, P47, DOI 10.1109/ICSE.2012.6227207
  • [9] Dai GX, 2017, AAAI CONF ARTIF INTE, P4002
  • [10] de Souza L.B.L., 2014, INT C PROGR COMPR, P72, DOI DOI 10.1145/2597008.2597146