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

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

机译:CodeatedTention:通过利用代码构造来翻译源代码来评论

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

摘要

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

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号