Improving Code Summarization with Block-wise Abstract Syntax Tree Splitting

Chen Lin, Zhichao Ouyang, Junqing Zhuang, Jianqiang Chen, Hui Li +1 more
3/14/2021
cs.SEcs.AIcs.CL

Official code: XMUDM/BASTS (24 stars, Java, last commit 2023-01-03).

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

XMUDM/BASTSOfficial100%

This is the code repository for our ICPC 2021 paper "Improving Code Summarization with Block-wise Abstract Syntax Tree Splitting"

249Java, PythonMar 8, 20213 years ago

Similar Papers

Cite this paper

@article{lin2021improving,
  title  = {Improving Code Summarization with Block-wise Abstract Syntax Tree Splitting},
  author = {Chen Lin and Zhichao Ouyang and Junqing Zhuang and Jianqiang Chen and Hui Li and Rongxin Wu},
  year   = {2021},
  eprint = {2103.07845},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2103.07845}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2103.07845.svg)](https://codeofpaper.com/paper/2103.07845)

Discussion