paperbot · PL 论文追踪

全部论文 待读 收藏

P2 DeepCommenter: a deep code comment generation tool with hybrid lexical and syntactical information

DeepCommenter:一种融合词法与语法信息的深度代码注释生成工具
FSE Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering2020匹配度 2/10 · 论文属于机器学习与程序语言的交叉,但聚焦代码注释生成这一程序理解任务,并非用户核心关注的静态分析/形式化验证、浮点程序分析或贝叶斯程序分析;也未涉及 LLM/Agent 在静态分析中的应用,因此匹配度低。引用 36 inbox
Boao Li, Meng Yan, Xin Xia, Xing Hu, Ge Li, David Lo
crossref: 2026-09-12

AI 速览

一句话:提出融合源码 token 与 AST 信息的深度神经网络代码注释生成工具 DeepCommenter,并实现为 IntelliJ IDEA 插件。

随着软件项目规模扩大,代码注释对程序理解愈发重要,但许多注释缺失、不匹配或过时。本文提出注释生成工具 DeepCommenter,为 Java 方法生成描述性注释:将注释生成建模为机器翻译问题,用深度神经网络分别从源码 token 与抽象语法树中学习词法与语法信息并加以融合。工具实现为 IntelliJ IDEA 插件,采用客户端/服务器架构,客户端发送用户选中的代码,服务器用预训练模型生成注释并插入代码上方。在 GitHub 开源 Java 项目构建的大型语料上评估,多指标显示其显著优于现有方法。

问题
软件开发中大量代码注释缺失、与代码不匹配或已过时,影响程序理解并加重开发者负担,因此需要自动为源代码生成描述性注释。
方法
将 Java 方法的注释生成形式化为机器翻译任务,使用深度神经网络分别从源码 token 和抽象语法树(AST)中抽取词法与语法信息并加以融合,并封装为基于客户端/服务器架构的 IntelliJ IDEA 插件。
评估
在由 GitHub 上大量开源 Java 项目构建的大型语料上进行实验,多种评价指标下均显著优于当时的最先进方法。
原文摘要(Abstract)

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 原文 ·

BibTeX
@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}
}