一句话:提出融合源码 token 与 AST 信息的深度神经网络代码注释生成工具 DeepCommenter,并实现为 IntelliJ IDEA 插件。
随着软件项目规模扩大,代码注释对程序理解愈发重要,但许多注释缺失、不匹配或过时。本文提出注释生成工具 DeepCommenter,为 Java 方法生成描述性注释:将注释生成建模为机器翻译问题,用深度神经网络分别从源码 token 与抽象语法树中学习词法与语法信息并加以融合。工具实现为 IntelliJ IDEA 插件,采用客户端/服务器架构,客户端发送用户选中的代码,服务器用预训练模型生成注释并插入代码上方。在 GitHub 开源 Java 项目构建的大型语料上评估,多指标显示其显著优于现有方法。
As the scale of software projects increases, the code comments are more and more important for program comprehension. Unfortunately, many code comments are missing, mismatched or outdated due to tight development schedule or other reasons. Automatic code comment generation is of great help for developers to comprehend source code and reduce their workload. Thus, we propose a code comment generation tool (DeepCommenter) to generate descriptive comments for Java methods. DeepCommenter formulates the comment generation task as a machine translation problem and exploits a deep neural network that combines the lexical and structural information of Java methods. We implement DeepCommenter in the form of an Integrated Development Environment (i.e., Intellij IDEA) plug-in. Such plug-in is built upon a Client/Server architecture. The client formats the code selected by the user, sends request to the server and inserts the comment generated by the server above the selected code. The server listens for client’s request, analyzes the requested code using the pre-trained model and sends back the generated comment to the client. The pre-trained model learns both the lexical and syntactical information from source code tokens and Abstract Syntax Trees (AST) respectively and combines these two types of information together to generate comments. To evaluate DeepCommenter, we conduct experiments on a large corpus built from a large number of open source Java projects on GitHub. The experimental results on different metrics show that DeepCommenter outperforms the state-of-the-art approaches by a substantial margin.
DOI 原文 ·
@inproceedings{paperbot5708,
title = {DeepCommenter: a deep code comment generation tool with hybrid lexical and syntactical information},
author = {Boao Li and Meng Yan and Xin Xia and Xing Hu and Ge Li and David Lo},
booktitle = {FSE},
year = {2020},
doi = {10.1145/3368089.3417926}
}