An Extractive-and-Abstractive Framework for Source Code Summarization

Author:

Sun Weisong1,Fang Chunrong1,Chen Yuchen1,Zhang Quanjun1,Tao Guanhong2,You Yudu1,Han Tingxu1,Ge Yifei1,Hu Yuling1,Luo Bin1,Chen Zhenyu1

Affiliation:

1. State Key Laboratory for Novel Software Technology, Nanjing University, China

2. Purdue University, USA

Abstract

(Source) Code summarization aims to automatically generate summaries/comments for given code snippets in the form of natural language. Such summaries play a key role in helping developers understand and maintain source code. Existing code summarization techniques can be categorized into extractive methods and abstractive methods . The extractive methods extract a subset of important statements and keywords from the code snippet using retrieval techniques and generate a summary that preserves factual details in important statements and keywords. However, such a subset may miss identifier or entity naming, and consequently, the naturalness of the generated summary is usually poor. The abstractive methods can generate human-written-like summaries leveraging encoder-decoder models. However, the generated summaries often miss important factual details. To generate human-written-like summaries with preserved factual details, we propose a novel extractive-and-abstractive framework. The extractive module in the framework performs the task of extractive code summarization, which takes in the code snippet and predicts important statements containing key factual details. The abstractive module in the framework performs the task of abstractive code summarization, which takes in the code snippet and important statements in parallel and generates a succinct and human-written-like natural language summary. We evaluate the effectiveness of our technique, called EACS, by conducting extensive experiments on three datasets involving six programming languages. Experimental results show that EACS significantly outperforms state-of-the-art techniques for all three widely used metrics, including BLEU, METEOR, and ROUGH-L. In addition, the human evaluation demonstrates that the summaries generated by EACS have higher naturalness and informativeness and are more relevant to given code snippets.

Publisher

Association for Computing Machinery (ACM)

Subject

Software

Reference127 articles.

1. Using developer eye movements to externalize the mental model used in code summarization tasks

2. Wasi Uddin Ahmad , Saikat Chakraborty , Baishakhi Ray , and Kai-Wei Chang . 2020 . A Transformer-based Approach for Source Code Summarization . In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. Association for Computational Linguistics, Online, 4998–5007 . Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, and Kai-Wei Chang. 2020. A Transformer-based Approach for Source Code Summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. Association for Computational Linguistics, Online, 4998–5007.

3. Miltiadis Allamanis , Earl  T. Barr , Premkumar  T. Devanbu , and Charles Sutton . 2018. A Survey of Machine Learning for Big Code and Naturalness. Comput. Surveys 51, 4 ( 2018 ), 81:1–81:37. Miltiadis Allamanis, Earl T. Barr, Premkumar T. Devanbu, and Charles Sutton. 2018. A Survey of Machine Learning for Big Code and Naturalness. Comput. Surveys 51, 4 (2018), 81:1–81:37.

4. Uri Alon Omer Levy and Eran Yahav. 2018. Code2seq: Generating Sequences from Structured Representations of Code. CoRR abs/1808.01400(2018). Uri Alon Omer Levy and Eran Yahav. 2018. Code2seq: Generating Sequences from Structured Representations of Code. CoRR abs/1808.01400(2018).

5. An approach for bug localization in models using two levels: model and metamodel

Cited by 2 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. Esale: Enhancing Code-Summary Alignment Learning for Source Code Summarization;IEEE Transactions on Software Engineering;2024-08

2. LenANet: A Length-Controllable Attention Network for Source Code Summarization;Communications in Computer and Information Science;2023-11-27

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3