Computer Engineering and Applications ›› 2020, Vol. 56 ›› Issue (10): 246-253.DOI: 10.3778/j.issn.1002-8331.1901-0222
Previous Articles Next Articles
BAI Yang, ZHANG Liping
Online:
Published:
白杨,张丽萍
Abstract:
Low number of comments and low quality for most software code comments, a method for automatically generating code comments is proposed. Firstly, the clone code is detected by Nicad, and the code and corresponding comments are extracted, then the code and comments are separately optimized and streamlined. Finally, the comment is matched to the code mapping to generate a comment for the code. The code comments in five projects are manually verified in the experiment, and then results are evaluated as well. The experiment finds that 28% code comments are good. And the comments are reported to five experts with the feedback that the comments of two projects have favorable performance. Experimental results and user surveys show the feasibility and effectiveness of this method for automatically generating code comments.
Key words: clone code, clone detection, code comment, comment optimizing, automatically generating comment
摘要:
针对大多数软件代码注释数量少、质量低的问题,提出了一种自动生成代码注释的方法。利用Nicad检测出克隆代码,提取出这些代码以及相应的注释,对代码和注释分别进行精简优化,将注释与代码匹配映射,为代码自动生成注释。对5款软件中的代码注释进行手动验证并评估注释结果,实验结果发现28%的代码注释是良好的,同时将注释报告给5位专家,专家评估结果为两款软件的代码注释为良好。实验结果及用户调研表明,该方法对于自动生成代码注释是可行、有效的。
关键词: 克隆代码, 克隆检测, 代码注释, 注释优化, 自动生成注释
BAI Yang, ZHANG Liping. Mining Source Code for Automatic Comment Generation Method[J]. Computer Engineering and Applications, 2020, 56(10): 246-253.
白杨,张丽萍. 挖掘软件源代码的代码注释自动生成方法[J]. 计算机工程与应用, 2020, 56(10): 246-253.
0 / Recommend
Add to citation manager EndNote|Ris|BibTeX
URL: http://cea.ceaj.org/EN/10.3778/j.issn.1002-8331.1901-0222
http://cea.ceaj.org/EN/Y2020/V56/I10/246