Abstract: Automatically generating code from natural language query is a very promising but much challenging direction. Existing approaches either try to generate the whole code or only predict a small part of critical code elements such as API sequence. Meanwhile, API usage patterns, including APIs and API-related control-flow statements, have the moderate complexity, but can provide enough code framework information and are very helpful for developers to implement various functionalities. Therefore, in this work, we study the problem of generating API usage patterns, represent API usage patterns by one special constrained tree API-MCTree and design one new API-MCTree decoder for automatically transforming natural language queries to API usage patterns, which can leverage both the difference of control-flow statement types and the syntactic knowledge of API usage patterns. We evaluate our model with annotated code snippets in real Java projects collected from GitHub, and the experimental results show that our approach is effective and outperforms the related approaches.
External IDs:dblp:conf/apsec/TianWSZGL18
Loading