arrow
Return

Summarizing source code through heterogeneous feature fusion and extraction

delete2024-03-01
delete0
PRE
AI
J
Juncai Guo
J
Jin Liu *
刘笑 cover
刘笑 (Xiao Liu) *
L
Li Li
DOI:10.1016/j.inffus.2023.102058delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Code summarization, which seeks to automatically produce a succinct natural-language description to summarize the functionality of source code, plays an essential role in maintaining the software. Currently, plentiful approaches have been proposed to first encode the source code based on its Abstract Syntax Tree (AST), and then decode it into a textual summary. However, most existing works interpret the AST-based syntax structure as a homogeneous graph, without discriminating the different relations between graph nodes (e.g., the parent-child and sibling relations) in a heterogeneous way. To mitigate this issue, this paper proposes HetCoS to extract the syntactic and sequential features of source code by exploring its inherent heterogeneity for code summarization. Specifically, we first build a Heterogeneous Code Graph (HCG) that fuses the syntax structure and code sequence with eight types of edges/relations designed between graph nodes. Moreover, we present a heterogeneous graph neural network for capturing the diverse relations in HCG. The represented HCG is then fed into a Transformer decoder, followed by a multi-head attention-based copying mechanism to support high-quality summary generation. Extensive experiments on the major Java and Python datasets illustrate the superiority of our approach over sixteen state-of-the-art baselines. To promote reproducibility studies, we make the implementation of HetCoS publicly accessible at https://github.com/GJCEXP/HETCOS.
Keywords:
Code summarization
Feature fusion
Heterogeneous graph
Graph neural network
Transformer

Journal

Information Fusion cover
Information Fusion
IF:
15.5
Papers:
4.1K
Citations:
2.7W

Organization

B
Beihang University
Scholars:
5.2W
Papers: 4.1W
Citations: 37
W
wuhan university
Scholars:
8.1W
Papers: 5.8W
Citations: 70
D
Deakin University
Scholars:
2.0W
Papers: 2.1W
Citations: 2.8W
researcher View more organizations