期刊文献+

组合源码结构和语义的代码注释自动生成方法

Automatic Code Comment Generation Method Combining Source Code Structure and Semantics
下载PDF
导出
摘要 代码注释有助于提高程序的可读性和可理解性,而不断地创建和更新注释非常费时费力,这将影响对软件的理解、重用和维护.自动代码注释试图解决此类问题,其中代码的表示和文本生成是研究的核心问题.该文提出一种基于编码器-解码器结构的自动生成Java代码注释模型.方法将代码的顺序序列和代码结构作为单独的输入进行处理,允许模型学习Java方法的结构和语义;以一定的概率从模型生成的预测序列和真实词序列中采样作为下一步的输入,以提高模型的纠错恢复能力.通过与3种典型自动代码注释方法在11个Java项目上的对比实验,结果表明,提出的模型在BLEU得分上提升了16.1%,有助于提高自动代码注释的性能. Code comments contribute to improve the readability and comprehensibility of programs,and constantly creating and updating comments is time-consuming and laborious,which will affect the understanding,reuse and maintenance of the software. Automatic code commenting attempts to solve such problems,in which code representation and text generation are the core issues. In this paper,we propose a method of generating java code comments automatically based on encoder-decoder structure. We process the sequential sequence and structure of the code as separate inputs,allowing the model to learn the structure and semantics of Java methods;the method samples the predicted sequence generated by the model and ground truth sequence with a certain probability as the next input to improve the error correction and recovery capabilities of the model. Compared with three typical automatic code commenting methods on 11 Java projects,the experimental results show that the BLEU score of our model is improved by 16. 1%,the proposed model contributes to the improvement of automatic code commenting performance.
作者 周培君 吴军华 ZHOU Pei-jun;WU Jun-hua(Institute of Computer Science and Technology,Nanjing University of Technology,Nanjing 211816,China)
出处 《小型微型计算机系统》 CSCD 北大核心 2021年第12期2501-2505,共5页 Journal of Chinese Computer Systems
基金 国家自然科学基金青年基金项目(61802176)资助。
关键词 代码注释生成 代码表示 文本生成 编码器-解码器 code comment generation code representation text generation encoder-decoder
  • 相关文献

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部