Code Summarization Enhancing Method with Dependency-aware Hierarchical Neural Network
Author:
Affiliation:

Clc Number:

TP311

Fund Project:

  • Article
  • |
  • Figures
  • |
  • Metrics
  • |
  • Reference
  • |
  • Related
  • |
  • Cited by
  • |
  • Materials
  • |
  • Comments
    Abstract:

    As an emerging technique in software engineering, automatic source code summarization aims to generate natural language descriptions for given code snippets. State-of-the-art code summarization techniques utilize encoder-decoder neural models. The encoder extracts the semantic representations of the source code, while the decoder translates them into human-readable code summaries. However, many existing approaches treat input code snippets as standalone functions, often overlooking the context dependencies between the target function and its invoked subfunctions. Ignoring these dependencies can result in the omission of crucial semantic information, potentially reducing the quality of the generated summaries. To this end, this study proposes a dependency-aware hierarchical code summarization neural model, DHCS. DHCS is designed to improve code summarization by explicitly modeling the hierarchical dependencies between the target function and its subfunctions. The proposed approach employs a hierarchical encoder consisting of both a subfunction encoder and a target function encoder, allowing the model to capture both local and contextual semantic representations effectively. Meanwhile, a self-supervised task, namely the masked subfunction prediction, is introduced to enhance the representation learning of subfunctions. Furthermore, the topic distribution of subfunctions is mined and incorporated into a summary decoder with a topic-aware copy mechanism. Therefore, it enables the direct extraction of key information from subfunctions, facilitating more effective summary generation for the target function. Finally, extensive experiments are conducted on three real-world datasets constructed for Python, Java, and Go languages, which clearly validate the effectiveness of the proposed approach.

    Reference
    Related
    Cited by
Get Citation

张育博,姚开春,张立波,武延军,赵琛.基于依赖感知分层神经网络的代码注释增强方法.软件学报,2026,37(2):662-683

Copy
Share
Article Metrics
  • Abstract:
  • PDF:
  • HTML:
  • Cited by:
History
  • Received:March 21,2025
  • Revised:June 26,2025
  • Adopted:
  • Online: September 02,2025
  • Published: February 06,2026
You are the firstVisitors
Copyright: Institute of Software, Chinese Academy of Sciences Beijing ICP No. 05046678-4
Address:4# South Fourth Street, Zhong Guan Cun, Beijing 100190,Postal Code:100190
Phone:010-62562563 Fax:010-62562533 Email:jos@iscas.ac.cn
Technical Support:Beijing Qinyun Technology Development Co., Ltd.

Beijing Public Network Security No. 11040202500063