An Extractive-and-Abstractive Framework for Source Code Summarization
ACM Transactions on Software Engineering and Methodology · 31.03.2024 · 33 (3) · 1-39
DOI: 10.1145/3632742 ↗Kurz gefasst
Fachartikel in der Zeitschrift ACM Transactions on Software Engineering and Methodology, online erschienen am 14.03.2024. Verfasst von Weisong Sun und 10 weiteren Autor:innen. Die Arbeit wurde bisher 38-mal zitiert (Crossref) und nennt 126 Literaturangaben. Gefördert von: National Natural Science Foundation of China, Program B for Outstanding PhD Candidate of Nanjing University.
Abstract (Originalsprache)
(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.
Förderung
- National Natural Science Foundation of China
- Program B for Outstanding PhD Candidate of Nanjing University
Zitieren
APA
Sun, W., Fang, C., Chen, Y., Zhang, Q., Tao, G., You, Y., Han, T., Ge, Y., Hu, Y., Luo, B., & Chen, Z. (2024). An Extractive-and-Abstractive Framework for Source Code Summarization. ACM Transactions on Software Engineering and Methodology, 33(3), 1-39. https://doi.org/10.1145/3632742
Vancouver
Sun W, Fang C, Chen Y, Zhang Q, Tao G, You Y, et al. An Extractive-and-Abstractive Framework for Source Code Summarization. ACM Transactions on Software Engineering and Methodology. 2024;33(3):1-39. doi:10.1145/3632742
BibTeX
@article{Sun2024,
author = {Sun, Weisong and Fang, Chunrong and Chen, Yuchen and Zhang, Quanjun and Tao, Guanhong and You, Yudu and Han, Tingxu and Ge, Yifei and Hu, Yuling and Luo, Bin and Chen, Zhenyu},
title = {An Extractive-and-Abstractive Framework for Source Code Summarization},
journal = {ACM Transactions on Software Engineering and Methodology},
year = {2024},
volume = {33},
number = {3},
pages = {1--39},
doi = {10.1145/3632742}
}
EUVIMED