SWIM: Synthesizing What I Mean
Mukund Raghothaman, Yi Wei, Youssef Hamadi

TL;DR
SWIM is a tool that generates idiomatic code snippets for API-related natural language queries by translating queries into APIs and synthesizing code patterns from open-source repositories, improving developer assistance.
Contribution
This paper introduces structured call sequences and a method to synthesize API usage patterns from search queries and open-source code, enabling automatic code snippet generation.
Findings
70% of queries received relevant first suggestions
Relevant solutions appeared in top 10 results for all queries
Average response time per snippet is 1.5 seconds
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
