Affiliation:
1. Wuhan University, China and Nanjing University, China
2. Zhejiang Sci-Tech University, China and Nanjing University, China and Wuhan University, China and Guangdong University of Petrochemical Technology, China
3. The University of Newcastle, Australia and Chongqing University, China
4. Nanjing University, China
5. Wuhan University, China
Abstract
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 paper, 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 a ⟨
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.
Publisher
Association for Computing Machinery (ACM)
Reference88 articles.
1. 2018. Android Library. https://developer.android.com/studio/. 2018. Android Library. https://developer.android.com/studio/.
2. 2018. Collections Library. http://www.oracle.com/technetwork/java/javase/downloads. 2018. Collections Library. http://www.oracle.com/technetwork/java/javase/downloads.
3. 2018a. JodaTime Library. https://github.com/JodaOrg/joda-time/releases. 2018a. JodaTime Library. https://github.com/JodaOrg/joda-time/releases.
4. 2018b. JodaTime Tutorial. https://www.joda.org/joda-time/index.html. 2018b. JodaTime Tutorial. https://www.joda.org/joda-time/index.html.
5. 2018. Lucene. https://lucene.apache.org/core. 2018. Lucene. https://lucene.apache.org/core.
Cited by
5 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献