T2API: synthesizing API code usage templates from English texts with statistical translation
Abstract
In this work, we develop T2API, a statistical machine translation-based tool that takes a given English description of a programming task as a query, and synthesizes the API usage template for the task by learning from training data. T2API works in two steps. First, it derives the API elements relevant to the task described in the input by statistically learning from a StackOverflow corpus of text descriptions and corresponding code. To infer those API elements, it also considers the context of the words in the textual input and the context of API elements that often go together in the corpus. The inferred API elements with their relevance scores are ensembled into an API usage by our novel API usage synthesis algorithm that learns the API usages from a large code corpus via a graph-based language model. Importantly, T2API is capable of generating new API usages from smaller, previously-seen usages.
BibTeX
@inproceedings{Nguyen-al:FSE16,
author = {Thanh Van Nguyen and
Peter C. Rigby and
Anh Tuan Nguyen and
Mark Karanfil and
Tien N. Nguyen},
title = {{T2API:} synthesizing {API} code usage templates from English texts with statistical translation},
booktitle = {FSE},
pages = {1013--1017},
publisher = {{ACM}},
year = {2016},
}