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

Author:

Wu Di1,Jing Xiao-Yuan2,Zhang Hongyu3,Feng Yang4,Chen Haowen5,Zhou Yuming4,Xu Baowen4

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)

Subject

Software

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篇论文的施引文献,订阅后可以查看论文全部施引文献

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3