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 条
  • [11] developer, 2018, ANDROID LIB
  • [12] Easy over Hard: A Case Study on Deep Learning
    Fu, Wei
    Menzies, Tim
    [J]. ESEC/FSE 2017: PROCEEDINGS OF THE 2017 11TH JOINT MEETING ON FOUNDATIONS OF SOFTWARE ENGINEERING, 2017, : 49 - 60
  • [13] Technical Q&A Site Answer Recommendation via Question Boosting
    Gao, Zhipeng
    Xia, Xin
    Lo, David
    Grundy, John
    [J]. ACM TRANSACTIONS ON SOFTWARE ENGINEERING AND METHODOLOGY, 2021, 30 (01)
  • [14] Generating Question Titles for Stack Overflow from Mined Code Snippets
    Gao, Zhipeng
    Xia, Xin
    Grundy, John
    Lo, David
    Li, Yuan-Fang
    [J]. ACM TRANSACTIONS ON SOFTWARE ENGINEERING AND METHODOLOGY, 2020, 29 (04)
  • [15] github, 2018, JODATIME LIB
  • [16] Grechanik M., 2010, ICSE 10, V1, P475
  • [17] Gu XD, 2017, PROCEEDINGS OF THE TWENTY-SIXTH INTERNATIONAL JOINT CONFERENCE ON ARTIFICIAL INTELLIGENCE, P3675
  • [18] Deep Code Search
    Gu, Xiaodong
    Zhang, Hongyu
    Kim, Sunghun
    [J]. PROCEEDINGS 2018 IEEE/ACM 40TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE), 2018, : 933 - 944
  • [19] Deep API Learning
    Gu, Xiaodong
    Zhang, Hongyu
    Zhang, Dongmei
    Kim, Sunghun
    [J]. FSE'16: PROCEEDINGS OF THE 2016 24TH ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON FOUNDATIONS OF SOFTWARE ENGINEERING, 2016, : 631 - 642
  • [20] Hall M., 2009, SIGKDD EXPLORATIONS, V11, P10, DOI DOI 10.1145/1656274.1656278