BLOCSUM: Block Scope-based Source Code Summarization via Shared Block Representation

YunSeok Choi, Hyojun Kim, Jee-Hyong Lee


Abstract
Code summarization, which aims to automatically generate natural language descriptions from 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.
Anthology ID:
2023.findings-acl.724
Volume:
Findings of the Association for Computational Linguistics: ACL 2023
Month:
July
Year:
2023
Address:
Toronto, Canada
Editors:
Anna Rogers, Jordan Boyd-Graber, Naoaki Okazaki
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
11427–11441
Language:
URL:
https://aclanthology.org/2023.findings-acl.724
DOI:
10.18653/v1/2023.findings-acl.724
Bibkey:
Cite (ACL):
YunSeok Choi, Hyojun Kim, and Jee-Hyong Lee. 2023. BLOCSUM: Block Scope-based Source Code Summarization via Shared Block Representation. In Findings of the Association for Computational Linguistics: ACL 2023, pages 11427–11441, Toronto, Canada. Association for Computational Linguistics.
Cite (Informal):
BLOCSUM: Block Scope-based Source Code Summarization via Shared Block Representation (Choi et al., Findings 2023)
Copy Citation:
PDF:
https://aclanthology.org/2023.findings-acl.724.pdf
Video:
 https://aclanthology.org/2023.findings-acl.724.mp4