首页> 外文期刊>Frontiers of computer science in China >CodeAttention: translating source code to comments by exploiting the code constructs
【24h】

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

机译:CodeAttention:通过利用代码构造将源代码转换为注释

获取原文
获取原文并翻译 | 示例
           

摘要

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.
机译:适当的代码片段注释可提供有关代码功能的见解,这有助于理解程序。但是,由于编写注释的成本很高,因此许多代码项目都没有包含足够的注释。已经提出了自动注释生成技术以从代码段生成注释,以减轻人类注释代码的工作。大多数现有方法试图利用代码和生成的注释之间的某些相关性(通常是手动给定),如果编码模式发生更改,因此注释生成的性能下降,则很容易违反这些相关性。另外,最近的方法忽略了对代码结构的利用,并没有利用纯文本之类的代码片段。此外,以前的数据集也太小,无法验证方法并显示其优势。在本文中,我们提出了一种称为CodeAttention的新注意机制,它将代码转换为注释,该机制能够利用代码结构,例如关键语句,符号和关键字。通过关注这些特定点,与以前的方法相比,CodeAttention可以更好地理解代码的语义。为了在更广泛的编码模式下验证我们的方法,我们从GitHub中的开放项目中构建了一个大型数据集。在这个大型数据集中的实验结果表明,该方法在客观和主观评估方面均优于现有方法。我们还将进行消融研究,以确定CodeAttention中不同部分的影响。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号