Code summarization, which aims to automatically generate natural language descriptions of the source code, has become an essential task in software development for better program understanding. Abstract Syntax Tree (AST), which represents the syntax structure of the source code, is helpful when utilized together with the sequence of code tokens to improve the quality of code summaries. Recent works on code summarization attempted to capture the sequential and structural information of the source code, but they considered less the property that source code consists of multiple code blocks. In this paper, we propose BLOCSUM, BLOck scope-based source Code SUMmarization via shared block representation that utilizes block-scope information by representing various structures of the code block. We propose a shared block position embedding to effectively represent the structure of code blocks and merge both code and AST. Furthermore, we develop variant ASTs to learn rich information such as block and global dependencies of the source code. To prove our approach, we perform experiments on two real-world datasets, the Java dataset and the Python dataset. We demonstrate the effectiveness of BLOCSUM through various experiments, including ablation studies and a human evaluation.
CITATION STYLE
Choi, Y. S., Kim, H., & Lee, J. H. (2023). BLOCSUM: Block Scope-based Source Code Summarization via Shared Block Representation. In Proceedings of the Annual Meeting of the Association for Computational Linguistics (pp. 11427–11441). Association for Computational Linguistics (ACL). https://doi.org/10.18653/v1/2023.findings-acl.724
Mendeley helps you to discover research relevant for your work.