论文地址:Improving Code Summarization with Block-wise Abstract Syntax Tree Splitting
BASTS:CFG用tree-LSTM做embedding给transformer
Abstract
本文展现了一种块级别的AST分割方法,将代码拆分为CFG的树状代码块,每个分割出的树用Tree-LSTM预训练获取局部非线性语法编码,再丢到transformer里面生成高质量代码摘要
Introduction
AST的深度一般非常大,导致一个heavy encoder的情况,并且训练困难,难以捕捉复杂的语义。此外基于GNN的方法也面临heavy encoder而且结果也没有很大的提升的问题
把代码根据CFG的块拆分,生成一个用Tree-LSTM建模的split AST,然后预训练任务是预测控制树中的下一个分割AST,最后结合分割AST的表征和token表征丢入transformer的
Overview

Code Splitting

根据method的CFG的dominator tree树中的block来分割一个method
Tree Encoding

Summarizing Code with Transformer

Experiment

