Work

Code2tree: A Method for Automatically Generating Code Comments

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.
Institution: Nantong University
Language: English
Open Access status: hybrid
Estimated APC paid: $2,000
OpenAlex ID: W4297962947
FWCI: 0.173
Cites: 21
Cited by: 2
Related to: 10