亲爱的研友该休息了!由于当前在线用户较少,发布求助请尽量完整的填写文献信息,科研通机器人24小时在线,伴您度过漫漫科研夜!身体可是革命的本钱,早点休息,好梦!

Snippet Comment Generation Based on Code Context Expansion

代码段 计算机科学 程序理解 程序设计语言 背景(考古学) 源代码 编码(集合论) 页眉 抽象语法树 解析 情报检索 人工智能 软件 软件系统 古生物学 计算机网络 集合(抽象数据类型) 生物
作者
Hanyang Guo,Xiangping Chen,Yuan Huang,Yanlin Wang,Xi Ding,Zibin Zheng,Xiaocong Zhou,Hong‐Ning Dai
出处
期刊:ACM Transactions on Software Engineering and Methodology [Association for Computing Machinery]
卷期号:33 (1): 1-30
标识
DOI:10.1145/3611664
摘要

Code commenting plays an important role in program comprehension. Automatic comment generation helps improve software maintenance efficiency. The code comments to annotate a method mainly include header comments and snippet comments. The header comment aims to describe the functionality of the entire method, thereby providing a general comment at the beginning of the method. The snippet comment appears at multiple code segments in the body of a method, where a code segment is called a code snippet. Both of them help developers quickly understand code semantics, thereby improving code readability and code maintainability. However, existing automatic comment generation models mainly focus more on header comments, because there are public datasets to validate the performance. By contrast, it is challenging to collect datasets for snippet comments, because it is difficult to determine their scope. Even worse, code snippets are often too short to capture complete syntax and semantic information. To address this challenge, we propose a novel S nippet C omment Gen eration approach called SCGen . First, we utilize the context of the code snippet to expand the syntax and semantic information. Specifically, 600,243 snippet code-comment pairs are collected from 959 Java projects. Then, we capture variables from code snippets and extract variable-related statements from the context. After that, we devise an algorithm to parse and traverse abstract syntax tree (AST) information of code snippets and corresponding context. Finally, SCGen generates snippet comments after inputting the source code snippet and corresponding AST information into a sequence-to-sequence-based model. We conducted extensive experiments on the dataset we collected to evaluate our SCGen . Our approach obtains 18.23 in BLEU-4 metrics, 18.83 in METEOR, and 23.65 in ROUGE-L, which outperforms state-of-the-art comment generation models.
最长约 10秒,即可获得该文献文件

科研通智能强力驱动
Strongly Powered by AbleSci AI
更新
大幅提高文件上传限制,最高150M (2024-4-1)

科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
11秒前
YW发布了新的文献求助10
15秒前
英俊的铭应助YW采纳,获得10
25秒前
Jun完成签到,获得积分10
1分钟前
1分钟前
路漫漫发布了新的文献求助10
1分钟前
1分钟前
wwf发布了新的文献求助10
1分钟前
2分钟前
YW发布了新的文献求助10
2分钟前
YW完成签到,获得积分10
3分钟前
12138完成签到 ,获得积分10
3分钟前
CC完成签到,获得积分10
3分钟前
wxyinhefeng完成签到 ,获得积分10
4分钟前
4分钟前
iii完成签到 ,获得积分10
4分钟前
天天快乐应助科研通管家采纳,获得10
5分钟前
5分钟前
路漫漫完成签到,获得积分20
6分钟前
路漫漫发布了新的文献求助10
6分钟前
科研通AI2S应助路漫漫采纳,获得10
6分钟前
6分钟前
熊仔一百完成签到 ,获得积分10
6分钟前
HLT完成签到 ,获得积分10
7分钟前
zzuzll完成签到,获得积分10
7分钟前
DoggyBadiou发布了新的文献求助10
8分钟前
8分钟前
完美世界应助DoggyBadiou采纳,获得10
8分钟前
芊瑶发布了新的文献求助10
8分钟前
共享精神应助菩提本无树采纳,获得10
9分钟前
9分钟前
jyy发布了新的文献求助200
9分钟前
赘婿应助怕黑凝天采纳,获得30
9分钟前
NexusExplorer应助科研通管家采纳,获得10
9分钟前
9分钟前
9分钟前
9分钟前
9分钟前
9分钟前
9分钟前
高分求助中
Ore genesis in the Zambian Copperbelt with particular reference to the northern sector of the Chambishi basin 800
Becoming: An Introduction to Jung's Concept of Individuation 600
A new species of Coccus (Homoptera: Coccoidea) from Malawi 500
A new species of Velataspis (Hemiptera Coccoidea Diaspididae) from tea in Assam 500
Актуализированная стратиграфическая схема триасовых отложений Прикаспийского региона. Объяснительная записка 360
Project Studies: A Late Modern University Reform? 300
2024 Medicinal Chemistry Reviews 300
热门求助领域 (近24小时)
化学 医学 生物 材料科学 工程类 有机化学 生物化学 物理 内科学 纳米技术 计算机科学 化学工程 复合材料 基因 遗传学 催化作用 物理化学 免疫学 量子力学 细胞生物学
热门帖子
关注 科研通微信公众号,转发送积分 3167178
求助须知:如何正确求助?哪些是违规求助? 2818660
关于积分的说明 7921848
捐赠科研通 2478428
什么是DOI,文献DOI怎么找? 1320299
科研通“疑难数据库(出版商)”最低求助积分说明 632748
版权声明 602438