Improving Code Summarization with Block-wise Abstract Syntax Tree Splitting
Automatic code summarization frees software developers from the heavy burden of manual commenting and benefits software development and maintenance. Abstract Syntax Tree (AST), which depicts the source code's syntactic structure, has been incorporated to guide the generation of code summaries. However, existing AST based methods suffer from the difficulty of training and generate inadequate code summaries. In this paper, we present the Block-wise Abstract Syntax Tree Splitting method (BASTS for short), which fully utilizes the rich tree-form syntax structure in ASTs, for improving code summarization. BASTS splits the code of a method based on the blocks in the dominator tree of the Control Flow Graph, and generates a split AST for each code split. Each split AST is then modeled by a Tree-LSTM using a pre-training strategy to capture local non-linear syntax encoding. The learned syntax encoding is combined with code encoding, and fed into Transformer to generate high-quality code summaries. Comprehensive experiments on benchmarks have demonstrated that BASTS significantly outperforms state-of-the-art approaches in terms of various evaluation metrics. To facilitate reproducibility, our implementation is available at https://github.com/XMUDM/BASTS.
Code (1)
Tasks
Code SummarizationSource Code SummarizationMethods 이 논문이 사용한 방법론
Similar Papers 제목 키워드 기반
Retrieval-based Layer-wise Adaptive Transformer for Source Code Summarization
We propose a model that learns both the sequential and the structural features of code for source code summarization. We adopt the Abstract Syntax Tree (AST) and graph convolution to model the structural information and …
Code SummarizationRetrievalSource Code SummarizationAST-Transformer: Encoding Abstract Syntax Trees Efficiently for Code Summarization
Code summarization aims to generate brief natural language descriptions for source code. As source code is highly structured and follows strict programming language grammars, its Abstract Syntax Tree (AST) is often lever…
Code SummarizationAutomatic Summarization for Creative Writing: BART based Pipeline Method for Generating Summary of Movie Scripts
This paper documents our approach for the Creative-Summ 2022 shared task for Automatic Summarization of Creative Writing. For this purpose, we develop an automatic summarization pipeline where we leverage a denoising aut…
DenoisingModeling Hierarchical Syntax Structure with Triplet Position for Source Code Summarization
Automatic code summarization, which aims to describe the source code in natural language, has become an essential task in software maintenance. Our fellow researchers have attempted to achieve such a purpose through vari…
Code SummarizationGraph Neural NetworkPositionSource Code Summarization+1Modeling Hierarchical Syntax Structure with Triplet Position for Source Code Summarization
Automatic code summarization, which aims to describe the source code in natural language, has become an essential task in software maintenance. Our fellow researchers have attempted to achieve such a purpose through vari…
Code SummarizationGraph Neural NetworkPositionSource Code Summarization+1