基于样本的神经评论生成算法
Retrieve and Refine: Exemplar-based Neural Comment Generation
摘要:
代码注释生成是软件自动化开发领域的一项重要任务。大多数以前的神经注释生成系统使用编码器-解码器神经网络,并且仅将来自源代码的信息编码为输入。软件复用是软件开发中的一个普遍现象。然而,该功能尚未引入现有系统。受传统的基于IR的方法的启发,我们建议使用类似的源代码的现有注释作为范例来指导注释生成过程。基于一个开源的搜索引擎,我们首先检索到一个类似的代码,并将其注释作为范例。然后,我们应用seq 2seq神经网络进行基于范例的评论生成。我们评估我们的方法在一个大规模的Java语料库,实验结果表明,我们的模型显着优于国家的最先进的方法。
英文摘要:
Code comment generation is a crucial task in the field of automatic software development. Most previous neural comment generation systems used an encoder-decoder neural network and encoded only information from source code as input. Software reuse is common in software development. However, this feature has not been introduced to existing systems. Inspired by the traditional IR-based approaches, we propose to use the existing comments of similar source code as exemplars to guide the comment generation process. Based on an open source search engine, we first retrieve a similar code and treat its comment as an exemplar. Then we applied a seq2seq neural network to conduct an exemplar-based comment generation. We evaluate our approach on a large-scale Java corpus, and experimental results demonstrate that our model significantly outperforms the state-of-the-art methods.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。