Code comments can help in program comprehension and are considered as important artifacts to help developers in software maintenance. However, the comments are mostly missing or are outdated, specially in complex software projects. As a result, several automatic comment generation models are developed as a solution. The recent models explore the integration of external knowledge resources such as Unified Modeling Language class diagrams to improve the generated comments. In this paper, we propose API2Com, a model that leverages the Application Programming Interface Documentations (API Docs) as a knowledge resource for comment generation. The API Docs include the description of the methods in more details and therefore, can provide better context in the generated comments. The API Docs are used along with the code snippets and Abstract Syntax Trees in our model. We apply the model on a large Java dataset of over 130,000 methods and evaluate it using both Transformer and RNN-base architectures. Interestingly, when API Docs are used, the performance increase is negligible. We therefore run different experiments to reason about the results. For methods that only contain one API, adding API Docs improves the results by 4% BLEU score on average (BLEU score is an automatic evaluation metric used in machine translation). However, as the number of APIs that are used in a method increases, the performance of the model in generating comments decreases due to long documentations used in the input. Our results confirm that the API Docs can be useful in generating better comments, but, new techniques are required to identify the most informative ones in a method rather than using all documentations simultaneously.


翻译:代码可以帮助程序理解, 并被视为帮助软件维护开发者的重要文物。 但是, 评论大多缺失或过时, 特别是在复杂的软件项目中。 因此, 开发了几个自动评论生成模型作为解决方案。 最近的一些模型探索外部知识资源的整合, 如统一模拟语言类图表, 以改进生成的注释。 在本文件中, 我们提议 API2Com 模式, 将应用应用程序设计接口文档( API 文档) 作为生成注释的知识资源。 因此, API Documents 包含对方法的详细描述, 因此, 可以在生成的注释中提供更好的背景。 API Docs 与我们模型中的代码片断和摘要图表树一起使用。 我们将模型应用于大型 Java 数据集中, 包括130,000多种方法, 并使用变换器和 RNNN- 基架构来评估它。 有趣的是, 使用API Document Documents, 我们对所有结果进行了不同的实验, 但是, 仅包含一个 API 注释的方法, 添加 API Documents 提供更好的注释, 在生成的文档中, 4 % BLEU 平均评分, 。

0
下载
关闭预览

相关内容

应用程序接口(简称 API),又称为应用编程接口,就是软件系统不同组成部分衔接的约定。
Google-EfficientNet v2来了!更快,更小,更强!
专知会员服务
18+阅读 · 2021年4月4日
【EMNLP2020】自然语言生成,Neural Language Generation
专知会员服务
38+阅读 · 2020年11月20日
一份简单《图神经网络》教程,28页ppt
专知会员服务
120+阅读 · 2020年8月2日
Linux导论,Introduction to Linux,96页ppt
专知会员服务
75+阅读 · 2020年7月26日
Transformer文本分类代码
专知会员服务
116+阅读 · 2020年2月3日
【阿里巴巴】 AI编译器,AI Compiler @ Alibaba,21页ppt
专知会员服务
43+阅读 · 2019年12月22日
强化学习最新教程,17页pdf
专知会员服务
167+阅读 · 2019年10月11日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
39+阅读 · 2019年10月9日
已删除
将门创投
4+阅读 · 2020年1月6日
Arxiv
0+阅读 · 2021年5月11日
FIGR: Few-shot Image Generation with Reptile
Arxiv
5+阅读 · 2019年1月8日
VIP会员
相关VIP内容
Google-EfficientNet v2来了!更快,更小,更强!
专知会员服务
18+阅读 · 2021年4月4日
【EMNLP2020】自然语言生成,Neural Language Generation
专知会员服务
38+阅读 · 2020年11月20日
一份简单《图神经网络》教程,28页ppt
专知会员服务
120+阅读 · 2020年8月2日
Linux导论,Introduction to Linux,96页ppt
专知会员服务
75+阅读 · 2020年7月26日
Transformer文本分类代码
专知会员服务
116+阅读 · 2020年2月3日
【阿里巴巴】 AI编译器,AI Compiler @ Alibaba,21页ppt
专知会员服务
43+阅读 · 2019年12月22日
强化学习最新教程,17页pdf
专知会员服务
167+阅读 · 2019年10月11日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
39+阅读 · 2019年10月9日
相关资讯
已删除
将门创投
4+阅读 · 2020年1月6日
Top
微信扫码咨询专知VIP会员