Automatic source code summarization with graph attention networks

被引:17
|
作者
Zhou, Yu [1 ,3 ]
Shen, Juanjuan [1 ]
Zhang, Xiaoqing [1 ]
Yang, Wenhua [1 ,3 ]
Han, Tingting [2 ]
Chen, Taolue [2 ,3 ]
机构
[1] Nanjing Univ Aeronaut & Astronaut, Coll Comp Sci & Technol, Nanjing, Peoples R China
[2] Birkbeck Univ London, Dept Comp Sci, London, England
[3] Nanjing Univ, State Key Lab Novel Software Technol, Nanjing, Peoples R China
基金
中国国家自然科学基金; 英国工程与自然科学研究理事会;
关键词
Source code summarization; Recurrent neural network; Graph neural network; PROGRAM; COMPREHENSION; CONTEXT;
D O I
10.1016/j.jss.2022.111257
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Source code summarization aims to generate concise descriptions for code snippets in a natural language, thereby facilitates program comprehension and software maintenance. In this paper, we propose a novel approach-GSCS-to automatically generate summaries for Java methods, which leverages both semantic and structural information of the code snippets. To this end, GSCS utilizes Graph Attention Networks to process the tokenized abstract syntax tree of the program, which employ a multi-head attention mechanism to learn node features in diverse representation sub-spaces, and aggregate features by assigning different weights to its neighbor nodes. GSCS further harnesses an additional RNN-based sequence model to obtain the semantic features and optimizes the structure by combining its output with a transformed embedding layer. We evaluate our approach on two widely adopted Java datasets; the experiment results confirm that GSCS outperforms the state-of-the-art baselines. (c) 2022 Elsevier Inc. All rights reserved.
引用
收藏
页数:12
相关论文
共 50 条
  • [1] Pyramid Attention For Source Code Summarization
    Chai, Lei
    Li, Ming
    [J]. ADVANCES IN NEURAL INFORMATION PROCESSING SYSTEMS 35 (NEURIPS 2022), 2022,
  • [2] A Survey of Automatic Source Code Summarization
    Zhang, Chunyan
    Wang, Junchao
    Zhou, Qinglei
    Xu, Ting
    Tang, Ke
    Gui, Hairen
    Liu, Fudong
    [J]. SYMMETRY-BASEL, 2022, 14 (03):
  • [3] Source Code Summarization Using Attention-based Keyword Memory Networks
    Choi, YunSeok
    Kim, Suah
    Lee, Jee-Hyong
    [J]. 2020 IEEE INTERNATIONAL CONFERENCE ON BIG DATA AND SMART COMPUTING (BIGCOMP 2020), 2020, : 564 - 570
  • [4] A Convolutional Attention Network for Extreme Summarization of Source Code
    Allamanis, Miltiadis
    Peng, Hao
    Sutton, Charles
    [J]. INTERNATIONAL CONFERENCE ON MACHINE LEARNING, VOL 48, 2016, 48
  • [5] DG-Trans: Automatic Code Summarization via Dynamic Graph Attention-based Transformer
    Zeng, Jianwei
    Zhang, Tao
    Xu, Zhou
    [J]. 2021 IEEE 21ST INTERNATIONAL CONFERENCE ON SOFTWARE QUALITY, RELIABILITY AND SECURITY (QRS 2021), 2021, : 786 - 795
  • [6] Automatic Documentation Generation via Source Code Summarization
    McBurney, Paul W.
    [J]. 2015 IEEE/ACM 37TH IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING, VOL 2, 2015, : 903 - 906
  • [7] GATES: Using Graph Attention Networks for Entity Summarization
    Firmansyah, Asep Fajar
    Moussallem, Diego
    Ngomo, Axel-Cyrille Ngonga
    [J]. PROCEEDINGS OF THE 11TH KNOWLEDGE CAPTURE CONFERENCE (K-CAP '21), 2021, : 73 - 80
  • [8] Gated Graph Neural Attention Networks for abstractive summarization
    Liang, Zeyu
    Du, Junping
    Shao, Yingxia
    Ji, Houye
    [J]. NEUROCOMPUTING, 2021, 431 : 128 - 136
  • [9] Automatic Source Code Summarization with Extended Tree-LSTM
    Shido, Yusuke
    Kobayashi, Yasuaki
    Yamamoto, Akihiro
    Miyamoto, Atsushi
    Matsumura, Tadayuki
    [J]. 2019 INTERNATIONAL JOINT CONFERENCE ON NEURAL NETWORKS (IJCNN), 2019,
  • [10] Automatic Source Code Summarization of Context for Java']Java Methods
    McBurney, Paul W.
    McMillan, Collin
    [J]. IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2016, 42 (02) : 103 - 119