Automatic Generation of Text Descriptive Comments for Code Blocks

Authors

  • Yuding Liang Shanghai Jiao Tong University
  • Kenny Zhu Shanghai Jiao Tong University

DOI:

https://doi.org/10.1609/aaai.v32i1.11963

Keywords:

code comment, recursive neural network, recurrent neural network

Abstract

We propose a framework to automatically generate descriptive comments for source code blocks. While this problem has been studied by many researchers previously, their methods are mostly based on fixed template and achieves poor results. Our framework does not rely on any template, but makes use of a new recursive neural network called CodeRNN to extract features from the source code and embed them into one vector. When this vector representation is input to a new recurrent neural network (Code-GRU), the overall framework generates text descriptions of the code with accuracy (Rouge-2 value) significantly higher than other learning-based approaches such as sequence-to-sequence model. The Code-RNN model can also be used in other scenario where the representation of code is required.

Downloads

Published

2018-04-27

How to Cite

Liang, Y., & Zhu, K. (2018). Automatic Generation of Text Descriptive Comments for Code Blocks. Proceedings of the AAAI Conference on Artificial Intelligence, 32(1). https://doi.org/10.1609/aaai.v32i1.11963