详细信息

Summarizing source code with hierarchical code representation  ( SCI-EXPANDED收录 EI收录)  

文献类型:期刊文献

英文题名:Summarizing source code with hierarchical code representation

作者:Zhou, Ziyi[1];Yu, Huiqun[1];Fan, Guisheng[1];Huang, Zijie[1];Yang, Xingguang[1]

机构:[1]East China Univ Sci & Technol, Dept Comp Sci & Engn, Shanghai, Peoples R China

年份:2022

卷号:143

外文期刊名:INFORMATION AND SOFTWARE TECHNOLOGY

收录:;EI(收录号:20214911259046);WOS:【SCI-EXPANDED(收录号:WOS:000727767300009)】;

基金:This work was supported by the National Natural Science Foundation of China (No. 61772200), Shanghai Natural Science Foundation (No. 21ZR1416300).

语种:英文

外文关键词:Code summarization; Program comprehension; Deep learning; Hierarchical attention

摘要:Context: Code summarization aims to automatically generate natural language descriptions for code, and has become a rapidly expanding research area. Data-driven code summarization models based on neural networks have proliferated in recent few years. Objective: Almost all of existing neural models are built upon the granularity of token or AST node. This has several drawbacks: a) Code summarization requires high-level knowledge of code while token representations are limited to provide a global view; b) Such approaches can hardly model the hierarchy of code; c) Long input codes challenge such models to handle long-range dependencies due to the large number of tokens and AST nodes. Method: To address these issues, we propose a novel framework to utilize hierarchical representation of code to generate better summaries. We consider two levels of code hierarchy: token-level and statement-level. Our framework contains a pair of customized encoder-decoder models for tokens and AST of code respectively. Each of them has a hierarchical encoder that aims to extract both token and statement-level code features, and an attentional decoder with the ability to attend to those different levels of representation during decoding. They are then combined to predict summaries via ensemble learning. Results: We conduct extensive experiments to evaluate our models on a large Java corpus. The experimental results show that our approach outperforms several state-of-the-art baselines by a substantial margin. Conclusion: In conclusion, our approach could better learn global information of code and shift attention between important statements during summary generation. With the help of hierarchical attention, the models are able to locate keywords more accurately in a top-down way. Ensemble learning is also proved to be an effective way to benefit from multiple input sources.

参考文献:

正在载入数据...

版权所有©华东理工大学 重庆维普资讯有限公司 渝B2-20050021-7 
渝公网安备 50019002500408号 违法和不良信息举报中心