code2seq: Generating Sequences from Structured Representations of Code

By Uri Alon, Shaked Brody, Omer Levy, Eran Yahav. 2018

812 citations recorded by the source corpus.

The ability to generate natural language sequences from source code snippets has a variety of applications such as code summarization, documentation, and retrieval. Sequence-to-sequence (seq2seq) models, adopted from neural machine translation (NMT), have achieved state-of-the-art performance on these tasks by treating source code as a sequence of tokens. We present ${\rm {\scriptsize CODE2SEQ}}$: an alternative approach that leverages the syntactic structure of programming languages to better encode source code. Our model represents a code snippet as the set of compositional paths in its abstract syntax tree (AST) and uses attention to select the relevant paths while decoding. We demonstrate the effectiveness of our approach for two tasks, two programming languages, and four datasets of up to $16$M examples. Our model significantly outperforms previous models that were specifically designed for programming languages, as well as state-of-the-art NMT models. An interactive online demo of our model is available at this http URL Our code, data and trained models are available at this http URL

Subfields: Natural Language Processing

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Natural Language Processing

  1. Prem Devanbu
  2. Graham Neubig
  3. Miltiadis Allamanis
  4. Luke S. Zettlemoyer
  5. Omer Levy
  6. Charles Sutton
  7. Mohit Bansal
  8. Uri Alon

Citations in the corpus