Year: 2022
Type: article
Abstract: Source code comments can improve the efficiency of software development and maintenance. However, due to the heterogeneity of natural language and program language, the quality of code comments is not so high. So, this paper proposes a novel method Code2tree, which is based on the encoder-decoder model to automatically generate Java code comments. Code2tree firstly converts Java source code into abstract syntax tree (AST) sequences, and then the AST sequences are encoded by GRU encoder to solve the long sequence learning dependency problem. Finally, the attention mechanism is introduced in the decoding stage, and the quality of the code comment is improved by increasing the weight of the key information. We use the open dataset java-small to train the model and verify the effectiveness of Code2tree based on common-used indicators BLEU and F1-Score.
Source: Scientific Programming
DOI: 10.1155/2022/6350686
Authors: Wanzhi Wen, Jiawei Chu, Tian Zhao, Ruinian Zhang, Bao Zhi, Chenqiang Shen
Institution: Nantong University
Language: English
Subfield: Information Systems
Field: Computer Science
Domain: Physical Sciences
Open Access status: hybrid
Estimated APC paid: $2,000
Awards: G1628594459, G5891416167
OpenAlex ID: W4297962947
