arrow
返回

Towards automatically generating block comments for code snippets

delete2020-11-01
delete24
PRE
AI
黄袁 封面图
黄袁 (Yuan Huang)
S
Shaohao Huang
H
Huanchao Chen
X
Xiangping Chen *
Z
Zibin Zheng
X
Xiapu Luo
N
Nan Jia
X
Xinyu Hu
X
Xiaocong Zhou
DOI:10.1016/j.infsof.2020.106373delete
delete原文链接
delete原文求助
delete分享
delete收藏
摘要

摘要

En 中文
Code commenting is a common programming practice of practical importance to help developers review and comprehend source code. There are two main types of code comments for a method: header comments that summarize the method functionality located before a method, and block comments that describe the functionality of the code snippets within a method. Inspired by the effectiveness of deep learning techniques in the NLP field, many studies focus on using the machine translation model to automatically generate comment for the source code. Because the data set of block comments is difficult to collect, current studies focus more on the automatic generation of header comments than that of block comments. However, block comments are important for program comprehension due to their explanation role for the code snippets in a method. To fill the gap, we have proposed an approach that combines heuristic rules and learning-based method to collect a large number of comment-code pairs from 1,032 open source projects in our previous study. In this paper, we propose a reinforcement learning-based method, RL-BlockCom, to automatically generate block comments for code snippets based on the collected comment-code pairs. Specifically, we utilize the abstract syntax tree (i.e., AST) of a code snippet to generate a token sequence with a statement-based traversal way. Then we propose a composite learning model, which combines the actor-critic algorithm of reinforcement learning with the encoder-decoder algorithm, to generate block comments. On the data set of the comment-code pairs, the BLEU-4 score of our method is 24.28, which outperforms the baselines and state-of-the-art in comment generation.
Keyword:
Automatic comment generation
Source code summarization
Code comment scope
Reinforcement learning
AI总结

AI总结

对已上传原文的论文进行重点信息的提取,主要内容包括:简要概述、研究摘要、背景介绍、关键亮点、图文解析、展望与总结。

期刊

Information and Software Technology 封面图
Information and Software Technology
IF:
4.3
论文数:
3.8K
被引数:
7.7K

机构

H
hong kong polytechnic university
学者数:
3.0W
论文数: 4.1W
被引数: 921
S
Sun Yat Sen University
学者数:
9.9W
论文数: 7.2W
被引数: 95
H
Hebei GEO University
学者数:
1.4K
论文数: 935
被引数: 943
学者 查看更多机构
引用论文

引用论文

err分享
err收藏
Semantic clustering: Identifying topics in source code
err2007-03-01
err343
PREAI
errKuhn, Adrian; Ducasse, Stephane; Girba, Tudor
err分享
err收藏
Automatically detecting the scopes of source code comments
err2019-07-01
err16
errOAAI
errChen, Huanchao; Huang, Yuan; Liu, Zhiyong; Chen, Xiangping; Zhou, Fan; Luo, Xiaonan
err分享
err收藏
ARENA: An Approach for the Automated Generation of Release NotesARENA: 一种自动生成发行说明的方法
err2017-02-01
err68
errOAAI
errMoreno, Laura; Bavota, Gabriele; Di Penta, Massimiliano; Oliveto, Rocco; Marcus, Andrian; Canfora, Gerardo
err分享
err收藏
Learning Code Context Information to Predict Comment Locations学习代码上下文信息以预测注释位置
err2020-03-01
err22
PREAI
errHuang, Yuan; Hu, Xinyu; Jia, Nan; Chen, Xiangping; Xiong, Yingfei; Zheng, Zibin
err分享
err收藏
没有更多内容