arrow
返回

CodeAttention: translating source code to comments by exploiting the code constructs

delete2018-10-16
delete11
PRE
AI
W
Wenhao Zheng
周洪宇 封面图
周洪宇 (Hong-Yu Zhou)
M
Ming Li *
吴
吴建鑫 (Jianxin Wu)
DOI:10.1007/s11704-018-7457-6delete
delete原文链接
delete原文求助
delete分享
delete收藏
摘要

摘要

En 中文
Appropriate comments of code snippets provide insight for code functionality, which are helpful for program comprehension. However, due to the great cost of authoring with the comments, many code projects do not contain adequate comments. Automatic comment generation techniques have been proposed to generate comments from pieces of code in order to alleviate the human efforts in annotating the code. Most existing approaches attempt to exploit certain correlations (usually manually given) between code and generated comments, which could be easily violated if coding patterns change and hence the performance of comment generation declines. In addition, recent approaches ignore exploiting the code constructs and leveraging the code snippets like plain text. Furthermore, previous datasets are also too small to validate the methods and show their advantage. In this paper, we propose a new attention mechanism called CodeAttention to translate code to comments, which is able to utilize the code constructs, such as critical statements, symbols and keywords. By focusing on these specific points, CodeAttention could understand the semantic meanings of code better than previous methods. To verify our approach in wider coding patterns, we build a large dataset from open projects in GitHub. Experimental results in this large dataset demonstrate that the proposed method has better performance over existing approaches in both objective and subjective evaluation. We also perform ablation studies to determine effects of different parts in CodeAttention.
Keyword:
software mining
machine learning
code comment generation
recurrent neural network
attention mechanism

期刊

Frontiers of Computer Science 封面图
Frontiers of Computer Science
IF:
4.6
论文数:
1.6K
被引数:
2.8K

机构

N
nanjing university
学者数:
7.8W
论文数: 5.6W
被引数: 87
引用论文

引用论文

A flexible sigmoid function of determinate growth
err2002-12-19
err634
errOAAI
errYin, XY; Goudriaan, J; Lantinga, EA; Vos, J; Spiertz, HJ
err分享
err收藏
Deep Neural Networks for Acoustic Modeling in Speech Recognition深度神经网络在语音识别声学建模中的应用
err2012-11-01
err8.2K
PREAI
errHinton, Geoffrey; Deng, Li; Yu, Dong; Dahl, George E.; Mohamed, Abdel-rahman; Jaitly, Navdeep; Senior, Andrew; Vanhoucke, Vincent; Patrick Nguyen; Sainath, Tara N.; Kingsbury, Brian
err分享
err收藏
没有更多内容