首页> 外文期刊>ACM transactions on software engineering and methodology >Why My Code Summarization Model Does Not Work: Code Comment Improvement with Category Prediction
【24h】

Why My Code Summarization Model Does Not Work: Code Comment Improvement with Category Prediction

机译:为什么我的代码摘要模型不起作用:代码评论改进与类别预测

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

摘要

Code summarization aims at generating a code comment given a block of source code and it is normally performed by training machine learning algorithms on existing code block-comment pairs. Code comments in practice have different intentions. For example, some code comments might explain how the methods work, while others explain why some methods are written. Previous works have shown that a relationship exists between a code block and the category of a comment associated with it. In this article, we aim to investigate to which extent we can exploit this relationship to improve code summarization performance. We first classify comments into six intention categories and manually label 20,000 code-comment pairs. These categories include "what," "why," "how-to-use," "how-it-is-done," "property, "and "others. "Based on this dataset, we conduct an experiment to investigate the performance of different state-of-the-art code summarization approaches on the categories. We find that the performance of different code summarization approaches varies substantially across the categories. Moreover, the category for which a code summarization model performs the best is different for the different models. In particular, no models perform the best for "why" and "property" comments among the six categories. We design a composite approach to demonstrate that comment category prediction can boost code summarization to reach better results. The approach leverages classified code-category labeled data to train a classifier to infer categories. Then it selects the most suitable models for inferred categories and outputs the composite results. Our composite approach outperforms other approaches that do not consider comment categories and obtains a relative improvement of 8.57% and 16.34% in terms of ROUGE-L and BLEU-4 score, respectively.
机译:代码摘要旨在给定源代码块的代码评论,它通常是通过现有代码块评论对的培训机器学习算法来执行的。实践中的代码评论有不同的意图。例如,一些代码评论可能会解释方法的工作原理,而其他则解释为什么写入某些方法。以前的作品已经表明,代码块和与其关联的评论的类别之间存在关系。在本文中,我们的目标是调查我们如何利用这种关系来提高代码摘要性能。我们首先将评论分为六个意图类别,并手动标记20,000个代码评论对。这些类别包括“什么”,“为什么”,“如何使用,”“hof-in-to-do,”“属性”和“其他”。根据此数据集进行了一个实验来调查不同最先进的代码摘要的性能对类别的方法。我们发现不同代码摘要方法的性能大幅度变化。此外,对于不同模型,代码摘要模型执行最佳的类别是不同的。特别是,没有模型在六个类别中的“为什么”和“属性”评论中最佳。我们设计一种复合方法来证明评论类别预测可以提高代码摘要以达到更好的结果。该方法利用分类的代码类标记的数据来训练分类器到推断类别。然后它为推断类别选择最合适的模型,并输出复合结果。我们的综合方法优于不考虑评论类别的其他方法,并分别在Rouge-L和Bleu-4分别获得8.57%和16.34%的相对提高。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号