Code summarization aims to generate concise natural language descriptions of source code, which can help improve program comprehension and maintenance. Recent studies show that syntactic and structural information extracted from abstract syntax trees (ASTs) is conducive to summary generation. However, existing approaches fail to fully capture the rich information in ASTs because of the large size/depth of ASTs. In this paper, we propose a novel model CAST that hierarchically splits and reconstructs ASTs. First, we hierarchically split a large AST into a set of subtrees and utilize a recursive neural network to encode the subtrees. Then, we aggregate the embeddings of subtrees by reconstructing the split ASTs to get the representation of the complete AST. Finally, AST representation, together with source code embedding obtained by a vanilla code token encoder, is used for code summarization. Extensive experiments, including the ablation study and the human evaluation, on benchmarks have demonstrated the power of CAST. To facilitate reproducibility, our code and data are available at https://anonymous.4open.science/r/CAST/.
Source Code Summarization with Structural Relative Position Guided Transformer
Harbin Institute of Technology (Shenzhen)(哈尔滨工业大学(深圳));Noah’s Ark Lab, Huawei Technologies(华为技术有限公司诺亚方舟实验室);The Chinese University of Hong Kong(香港中文大学)
What Do They Capture? -- A Structural Analysis of Pre-Trained Language Models for Source Code
National Engineering Research Center for Big Data Technology and System, Services Computing Technology and System Lab, Cluster and Grid Computing Lab, HUST(华中科技大学(HUST)大数据技术与系统国家工程研究中心、服务计算技术与系统实验室、集群与网格计算实验室);School of Computer Science and Technology, Huazhong University of Science and Technology(华中科技大学计算机科学与技术学院);University of Newcastle(纽卡斯尔大学);School of Computer Science, University of Technology Sydney(悉尼科技大学计算机学院)
HGAdapter: Hypergraph-based Adapters in Language Models for Code Summarization and Clone Detection
Data Technology Group, Technology Research and Development Department, Guotai Haitong Securities, China(国泰君安证券数据技术部、技术研发部);School of Computer Science and Technology, East China Normal University, China(华东师范大学计算机科学与技术学院)
Improving Automatic Source Code Summarization via Deep Reinforcement Learning
Zhejiang University(浙江大学);Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences(中国科学院深圳先进技术研究院);University of Technology Sydney(悉尼科技大学);University of Illinois at Chicago(伊利诺伊大学芝加哥分校);Tsinghua University(清华大学)
HierarchyNet: Learning to Summarize Source Code with Heterogeneous Representations
FPT Software AI Center(FPT软件人工智能中心);Fulbright University, Viet Nam(越南富布赖特大学);University of Chicago(芝加哥大学);University of Warwick(华威大学);The University of Texas at Dallas(德克萨斯大学达拉斯分校)