Learning a holistic and comprehensive code representation for code summarization

被引:1
|
作者
Yang, Kaiyuan [1 ]
Wang, Junfeng [1 ]
Song, Zihua [2 ]
机构
[1] Sichuan Univ, Coll Comp Sci, Chengdu 610065, Peoples R China
[2] Sichuan Univ, Sch Cyber Sci & Engn, Chengdu 610207, Peoples R China
基金
中国国家自然科学基金;
关键词
Code summarization; API; Deep learning; Program comprehension;
D O I
10.1016/j.jss.2023.111746
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Code summarization is the task of describing the function of code snippets in natural language, which benefits program comprehension and boosts software productivity. Despite lots of effort made by previous studies, existing models are not comprehensive enough to represent code, and yet the literature does not consider to model source code with API usage from a holistic perspective. To this end, this paper proposes a novel multi-modal code summarization approach called HCCS (Learning a Holistic and Comprehensive code representation for Code Summarization). We first design a neural network based on the graph attention mechanism to encode API Context Graph (ACG), which highlights holistic information of source code. Then, a multi-modal framework with a tree encoder for Abstract Syntax Tree (AST) and a code encoder for code tokens is incorporated to learn a more comprehensive code representation. Afterwards, we propose a fusing layer to integrate the encodings, which are then passed to a joint-decoder to generate summaries. The experimental results show that HCCS achieves better performance than the state of the arts (i.e., HCCS scores 9.5% higher in terms of BLEU metric and 11.46% in terms of BERTScore). As a result, HCCS is an effective approach to generate high-quality summaries.(c) 2023 Elsevier Inc. All rights reserved.
引用
收藏
页数:12
相关论文
共 50 条
  • [1] CogCol: Code Graph-Based Contrastive Learning Model for Code Summarization
    Shi, Yucen
    Yin, Ying
    Yu, Mingqian
    Chu, Liangyu
    [J]. ELECTRONICS, 2024, 13 (10)
  • [2] GypSum: Learning Hybrid Representations for Code Summarization
    Wang, Yu
    Dong, Yu
    Lu, Xuesong
    Zhou, Aoying
    [J]. 30TH IEEE/ACM INTERNATIONAL CONFERENCE ON PROGRAM COMPREHENSION (ICPC 2022), 2022, : 12 - 23
  • [3] Contrastive Code Representation Learning
    Jain, Paras
    Jain, Ajay
    Zhang, Tianjun
    Abbeel, Pieter
    Gonzalez, Joseph E.
    Stoica, Ion
    [J]. 2021 CONFERENCE ON EMPIRICAL METHODS IN NATURAL LANGUAGE PROCESSING (EMNLP 2021), 2021, : 5954 - 5971
  • [4] Combining Holistic Source Code Representation with Siamese Neural Networks for Detecting Code Clones
    Patel, Smit
    Sinha, Roopak
    [J]. TESTING SOFTWARE AND SYSTEMS, ICTSS 2021, 2022, 13045 : 148 - 159
  • [5] Contextuality of Code Representation Learning
    Li, Yi
    Wang, Shaohua
    Nguyen, Tien N.
    [J]. 2023 38TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING, ASE, 2023, : 548 - 559
  • [6] Esale: Enhancing Code-Summary Alignment Learning for Source Code Summarization
    Fang, Chunrong
    Sun, Weisong
    Chen, Yuchen
    Chen, Xiao
    Wei, Zhao
    Zhang, Quanjun
    You, Yudu
    Luo, Bin
    Liu, Yang
    Chen, Zhenyu
    [J]. IEEE Transactions on Software Engineering, 2024, 50 (08) : 2077 - 2095
  • [7] Leveraging Code Generation to Improve Code Retrieval and Summarization via Dual Learning
    Ye, Wei
    Xie, Rui
    Zhang, Jinglei
    Hu, Tianxiang
    Wang, Xiaoyin
    Zhang, Shikun
    [J]. WEB CONFERENCE 2020: PROCEEDINGS OF THE WORLD WIDE WEB CONFERENCE (WWW 2020), 2020, : 2309 - 2319
  • [8] Code Generation as a Dual Task of Code Summarization
    Wei, Bolin
    Li, Ge
    Xia, Xin
    Fu, Zhiyi
    Jin, Zhi
    [J]. ADVANCES IN NEURAL INFORMATION PROCESSING SYSTEMS 32 (NIPS 2019), 2019, 32
  • [9] Advances in Code Summarization
    Desai, Utkarsh
    Sridhara, Giriprasad
    Tamilselvam, Srikanth
    [J]. 2021 IEEE/ACM 43RD INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING: COMPANION PROCEEDINGS (ICSE-COMPANION 2021), 2021, : 330 - 331
  • [10] Interpretable Code Summarization
    Kamal, Md Sarwar
    Nimmy, Sonia Farhana
    Dey, Nilanjan
    [J]. IEEE TRANSACTIONS ON RELIABILITY, 2024,