arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2103.11448cs.CL
收藏

利用方法名改进代码摘要:一种深思熟虑的多任务学习方法

Exploiting Method Names to Improve Code Summarization: A Deliberation Multi-Task Learning Approach

National Engineering Research Center for Software Engineering, Peking University(北京大学软件工程国家工程研究中心);School of Software and Microelectronics, Peking University(北京大学软件与微电子学院)

Rui Xie, Wei Ye, Jinan Sun, Shikun Zhang

摘要:

代码摘要是源代码片段的简短自然语言描述。代码摘要的主要目的是帮助开发人员理解代码并减少文档工作量。在本文中,我们设计了一种新的多任务学习(MTL)的代码摘要方法,通过挖掘方法代码摘要和方法名称之间的关系。更具体地说,由于一个方法的名称可以被认为是一个较短的版本,其代码摘要,我们首先介绍的任务的生成和信息量预测的方法名称作为两个辅助训练目标的代码摘要。一种新的两遍审议机制,然后纳入我们的MTL架构,以产生更一致的中间状态馈入一个摘要解码器,特别是当信息方法名称不存在。为了评估我们的审议MTL方法,我们对Java和Python的两个现有数据集进行了大规模实验。实验结果表明,我们的技术可以很容易地应用到许多国家的最先进的神经模型的代码摘要,并提高其性能。同时,我们的方法显示出显着的优越性时,生成摘要的方法与非信息名称。

英文摘要:

Code summaries are brief natural language descriptions of source code pieces. The main purpose of code summarization is to assist developers in understanding code and to reduce documentation workload. In this paper, we design a novel multi-task learning (MTL) approach for code summarization through mining the relationship between method code summaries and method names. More specifically, since a method's name can be considered as a shorter version of its code summary, we first introduce the tasks of generation and informativeness prediction of method names as two auxiliary training objectives for code summarization. A novel two-pass deliberation mechanism is then incorporated into our MTL architecture to generate more consistent intermediate states fed into a summary decoder, especially when informative method names do not exist. To evaluate our deliberation MTL approach, we carried out a large-scale experiment on two existing datasets for Java and Python. The experiment results show that our technique can be easily applied to many state-of-the-art neural models for code summarization and improve their performance. Meanwhile, our approach shows significant superiority when generating summaries for methods with non-informative names.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑