• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

Computer Engineering & Science ›› 2024, Vol. 46 ›› Issue (04): 667-675.

• Software Engineering • Previous Articles     Next Articles

A code summarization generation model fusing multi-structure data

YU Tian-ci,GAO Shang   

  1. (School of Computer Science,Jiangsu University of Science and Technology,Zhenjiang 212100,China)
  • Received:2023-04-03 Revised:2023-10-13 Accepted:2024-04-25 Online:2024-04-25 Published:2024-04-18

Abstract: Code summarization can help developers understand the function and implementation of the code. The code summarization generation model can automatically identify the key information in the code and generate relevant summarization to improve the readability and maintainability of the code. Existing code summarization generation models usually only use abstract syntax tree structure information to represent code, resulting in low-quality model-generated summarization. Aiming at this problem, this paper proposes a code summarization generation model that integrates multi-structure data. Firstly, the model adds data flow graph structure information to represent code on the basis of abstract syntax tree. Secondly, in order to capture the global information of the code, the model uses Transformer's encoder to encode the abstract syntax tree sequence. In addition, the model uses the graph neural network to extract features from the data flow graph and provide information such as the computational depen- dencies between variables. Finally, the model uses the cross-modal attention mechanism to fuse the two features of the abstract syntax tree and the data flow and generate corresponding summarization through the Transformer decoder. The experimental results show that, compared with the six mainstream models, the model improves the scores of BLEU,METEOR and ROUGE-L on the Java and Python datasets, and the generated summarization is also very readable.

Key words: code understanding, code summarization generation, graph neural network, multi-feature fusion, natural language processing