SWIM: Synthesizing What I Mean
arXiv:1511.08497 · doi:10.1145/2884781.2884808
Abstract
Modern programming frameworks come with large libraries, with diverse applications such as for matching regular expressions, parsing XML files and sending email. Programmers often use search engines such as Google and Bing to learn about existing APIs. In this paper, we describe SWIM, a tool which suggests code snippets given API-related natural language queries such as "generate md5 hash code". We translate user queries into the APIs of interest using clickthrough data from the Bing search engine. Then, based on patterns learned from open-source code repositories, we synthesize idiomatic code describing the use of these APIs. We introduce \emph{structured call sequences} to capture API-usage patterns. Structured call sequences are a generalized form of method call sequences, with if-branches and while-loops to represent conditional and repeated API usage patterns, and are simple to extract and amenable to synthesis. We evaluated SWIM with 30 common C# API-related queries received by Bing. For 70% of the queries, the first suggested snippet was a relevant solution, and a relevant solution was present in the top 10 results for all benchmarked queries. The online portion of the workflow is also very responsive, at an average of 1.5 seconds per snippet.
Final draft of paper to be presented at ICSE 2016
References in corpus (1)
Cited by in corpus (14)
- Studying the effect of AI Code Generators on Supporting Novice Learners in Introductory Programming
- Easy over Hard: A Case Study on Deep Learning
- Big Code != Big Vocabulary: Open-Vocabulary Models for Source Code
- Aroma: Code Recommendation via Structural Code Search
- Opportunities and Challenges in Code Search Tools
- StaQC: A Systematically Mined Question-Code Dataset from Stack Overflow
- Code Search: A Survey of Techniques for Finding Code
- Code Vectors: Understanding Programs Through Embedded Abstracted Symbolic Traces
- Development of recommendation systems for software engineering: the CROSSMINER experience
- CodeMatcher: Searching Code Based on Sequential Semantics of Important Query Words
- Compositional API Recommendation for Library-Oriented Code Generation
- Recovering Variable Names for Minified Code with Usage Contexts
- Learning the Relation between Code Features and Code Transforms with Structured Prediction
- On the Effectiveness of Pretrained Models for API Learning