Deep API Learning

Xiaodong Gu, Hongyu Zhang, Dongmei Zhang, Sunghun Kim

Research output: Chapter in Book/Conference Proceeding/ReportConference Paper published in a bookpeer-review

469 Citations (Scopus)

Abstract

Developers often wonder how to implement a certain functionality (e.g., how to parse XML files) using APIs. Obtaining an API usage sequence based on an API-related natural language query is very helpful in this regard. Given a query, existing approaches utilize information retrieval models to search for matching API sequences. These approaches treat queries and APIs as bags-of-words and lack a deep understanding of the semantics of the query. We propose DeepAPI, a deep learning based approach to generate API usage sequences for a given natural language query. Instead of a bag-of-words assumption, it learns the sequence of words in a query and the sequence of associated APIs. DeepAPI adapts a neural language model named RNN Encoder-Decoder. It encodes a word sequence (user query) into a fixed-length context vector, and generates an API sequence based on the context vector. We also augment the RNN Encoder-Decoder by considering the importance of individual APIs. We empirically evaluate our approach with more than 7 million annotated code snippets collected from GitHub. The results show that our approach generates largely accurate API sequences and outperforms the related approaches.

Original languageEnglish
Title of host publicationFSE 2016 - Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering
EditorsZhendong Su, Thomas Zimmermann, Jane Cleland-Huang
PublisherAssociation for Computing Machinery
Pages631-642
Number of pages12
ISBN (Electronic)9781450342186
DOIs
Publication statusPublished - 1 Nov 2016
Event24th ACM SIGSOFT International Symposium on Foundations of Software Engineering, FSE 2016 - Seattle, United States
Duration: 13 Nov 201618 Nov 2016

Publication series

NameProceedings of the ACM SIGSOFT Symposium on the Foundations of Software Engineering
Volume13-18-November-2016

Conference

Conference24th ACM SIGSOFT International Symposium on Foundations of Software Engineering, FSE 2016
Country/TerritoryUnited States
CitySeattle
Period13/11/1618/11/16

Keywords

  • API
  • API usage
  • Code search
  • Deep learning
  • RNN

Fingerprint

Dive into the research topics of 'Deep API Learning'. Together they form a unique fingerprint.

Cite this