Article(id=1329455842283335722, tenantId=1146029695717560320, journalId=1324759914146529478, issueId=1329455653363495339, articleNumber=null, orderNo=null, doi=10.7544/issn1000-1239.202330730, pmid=null, cstr=null, oa=null, hot=null, price=null, onlineType=0, articleFormat=0, articleType=null, articleTypeStr=null, receivedDate=1694361600000, receivedDateStr=2023-09-11, revisedDate=1701705600000, revisedDateStr=2023-12-05, acceptedDate=null, acceptedDateStr=null, onlineDate=1794896572895, onlineDateStr=2026-11-17, pubDate=1706803200000, pubDateStr=2024-02-02, doiRegisterDate=null, doiRegisterDateStr=null, onlineIssueDate=1794896572895, onlineIssueDateStr=2026-11-17, onlineJustAcceptDate=null, onlineJustAcceptDateStr=null, onlineFirstDate=null, onlineFirstDateStr=null, sourceXml=null, magXml=null, createTime=1794896572895, creator=13701087609, updateTime=1794896572895, updator=13701087609, issue=Issue{id=1329455653363495339, tenantId=1146029695717560320, journalId=1324759914146529478, year='2024', volume='61', issue='2', pageStart='273', pageEnd='538', issueExtLink='null', onlineDate='null', pubDate='1706803200000', pubDateStr='2024-02-02', beforeIssueId=null, nextIssueId=null, price=null, status=1, issueComplete=1, articleOrder=1, issueType=-1, specialIssue=null, createTime=1794896527853, creator='13701087609', updateTime=1794896527853, updator='13701087609', preIssue=null, nextIssue=null, articleTotal=null, ext=null, issueFiles=null, downloadFileDto=null}, startPage=307, endPage=323, ext={EN=ArticleExt(id=1329455842480468011, articleId=1329455842283335722, tenantId=1146029695717560320, journalId=1324759914146529478, language=EN, title=Class Summarization Generation Technology Based on Hierarchical Representation and Context Enhancement, columnId=1329455654147830188, journalTitle=Journal of Computer Research and Development, columnName=Special Issue on Generative AI and Software Automation, runingTitle=null, highlight=null, articleAbstract=

Code summarization is a natural language description of source code, and high-quality code summaries help to improve developers’ program understanding efficiency. In recent years, research on code summarization has focused on generating summaries for method-grained code snippet. However, in an object-oriented language such as Java, class is the basic programming unit. Due to the above problems, we propose a class summarization generation method based on hierarchical representation and context enhancement, called HRCE, as well as constructs a class summarization dataset containing 358992 pairs of <Java class, content, summary>. HRCE uses code simplification strategy to remove non-critical code of class to shorten the code length. Then, HRCE models the class hierarchy, including class signature, attribute and method respectively, to obtain the semantic information and hierarchical structure information of the class. In addition, HRCE selects parent’s class signature and class summary to describe the context that the class depends on in the project. Experiments show that a generative model for class summarization based on hierarchical representation and context enhancement is able to characterize the semantics and hierarchical structure of the code, and obtain information from both inside and outside of the target class. As a result, HRCE outperforms all baseline models on evaluation metrics such as BLEU, METEOR, ROUGE-L, etc.

, authors=Haoling Chen, Huiqun Yu*, Guisheng Fan, Mingchen Li, Zijie Huang, authorsList=Haoling Chen, Huiqun Yu, Guisheng Fan, Mingchen Li, Zijie Huang, authorCompany=null, correspAuthors=Huiqun Yu, authorNote=

born in 1999. Master candidate. Student member of CCF. Her main research interests include automatic code summarization and program comprehension

born in 1967. PhD, professor, PhD supervisor. Senior member of CCF. His main research interests include software engineering, trusted computing, cloud computing, and formal methods

born in 1980. PhD, associate research fellow, PhD supervisor. Member of CCF. His main research interests include software engineering, service computing, and software architecture analysis techniques

born in 1998. PhD candidate. His main research interests include automatic code summarization and program comprehension

born in 1994. PhD candidate. Student member of CCF. His main research interests include code smell, software quality assurance, program comprehension, and empirical software engineering

, correspAuthorsNote=null, copyrightStatement=Copyright © 2024 Journal of Computer Research and Development. All rights reserved., copyrightOwner=null, extLink=null, articleAbsUrl=null, sourceXml=null, magXml=null, pdfUrl=null, pdf=null, pdfFileSize=null, pdfExtLink=null, richHtmlUrl=null, mobilePdfUrl=null, reviewReport=null, pdfFirstPage=null, abstractGraph=null, abstractGraphContent=null, abstractVideo=null, citation=null, cebUrl=null, magXmlContent=null, mapNumber=null, fund=null), CN=ArticleExt(id=1329455846234370118, articleId=1329455842283335722, tenantId=1146029695717560320, journalId=1324759914146529478, language=CN, title=基于分层表示和上下文增强的类摘要生成技术, columnId=1329455654328185262, journalTitle=计算机研究与发展, columnName=生成式AI与软件自动化专题, runingTitle=null, highlight=null, articleAbstract=

代码摘要是源代码的自然语言解释,高质量的代码摘要有助于提高开发人员程序理解效率. 近年来,代码自动摘要的研究集中在为方法粒度的代码片段生成摘要. 然而,对于面向对象的语言,例如Java,类才是项目的基本组成单元. 基于上述问题,提出一种基于分层表示和上下文增强的类摘要生成方法HRCE(hierarchical representation and context enhancement),并构建了一个包含358992个$\langle $Java类,上下文,摘要$\rangle $数据对的类摘要数据集. HRCE使用代码精简策略去除类的非关键代码,从而缩短代码长度. 然后,对类的层次结构,包括类签名、属性和方法分别进行建模,获得类的语义信息和层次结构信息. 此外,从项目中抽取父类的签名及摘要来刻画类在项目中依赖的上下文. 实验表明,基于分层表示和上下文增强的类摘要生成模型能够表征代码的语义和层次结构,并可以从目标类的内部和外部获取信息. HRCE在BLEU,METEOR,ROUGE-L等评估指标上超过了所有基准模型.

, authors=陈豪伶, 虞慧群*, 范贵生, 李明辰, 黄子杰, authorsList=陈豪伶, 虞慧群, 范贵生, 李明辰, 黄子杰, authorCompany=null, correspAuthors=虞慧群, authorNote=

1999年生. 硕士研究生. CCF学生会员. 主要研究方向为代码自动摘要、程序理解

1967年生. 博士,教授,博士生导师. CCF高级会员. 主要研究方向为软件工程、可信计算、云计算、形式化方法

1980年生. 博士,副研究员,博士生导师. CCF会员. 主要研究方向为软件工程、服务计算、软件架构分析技术

1998年生. 博士研究生. 主要研究方向为代码自动摘要、程序理解

1994年生. 博士研究生. CCF学生会员. 主要研究方向为代码异味、软件质量保障、程序理解、实证软件工程

, correspAuthorsNote=
虞慧群()
, copyrightStatement=版权所有 © 2024 计算机研究与发展编辑部, copyrightOwner=null, extLink=null, articleAbsUrl=null, sourceXml=HnSB5O+3VEnIj+vLHIHq3A==, magXml=E93hKfZeInp0pXJmwVmg1g==, pdfUrl=null, pdf=NLqKaJpDNI9+NVoQdJXc2A==, pdfFileSize=1583775, pdfExtLink=null, richHtmlUrl=null, mobilePdfUrl=null, reviewReport=null, pdfFirstPage=null, abstractGraph=K/IjJVULYnVSaOA9IlY6GQ==, abstractGraphContent=null, abstractVideo=null, citation=null, cebUrl=null, magXmlContent=0jVZulremkeRb5lqkcNgww==, mapNumber=null, fund=null)}, authors=[Author(id=1329455846540554316, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, orderNo=0, firstName=null, middleName=null, lastName=null, nameCn=null, orcid=null, stid=null, country=null, authorPic=null, dead=0, email=hlchen@mail.ecust.edu.cn, emailSecond=null, emailThird=null, correspondingAuthor=0, authorType=1, ext={EN=AuthorExt(id=1329455846624440398, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846540554316, language=EN, stringName=Haoling Chen, firstName=Haoling, middleName=null, lastName=Chen, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237, bio={"content":"

born in 1999. Master candidate. Student member of CCF. Her main research interests include automatic code summarization and program comprehension

"}, bioImg=null, bioContent=

born in 1999. Master candidate. Student member of CCF. Her main research interests include automatic code summarization and program comprehension

, aboutCorrespAuthor=null), CN=AuthorExt(id=1329455846683160655, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846540554316, language=CN, stringName=陈豪伶, firstName=null, middleName=null, lastName=null, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1华东理工大学计算机科学与工程系 上海 200237, bio={"img":"Vym2dwtjYq+CUEaNu9HoGA==","content":"

1999年生. 硕士研究生. CCF学生会员. 主要研究方向为代码自动摘要、程序理解

"}, bioImg=Vym2dwtjYq+CUEaNu9HoGA==, bioContent=

1999年生. 硕士研究生. CCF学生会员. 主要研究方向为代码自动摘要、程序理解

, aboutCorrespAuthor=null)}, companyList=[AuthorCompany(id=1329455846444085320, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, xref=1, ext=[AuthorCompanyExt(id=1329455846456668233, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=EN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237), AuthorCompanyExt(id=1329455846465056842, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=CN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1华东理工大学计算机科学与工程系 上海 200237)])]), Author(id=1329455846767046737, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, orderNo=1, firstName=null, middleName=null, lastName=null, nameCn=null, orcid=null, stid=null, country=null, authorPic=null, dead=0, email=yhq@ecust.edu.cn, emailSecond=null, emailThird=null, correspondingAuthor=1, authorType=1, ext={EN=AuthorExt(id=1329455846842544211, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846767046737, language=EN, stringName=Huiqun Yu, firstName=Huiqun, middleName=null, lastName=Yu, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=*, address=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237, bio={"content":"

born in 1967. PhD, professor, PhD supervisor. Senior member of CCF. His main research interests include software engineering, trusted computing, cloud computing, and formal methods

"}, bioImg=null, bioContent=

born in 1967. PhD, professor, PhD supervisor. Senior member of CCF. His main research interests include software engineering, trusted computing, cloud computing, and formal methods

, aboutCorrespAuthor=null), CN=AuthorExt(id=1329455846909653076, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846767046737, language=CN, stringName=虞慧群, firstName=null, middleName=null, lastName=null, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=*, address=1华东理工大学计算机科学与工程系 上海 200237, bio={"img":"MByucvCqVjMbvnsE/DohFg==","content":"

1967年生. 博士,教授,博士生导师. CCF高级会员. 主要研究方向为软件工程、可信计算、云计算、形式化方法

"}, bioImg=MByucvCqVjMbvnsE/DohFg==, bioContent=

1967年生. 博士,教授,博士生导师. CCF高级会员. 主要研究方向为软件工程、可信计算、云计算、形式化方法

, aboutCorrespAuthor=null)}, companyList=[AuthorCompany(id=1329455846444085320, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, xref=1, ext=[AuthorCompanyExt(id=1329455846456668233, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=EN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237), AuthorCompanyExt(id=1329455846465056842, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=CN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1华东理工大学计算机科学与工程系 上海 200237)])]), Author(id=1329455846972567638, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, orderNo=2, firstName=null, middleName=null, lastName=null, nameCn=null, orcid=null, stid=null, country=null, authorPic=null, dead=0, email=null, emailSecond=null, emailThird=null, correspondingAuthor=0, authorType=1, ext={EN=AuthorExt(id=1329455847043870808, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846972567638, language=EN, stringName=Guisheng Fan, firstName=Guisheng, middleName=null, lastName=Fan, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237, bio={"content":"

born in 1980. PhD, associate research fellow, PhD supervisor. Member of CCF. His main research interests include software engineering, service computing, and software architecture analysis techniques

"}, bioImg=null, bioContent=

born in 1980. PhD, associate research fellow, PhD supervisor. Member of CCF. His main research interests include software engineering, service computing, and software architecture analysis techniques

, aboutCorrespAuthor=null), CN=AuthorExt(id=1329455847115173977, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846972567638, language=CN, stringName=范贵生, firstName=null, middleName=null, lastName=null, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1华东理工大学计算机科学与工程系 上海 200237, bio={"img":"fJO8obNlgnD9dZH2XbmYwQ==","content":"

1980年生. 博士,副研究员,博士生导师. CCF会员. 主要研究方向为软件工程、服务计算、软件架构分析技术

"}, bioImg=fJO8obNlgnD9dZH2XbmYwQ==, bioContent=

1980年生. 博士,副研究员,博士生导师. CCF会员. 主要研究方向为软件工程、服务计算、软件架构分析技术

, aboutCorrespAuthor=null)}, companyList=[AuthorCompany(id=1329455846444085320, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, xref=1, ext=[AuthorCompanyExt(id=1329455846456668233, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=EN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237), AuthorCompanyExt(id=1329455846465056842, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=CN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1华东理工大学计算机科学与工程系 上海 200237)])]), Author(id=1329455847186477147, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, orderNo=3, firstName=null, middleName=null, lastName=null, nameCn=null, orcid=null, stid=null, country=null, authorPic=null, dead=0, email=null, emailSecond=null, emailThird=null, correspondingAuthor=0, authorType=1, ext={EN=AuthorExt(id=1329455847261974621, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455847186477147, language=EN, stringName=Mingchen Li, firstName=Mingchen, middleName=null, lastName=Li, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237, bio={"content":"

born in 1998. PhD candidate. His main research interests include automatic code summarization and program comprehension

"}, bioImg=null, bioContent=

born in 1998. PhD candidate. His main research interests include automatic code summarization and program comprehension

, aboutCorrespAuthor=null), CN=AuthorExt(id=1329455847324889182, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455847186477147, language=CN, stringName=李明辰, firstName=null, middleName=null, lastName=null, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1华东理工大学计算机科学与工程系 上海 200237, bio={"img":"BeXOFVBvv0ksIBTfM0XW7Q==","content":"

1998年生. 博士研究生. 主要研究方向为代码自动摘要、程序理解

"}, bioImg=BeXOFVBvv0ksIBTfM0XW7Q==, bioContent=

1998年生. 博士研究生. 主要研究方向为代码自动摘要、程序理解

, aboutCorrespAuthor=null)}, companyList=[AuthorCompany(id=1329455846444085320, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, xref=1, ext=[AuthorCompanyExt(id=1329455846456668233, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=EN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237), AuthorCompanyExt(id=1329455846465056842, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=CN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1华东理工大学计算机科学与工程系 上海 200237)])]), Author(id=1329455847421358176, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, orderNo=4, firstName=null, middleName=null, lastName=null, nameCn=null, orcid=null, stid=null, country=null, authorPic=null, dead=0, email=null, emailSecond=null, emailThird=null, correspondingAuthor=0, authorType=1, ext={EN=AuthorExt(id=1329455847496855650, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455847421358176, language=EN, stringName=Zijie Huang, firstName=Zijie, middleName=null, lastName=Huang, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237, bio={"content":"

born in 1994. PhD candidate. Student member of CCF. His main research interests include code smell, software quality assurance, program comprehension, and empirical software engineering

"}, bioImg=null, bioContent=

born in 1994. PhD candidate. Student member of CCF. His main research interests include code smell, software quality assurance, program comprehension, and empirical software engineering

, aboutCorrespAuthor=null), CN=AuthorExt(id=1329455847593324643, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455847421358176, language=CN, stringName=黄子杰, firstName=null, middleName=null, lastName=null, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1华东理工大学计算机科学与工程系 上海 200237, bio={"img":"mAQiT1WiZ3qCeU5zFhLc/A==","content":"

1994年生. 博士研究生. CCF学生会员. 主要研究方向为代码异味、软件质量保障、程序理解、实证软件工程

"}, bioImg=mAQiT1WiZ3qCeU5zFhLc/A==, bioContent=

1994年生. 博士研究生. CCF学生会员. 主要研究方向为代码异味、软件质量保障、程序理解、实证软件工程

, aboutCorrespAuthor=null)}, companyList=[AuthorCompany(id=1329455846444085320, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, xref=1, ext=[AuthorCompanyExt(id=1329455846456668233, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=EN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237), AuthorCompanyExt(id=1329455846465056842, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=CN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1华东理工大学计算机科学与工程系 上海 200237)])])], keywords=[Keyword(id=1329455847689793636, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, orderNo=1, keyword=automatic code summarization), Keyword(id=1329455847765291109, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, orderNo=2, keyword=hierarchical representation), Keyword(id=1329455847832399974, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, orderNo=3, keyword=context enhancement), Keyword(id=1329455847899508839, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, orderNo=4, keyword=deep learning), Keyword(id=1329455847954034792, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, orderNo=5, keyword=class summarization), Keyword(id=1329455848025337961, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, orderNo=1, keyword=代码自动摘要), Keyword(id=1329455848100835434, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, orderNo=2, keyword=分层表示), Keyword(id=1329455848163749995, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, orderNo=3, keyword=上下文增强), Keyword(id=1329455848235053164, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, orderNo=4, keyword=深度学习), Keyword(id=1329455848285384813, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, orderNo=5, keyword=类摘要)], refs=[Reference(id=1329455852295139466, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=1, rfOrder=0, authorNames=null, journalName=null, refType=null, unstructuredReference=Xia Xin, Bao Lingfeng, Lo D, et al. Measuring program comprehension: A large-scale field study with professionals[J]. IEEE Transactions on Software Engineering, 2017, 44(10): 951−976, articleTitle=null, refAbstract=null), Reference(id=1329455852366442635, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=2, rfOrder=1, authorNames=null, journalName=null, refType=null, unstructuredReference=Haiduc S, Aponte J, Moreno L, et al. On the use of automated text summarization techniques for summarizing source code[C] //Proc of the 17th Working Conf on Reverse Engineering. Piscataway, NJ: IEEE, 2010: 35−44, articleTitle=null, refAbstract=null), Reference(id=1329455852425162892, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=3, rfOrder=2, authorNames=null, journalName=null, refType=null, unstructuredReference=Haiduc S, Aponte J, Marcus A, et al. Supporting program comprehension with source code summarization[C] //Proc of the 32nd ACM/IEEE Int Conf on Software Engineering. New York: ACM, 2010: 223−226, articleTitle=null, refAbstract=null), Reference(id=1329455852479688845, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=4, rfOrder=3, authorNames=null, journalName=null, refType=null, unstructuredReference=Eddy B P, Robinson J A, Kraft N A, et al. Evaluating source code summarization techniques: Replication and expansion[C] //Proc of the 21st Int Conf on Program Comprehension. Piscataway, NJ: IEEE, 2013: 13−22, articleTitle=null, refAbstract=null), Reference(id=1329455852542603406, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=5, rfOrder=4, authorNames=null, journalName=null, refType=null, unstructuredReference=McBurney P W, Liu C, McMillan C, et al. Improving topic model source code summarization[C] //Pro of the 22nd Int Conf on Program Comprehension. New York: ACM, 2014: 291−294, articleTitle=null, refAbstract=null), Reference(id=1329455852613906575, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=6, rfOrder=5, authorNames=null, journalName=null, refType=null, unstructuredReference=Movshovitz-Attias D, Cohen W. Natural language models for predicting programming comments[C] //Proc of the 51st Annual Meeting of the Association for Computational Linguistics. Stroudsburg, PA: ACL, 2013: 35−40, articleTitle=null, refAbstract=null), Reference(id=1329455852676821136, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=7, rfOrder=6, authorNames=null, journalName=null, refType=null, unstructuredReference=Wong E, Yang Jinqiu, Tan Lin. Autocomment: Mining question and answer sites for automatic comment generation[C] //Proc of the 28th IEEE/ACM Int Conf on Automated Software Engineering. Piscataway, NJ: IEEE, 2013: 562−567, articleTitle=null, refAbstract=null), Reference(id=1329455852756512913, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=8, rfOrder=7, authorNames=null, journalName=null, refType=null, unstructuredReference=Sridhara G, Hill E, Muppaneni D, et al. Towards automatically generating summary comments for Java methods[C] //Proc of the 25th IEEE/ACM Int Conf on Automated Software Engineering. New York: ACM, 2010: 43−52, articleTitle=null, refAbstract=null), Reference(id=1329455852819427474, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=9, rfOrder=8, authorNames=null, journalName=null, refType=null, unstructuredReference=Sridhara G, Pollock L, Vijay-Shanker K. Generating parameter comments and integrating with method summaries[C] //Proc of the 19th Int Conf on Program Comprehension. Piscataway, NJ: IEEE, 2011: 71−80, articleTitle=null, refAbstract=null), Reference(id=1329455852894924947, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=10, rfOrder=9, authorNames=null, journalName=null, refType=null, unstructuredReference=Sridhara G, Pollock L, Vijay-Shanker K. Automatically detecting and describing high level actions within methods[C] //Proc of the 33rd Int Conf on Software Engineering. New York: ACM, 2011: 101−110, articleTitle=null, refAbstract=null), Reference(id=1329455854505537684, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=11, rfOrder=10, authorNames=null, journalName=null, refType=null, unstructuredReference=Abid N J, Dragan N, Collard M L, et al. Using stereotypes in the automatic generation of natural language summaries for C++ methods[C] //Proc of Int Conf on Software Maintenance and Evolution. Piscataway, NJ: IEEE, 2015: 561−565, articleTitle=null, refAbstract=null), Reference(id=1329455854597812373, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=12, rfOrder=11, authorNames=null, journalName=null, refType=null, unstructuredReference=Song Xiaotao, Sun Hailong, Wang Xu, et al. A survey of automatic generation of source code comments: Algorithms and techniques[J]. IEEE Access, 2019, 7: 111411−111428, articleTitle=null, refAbstract=null), Reference(id=1329455854660726934, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=13, rfOrder=12, authorNames=null, journalName=null, refType=null, unstructuredReference=Moreno L, Aponte J, Sridhara G, et al. Automatic generation of natural language summaries for Java classes[C] //Proc of the 21st Int Conf on Program Comprehension. Piscataway, NJ: IEEE, 2013: 23−32, articleTitle=null, refAbstract=null), Reference(id=1329455854736224407, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=14, rfOrder=13, authorNames=null, journalName=null, refType=null, unstructuredReference=Li Mingchen, Yu Huiqun, Fan Guisheng, et al. ClassSum: A deep learning model for class-level code summarization[J]. Neural Computing and Applications, 2023, 35(4): 3373−3393, articleTitle=null, refAbstract=null), Reference(id=1329455854815916184, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=15, rfOrder=14, authorNames=null, journalName=null, refType=null, unstructuredReference=Li Zheng, Wu Yonghao, Peng Bin, et al. Setransformer: A transformer-based code semantic parser for code comment generation[J]. IEEE Transactions on Reliability, 2022, 72(1): 258−273, articleTitle=null, refAbstract=null), Reference(id=1329455854874636441, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=16, rfOrder=15, authorNames=null, journalName=null, refType=null, unstructuredReference=Iyer S, Konstas I, Cheung A, et al. Summarizing source code using a neural attention model[C] //Proc of the 54th Annual Meeting of the Association for Computational Linguistics. Stroudsburg, PA: ACL, 2016: 2073−2083, articleTitle=null, refAbstract=null), Reference(id=1329455854954328218, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=17, rfOrder=16, authorNames=null, journalName=null, refType=null, unstructuredReference=Allamanis M, Peng H, Sutton C. A convolutional attention network for extreme summarization of source code[C] //Proc of the 33rd Int Conf on Machine Learning. New York: ACM, 2016: 2091−2100, articleTitle=null, refAbstract=null), Reference(id=1329455855017242779, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=18, rfOrder=17, authorNames=null, journalName=null, refType=null, unstructuredReference=Hu Xing, Li Ge, Xia Xin, et al. Deep code comment generation[C] //Proc of the 26th Conf on Program Comprehension. New York: ACM, 2018: 200−210, articleTitle=null, refAbstract=null), Reference(id=1329455855071768732, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=19, rfOrder=18, authorNames=null, journalName=null, refType=null, unstructuredReference=Leclair A, Jiang S, McMillan C. A neural model for generating natural language summaries of program subroutines[C] //Proc of the 41st Int Conf on Software Engineering. New York: ACM, 2019: 795−806, articleTitle=null, refAbstract=null), Reference(id=1329455855151460509, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=20, rfOrder=19, authorNames=null, journalName=null, refType=null, unstructuredReference=Hu Xing, Li Ge, Xia Xin, et al. Deep code comment generation with hybrid lexical and syntactical information[J]. Empirical Software Engineering, 2019, 25(3): 2179−2217, articleTitle=null, refAbstract=null), Reference(id=1329455855214375070, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=21, rfOrder=20, authorNames=null, journalName=null, refType=null, unstructuredReference=Zhou Ziyi, Yu Huiqun, Fan Guisheng. Effective approaches to combining lexical and syntactical information for code summarization[J]. Software: Practice and Experience, 2020, 50(12): 2313−2336, articleTitle=null, refAbstract=null), Reference(id=1329455855277289631, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=22, rfOrder=21, authorNames=null, journalName=null, refType=null, unstructuredReference=Ahmad W U, Chakraborty S, Ray B, et al. A transformer-based approach for source code summarization[J]. arXiv preprint, arXiv: 2005. 00653, 2020, articleTitle=null, refAbstract=null), Reference(id=1329455855377952928, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=23, rfOrder=22, authorNames=null, journalName=null, refType=null, unstructuredReference=Alon U, Brody S, Levy O, et al. Code2Seq: Generating sequences from structured representations of code[C/OL] //Proc of the 7th Int Conf on Learning Representations. Amherst, MA: OpenReview. Net, 2019 [2023-11-30].https://openreview.net/forum?id=H1gKYo09tX, articleTitle=null, refAbstract=null), Reference(id=1329455855445061793, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=24, rfOrder=23, authorNames=null, journalName=null, refType=null, unstructuredReference=Zhou Yu, Shen Juanjuan, Zhang Xiaoqing, et al. Automatic source code summarization with graph attention networks[J]. Journal of Systems and Software, 2022, 188: 111257, articleTitle=null, refAbstract=null), Reference(id=1329455855512170658, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=25, rfOrder=24, authorNames=null, journalName=null, refType=null, unstructuredReference=张世琨,谢睿,叶蔚,等. 基于关键词的代码自动摘要[J]. 计算机研究与发展,2020,57(9):1987−2000, articleTitle=null, refAbstract=null), Reference(id=1329455855596056739, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=25, rfOrder=25, authorNames=null, journalName=null, refType=null, unstructuredReference=Zhang Shikun, Xie Rui, Ye Wei, et al. Keyword-based source code summarization[J]. Journal of Computer Research and Development, 2020, 57(9): 1987−2000 (in Chinese), articleTitle=null, refAbstract=null), Reference(id=1329455855654776996, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=26, rfOrder=26, authorNames=null, journalName=null, refType=null, unstructuredReference=Zhou Ziyi, Yu Huiqun, Fan Guisheng, et al. Summarizing source code with hierarchical code representation[J]. Information and Software Technology, 2022, 143: 106761, articleTitle=null, refAbstract=null), Reference(id=1329455855742857381, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=27, rfOrder=27, authorNames=null, journalName=null, refType=null, unstructuredReference=Wang Wenhua, Zhang Yuqun, Sui Yulei, et al. Reinforcement-learning-guided source code summarization using hierarchical attention[J]. IEEE Transactions on Software Engineering, 2020, 48(1): 102−119, articleTitle=null, refAbstract=null), Reference(id=1329455855805771942, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=28, rfOrder=28, authorNames=null, journalName=null, refType=null, unstructuredReference=Lin Chen, Ouyang Zhichao, Zhuang Junqing, et al. Improving code summarization with block-wise abstract syntax tree splitting[C] //Proc of the 2021 IEEE/ACM 29th Int Conf on Program Comprehension. Los Alamitos, CA: IEEE Computer Society, 2021: 184−195, articleTitle=null, refAbstract=null), Reference(id=1329455855872880807, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=29, rfOrder=29, authorNames=null, journalName=null, refType=null, unstructuredReference=Shi Ensheng, Wang Youlin, Du Lun, et al. Cast: Enhancing code summarization with hierarchical splitting and reconstruction of abstract syntax trees[C] //Proc of the 2021 Conf on Empirical Methods in Natural Language Processing. Stroudsburg, PA: ACL, 2021: 4053−4062, articleTitle=null, refAbstract=null), Reference(id=1329455856032264360, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=30, rfOrder=30, authorNames=null, journalName=null, refType=null, unstructuredReference=Mcburney P W, McMillan C. Automatic source code summarization of context for Java methods[J]. IEEE Transactions on Software Engineering, 2016, 42(2): 103−119, articleTitle=null, refAbstract=null), Reference(id=1329455856132927657, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=31, rfOrder=31, authorNames=null, journalName=null, refType=null, unstructuredReference=Hill E, Pollock L, Vijay-Shanker K. Automatically capturing source code context of NL-queries for software maintenance and reuse[C] //Proc of the 31st Int Conf on Software Engineering. Piscataway, NJ: IEEE, 2009: 232−242, articleTitle=null, refAbstract=null), Reference(id=1329455856208425130, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=32, rfOrder=32, authorNames=null, journalName=null, refType=null, unstructuredReference=Yu Xiaohan, Huang Quzhe, Wang Zheng, et al. Towards context-aware code comment generation[C] //Proc of Findings of the Association for Computational Linguistics: EMNLP. Stroudsburg, PA: ACL, 2020: 3938−3947, articleTitle=null, refAbstract=null), Reference(id=1329455856288116907, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=33, rfOrder=33, authorNames=null, journalName=null, refType=null, unstructuredReference=Wang Yanlin, Shi Ensheng, Du Lun, et al. Cocosum: Contextual code summarization with multi-relational graph neural network[J]. arXiv preprint, arXiv: 2107. 01933, 2021, articleTitle=null, refAbstract=null), Reference(id=1329455856376197292, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=34, rfOrder=34, authorNames=null, journalName=null, refType=null, unstructuredReference=Haque S, Leclair A, Wu Lingfei, et al. Improved automatic summarization of subroutines via attention to file context[C] //Proc of the 17th Int Conf on Mining Software Repositories. New York: ACM, 2020: 300−310, articleTitle=null, refAbstract=null), Reference(id=1329455856485249197, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=35, rfOrder=35, authorNames=null, journalName=null, refType=null, unstructuredReference=Bansal A, Haque S, McMillan C. Project-level encoding for neural source code summarization of subroutines[C] //Proc of the 29th Int Conf on Program Comprehension. Piscataway, NJ: IEEE, 2021: 253−264, articleTitle=null, refAbstract=null), Reference(id=1329455856552358062, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=36, rfOrder=36, authorNames=null, journalName=null, refType=null, unstructuredReference=Devlin J, Chang M W, Lee K, et al. BERT: Pre-training of deep bidirectional transformers for language understanding[J]. arXiv preprint, arXiv: 1810. 04805, 2018, articleTitle=null, refAbstract=null), Reference(id=1329455856611078319, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=37, rfOrder=37, authorNames=null, journalName=null, refType=null, unstructuredReference=Radford A, Wu J, Child R, et al. Language models are unsupervised multitask learners[J]. OpenAI Blog, 2019, 1(8): 9, articleTitle=null, refAbstract=null), Reference(id=1329455856690770096, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=38, rfOrder=38, authorNames=null, journalName=null, refType=null, unstructuredReference=Brown T, Mann B, Ryder N, et al. Language models are few-shot learners[J]. Advances in Neural Information Processing Systems, 2020, 33: 1877−1901, articleTitle=null, refAbstract=null), Reference(id=1329455856762073265, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=39, rfOrder=39, authorNames=null, journalName=null, refType=null, unstructuredReference=Ouyang Long, Wu J, Jiang Xu, et al. Training language models to follow instructions with human feedback[J]. Advances in Neural Information Processing Systems, 2022, 35: 27730−27744, articleTitle=null, refAbstract=null), Reference(id=1329455856837570738, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=40, rfOrder=40, authorNames=null, journalName=null, refType=null, unstructuredReference=Feng Zhangyin, Guo Daya, Tang Duyu, et al. CodeBERT: A pre-trained model for programming and natural languages[J]. arXiv preprint, arXiv: 2002. 08155, 2020, articleTitle=null, refAbstract=null), Reference(id=1329455856892096691, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=41, rfOrder=41, authorNames=null, journalName=null, refType=null, unstructuredReference=Wang Yue, Wang Weishi, Joty S, et al. Codet5: Identifier-aware unified pre-trained encoder-decoder models for code understanding and generation[J]. arXiv preprint, arXiv: 2109. 00859, 2021, articleTitle=null, refAbstract=null), Reference(id=1329455856955011252, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=42, rfOrder=42, authorNames=null, journalName=null, refType=null, unstructuredReference=Guo Daya, Ren Shuo, Lu Shuai, et al. GraphCodeBERT: Pre-training code representations with data flow[J]. arXiv preprint, arXiv: 2009. 08366, 2020, articleTitle=null, refAbstract=null), Reference(id=1329455857013731509, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=43, rfOrder=43, authorNames=null, journalName=null, refType=null, unstructuredReference=OpenAI. GPT-4 technical report[J]. arXiv preprint, arXiv: 2303. 08774, 2023, articleTitle=null, refAbstract=null), Reference(id=1329455857085034678, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=44, rfOrder=44, authorNames=null, journalName=null, refType=null, unstructuredReference=Chen M, Tworek J, Jun H, et al. Evaluating large language models trained on code[J]. arXiv preprint, arXiv: 2107. 03374, 2021, articleTitle=null, refAbstract=null), Reference(id=1329455857164726455, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=45, rfOrder=45, authorNames=null, journalName=null, refType=null, unstructuredReference=Roziere B, Gehring J, Gloeckle F, et al. Code Llama: Open foundation models for code[J]. arXiv preprint, arXiv: 2308. 12950, 2023, articleTitle=null, refAbstract=null), Reference(id=1329455857227641016, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=46, rfOrder=46, authorNames=null, journalName=null, refType=null, unstructuredReference=Luo Ziyang, Xu Can, Zhao Pu, et al. WizardCoder: Empowering code large language models with evol-Instruct[J]. arXiv preprint, arXiv: 2306. 08568, 2023, articleTitle=null, refAbstract=null), Reference(id=1329455857311527097, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=47, rfOrder=47, authorNames=null, journalName=null, refType=null, unstructuredReference=Sutskever I, Vinyals O, Le Q V. Sequence to sequence learning with neural networks[J]. Advances in Neural Information Processing Systems, 2014, 27: 3104−3112, articleTitle=null, refAbstract=null), Reference(id=1329455857378635962, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=48, rfOrder=48, authorNames=null, journalName=null, refType=null, unstructuredReference=Hochreiter S, Schmidhuber J. Long short-term memory[J]. Neural Computation, 1997, 9(8): 1735−1780, articleTitle=null, refAbstract=null), Reference(id=1329455859006025915, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=49, rfOrder=49, authorNames=null, journalName=null, refType=null, unstructuredReference=Ge Fan, Kuang Li. Keywords guided method name generation[C] //Proc of the 29th Int Conf on Program Comprehension. Piscataway, NJ: IEEE, 2021: 196−206, articleTitle=null, refAbstract=null), Reference(id=1329455859077329084, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=50, rfOrder=50, authorNames=null, journalName=null, refType=null, unstructuredReference=Vaswani A, Shazeer N, Parmar N, et al. Attention is all you need[C] //Proc of the Annual Conf on Neural Information Processing Systems. Cambridge, MA: MIT, 2017: 5998−6008, articleTitle=null, refAbstract=null), Reference(id=1329455859136049341, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=51, rfOrder=51, authorNames=null, journalName=null, refType=null, unstructuredReference=Papineni K, Roukos S, Ward T, et al. BLEU: A method for automatic evaluation of machine translation[C] //Proc of the 40th Annual Meeting of the Association for Computational Linguistics. New York: ACM, 2002: 311−318, articleTitle=null, refAbstract=null), Reference(id=1329455859190575294, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=52, rfOrder=52, authorNames=null, journalName=null, refType=null, unstructuredReference=Denkowski M, Lavie A. METEOR universal: Language specific translation evaluation for any target language[C] //Proc of the 9th Workshop on Statistical Machine Translation. Stroudsburg, PA: ACL 2014: 376−380, articleTitle=null, refAbstract=null), Reference(id=1329455859270267071, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=53, rfOrder=53, authorNames=null, journalName=null, refType=null, unstructuredReference=Lin C Y. ROUGE: A package for automatic evaluation of summaries[C] // Proc of the Workshop on Text Summarization Branches Out. Stroudsburg, PA: ACL, 2004: 74−81, articleTitle=null, refAbstract=null), Reference(id=1329455859349958848, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=54, rfOrder=54, authorNames=null, journalName=null, refType=null, unstructuredReference=Kingma D P, Ba J. Adam: A method for stochastic optimization[J]. arXiv preprint, arXiv: 1412. 6980, 2014, articleTitle=null, refAbstract=null), Reference(id=1329455859421262017, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=55, rfOrder=55, authorNames=null, journalName=null, refType=null, unstructuredReference=Wu Yonghui, Schuster M, Chen Zhifeng, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation[J]. arXiv preprint, arXiv: 1609. 08144, 2014, articleTitle=null, refAbstract=null), Reference(id=1329455859479982274, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, doi=null, pmid=null, pmcid=null, year=null, volume=null, issue=null, pageStart=null, pageEnd=null, url=null, language=null, rfNumber=56, rfOrder=56, authorNames=null, journalName=null, refType=null, unstructuredReference=Ji Ziwei, Lee N, Frieske R, et al. Survey of hallucination in natural language generation[J]. ACM Computing Surveys, 2023, 55(12): 1−38, articleTitle=null, refAbstract=null)], funds=null, companyList=[AuthorCompany(id=1329455846444085320, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, xref=1, ext=[AuthorCompanyExt(id=1329455846456668233, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=EN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237), AuthorCompanyExt(id=1329455846465056842, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=CN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1华东理工大学计算机科学与工程系 上海 200237)])], figs=[ArticleFig(id=1329455848398631022, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Figure 1, caption=The structure of a LSTM cell, figureFileSmall=VNCRZu08H0oX0nmwAh5LjQ==, figureFileBig=K/IjJVULYnVSaOA9IlY6GQ==, tableContent=null), ArticleFig(id=1329455848478322799, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=图1, caption=LSTM单元的结构, figureFileSmall=VNCRZu08H0oX0nmwAh5LjQ==, figureFileBig=K/IjJVULYnVSaOA9IlY6GQ==, tableContent=null), ArticleFig(id=1329455850256707696, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Figure 2, caption=Class summarization generation model HRCE, figureFileSmall=P96jmYk74cEUyJeCWy8QMA==, figureFileBig=5vh/lJ9zDEEB3H6KJW1jIw==, tableContent=null), ArticleFig(id=1329455850332205169, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=图2, caption=类摘要生成模型HRCE, figureFileSmall=P96jmYk74cEUyJeCWy8QMA==, figureFileBig=5vh/lJ9zDEEB3H6KJW1jIw==, tableContent=null), ArticleFig(id=1329455850441257074, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Figure 3, caption=The encoding process of attribute names, figureFileSmall=aE3uIxx77s5H7oA2tpN51A==, figureFileBig=99G9ZF+XmxTejl1wNnS4tw==, tableContent=null), ArticleFig(id=1329455850508365939, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=图3, caption=属性名的编码过程, figureFileSmall=aE3uIxx77s5H7oA2tpN51A==, figureFileBig=99G9ZF+XmxTejl1wNnS4tw==, tableContent=null), ArticleFig(id=1329455850592252020, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Figure 4, caption=The process of class code reduction, figureFileSmall=HHhisl+/uODA7plyUOJIjg==, figureFileBig=C+BCINg+L+tDqkYFsg61rw==, tableContent=null), ArticleFig(id=1329455850659360885, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=图4, caption=类代码精简过程, figureFileSmall=HHhisl+/uODA7plyUOJIjg==, figureFileBig=C+BCINg+L+tDqkYFsg61rw==, tableContent=null), ArticleFig(id=1329455850734858358, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Figure 5, caption=The prompt template of Code Llama, figureFileSmall=Pg1W6g8tYfI5vVuYtekuFA==, figureFileBig=bippoytfCd0CuK1obvpHlQ==, tableContent=null), ArticleFig(id=1329455850831327351, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=图5, caption=Code Llama的提示模板, figureFileSmall=Pg1W6g8tYfI5vVuYtekuFA==, figureFileBig=bippoytfCd0CuK1obvpHlQ==, tableContent=null), ArticleFig(id=1329455850940379256, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Table 1, caption=

Statistics on the Number of Attribute

, figureFileSmall=null, figureFileBig=null, tableContent=
序号个数属性名
1最大1684
2平均3
3<150%
4<375%
5<585%
), ArticleFig(id=1329455851007488121, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=表1, caption=

属性名个数统计

, figureFileSmall=null, figureFileBig=null, tableContent=
序号个数属性名
1最大1684
2平均3
3<150%
4<375%
5<585%
), ArticleFig(id=1329455851078791290, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Table 2, caption=

Statistics on the Number of Method Signature

, figureFileSmall=null, figureFileBig=null, tableContent=
序号个数属性名
1最大1787
2平均8
3<450%
4<875%
5<1588%
), ArticleFig(id=1329455851141705851, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=表2, caption=

方法签名个数统计

, figureFileSmall=null, figureFileBig=null, tableContent=
序号个数属性名
1最大1787
2平均8
3<450%
4<875%
5<1588%
), ArticleFig(id=1329455851213009020, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Table 3, caption=

Sequence Length Statistics

, figureFileSmall=null, figureFileBig=null, tableContent=
序列名称最大长度平均长度25%长度50%长度75%长度
类签名1105106914
属性254344
方法签名9681381115
上下文64800015
摘要50105813
), ArticleFig(id=1329455851275923581, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=表3, caption=

序列长度统计

, figureFileSmall=null, figureFileBig=null, tableContent=
序列名称最大长度平均长度25%长度50%长度75%长度
类签名1105106914
属性254344
方法签名9681381115
上下文64800015
摘要50105813
), ArticleFig(id=1329455851338838142, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Table 4, caption=

Splits of Dataset

, figureFileSmall=null, figureFileBig=null, tableContent=
数据集样本数项目数
混项目测试集359002697
跨项目测试集35186187
验证集359002687
训练集2520063677
总数3589923955
), ArticleFig(id=1329455851410141311, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=表4, caption=

数据集划分

, figureFileSmall=null, figureFileBig=null, tableContent=
数据集样本数项目数
混项目测试集359002697
跨项目测试集35186187
验证集359002687
训练集2520063677
总数3589923955
), ArticleFig(id=1329455851473055872, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Table 5, caption=

Performance of HRCE and Baseline Models on Hybrid-Projects Test Set and Cross-Projects Test Set

, figureFileSmall=null, figureFileBig=null, tableContent=
模型混项目测试集跨项目测试集
BLEU-4BLEU-4(s)METEORROUGE-LBLEU-4BLEU-4(s)METEORROUGE-L
Code Llama0.401.9011.4714.540.552.0511.7215.67
SBT5.0111.6010.9722.610.352.664.049.17
CodeNN13.7820.3217.0643.180.364.026.7315.72
Transformer19.0926.2221.9443.181.215.619.8320.75
AST-attendgru24.1831.1524.2747.511.317.0111.2624.60
CodeBERT24.0632.2724.9248.592.249.1913.1928.51
ClassSum28.1335.3826.8450.962.838.9013.0227.18
HRCE30.3237.0128.0652.183.819.4213.7427.20
), ArticleFig(id=1329455851535970433, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=表5, caption=

HRCE和基准模型在混项目测试集和跨项目测试集上的表现

, figureFileSmall=null, figureFileBig=null, tableContent=
模型混项目测试集跨项目测试集
BLEU-4BLEU-4(s)METEORROUGE-LBLEU-4BLEU-4(s)METEORROUGE-L
Code Llama0.401.9011.4714.540.552.0511.7215.67
SBT5.0111.6010.9722.610.352.664.049.17
CodeNN13.7820.3217.0643.180.364.026.7315.72
Transformer19.0926.2221.9443.181.215.619.8320.75
AST-attendgru24.1831.1524.2747.511.317.0111.2624.60
CodeBERT24.0632.2724.9248.592.249.1913.1928.51
ClassSum28.1335.3826.8450.962.838.9013.0227.18
HRCE30.3237.0128.0652.183.819.4213.7427.20
), ArticleFig(id=1329455851603079298, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Table 6, caption=

Performance of Code Llama on Hybrid-Projects Test Set and Cross-Projects Test Set with and Without Context

, figureFileSmall=null, figureFileBig=null, tableContent=
模型输入混项目测试集跨项目测试集
BLEU-4BLEU-4(s)METEORROUGE-LBLEU-4BLEU-4(s)METEORROUGE-L
无上下文0.191.289.8611.240.261.5711.0813.87
有上下文0.401.9011.4714.540.552.0511.7215.67
), ArticleFig(id=1329455851670188163, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=表6, caption=

Code Llama有无上下文时在混项目测试集和跨项目测试集上的表现

, figureFileSmall=null, figureFileBig=null, tableContent=
模型输入混项目测试集跨项目测试集
BLEU-4BLEU-4(s)METEORROUGE-LBLEU-4BLEU-4(s)METEORROUGE-L
无上下文0.191.289.8611.240.261.5711.0813.87
有上下文0.401.9011.4714.540.552.0511.7215.67
), ArticleFig(id=1329455851745685636, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Table 7, caption=

Class Summarization Generated by Code Llama

, figureFileSmall=null, figureFileBig=null, tableContent=
), ArticleFig(id=1329455851821183109, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=表7, caption=

Code Llama生成的类摘要

, figureFileSmall=null, figureFileBig=null, tableContent=
), ArticleFig(id=1329455851900874886, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Table 8, caption=

Ablation Experiment Results on Hybrid-Projects Test Set and Cross-Projects Test Set

, figureFileSmall=null, figureFileBig=null, tableContent=
模型混项目测试集跨项目测试集
BLEU-4BLEU-4(s)METEORROUGE-LBLEU-4BLEU-4(s)METEORROUGE-L
HRCE-NON-SIG29.1335.8227.3451.123.218.6812.9225.89
HRCE-NON-ATTR29.6436.4227.6851.923.629.4913.9928.26
HRCE-NON-INHER28.2234.7226.5549.583.499.0013.2126.56
HRCE30.3237.0128.0652.183.819.4213.7427.20
), ArticleFig(id=1329455851959595143, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=表8, caption=

在混项目测试集和跨项目测试集上的消融实验结果

, figureFileSmall=null, figureFileBig=null, tableContent=
模型混项目测试集跨项目测试集
BLEU-4BLEU-4(s)METEORROUGE-LBLEU-4BLEU-4(s)METEORROUGE-L
HRCE-NON-SIG29.1335.8227.3451.123.218.6812.9225.89
HRCE-NON-ATTR29.6436.4227.6851.923.629.4913.9928.26
HRCE-NON-INHER28.2234.7226.5549.583.499.0013.2126.56
HRCE30.3237.0128.0652.183.819.4213.7427.20
), ArticleFig(id=1329455852022509704, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=EN, label=Table 9, caption=

Output Examples of Different Models

, figureFileSmall=null, figureFileBig=null, tableContent=
), ArticleFig(id=1329455852093812873, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, language=CN, label=表9, caption=

不同模型的输出示例

, figureFileSmall=null, figureFileBig=null, tableContent=
)], attaches=null, journal=Journal(id=1324759606947315908, delFlag=0, nameCn=计算机研究与发展, nameEn=Journal of Computer Research and Development, nameHistory1=null, nameHistory2=null, issn=1000-1239, eissn=null, cn=11-1777/TP, coden=null, periodic=0, language=CN, oaType=null, ccby=null, superviseOffice=null, ownerOffice=null, pubOffice=null, editorOffice=null, officeType=null, aims=null, clcCode=null, officeProv=null, officeCity=null, officeAddr=null, officeZip=null, officeEmail=null, officePhone=null, editDirector=null, officeDirector=null, officeDirectorPhone=null, officeStaffNum=null, officeEmpNum=null, coverPicUrl=k2l8zgqwstuxxevFX2qxVA==, journalPrice=null, startedYear=null, abbrevIsoEn=Journal of Computer Research and Development, journalRemark=null, publicationField=null, createdTime=1793776903141, updatedTime=1793850698612, createdBy=18614031015, updatedBy=13701087609, firstLetterCn=J, firstLetterEn=J, subjectCode=Electronic Information, subjectName=null, subjectCodeEn=Electronic Information, subjectNameEn=null, picCn=k2l8zgqwstuxxevFX2qxVA==, picEn=r6k0Ry+RD+c/VXj5QarmDw==, jcr=null, cjcr=null, exts=[JournalExt(id=1325069127710286688, language=CN, name=计算机研究与发展, nameHistory1=null, nameHistory2=null, managedBy=, sponsoredBy=, publishedBy=, editorOffice=, officeProv=null, officeCity=null, officeAddr=, officeZip=, editDirector=, officeDirector=null, officePhone=null, coverPicUrl=null, journalRemark=, submitArticleUrl=null, websiteUrl=, createdTime=1793850698640, updatedTime=1793850698640, createdBy=13701087609, updatedBy=13701087609, submissionGuidelinesUrl=, submissionAuthorUrl=https://crad.ict.ac.cn/journalx/authorLogOn.action, submissionEditorUrl=https://crad.ict.ac.cn/journalx/editorLogOn.action, submissionReviewUrl=https://crad.ict.ac.cn/journalx/expertLogOn.action, submissionCeEditorUrl=https://crad.ict.ac.cn/journalx/editorInChiefLogOn.action, submissionAeEditorUrl=, option={"copyright":""}), JournalExt(id=1325069127777395553, language=EN, name=Journal of Computer Research and Development, nameHistory1=null, nameHistory2=null, managedBy=, sponsoredBy=, publishedBy=, editorOffice=, officeProv=null, officeCity=null, officeAddr=, officeZip=, editDirector=, officeDirector=null, officePhone=null, coverPicUrl=null, journalRemark=, submitArticleUrl=null, websiteUrl=, createdTime=1793850698656, updatedTime=1793850698656, createdBy=13701087609, updatedBy=13701087609, submissionGuidelinesUrl=, submissionAuthorUrl=https://crad.ict.ac.cn/journalx/authorLogOn.action, submissionEditorUrl=https://crad.ict.ac.cn/journalx/editorLogOn.action, submissionReviewUrl=https://crad.ict.ac.cn/journalx/expertLogOn.action, submissionCeEditorUrl=https://crad.ict.ac.cn/journalx/editorInChiefLogOn.action, submissionAeEditorUrl=, option={"copyright":""})], databaseList=null, tenantJournalId=1324759914146529478, websiteList=[Website(id=1325070300139892771, webName=null, webTitle=null, webDomain=null, webCopyrigh=null, webIpcNo=null, seoTitle=null, seoKeywords=null, seoDescription=null, tenantJournalId=null, journalId=1324759914146529478, journalNameCn=null, journalNameEn=null, grayFlag=null, tenantId=1146029695717560320, platformId=null, journalGroupId=null, journalGroupNameCn=null, journalGroupNameEn=null, type=1, domain=https://castjournals.cast.org.cn/joweb/jsjyjyfz/CN, language=CN, createTime=1793850978169, createBy=18614031015, updateTime=1793851040259, updateBy=18614031015, name=计算机研究与发展-中文, tplId=1146099689490845704, title=计算机研究与发展, delFlag=0, indexPage=/home, props=[WebsiteProps(id=1325070893751349360, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300139892771, code=articleTextType, value=kx, createTime=1793851119697, updateTime=1793851119697, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070893730377837, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300139892771, code=banner, value=null, createTime=1793851119692, updateTime=1793851119692, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070893772320883, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300139892771, code=grayFlag, value=0, createTime=1793851119702, updateTime=1793851119702, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070893721989228, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300139892771, code=logo, value=https://castjournals.cast.org.cn/joweb/jsjyjyfz/CN/file/pic?fileId=U27tDsy717YF7XSPA+Vwdw==, createTime=1793851119690, updateTime=1793851119690, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070893784903797, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300139892771, code=minRunFlag, value=0, createTime=1793851119705, updateTime=1793851119705, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070893742960751, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300139892771, code=picServerUrl, value=https://castjournals.cast.org.cn/joweb/jsjyjyfz/CN/file/pic, createTime=1793851119695, updateTime=1793851119695, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070893780709492, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300139892771, code=silenceFlag, value=0, createTime=1793851119704, updateTime=1793851119704, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070893738766446, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300139892771, code=staticResourcePath, value=https://castjournals.cast.org.cn/joweb/cast_kjdb_cn_619/, createTime=1793851119694, updateTime=1793851119694, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070893755543665, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300139892771, code=themeColor, value=null, createTime=1793851119698, updateTime=1793851119698, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070893763932274, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300139892771, code=themeStyle, value=null, createTime=1793851119700, updateTime=1793851119700, creator=18614031015, updator=18614031015)]), Website(id=1325070300580294698, webName=null, webTitle=null, webDomain=null, webCopyrigh=null, webIpcNo=null, seoTitle=null, seoKeywords=null, seoDescription=null, tenantJournalId=null, journalId=1324759914146529478, journalNameCn=null, journalNameEn=null, grayFlag=null, tenantId=1146029695717560320, platformId=null, journalGroupId=null, journalGroupNameCn=null, journalGroupNameEn=null, type=1, domain=https://castjournals.cast.org.cn/joweb/jsjyjyfz/EN, language=EN, createTime=1793850978274, createBy=18614031015, updateTime=1793851036638, updateBy=18614031015, name=计算机研究与发展-英文, tplId=1146101810881728533, title=Journal of Computer Research and Development, delFlag=0, indexPage=/home, props=[WebsiteProps(id=1325070925288321148, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300580294698, code=articleTextType, value=kx, createTime=1793851127216, updateTime=1793851127216, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070925263155321, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300580294698, code=banner, value=null, createTime=1793851127210, updateTime=1793851127210, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070925309292671, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300580294698, code=grayFlag, value=0, createTime=1793851127221, updateTime=1793851127221, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070925254766712, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300580294698, code=logo, value=https://castjournals.cast.org.cn/joweb/jsjyjyfz/EN/file/pic?fileId=U27tDsy717YF7XSPA+Vwdw==, createTime=1793851127208, updateTime=1793851127208, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070925326069889, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300580294698, code=minRunFlag, value=0, createTime=1793851127225, updateTime=1793851127225, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070925279932539, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300580294698, code=picServerUrl, value=https://castjournals.cast.org.cn/joweb/jsjyjyfz/EN/file/pic, createTime=1793851127214, updateTime=1793851127214, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070925317681280, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300580294698, code=silenceFlag, value=0, createTime=1793851127223, updateTime=1793851127223, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070925271543930, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300580294698, code=staticResourcePath, value=https://castjournals.cast.org.cn/joweb/cast_kjdb_en_623/, createTime=1793851127212, updateTime=1793851127212, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070925292515453, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300580294698, code=themeColor, value=null, createTime=1793851127217, updateTime=1793851127217, creator=18614031015, updator=18614031015), WebsiteProps(id=1325070925300904062, tenantId=1146029695717560320, journalId=null, journalGroupId=null, siteId=1325070300580294698, code=themeStyle, value=null, createTime=1793851127219, updateTime=1793851127219, creator=18614031015, updator=18614031015)])], journalTitle=计算机研究与发展, weixinUrl=null, journalUrl=https://crad.ict.ac.cn/, iacademicId=null, status=1, seqNo=null, journalTitleEn=Journal of Computer Research and Development, journalPhotoCn=k2l8zgqwstuxxevFX2qxVA==, journalPhotoEn=r6k0Ry+RD+c/VXj5QarmDw==, journalFirstLetter=J, journalRecommend=null, journalNew=null, journalCollection=null, jcrJf=null, cjcrJf=null, jcrJfStr=null, cjcrJfStr=null, submissionFirstDecision=null, sciSubjectClassification=null, casSubjectClassification=null, citeScore=null, totalCitationFrequency=null, icpCode=null, psCode=null, advertisingLicenseCode=null, copyrightInformation=null, country=null, option=, provinceCode=null, provinceName=null, collectFlag=false, interPubPlatform=, interPubPlatformUrl=null), detailUrlCn=https://castjournals.cast.org.cn/joweb/jsjyjyfz/CN/10.7544/issn1000-1239.202330730, detailUrlEn=https://castjournals.cast.org.cn/joweb/jsjyjyfz/EN/10.7544/issn1000-1239.202330730, pdfUrlCn=https://castjournals.cast.org.cn/joweb/jsjyjyfz/CN/PDF/10.7544/issn1000-1239.202330730, pdfUrlEn=https://castjournals.cast.org.cn/joweb/jsjyjyfz/EN/PDF/10.7544/issn1000-1239.202330730, aliStartDate=0, aliEndDate=0, collectionFlag=false, citedCount=null, citedUrl=null, previewStatus=0, delFlag=0, hasFullText=1, orderTime=1706803200000, fullTextJson=null, articleText=null, reference=null)
收藏切换
基于分层表示和上下文增强的类摘要生成技术
陈豪伶 , 虞慧群 * , 范贵生 , 李明辰 , 黄子杰
计算机研究与发展 | 生成式AI与软件自动化专题 2024,61(2): 307-323
收起
收藏切换
计算机研究与发展 |生成式AI与软件自动化专题 2024 , 61 (2) : 307 -323
基于分层表示和上下文增强的类摘要生成技术
全屏
[Author(id=1329455846540554316, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, orderNo=0, firstName=null, middleName=null, lastName=null, nameCn=null, orcid=null, stid=null, country=null, authorPic=null, dead=0, email=hlchen@mail.ecust.edu.cn, emailSecond=null, emailThird=null, correspondingAuthor=0, authorType=1, ext={EN=AuthorExt(id=1329455846624440398, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846540554316, language=EN, stringName=Haoling Chen, firstName=Haoling, middleName=null, lastName=Chen, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237, bio={"content":"

born in 1999. Master candidate. Student member of CCF. Her main research interests include automatic code summarization and program comprehension

"}, bioImg=null, bioContent=

born in 1999. Master candidate. Student member of CCF. Her main research interests include automatic code summarization and program comprehension

, aboutCorrespAuthor=null), CN=AuthorExt(id=1329455846683160655, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846540554316, language=CN, stringName=陈豪伶, firstName=null, middleName=null, lastName=null, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1华东理工大学计算机科学与工程系 上海 200237, bio={"img":"Vym2dwtjYq+CUEaNu9HoGA==","content":"

1999年生. 硕士研究生. CCF学生会员. 主要研究方向为代码自动摘要、程序理解

"}, bioImg=Vym2dwtjYq+CUEaNu9HoGA==, bioContent=

1999年生. 硕士研究生. CCF学生会员. 主要研究方向为代码自动摘要、程序理解

, aboutCorrespAuthor=null)}, companyList=[AuthorCompany(id=1329455846444085320, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, xref=1, ext=[AuthorCompanyExt(id=1329455846456668233, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=EN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237), AuthorCompanyExt(id=1329455846465056842, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=CN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1华东理工大学计算机科学与工程系 上海 200237)])]), Author(id=1329455846767046737, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, orderNo=1, firstName=null, middleName=null, lastName=null, nameCn=null, orcid=null, stid=null, country=null, authorPic=null, dead=0, email=yhq@ecust.edu.cn, emailSecond=null, emailThird=null, correspondingAuthor=1, authorType=1, ext={EN=AuthorExt(id=1329455846842544211, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846767046737, language=EN, stringName=Huiqun Yu, firstName=Huiqun, middleName=null, lastName=Yu, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=*, address=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237, bio={"content":"

born in 1967. PhD, professor, PhD supervisor. Senior member of CCF. His main research interests include software engineering, trusted computing, cloud computing, and formal methods

"}, bioImg=null, bioContent=

born in 1967. PhD, professor, PhD supervisor. Senior member of CCF. His main research interests include software engineering, trusted computing, cloud computing, and formal methods

, aboutCorrespAuthor=null), CN=AuthorExt(id=1329455846909653076, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846767046737, language=CN, stringName=虞慧群, firstName=null, middleName=null, lastName=null, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=*, address=1华东理工大学计算机科学与工程系 上海 200237, bio={"img":"MByucvCqVjMbvnsE/DohFg==","content":"

1967年生. 博士,教授,博士生导师. CCF高级会员. 主要研究方向为软件工程、可信计算、云计算、形式化方法

"}, bioImg=MByucvCqVjMbvnsE/DohFg==, bioContent=

1967年生. 博士,教授,博士生导师. CCF高级会员. 主要研究方向为软件工程、可信计算、云计算、形式化方法

, aboutCorrespAuthor=null)}, companyList=[AuthorCompany(id=1329455846444085320, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, xref=1, ext=[AuthorCompanyExt(id=1329455846456668233, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=EN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237), AuthorCompanyExt(id=1329455846465056842, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=CN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1华东理工大学计算机科学与工程系 上海 200237)])]), Author(id=1329455846972567638, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, orderNo=2, firstName=null, middleName=null, lastName=null, nameCn=null, orcid=null, stid=null, country=null, authorPic=null, dead=0, email=null, emailSecond=null, emailThird=null, correspondingAuthor=0, authorType=1, ext={EN=AuthorExt(id=1329455847043870808, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846972567638, language=EN, stringName=Guisheng Fan, firstName=Guisheng, middleName=null, lastName=Fan, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237, bio={"content":"

born in 1980. PhD, associate research fellow, PhD supervisor. Member of CCF. His main research interests include software engineering, service computing, and software architecture analysis techniques

"}, bioImg=null, bioContent=

born in 1980. PhD, associate research fellow, PhD supervisor. Member of CCF. His main research interests include software engineering, service computing, and software architecture analysis techniques

, aboutCorrespAuthor=null), CN=AuthorExt(id=1329455847115173977, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455846972567638, language=CN, stringName=范贵生, firstName=null, middleName=null, lastName=null, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1华东理工大学计算机科学与工程系 上海 200237, bio={"img":"fJO8obNlgnD9dZH2XbmYwQ==","content":"

1980年生. 博士,副研究员,博士生导师. CCF会员. 主要研究方向为软件工程、服务计算、软件架构分析技术

"}, bioImg=fJO8obNlgnD9dZH2XbmYwQ==, bioContent=

1980年生. 博士,副研究员,博士生导师. CCF会员. 主要研究方向为软件工程、服务计算、软件架构分析技术

, aboutCorrespAuthor=null)}, companyList=[AuthorCompany(id=1329455846444085320, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, xref=1, ext=[AuthorCompanyExt(id=1329455846456668233, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=EN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237), AuthorCompanyExt(id=1329455846465056842, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=CN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1华东理工大学计算机科学与工程系 上海 200237)])]), Author(id=1329455847186477147, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, orderNo=3, firstName=null, middleName=null, lastName=null, nameCn=null, orcid=null, stid=null, country=null, authorPic=null, dead=0, email=null, emailSecond=null, emailThird=null, correspondingAuthor=0, authorType=1, ext={EN=AuthorExt(id=1329455847261974621, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455847186477147, language=EN, stringName=Mingchen Li, firstName=Mingchen, middleName=null, lastName=Li, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237, bio={"content":"

born in 1998. PhD candidate. His main research interests include automatic code summarization and program comprehension

"}, bioImg=null, bioContent=

born in 1998. PhD candidate. His main research interests include automatic code summarization and program comprehension

, aboutCorrespAuthor=null), CN=AuthorExt(id=1329455847324889182, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455847186477147, language=CN, stringName=李明辰, firstName=null, middleName=null, lastName=null, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1华东理工大学计算机科学与工程系 上海 200237, bio={"img":"BeXOFVBvv0ksIBTfM0XW7Q==","content":"

1998年生. 博士研究生. 主要研究方向为代码自动摘要、程序理解

"}, bioImg=BeXOFVBvv0ksIBTfM0XW7Q==, bioContent=

1998年生. 博士研究生. 主要研究方向为代码自动摘要、程序理解

, aboutCorrespAuthor=null)}, companyList=[AuthorCompany(id=1329455846444085320, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, xref=1, ext=[AuthorCompanyExt(id=1329455846456668233, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=EN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237), AuthorCompanyExt(id=1329455846465056842, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=CN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1华东理工大学计算机科学与工程系 上海 200237)])]), Author(id=1329455847421358176, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, orderNo=4, firstName=null, middleName=null, lastName=null, nameCn=null, orcid=null, stid=null, country=null, authorPic=null, dead=0, email=null, emailSecond=null, emailThird=null, correspondingAuthor=0, authorType=1, ext={EN=AuthorExt(id=1329455847496855650, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455847421358176, language=EN, stringName=Zijie Huang, firstName=Zijie, middleName=null, lastName=Huang, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237, bio={"content":"

born in 1994. PhD candidate. Student member of CCF. His main research interests include code smell, software quality assurance, program comprehension, and empirical software engineering

"}, bioImg=null, bioContent=

born in 1994. PhD candidate. Student member of CCF. His main research interests include code smell, software quality assurance, program comprehension, and empirical software engineering

, aboutCorrespAuthor=null), CN=AuthorExt(id=1329455847593324643, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, authorId=1329455847421358176, language=CN, stringName=黄子杰, firstName=null, middleName=null, lastName=null, prefix=null, suffix=null, authorComment=null, nameInitials=null, affiliation=null, department=null, xref=null, address=1华东理工大学计算机科学与工程系 上海 200237, bio={"img":"mAQiT1WiZ3qCeU5zFhLc/A==","content":"

1994年生. 博士研究生. CCF学生会员. 主要研究方向为代码异味、软件质量保障、程序理解、实证软件工程

"}, bioImg=mAQiT1WiZ3qCeU5zFhLc/A==, bioContent=

1994年生. 博士研究生. CCF学生会员. 主要研究方向为代码异味、软件质量保障、程序理解、实证软件工程

, aboutCorrespAuthor=null)}, companyList=[AuthorCompany(id=1329455846444085320, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, xref=1, ext=[AuthorCompanyExt(id=1329455846456668233, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=EN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237), AuthorCompanyExt(id=1329455846465056842, tenantId=1146029695717560320, journalId=1324759914146529478, articleId=1329455842283335722, companyId=1329455846444085320, language=CN, country=null, province=null, city=null, postcode=null, companyName=null, departmentName=null, remark=1华东理工大学计算机科学与工程系 上海 200237)])])]
陈豪伶 , 虞慧群* , 范贵生, 李明辰, 黄子杰
作者信息
  • 1华东理工大学计算机科学与工程系 上海 200237
通讯作者:
虞慧群()
作者简介:

1999年生. 硕士研究生. CCF学生会员. 主要研究方向为代码自动摘要、程序理解

1967年生. 博士,教授,博士生导师. CCF高级会员. 主要研究方向为软件工程、可信计算、云计算、形式化方法

1980年生. 博士,副研究员,博士生导师. CCF会员. 主要研究方向为软件工程、服务计算、软件架构分析技术

1998年生. 博士研究生. 主要研究方向为代码自动摘要、程序理解

1994年生. 博士研究生. CCF学生会员. 主要研究方向为代码异味、软件质量保障、程序理解、实证软件工程

Class Summarization Generation Technology Based on Hierarchical Representation and Context Enhancement
Haoling Chen , Huiqun Yu* , Guisheng Fan, Mingchen Li, Zijie Huang
Affiliations
  • 1Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237
  • born in 1999. Master candidate. Student member of CCF. Her main research interests include automatic code summarization and program comprehension

    born in 1967. PhD, professor, PhD supervisor. Senior member of CCF. His main research interests include software engineering, trusted computing, cloud computing, and formal methods

    born in 1980. PhD, associate research fellow, PhD supervisor. Member of CCF. His main research interests include software engineering, service computing, and software architecture analysis techniques

    born in 1998. PhD candidate. His main research interests include automatic code summarization and program comprehension

    born in 1994. PhD candidate. Student member of CCF. His main research interests include code smell, software quality assurance, program comprehension, and empirical software engineering

出版时间: 2024-02-02 doi: 10.7544/issn1000-1239.202330730
文章导航
收藏切换

代码摘要是源代码的自然语言解释,高质量的代码摘要有助于提高开发人员程序理解效率. 近年来,代码自动摘要的研究集中在为方法粒度的代码片段生成摘要. 然而,对于面向对象的语言,例如Java,类才是项目的基本组成单元. 基于上述问题,提出一种基于分层表示和上下文增强的类摘要生成方法HRCE(hierarchical representation and context enhancement),并构建了一个包含358992个$\langle $Java类,上下文,摘要$\rangle $数据对的类摘要数据集. HRCE使用代码精简策略去除类的非关键代码,从而缩短代码长度. 然后,对类的层次结构,包括类签名、属性和方法分别进行建模,获得类的语义信息和层次结构信息. 此外,从项目中抽取父类的签名及摘要来刻画类在项目中依赖的上下文. 实验表明,基于分层表示和上下文增强的类摘要生成模型能够表征代码的语义和层次结构,并可以从目标类的内部和外部获取信息. HRCE在BLEU,METEOR,ROUGE-L等评估指标上超过了所有基准模型.

代码自动摘要  /  分层表示  /  上下文增强  /  深度学习  /  类摘要

Code summarization is a natural language description of source code, and high-quality code summaries help to improve developers’ program understanding efficiency. In recent years, research on code summarization has focused on generating summaries for method-grained code snippet. However, in an object-oriented language such as Java, class is the basic programming unit. Due to the above problems, we propose a class summarization generation method based on hierarchical representation and context enhancement, called HRCE, as well as constructs a class summarization dataset containing 358992 pairs of <Java class, content, summary>. HRCE uses code simplification strategy to remove non-critical code of class to shorten the code length. Then, HRCE models the class hierarchy, including class signature, attribute and method respectively, to obtain the semantic information and hierarchical structure information of the class. In addition, HRCE selects parent’s class signature and class summary to describe the context that the class depends on in the project. Experiments show that a generative model for class summarization based on hierarchical representation and context enhancement is able to characterize the semantics and hierarchical structure of the code, and obtain information from both inside and outside of the target class. As a result, HRCE outperforms all baseline models on evaluation metrics such as BLEU, METEOR, ROUGE-L, etc.

automatic code summarization  /  hierarchical representation  /  context enhancement  /  deep learning  /  class summarization
陈豪伶, 虞慧群, 范贵生, 李明辰, 黄子杰. 基于分层表示和上下文增强的类摘要生成技术. 计算机研究与发展, 2024 , 61 (2) : 307 -323 . DOI: 10.7544/issn1000-1239.202330730
Haoling Chen, Huiqun Yu, Guisheng Fan, Mingchen Li, Zijie Huang. Class Summarization Generation Technology Based on Hierarchical Representation and Context Enhancement[J]. Journal of Computer Research and Development, 2024 , 61 (2) : 307 -323 . DOI: 10.7544/issn1000-1239.202330730
研究表明,在软件的开发和维护的过程中,软件工程师需要花费59%的时间在程序理解上[1]. 代码摘要可以帮助软件开发人员快速理解代码. 但是,由于项目工期紧,开发人员将主要精力花费在编程上,代码摘要编写工作往往被忽视. 代码自动摘要类似于机器翻译,可以为源码自动生成自然语言描述,节省手工编写摘要的时间,提高软件开发效率. 早期的代码自动摘要主要采用基于模板[2-7]和基于信息检索[8-11]的技术. 近年来,基于深度学习的方法被应用到代码自动摘要领域,并逐渐取代传统的方法.
然而,这些基于深度学习的代码自动摘要技术大都致力于为方法粒度的代码片段生成摘要[12]. 对面向对象的语言,例如Java语言,类才是项目的基本组成单元[13]. 与方法相比,类的结构更为复杂,代码量也更大. 因此,需要专门针对类摘要生成任务的深度学习模型. Li等人[14]提出的ClassSum将深度学习的方法应用到类摘要生成任务中,并构建了一个包含十几万个样本的类摘要数据集. ClassSum是一个基于多编码器的类摘要生成模型,使用2个编码器分别得到代码的token序列和CSBT序列的向量表征,再使用带有Switch网络的解码器在每个解码时间步动态地为2种代码表征分配权重,从而融合代码的语义和结构信息. 类的代码量较大,将整个类的源码作为输入对于编码器而言是一个极大的挑战. 因此,Li等人[14]创造性地提出了源代码精简策略,只保留类签名、属性和方法签名等关键信息,并使用精简后的代码生成CSBT序列.
尽管ClassSum融合了类的结构和语义信息,但未充分利用类的层次结构. ClassSum将抽象语法树(abstract syntax tree,AST)处理为CSBT序列,为保证编码效率对CSBT序列做截断处理,序列化和截断的操作一定程度上破坏了抽象语法树的结构,无法保留完整的层次结构. ClassSum的代码精简策略可以有效控制类的代码文本的长度,但是使用单个编码器编码精简后的类,输入序列的长度依旧很长. 当输入序列过长时,循环神经网络很难处理长程依赖问题,从而丢失较早时间步的特征[15]. 此外,使用的语料库缺乏上下文,而在实际的摘要编写过程中,开发人员往往高度依赖程序的上下文信息. 最后,基于深度学习的代码摘要模型由数据驱动,数据集的质量和规模将直接影响生成摘要的质量. 目前的数据集规模较小,模型在数据集上学习到的知识有限,一定程度上影响生成摘要的质量.
针对这些问题,本文提出了基于分层表示和上下文增强的类摘要生成方法,主要工作内容有3方面.
1)类包含明显的层次结构,可以分为3个层次:类签名、属性和方法. 为了快速理解项目,软件开发人员往往只阅读类签名、属性名和方法签名,很少关注方法的具体实现. 受此代码阅读习惯的启发,提出一种基于分层的方法来表征类. 该方法首先对语料库中的源代码作精简处理[14],每个类只保留它的签名、属性名和方法签名. 编码阶段,对类的层次结构建模,根据各层次的特点设计不同的编码器得到向量表征. 解码阶段,通过注意力机制和Switch网络融合每个层次的关键信息生成摘要. 代码分层表示,一方面能对类的层次结构建模,在编码—解码的过程中显示地利用类的层次结构,学习对类摘要生成具有重要作用的信息在各层次的分布情况. 另一方面,可以缩短每个编码器输入序列的长度,缓解长程依赖问题.
2)在数据集构造方面,采用从开源网站下载公开代码仓库的方法获得原始数据,并使用多种静态分析工具从代码仓库中提取类的源代码及其摘要. 同时,分析类之间的继承关系,将父类的签名及父类的摘要作为类的上下文,最终构建了一个包含上下文信息的类摘要数据集. 数据集共有358992个$\langle $Java类,上下文,摘要$\rangle $数据对.
3)数据集中的部分类继承了父类. 对于这些类,将父类的签名及父类的摘要作为上下文编码器的输入,从而引入类的上下文知识,使得模型可以同时从目标类的内部和外部获取信息,进一步提高这部分类的摘要生成质量. 对于没有父类的类,使用无实际意义的符号“$\langle $pad$\rangle $”填充上下文序列,模型只学习类的内部知识.
目前,深度学习已经成为代码摘要领域最主要的方法,本节对基于深度学习的代码摘要方法进行系统的归纳和阐述,包括基于文本和抽象语法树的代码摘要方法、基于层次结构建模的代码摘要方法、融合上下文信息的代码摘要方法. 近年来,大语言模型逐渐被应用到代码生成、代码理解等代码相关任务上,本节也对相关的工作进行介绍.
此类方法通常将代码的文本序列或AST节点序列输入到深度学习模型中,得到向量表征,再解码生成摘要.
Iyer等人[16]率先将深度学习的方法引入代码自动摘要领域,使用带有注意力机制的长短期记忆(long short-term memory,LSTM)神经网络,根据代码语言的token序列生成自然语言描述. 之后,基于深度神经网络的技术逐渐成为代码自动摘要生成领域的主流技术. Allamanis等人[17]使用卷积神经网络和注意力机制从源代码的token序列中提取局部特征,生成类似函数名的摘要.
代码是结构化的语言,其抽象语法树蕴含着丰富的结构信息,对摘要的生成具有重要作用. Hu等人[18]提出了一种基于结构的遍历(structure-based traversal, SBT),把抽象语法树扁平化为序列,并将SBT序列作为模型输入,学习程序语言的语义和结构信息.
通过代码的文本和抽象语法树可以分别得到语义和结构信息. Leclair等人[19]使用2个双向的GRU编码器分别编码源代码token序列和AST节点序列,得到源代码的2种表示,再通过一个带有注意力机制的解码器生成摘要. 研究人员开始思考如何更有效地融合语义和结构信息. Hu等人[20]提出了一个多编码器模型Hybrid-DeepCom,从源代码和抽象语法树中分别学习语义和结构信息,并使用一个混合注意力机制融合语义和结构信息. Zhou等人[21]提出的交换网络在每个解码时间步生成一个权重向量,从而有效地组合源代码和抽象语法树的表示.
此外,Ahmad等人[22]使用Transformer模型生成摘要. Alon等人[23]将源代码表示为AST中的一组路径,在解码时使用注意力机制选取相应的路径生成摘要. Zhou等人[24]将图神经网络应用到代码摘要生成任务,采用多头注意力机制学习AST节点的特征,并通过为其邻居节点分配不同的权重来聚合特征. 张世琨等人[25]将源码中的签名和API调用作为关键字,在解码阶段使用关键字来优化注意力权重的分配.
总之,基于文本和抽象语法树的代码摘要在建模时忽略了代码的层次结构,无法获得代码的层次知识.
源代码及其抽象语法树都具有明显的层次特点,基于层次结构建模的代码摘要方法可以获取代码的层次结构知识.
Zhou等人[26]注意到代码的分层特点,即token组成语句,语句组成代码片段的层次. 为了建模代码的层次结构,将抽象语法树和代码片段按照语句的粒度切分. 编码阶段,每个语句先使用token编码器和内部注意力机制得到token层次的代码表征,再经过语句编码器得到语句层次的向量表征,最后将这2个层次的表征拼接起来. Wang等人[27]将代码、控制流图以及类型增强的AST作为输入,采用分层编码为3个模态的输入建立token层次和语句层次的代码表征. Lin等人[28] 提出了一种基于块的AST分割方法,根据代码控制流图的支配树拆分代码,并为每个代码块生成一个AST. 然后,使用Tree-LSTM建模AST子树,将根节点的输出作为AST的语法嵌入. 最后,将所有AST的嵌入向量经过一个平均池化层,得到最终的全局向量表示,并将该向量表示与每个token的词嵌入拼接,作为Transformer的输入,解码生成摘要. Shi等人[29]以分层的方式拆分代码的AST,并根据子树的特点采用2阶段编码. 第1阶段使用基于树的递归神经网络和池化层得到每棵子树的向量表示,第2阶段使用另一个基于树的递归神经网络建模子树之间的层次关系,然后将抽象语法树和源码的表示一起输入到Transformer解码器中生成摘要.
总之,基于层次结构建模的代码摘要方法利用了代码的层次结构知识,一定程度上提升了摘要的质量,但是仅利用了目标代码的内部知识,未充分利用代码的上下文信息.
目前,大部分的代码摘要生成模型都在独立的代码摘要对上训练. 但在项目中,代码的功能需要通过项目本身以及它的上下文获取.
Mcburney等人[30]使用PageRank算法,并根据程序调用图确定函数的上下文,借助软件词语用例模型[31]从上下文中提取关键字,然后使用模板生成摘要. Yu等人[32]使用目标函数的局部和全局信息生成摘要. 首先,使用局部编码器从函数中获取语义信息. 然后为了获得函数的全局信息,将目标函数与所在类的其他函数连接起来,构成类级别的上下文图并使用图注意力网络得到目标函数类级别的表示. Wang等人[33]使用类内上下文信息和类间上下文信息丰富函数的语义信息. 根据目标函数所在类的类名挖掘函数与类的关系,通过UML类图得到所属类与其他类的关系,最后将这些上下文信息、源码和AST一同作为模型的输入. Haque等人[34]提出文件上下文的概念,即把同一个文件内的其他函数当作上下文,在编码阶段使用文件编码器获取函数的上下文信息. 此外,他们将目标方法的方法名作为关键字单独编码,并提出了动态词表机制缓解未登录词(out of vocabulary,OOV)问题. Bansal等人[35]抽取目标函数所在项目中的文件作为上下文,采用与Haque等人[34]相似的方式将文件中的方法转化为向量表示,再使用RNN编码器得到方法的最终表示,供解码阶段使用.
总之,融合上下文信息的代码摘要方法能够从目标代码的外部获取信息,提高生成摘要的质量.
近年来,BERT[36],GPT[37-39]等预训练语言模型在自然语言处理任务上取得了极大的成功. 最近的一些工作将预训练语言模型应用到编程语言上. Feng等人[40]提出的CodeBERT模型使用屏蔽语言建模和替换令牌检测2个任务进行预训练,可以捕获编程语言和自然语言之间的联系,并生成支持编程语言和自然语言理解任务的通用表示. Wang等人[41]基于Transformer构建了一个预训练的编码器-解码器模型CodeT5,并提出一种新的标识符感知的预训练任务. Guo等人[42]考虑到代码的结构特点提出了模型GraphCodeBERT,该模型引入2个结构感知的预训练任务,分别从源码和数据流中学习代码的表示.
由OpenAI开发的人工智能内容生成模型ChatGPT在机器翻译、文本生成、摘要编写等语言理解和生成任务上展现出强大的能力. OpenAI最新发布的GPT-4[43]能够处理文本和图像的输入,功能进一步增强. 近期也出现了一些针对代码相关任务的大模型. Chen等人[44]使用GitHub上公开的代码数据微调了一个基于GPT的代码大模型Codex. Meta发布的Code Llama[45]是基于Llama 2的开源大型代码语言模型,可以执行各种代码相关任务,例如代码生成、代码摘要生成. Code Llama在代码生成任务上的表现逼近GPT-4. WizardLM推出的WizardCoder[46]在Code Llama的基础上进行指令微调,在4个广泛认可的数据集上表现出优秀的代码生成能力.
编码器-解码器框架[47]是NMT领域的经典框架,其包括一个编码器和一个带有注意力机制的解码器. 对于代码摘要生成任务而言,编码器将输入的代码序列转换为向量表征,解码器则根据这个中间表示解码生成摘要,具体的执行过程有2个阶段:
1)编码阶段. 给定代码输入序列,首先经过一个词嵌入层,将输入序列转换为词嵌入向量序列${{{x}}} = ({{{\boldsymbol{x}}}_{1}}, {{{\boldsymbol{x}}}_{2}},…, {{{\boldsymbol{x}}}_{n}} )$. 再经过一个循环神经网络,将词嵌入序列的向量表征编码为一组连续的表示,得到代码的语义向量序列$ {{{h}}} = ( {{{\boldsymbol{h}}}_{1}},{{{\boldsymbol{h}}}_{2}},…,{{{\boldsymbol{h}}}_{n}}) $:
$ {{{\boldsymbol{h}}}_{t}} = {f_{\rm{enc}}}({{{\boldsymbol{x}}}_{t}},{{{\boldsymbol{h}}}_{{t - 1}}}) \text{,} $
其中${f_{\rm{enc}}}$是一个RNN编码器,编码器的输出${{{\boldsymbol{h}}}_{t}}$由当前编码时间步的输入${{{\boldsymbol{x}}}_{t}}$和上一时刻的输出${{{\boldsymbol{h}}}_{{t - 1}}}$共同决定.
2)解码阶段. 解码器根据中间表示h以及之前的解码结果预测目标序列下一个token的概率分布:
$ p({y_t}|{{{\boldsymbol{y}}}_{{ < t}}},{{\boldsymbol{x}}}) = softmax (g({{{\boldsymbol{s}}}_{t}},{{{\boldsymbol{c}}}_{t}}))\text{,} $
其中解码器通常为单向的RNN,$g$是一个概率估计函数,${{{\boldsymbol{s}}}_{t}}$是解码器时刻$t$的隐藏状态. 解码器使用注意力机制计算出背景向量${{{\boldsymbol{c}}}_{t}}$:
$ {{{\boldsymbol{c}}}_{t}} = \sum\limits_{i = 1}^n {{\alpha _{ti}}{{{\boldsymbol{h}}}_{i}}} . $
解码器当前状态$ {{{\boldsymbol{s}}}_{t}} $在编码器第$i$个输出${{{\boldsymbol{h}}}_{i}}$上的注意力权重${\alpha _{ti}}$计算公式为:
$ {\alpha _{ti}} = \frac{{\exp ({e_{ti}})}}{{\displaystyle\sum\limits_{k = 1}^n {\exp ({e_{tk}})} }} \text{,} $
$ {e_{ti}} = a({{{\boldsymbol{s}}}_{t}},{{{\boldsymbol{h}}}_{i}}) = {{\boldsymbol{s}}}_{t}^{{\mathrm{T}}}{{{\boldsymbol{W}}}_{a}}{{{\boldsymbol{h}}}_{i}} \text{,} $
其中$a$是对齐得分函数,用于计算${{{\boldsymbol{s}}}_{t}}$和${{{\boldsymbol{h}}}_{i}}$的匹配程度.
LSTM神经网络[48]引入记忆细胞的结构,有效缓解了普通循环神经网络难以处理的长程依赖问题. LSTM通过遗忘门决定上一个细胞状态中需要被遗忘的内容,通过输入门决定当前时刻输入中需要被保留的内容,并根据遗忘门和输入门更新记忆细胞状态. 最后,通过细胞状态和输出门计算输出信号. LSTM的结构如图1所示.
具体的计算过程为:
$ {{{\boldsymbol{f}}}_t} = \sigma ({{{\boldsymbol{W}}}_{\boldsymbol{f}}}{{{\boldsymbol{x}}}_{t}} + {{{\boldsymbol{U}}}_{\boldsymbol{f}}}{{{\boldsymbol{h}}}_{{t - 1}}} + {{{\boldsymbol{b}}}_{\boldsymbol{f}}}) \text{,} $
$ {{{\boldsymbol{i}}}_{t}} = \sigma ({{{\boldsymbol{W}}}_{\boldsymbol{i}}}{{{\boldsymbol{x}}}_{t}} + {{{\boldsymbol{U}}}_{\boldsymbol{i}}}{{{\boldsymbol{h}}}_{{t - 1}}} + {{{\boldsymbol{b}}}_{\boldsymbol{i}}}) \text{,} $
$ \widetilde {{{{\boldsymbol{c}}}_{t}}} = \tanh ({{{\boldsymbol{W}}}_{\boldsymbol{c}}}{{{\boldsymbol{x}}}_{t}} + {{{\boldsymbol{U}}}_{\boldsymbol{c}}}{{\boldsymbol{h}}_{{t - 1}}} + {{{\boldsymbol{b}}}_{\boldsymbol{c}}}) \text{,} $
$ {{{\boldsymbol{c}}}_{t}} = {{{\boldsymbol{f}}}_t} \odot {{{\boldsymbol{c}}}_{{t - 1}}} + {{{\boldsymbol{i}}}_{t}} \odot \widetilde {{{{\boldsymbol{c}}}_{t}}}\text{,} $
$ {{{\boldsymbol{o}}}_{t}} = \sigma ({{{\boldsymbol{W}}}_{\boldsymbol{o}}}{{{\boldsymbol{x}}}_{t}} + {{{\boldsymbol{U}}}_{\boldsymbol{o}}}{{{\boldsymbol{h}}}_{{t - 1}}} + {{{\boldsymbol{b}}}_{\boldsymbol{o}}}) \text{,} $
$ {{{\boldsymbol{h}}}_{t}} = {{{\boldsymbol{o}}}_{t}} \odot \tanh ({{{\boldsymbol{c}}}_{t}}) \text{,} $
其中,${{{\boldsymbol{x}}}_{t}}$是当前时刻的输入,${{{\boldsymbol{h}}}_{{t - 1}}}$是上一时刻的输出,${{{\boldsymbol{f}}}_{t}}$、${{{\boldsymbol{i}}}_{t}}$、${{{\boldsymbol{o}}}_{t}}$分别为遗忘门、输入门和输出门,${{{\boldsymbol{c}}}_{{t - 1}}}$、$ {{{\boldsymbol{c}}}_{t}} $分别为上一时刻和当前时刻的细胞状态,$\sigma $是sigmoid激活函数.
Switch网络由Zhou等人[21]提出,Switch网络能有效融合代码的文本和抽象语法树的向量表征,提高代码摘要的生成质量. 考虑到解码器可能在每个解码时间步对不同模态的代码表征有偏好,Switch网络学习自适应权重向量,为各代码表征动态地分配权重.
给定源代码文本和抽象语法树的背景向量$ {{\boldsymbol{c}}}_{t}^{\rm{lex}} $,$ {{\boldsymbol{c}}}_{t}^{\rm{AST}} $,Switch网络根据解码器的隐藏状态${{{\boldsymbol{s}}}_{t}}$计算一个权重向量${{\boldsymbol{p}}} \in {{{\mathbb{R}}}^{d}}$:
$ {{\boldsymbol{p}}} = \delta ({{{\boldsymbol{w}}}_{\boldsymbol{p}}}{{{\boldsymbol{s}}}_{t}} + {{{\boldsymbol{b}}}_{\boldsymbol{p}}})\text{,} $
其中,$\delta $是激活函数,用于确保${{\boldsymbol{p}}}$中每个维度的值在$[0,1]$区间内. 最终的背景向量表示${{{\boldsymbol{c}}}_{t}}$由$ {{\boldsymbol{c}}}_{t}^{\rm{lex}} $和$ {{\boldsymbol{c}}}_{t}^{\rm{AST}} $的加权平均值经过一个非线性激活函数得到:
$ {{{\boldsymbol{c}}}_{t}} = \tanh ({{\boldsymbol{p}}} \otimes {{\boldsymbol{c}}}_{t}^{\rm{lex}} + (1 - {{\boldsymbol{p}}}) \otimes {{\boldsymbol{c}}}_{t}^{\rm{AST}} ) . $
本节详细介绍基于分层表示和上下文增强的类摘要生成模型的架构HRCE(hierarchical representation and context enhancement). HRCE能有效表征类的代码文本,提取语义信息和层次结构信息,同时从父类及其相应的摘要中获取类的上下文语义. 利用类的内部和外部的知识,解码得到类功能的自然语言描述. HRCE的整体架构如图2所示,它是一个多编码器-解码器模型,包括分层编码器、上下文编码器和联合解码器3部分.
模型的输入为类签名、属性名、方法签名和由父类的签名及父类摘要组成的上下文,输出为生成的摘要. HRCE采用导师驱动(teacher forcing)的训练方式,在模型训练阶段,解码器的输入为参考摘要,从而最大化摘要中真实token的概率,加快模型收敛速度. 测试阶段,模型无法看到参考摘要,解码器的输入为上一时刻的预测结果.
分层编码器由3个独立的子编码器组成:类签名编码器、属性名编码器和方法签名编码器,分别用于提取类签名、属性名和方法签名中的语义信息,并对类的层次结构建模.
规范的类签名能反映一个类的大致功能,是编写摘要的重要依据[49]. 然而,以往的工作通常将整个代码段的token序列输入到编码器中,过长的输入使得神经网络难以处理长程依赖,从而遗忘前面输入的特征. 为了解决这个问题,本文用一个单独的编码器编码类签名,尽可能多地保留其语义特征.
类签名编码器使用一个双向的LSTM.给定类签名token序列的嵌入向量序列$ {{{x}}_{\rm{cs}}} = ( {{{\boldsymbol{x}}_{1}},{{\boldsymbol{x}}_{2}}, … ,{{\boldsymbol{x}}_{n}}}) $. 在每个时刻$t$编码一个词向量${{\boldsymbol{x}}_{t}}$,得到隐藏状态:
$ \overrightarrow {{{\boldsymbol{h}}_{t}}} ,\overleftarrow {{{\boldsymbol{h}}_{t}}} = f({{\boldsymbol{x}}_{t}},{{\boldsymbol{s}}_{{t - 1}}}) \text{,} $
其中$ \overrightarrow {{{\boldsymbol{h}}_{t}}} $是前向隐藏状态,$ \overleftarrow {{{\boldsymbol{h}}_{t}}} $是反向隐藏状态,将2个方向的输出连接得到最终的隐藏状态表示$ {\boldsymbol{h}}_{t}^{\rm{cs}} $:
$ {\boldsymbol{h}}_{t}^{\rm{cs}}= [\overrightarrow {{{\boldsymbol{h}}_{t}}} ,\overleftarrow {{{\boldsymbol{h}}_{t}}} ] . $
属性名编码器由双向的LSTM和内部注意力机制组成. 给定一组属性名$ attrs_{ }=\left\{attr_1,attr_2,\dots,attr_n\right\} $,经分词处理后,每个属性名都被拆分为若干个token,即$ attr_i = \left\{ {toke{n_1},toke{n_2}, … ,toke{n_n}} \right\} $. $ attr $经过词嵌入层转换为词嵌入向量序列$ {{x}}_{i}^{\rm{attr}} =( {{{\boldsymbol{x}}_{{i1}}},{{\boldsymbol{x}}_{{i2}}}, … ,{{\boldsymbol{x}}_{{il}}}} )$,再通过LSTM编码为隐藏表示序列$ {{h}}_{i}^{\rm{attr}} = ( {{\boldsymbol{h}}_{{i1}}^{\rm{attr}},{\boldsymbol{h}}_{{i2}}^{\rm{attr}}, … ,{\boldsymbol{h}}_{{il}}^{\rm{attr}}}) $. 图3展示了属性名的编码过程.
考虑到每个token对属性名的表示贡献不同,使用一个注意力层提取关键信息,得到属性名的最终表示. 为了与解码器的注意力机制区分,称这个注意力为内部注意力[26]:
$ {{{\boldsymbol{u}}}_{{ij}}} = \tanh ({{{\boldsymbol{w}}}_{\boldsymbol{u}}}{\boldsymbol{h}}_{{ij}}^{\rm{attr}} + {{{\boldsymbol{b}}}_{\boldsymbol{u}}}) \text{,} $
$ {\alpha _{ij}} = \frac{{\exp ({\boldsymbol{u}}_{{ij}}^{\rm{T}}{{\boldsymbol{u}}_{x}})}}{{\displaystyle\sum\limits_{j = 1}^l {\exp ({\boldsymbol{u}}_{{ij}}^{\rm{T}}{{\boldsymbol{u}}_{x}})} }} \text{,} $
$ {{{\boldsymbol{k}}}_{i}} = \sum\limits_{j = 1}^l {{\alpha _{ij}}{\boldsymbol{h}}_{{ij}}^{\rm{attr}}} \text{,} $
其中,$ {{\boldsymbol{w}}_{\boldsymbol{u}}} $和$ {{\boldsymbol{b}}_{\boldsymbol{u}}} $分别为参数矩阵和偏置值,$ {\alpha _{ij}} $是归一化的权重. $ {{\boldsymbol{u}}_{x}} $是通过联合学习得到的背景向量,用于选择token. $ {{\boldsymbol{k}}_{i}} $是属性名最终的表示,一组属性名的语义向量序列可表示为$ {{{{k}}}^{\rm{attr}}} =( {{{\boldsymbol{k}}_{1}},{{\boldsymbol{k}}_{2}}, … ,{{\boldsymbol{k}}_{n}}} ) $.
与类签名编码器类似,方法签名编码器也是一个双向的LSTM.给定方法签名token序列的词嵌入向量序列$ {{{x}}_{\rm{ms}}} = ({{{\boldsymbol{x}}_{1}},{{\boldsymbol{x}}_{2}}, … ,{{\boldsymbol{x}}_{n}}}) $. 每个时刻$t$,编码一个词向量${{\boldsymbol{x}}_{t}}$,得到其隐藏状态 :
$ \overrightarrow {{{\boldsymbol{h}}_{t}}} ,\overleftarrow {{{\boldsymbol{h}}_{t}}} = f({{\boldsymbol{x}}_{t}},{{\boldsymbol{s}}_{{t - 1}}}) \text{,} $
其中$ \overrightarrow {{{\boldsymbol{h}}_{t}}} $是前向隐藏状态,$ \overleftarrow {{{\boldsymbol{h}}_{t}}} $是反向隐藏状态,将2个方向的输出连接,得到方法签名的最终的隐藏状态表示${\boldsymbol{h}}_{t}^{\rm{ms}}$:
$ {\boldsymbol{h}}_{t}^{\rm{ms}} = [\overrightarrow {{{\boldsymbol{h}}_{t}}} ,\overleftarrow {{{\boldsymbol{h}}_{t}}} ] . $
本文将父类的类签名及父类的摘要作为上下文,挖掘父类的类签名及父类的摘要中包含的语义信息,上下文编码器是一个双向的LSTM.给定上下文符号序列的嵌入向量序列$ {{{x}}_{\rm{cnt}}} = ( {{{\boldsymbol{x}}_{1}},{{\boldsymbol{x}}_{2}}, … ,{{\boldsymbol{x}}_{n}}} )$,经神经网络编码后得到隐藏表示序列$ {{{{h}}}^{\rm{cnt}}} = ({{\boldsymbol{h}}_{1}^{\rm{cnt}},{\boldsymbol{h}}_{2}^{\rm{cnt}}, … ,{\boldsymbol{h}}_{n}^{\rm{cnt}}} ) $.
联合解码器在解码过程中同时关注源代码表示和上下文表示,由单向LSTM、注意力机制和Switch网络[21]组成.
类签名中包含丰富的语义信息,因此使用类签名编码器的语义向量初始化解码器. 在每一个解码时间步,计算源代码的环境向量(context vector)和上下文的环境向量.
源代码经分层编码器编码后得到类签名、属性名和方法签名的隐藏状态序列${{{h}}^{\rm{cs}}}$、${{{k}}^{\rm{attr}}}$、${{{h}}^{\rm{ms}}}$. 使用注意力机制分别从这3部分中提取关键信息. 公式有:
$ {\boldsymbol{c}}_{{t}}^{\rm{cs}}=\sum _{j=1}^{L}{\alpha }_{tj}^{\rm{cs}}{{{\boldsymbol{h}}}}_{{j}}^{\rm{cs}} {,} $
$ {\boldsymbol{c}}_{{t}}^{\rm{attr}}=\displaystyle\sum\limits _{j=1}^{L}{\alpha }_{tj}^{\rm{attr}}{{{\boldsymbol{k}}}}_{{j}}^{\rm{attr}} {,} $
$ {\boldsymbol{c}}_{{t}}^{\rm{ms}}=\sum _{j=1}^{L}{\alpha }_{tj}^{\rm{ms}}{{{\boldsymbol{h}}}}_{{j}}^{\rm{ms}} {,} $
其中,$ \alpha _{tj}^{\rm{cs}} $,$ \alpha _{tj}^{attr} $,$ \alpha _{tj}^{\rm{cs}} $分别是编码器隐藏状态$ {\boldsymbol{h}}_{j}^{\rm{cs}}$,$ {\boldsymbol{k}}_{j}^{\rm{attr}} $,$ {\boldsymbol{h}}_{j}^{\rm{ms}} $在时刻$t$的注意力权重系数,计算公式有:
$ {\alpha }_{tj}^{\rm{cs}}=\frac{\mathrm{exp}\left({{{\boldsymbol{s}}}}_{{t}}{{{\boldsymbol{W}}}}^{\rm{cs}}{{{\boldsymbol{h}}}}_{{j}}^{\rm{cs}}\right)}{\displaystyle\sum\limits _{j=1}^{L}\mathrm{exp}\left({{{\boldsymbol{s}}}}_{{t}}{{{\boldsymbol{W}}}}^{\rm{cs}}{{{\boldsymbol{h}}}}_{{j}}^{\rm{cs}}\right)} {,} $
$ \alpha_{tj}^{\mathrm{attr}}=\frac{\mathrm{exp}\left(\boldsymbol{s}_t\boldsymbol{W}^{\rm{attr}}\boldsymbol{k}_j^{\rm{attr}}\right)}{\displaystyle\sum\limits_{j=1}^L\mathrm{exp}\left(\boldsymbol{s}_t\boldsymbol{W}^{\rm{attr}}\boldsymbol{k}_j^{\rm{attr}}\right)}, $
$ \alpha_{tj}^{\rm{ms}}=\frac{\mathrm{exp}\left(\boldsymbol{s}_t\boldsymbol{W}^{\rm{ms}}\boldsymbol{h}_j^{\rm{ms}}\right)}{\displaystyle\sum_{j=1}^L\mathrm{exp}\left(\boldsymbol{s}_t\boldsymbol{W}^{\rm{ms}}\boldsymbol{h}_j^{\rm{ms}}\right)}, $
其中$ {\boldsymbol{c}}_{t}^{\rm{cs}}$、$ {\boldsymbol{c}}_{t}^{\rm{attr}} $和$ {\boldsymbol{c}}_{t}^{\rm{ms}} $的维度不同,通过线性变换将它们转换为相同的维度:
$ \widetilde {{\boldsymbol{c}}_{t}^{\rm{cs}}} = {\boldsymbol{W}}_{l}^{\rm{cs}}{\boldsymbol{c}}_{t}^{\rm{cs}}+ {{\boldsymbol{b}}_{\rm{cs}}} \text{,} $
$ \widetilde {{\boldsymbol{c}}_{t}^{\rm{attr}}} = {\boldsymbol{W}}_{l}^{\rm{attr}}{\boldsymbol{c}}_{t}^{\rm{attr}} + {{\boldsymbol{b}}_{\rm{attr}}} \text{,} $
$ \widetilde {{\boldsymbol{c}}_{t}^{\rm{ms}}} = {\boldsymbol{W}}_{l}^{\rm{ms}}{\boldsymbol{c}}_{t}^{\rm{ms}} + {{\boldsymbol{b}}_{\rm{ms}}} . $
对Switch网络[21]稍做改动,使其能够为3个环境向量生成注意力权重. 首先,根据解码器的隐藏状态$ {{\boldsymbol{s}}_{t}} $计算概率向量$ {{\boldsymbol{p}}^{\rm{cs}}} \in {\mathbb{R}^{d}} $:
$ {{\boldsymbol{p}}^{\rm{cs}}} = \delta \left( {{{\boldsymbol{W}}_{\rm{cs}}}{{\boldsymbol{s}}_{t}} + {{\boldsymbol{b}}_{\rm{cs}}}} \right) \text{,} $
其中$ {{\boldsymbol{p}}^{\rm{cs}}} $是环境向量$ \widetilde {{\boldsymbol{c}}_{t}^{\rm{cs}}} $的权重,$ \delta $是一个激活函数,确保向量$ {{\boldsymbol{p}}^{\rm{cs}}} $的每一个维度的值都在$[0,1]$区间内.
向量${{\boldsymbol{p}}}$为环境向量$ \widetilde {{\boldsymbol{c}}_{t}^{\rm{attr}}} $和$ \widetilde {{\boldsymbol{c}}_{t}^{\rm{ms}}} $的权重向量之和:
$ {{\boldsymbol{p}}} = 1 - {{\boldsymbol{p}}^{\rm{cs}}} . $
根据${{\boldsymbol{p}}}$和$ {{\boldsymbol{s}}_{t}} $分别计算环境向量$ \widetilde {{\boldsymbol{c}}_{t}^{\rm{attr}}} $的权重$ {{\boldsymbol{p}}^{\rm{attr}}} $和环境向量$ \widetilde {{\boldsymbol{c}}_{t}^{\rm{ms}}} $的权重$ {{\boldsymbol{p}}^{\rm{ms}}} $:
$ {{\boldsymbol{w}}_{\rm{attr}}} = \delta \left( {{{\boldsymbol{W}}_{\rm{attr}}}{{\boldsymbol{s}}_{t}} + {{\boldsymbol{b}}_{\rm{attr}}}} \right) \text{,} $
$ {{\boldsymbol{p}}^{\rm{attr}}} = {{{\boldsymbol{w}}}^{\rm{attr}}}{{\boldsymbol{p}}} \text{,} $
$ {{\boldsymbol{p}}^{\rm{ms}}} = {{\boldsymbol{p}}} - {{\boldsymbol{p}}^{\rm{attr}}} . $
源代码环境向量为$ \widetilde {{\boldsymbol{c}}_{t}^{\rm{cs}}} $、$ \widetilde {{\boldsymbol{c}}_{t}^{\rm{attr}}} $和$ \widetilde {{\boldsymbol{c}}_{t}^{\rm{ms}}} $的加权和:
$ {\boldsymbol{c}}_{t}^{\rm{src}} = \tanh \left( {{{\boldsymbol{p}}^{\rm{cs}}} \otimes \widetilde {{\boldsymbol{c}}_{t}^{\rm{cs}}} + {{\boldsymbol{p}}^{\rm{attr}}} \otimes \widetilde {{\boldsymbol{c}}_{t}^{\rm{attr}}} + {{\boldsymbol{p}}^{\rm{ms}}} \otimes \widetilde {{\boldsymbol{c}}_{t}^{\rm{ms}}}} \right) . $
上下文环境向量$ {\boldsymbol{c}}_{t}^{\rm{cnt}} $的计算与式(21)和式(24)相同. 通过Switch网络得到源代码环境向量的权重$ {{\boldsymbol{p}}^{\rm{src}}} $和上下文环境向量的权重$ {{\boldsymbol{p}}^{\rm{cnt}}} $. 最终的环境向量为:
$ \boldsymbol{c}_t=\tanh\left(\boldsymbol{p}^{\rm{src}}\otimes\boldsymbol{c}_t^{\rm{src}}+\boldsymbol{p}^{\rm{cnt}}\otimes\boldsymbol{c}_t^{\rm{cnt}}\right)\text{.} $
最后,根据解码器的隐藏状态${{\boldsymbol{s}}_{t}}$和环境向量${{\boldsymbol{c}}_{t}}$,计算下一个单词的概率分布:
$ p\left( {{y_t}\mid {{{\boldsymbol{y}}}_{{ < t}}},{{\boldsymbol{x}}}} \right) = softmax\left( {{{\boldsymbol{W}}_{{\boldsymbol{s}}}}\tanh \left( {{{\boldsymbol{W}}_t}\left[ {{{\boldsymbol{c}}_{t}};{{\boldsymbol{s}}_{t}}} \right]} \right)} \right) . $
从CodeSearchNet数据集中选取在Github上开源的Java代码仓库地址,成功下载4188个项目,采用与Li等人[14]相似的规则过滤项目,最终保留3955个Java项目. 对于每个Java项目,使用SrcML工具抽取项目中的类及其对应的Javadoc注释.Javadoc注释一般分为3个部分:第1部分简要描述类的功能,是一个摘要性的句子;第2部分用一句或者多句话详细描述类的作用;第3部分是特殊说明,包括版本说明、参数说明等. 因此,选取Javadoc的第一句话作为类的摘要. 此外,分析类之间的继承关系,将父类及其相应的摘要作为类的上下文. 最终得到358992个$\langle $Java类,上下文,摘要$\rangle $数据对.
对于数据集中的每个样本,删除类的属性类型和方法体,只保留类的签名、属性名和方法签名. 具体有3个步骤:
1)用SrcML将Java类转换为XML文件.
2)以深度优先搜索的方式遍历XML文件. 当遍历到方法或嵌套类时,根据$\langle $body$\rangle $标签删除其内部元素. 当遍历到属性定义时,根据$\langle $type$\rangle $标签删除属性类型.
3)从修改后的XML文件中获取类的签名、属性名和方法签名.
图4以一个Java类为例,展示代码的精简过程. 首先,将类的源码转换为XML文件. XML的结构较为复杂,为了清楚地展示类的精简过程,此处不改变XML文件的层级结构,但删减和修改了部分内容. 如图4(b)所示,$\langle $decl_stmt$\rangle $标签的内容是属性定义,包括属性的类型和名称,它根据$\langle $type$\rangle $标签删除属性类型.$\langle $function$\rangle $标签内是方法的定义,通过$\langle $body$\rangle $标签删除方法体. 当删除类的所有的属性类型和方法体后,得到一个新的XML文件,从此文件生成代码精简后的类.
统计代码精简后的数据集中类的属性名和方法签名的个数分布.结果如表1和表2所示,85%的类的属性名个数不超过5,88%的类的方法签名个数不超过15. 方法签名编码器和属性名编码器的输入序列分别由类的方法签名和属性名拼接而成,考虑到编码效率为属性名个数超过5的类,随机保留5个属性;为方法签名个数超过15的类,随机保留15个方法签名. 随机保留机制确保类中的每个属性名和方法签名都有同等被选中的概率,是综合考虑编码效率和语义保留后采取的方法. 数据集中的少量样本会因为舍弃部分属性和方法签名丢失语义信息,但若不对这部分样本做处理,编码器同样会因为输入序列过长丢失语义信息,导致编码效率下降. 例如:数据集中类最多包含1787个方法,而方法签名的平均长度为8个token,拼接而成的序列长度近2万个token.
对类各层次的代码片段以及类摘要作分词和截断处理. 根据驼峰和蛇形命名规则拆分代码中的组合词,并将所有的token转化为小写,从而降低未登录词的比例. 统计分词后的类签名、属性名、方法签名和上下文的序列长度,结果如表3所示. 考虑到编码效率,对类各层次的代码序列作截断处理,使得类签名的长度不超过20个token,每个属性名的长度不超过5个token,每个方法签名的长度不超过15个token. 借助NLTK对类摘要做分词处理,根据表3的长度统计结果,将长度超过20个token的摘要序列截断.
对由父类的签名和摘要拼接而成的上下文序列也做截断处理,确保上下文序列的长度不超过20个token.对于没有父类的类,使用无实际意义的符号〈pad〉填充上下文序列.
将预处理后的数据集按照7∶1∶1∶1的比例划分为训练集、验证集、混项目测试集和跨项目测试集. 首先,随机选取一部分项目,使得这些项目包含的样本量占数据总量的10%,并把这部分数据作为跨项目测试集. 剩余的数据按照既定的混项目比例随机划分为训练集、验证集和混项目测试集. 数据集的划分情况如表4所示.
本文选用7个基准模型与HRCE做效果对比. 其中4个是经典的方法摘要生成模型,选用这4个模型的原因有2点: 1)这些基准模型将代码文本的token序列或抽象语法树节点序列输入到编码器-解码器框架,生成代码的自然语言描述. 类的源码同样可以处理为token序列和抽象语法树节点序列,因此这些模型也能生成类摘要. 2)HRCE致力于学习类的语义和结构信息以及缓解长程依赖问题,这些基准模型的设计也是为了解决这些问题,可以检验HRCE的有效性. 基准模型ClassSum是首个基于深度学习的类摘要生成模型. 近年来,大语言模型表现出了优秀的代码理解能力,本文选用CodeBERT和Code Llama这2种不同类型的大语言模型来评估它们在类摘要生成任务上的表现. 下面详细介绍7种基准模型的原理:
1)CodeNN[16]. CodeNN是一个端到端的数据驱动的代码摘要生成模型,使用带有注意力机制的LSTM解码器,直接从源代码token序列的词嵌入向量生成摘要.
2)SBT[18]. SBT是一种抽象语法树遍历方法. 在对抽象语法树进行前序遍历时,为每个子树添加一对括号. 该遍历方式保证可以从SBT序列恢复到原始的抽象语法树,能够较好地保留代码的结构信息.
3)AST-attendgru[19]. AST-attengru是一个基于GRU的编码器-解码器模型,该模型使用2个编码器分别编码代码的token序列和SBT序列. 解码时使用注意力机制得到token序列和SBT序列的上下文向量,并通过拼接操作结合2个上下文向量同时学习到代码的语义和结构信息.
4)Transformer[50]. Transformer是一个基于多头注意力机制的模型,该模型能够有效捕获长程依赖,因此将它作为本文的一个基准模型.
5)ClassSum[14]. ClassSum是首个基于深度学习技术的类摘要生成模型,该模型通过精简代码去除类的非关键信息,只保留类签名、属性和方法签名. 从精简后的代码以及CSBT序列中获取语义和结构信息,解码时通过门控网络融合这2部分信息,为Java类生成摘要.
6)CodeBERT[40]. CodeBERT是基于Transformer的预训练代码语言模型,该模型使用掩码语言建模任务和替换令牌检测任务进行预训练,能够生成文本的通用表示. 经过微调后,在代码文档生成等下游任务上表现出色.
7)Code Llama[45]. Code Llama是基于Llama 2的大型代码语言模型,在代码生成任务上的一次通过率超越了ChatGPT,逼近GPT-4.由于Code Llama在代码相关任务上的能力不逊色于GPT-4,且是一个被广泛使用的开源免费的模型,因此将其作为本文的基准模型.
BLEU[51]、METEOR[52]和ROUGE-L[53]是机器翻译和代码摘要领域广泛使用的自动评估指标,本文使用这3种指标评估生成的类摘要的质量.
1)BLEU. BLEU根据n-gram可以划分为多个评价指标. 常见的有BLUE-1、BLUE-2、BLUE-3、BLUE-4,其中的数字表示连续单词的个数. 给定一个候选摘要,BLEU计算其与参考摘要的n-gram匹配精度的加权几何平均值,并且对短摘要施加惩罚.
2)METEOR. BLEU是一种基于精确度的评估指标,METEOR在BLEU的基础上,综合考虑精确度、召回率和词序,并进行同义词匹配.
3)ROUGE-L. ROUGE-L是ROUGE指标的一种,它根据候选摘要和参考摘要最长公共子序列的长度衡量二者的相似度.
1)HRCE的参数设置为:
①编码器和解码器的词嵌入维度设置为256. 编码器采用双向LSTM,每个方向的维度都为512,层数设置为2. 解码器采用单向LSTM,隐藏层维度设置为512,层数设置为2. 嵌入层和循环层都采用随机失活策略,将失活率设为0.2.
②代码和摘要的词表都未设置固定大小,而是根据单词在数据集中出现的频率决定是否加入词表. 设置词频为2,并将在数据集中出现次数大于等于2的单词加入词表.
③模型使用Adam[54]优化器训练,初始学习率设为0.001,以最大限度地减少在训练集上的损失. 将批量大小设置为32.
④为了防止模型过拟合,在训练时采用早停策略,当模型的性能连续4个epoch都没有提升则停止训练. 此外,限定模型训练次数的上限为100个epoch.
⑤模型在验证和测试阶段均使用集束搜索[55],并将束宽设为4.
2)基准模型的参数设置为:
①AST-attendgru、SBT、ClassSum和CodeNN的隐藏层维度都设置为256.
②Transformer以及CodeBERT的参数配置分别与Vaswani等人[50]和Feng等人[40]的工作保持一致.
本节将从整体性能、消融实验以及数据集划分方式3个方面分析HRCE的效果.
表5显示了HRCE和基准模型的实验数据, 从整体上看,HRCE在所有的评估指标上都优于基准模型.
具体来看,专门为类摘要生成任务设计的模型ClassSum相较于其他基准模型更具竞争力. ClassSum采用代码精简策略去除类源码中的非关键代码,使用2个双向LSTM编码器分别编码精简后的代码token序列和CSBT节点序列,解码时利用门控网络动态地生成权重向量来融合代码的语义和结构信息,使得每一个解码时间步可以对不同模态的向量表征有偏好. AST-attendgru使用2个GRU编码器分别编码代码的token序列和SBT节点序列,以此学习代码的语义和结构信息. 但是,AST-attendgru直接编码原始代码文本的token序列,由于类的源码中包含许多非关键信息,编码器很难提取到有用特征. 解码阶段,AST-attendgru通过拼接操作结合2个编码器编码结果的注意力向量,导致不同模态的向量表征在每个解码时间步的贡献都相同. 因此,AST-attendgru在各个指标上的表现都远不及ClassSum.
Transformer的输入也是类的源码,但Transformer是基于多头注意力机制的模型,能够有效捕获长程依赖. Transformer与AST-attendgru的效果差异主要来自于模型的输入.AST-attendgru将类源码的token序列和SBT节点序列作为输入,从中获取语义和结构信息,而Transformer的输入不包含SBT节点序列,无法学习到类的结构信息,生成的摘要质量不高. CodeNN直接从类源码token序列的词嵌入向量中产生摘要,无法很好地捕获语义特征,生成的摘要质量较差.
SBT与其他模型的性能差距源于SBT丢失了语义信息. 相对于结构信息,语义对摘要的生成更为重要. SBT将源码转化为抽象语法树,并将抽象语法树叶节点的类型和值通过符号“_”连接起来作为一个token,然后使用基于结构的遍历方式将抽象语法树扁平化为序列作为模型的输入. 这种处理方式能够很大程度上保留抽象语法树的结构信息,但是没有构建源码中组合词的子词嵌入表示,丢失了大量的语义信息. 此外,类的抽象语法树规模很大,为了保证编码器效率,需要对抽象语法树结点序列做截断处理,也会丢失部分结构信息. 综上,对类摘要生成任务而言,SBT丢失语义信息也无法完整地保留结构信息,生成的类摘要质量较差,在BLEU-4,BLEU-4(s),METEOR和ROUGE-L上的值分别为5.01,11.60,10.97,22.61.
微调后的CodeBERT在类摘要生成任务上的表现优于大部分的基准模型,但不及ClassSum和HRCE. CodeBERT在6种编程语言上进行预训练,能够捕获自然语言和编程语言之间的联系,表现出强大的语义理解能力. 因此即使只输入类的源码,CodeBERT的性能也能接近双模态输入的AST-attendgru. 但是,CodeBERT的预训练语料都是函数级的代码,而类的结构更为复杂,在语义理解上面临着更大的挑战. 因此CodeBERT的性能不及专门为类摘要生成任务设计的模型.
Code Llama根据提示信息生成摘要,类摘要生成任务的提示模板如图5所示. 设计2个提示模板,比较只输入类的源码和同时输入源码与上下文这2种情况下,Code Llama在类摘要生成任务上的表现.结果如表6所示,在2个测试集上,添加上下文信息后生成的摘要在各个衡量指标上的表现都优于只根据源码生成的摘要,表明外部信息对类摘要生成的有用性.
从表5的结果来看,与其他模型相比,Code Llama生成的摘要与参考摘要的相似度最低,主要有2个原因. 1)Code Llama没有在类摘要生成任务上进行微调,无法学习类摘要的编写模式. 如表7的例1所示,Code Llama生成的摘要在形式上与参考摘要存在较大差异. 参考摘要简洁明了、概括性较强,而Code Llama生成的摘要冗长,包含大量非必要的描述,无法达到通过摘要快速掌握类的功能的目的. 2)大语言模型虽然能够执行广泛的文本理解和生成任务,但是也存在一些局限性,例如“幻觉”[56],即生成无意义或不忠实于输入的文本. Code Llama在执行类摘要生成任务的过程中,也存在“幻觉”问题. 如表7的第2个例子,Code Llama没有根据提示模板的要求生成摘要,而是生成了与模型输入无关的代码. 经统计,所有的测试样本中约五分之一的摘要生成结果未忠实于输入. “幻觉”问题以及大量的冗余描述导致Code Llama在类摘要生成任务上的表现不佳.
HRCE的BLEU-4得分为30.32、BLEU-4(s)得分为37.01、METEOR得分为28.06、ROUGE-L得分为52.18,与最好的基准模型ClassSum相比,分别获得了7.79%、4.61%、4.55%、2.39%的性能提升. HRCE与ClassSum一样,对类的源码做精简处理,只保留类的签名、属性名和方法签名这些关键代码. 与ClassSum不同的是,HRCE采用分层表示的方法对类的关键代码进行层次结构建模,能从类的代码文本中同时学习语义和层次结构信息,无需输入代表结构信息的CSBT序列. 且分层表示的设计缩短了每个编码器输入序列的长度,有效缓解了模型记忆长序列的挑战. 此外,HRCE考虑到类的继承关系,使用上下文编码器学习父类的语义信息,使得有父类的类能够同时获取内部和外部的信息,进一步提高这些类的摘要生成质量. HRCE在所有衡量指标上的表现,证明分层表示和上下文增强的方法可以为类生成高质量的摘要.
为了检验HRCE各模块的有效性,设计了一组消融实验,通过去除模型的某一部分得到3个变体模型:
1)HRCE-NON-SIG,表示HRCE去除分层编码中的类签名编码器或方法签名编码器. 该模型将类签名token序列和方法签名token序列拼接起来,输入到一个双向LSTM编码器. 由于类签名编码器和方法签名编码器都由双向LSTM构成,因此该模型可同时表示去除类签名编码器或方法签名编码器.
2)HRCE-NON-ATTR,是由HRCE去除属性编码器得到的变体. 为了保留属性名的语义信息,将所有的属性名拼接为一个token序列,与方法签名一同输入到方法签名编码器中. 该处理方式将属性名视为普通的token序列,不做特殊的编码处理,以此检验属性编码器的有效性.
3)HRCE-NON-INHER,是HRCE去除上下文编码器得到的变体. 该模型只对类进行分层表示,不添加上下文信息,模型解码时只能根据类本身的信息生成摘要而无法获得外部知识.
表8给出HRCE和3种变体模型在各个评估指标上的表现. 结果表明,HRCE-NON-INHER的表现最差,在各个指标上的分数都低于其他变体. 这是因为HRCE-NON-INHER只利用类的内部语义和结构信息生成摘要,而类的作用往往是由其本身以及项目中与它有关联的上下文共同决定的. 换言之,摘要中的内容可能并不直接来自类的内部代码,而是出现在类的上下文中. 表8的结果证明在类摘要生成模型中添加上下文信息的有用性. 值得注意的是,结合表5和表8的实验结果,可以看到HRCE-NON-INHER和ClassSum在BLEU-4上的分数分别为28.22和28.13. 这2个模型都只利用类的内部信息生成摘要,区别在于ClassSum通过SBT序列获取类的结构信息,而HRCE-NON-INHER的输入中并不包含能够表征代码结构的SBT序列,但二者在BLEU和METEOR指标上的表现几乎相同. 这一结果证明对类进行分层表示的有效性,不仅能够获取类的语义信息,还能够获取类的层次结构信息.
HRCE-NON-SIG略好于HRCE-NON-INHER,但与完整的模型HRCE相比,BLEU-4的分值从30.32下降到了29.13,这表明为类签名单独编码的必要性. 当循环神经网络的输入序列较长时,容易产生长程依赖问题,从而忘记较早编码时间步的特征. 与类的其他部分相比,类签名的语义信息更为重要,有时只需阅读类的签名就可以了解类的功能. 根据4.2节的统计,类签名的token序列往往很短,使用单独的类签名编码器,可以最大程度地保留其语义信息.
HRCE-NON-ATTR的表现也不及完整的模型HRCE,这表明对每个属性单独编码并使用内部注意力机制得到每个属性名的向量表示是适合属性名的编码方式,可以得到更有利于摘要生成的属性名向量表征.
表5和表8 分别展示了HRCE和基准模型在混项目测试集和跨项目测试集上的得分. 与混项目测试相比,HRCE跨项目测试时,在BLEU-4,BLEU-4(s),METEOR和ROUGE-L上的性能分别下降了87%,75%,51%和48%.
这是因为同一个项目中通常会存在许多相似代码和复用代码. 数据集混项目随机划分时,这些相似或复用的代码片段会被划分到训练集、验证集和测试集中. 因此,训练集和测试集的样本差异不会很大,模型在测试集上也能得到与训练集一致的表现. 数据集跨项目划分时,测试集中的项目都不会出现在训练集中. 由于缺少相似的代码片段,训练集和测试集的样本差异巨大,因此在各个衡量指标上的得分都大幅度降低.
值得注意的是,Code Llama在混项目测试集和跨项目测试集上的表现几乎一致. 因为Code Llama通过提示生成摘要,无需使用类摘要数据从头训练或微调,所有的测试数据对模型而言都是跨项目的数据.
表9展示HRCE和基准模型生成的摘要,与基准模型相比,HRCE生成的摘要与参考摘要最相似. Code Llama生成的类摘要实例已在6.1节中进行分析,本节不再重复说明.
第1个例子中,摘要的信息主要来自类签名,包含“constant”“expression”“number”等关键字, HRCE采用分层表示,使用单独的编码器编码类签名,缓解了长程依赖问题,最大程度地保留了类签名的语义信息,因此能够准确捕获这些关键字. ClassSum面临记忆长序列的挑战,生成的摘要虽然也包含了所有关键字,但后半段摘要“number constant number and num”无法准确描述类的功能. CodeBERT只在函数级的编程语言上进行预训练,在理解内容更为复杂的Java类上面临挑战,生成的摘要对类功能描述不够准确. AST-attendgru和Transformer都未采用代码精简策略,难以提取有效特征,因此摘要只包含了部分关键词. CodeNN和SBT都无法很好地学习语义信息,生成的摘要与代码的相关性较低.
第2个例子,摘要的信息来自类签名和方法签名. HRCE的分层表示可以提取各层次的特征,Switch网络在每个解码时间步动态地选择并融合各层次的信息,因此可以从类签名和方法签名中获取“class”“generator”“random”“ipv”“address”等关键信息组成摘要. 其他基准模型由于未能充分表示类的复杂结构,生成的摘要与参考摘要的相似性较低.
第3个例子,摘要的部分信息来自父类. HRCE使用上下文编码器引入父类信息,因此生成的摘要中包含了“used”“format”等来自父类的关键字. ClassSum,AST-attendgru和CodeBERT能从类的源码中获取关键词生成摘要“implementation of link tar exporter”,但由于遗漏父类信息,此摘要无法完整描述类的功能. Transformer也能获取到源码的关键信息,但是生成了一些无关的描述. CodeNN和SBT只能获取源码的部分关键信息,生成的摘要包含大量无关的单词.
本文针对类摘要自动生成任务,提出了一种基于分层表示和上下文增强的方法HRCE.实验结果表明,HRCE能够为类生成高质量的注释,在所有的评估指标上超越了最先进的基准模型. 主要原因有2点:
1)HRCE根据类的层次特点,采用分层表示的方法得到类的签名、属性名和方法签名的代码表征. 分层表示的方法能够学习类的语义信息并对类的层次结构建模以获取结构信息,同时缩短了编码器输入序列的长度,缓解了长程依赖问题.
2)HRCE将父类的签名和父类的摘要作为类的上下文,在解码过程中融合上下文语义信息,进一步提高有父类的类的摘要生成质量.
此外,本文还构建了一个包含上下文信息的类摘要语料库1,为后续的类摘要研究提供数据基础.
类具有丰富的上下文,而本文只使用了父类的相关信息,下一步的工作将从项目中提取不同类型的代码上下文,比较不同上下文对摘要生成的贡献. 此外,HRCE具备跨语言训练的能力,后续将尝试使用此模型为其他面向对象的语言生成摘要.
作者贡献声明:陈豪伶构思和实现模型,完成实验并撰写论文;虞慧群和范贵生指导实验方案并修改论文;李明辰指导实验和处理数据;黄子杰指导论文写作.

参考文献 引证文献
排序方式:
1
Xia Xin, Bao Lingfeng, Lo D, et al. Measuring program comprehension: A large-scale field study with professionals[J]. IEEE Transactions on Software Engineering, 2017, 44(10): 951−976
2
Haiduc S, Aponte J, Moreno L, et al. On the use of automated text summarization techniques for summarizing source code[C] //Proc of the 17th Working Conf on Reverse Engineering. Piscataway, NJ: IEEE, 2010: 35−44
3
Haiduc S, Aponte J, Marcus A, et al. Supporting program comprehension with source code summarization[C] //Proc of the 32nd ACM/IEEE Int Conf on Software Engineering. New York: ACM, 2010: 223−226
4
Eddy B P, Robinson J A, Kraft N A, et al. Evaluating source code summarization techniques: Replication and expansion[C] //Proc of the 21st Int Conf on Program Comprehension. Piscataway, NJ: IEEE, 2013: 13−22
5
McBurney P W, Liu C, McMillan C, et al. Improving topic model source code summarization[C] //Pro of the 22nd Int Conf on Program Comprehension. New York: ACM, 2014: 291−294
6
Movshovitz-Attias D, Cohen W. Natural language models for predicting programming comments[C] //Proc of the 51st Annual Meeting of the Association for Computational Linguistics. Stroudsburg, PA: ACL, 2013: 35−40
7
Wong E, Yang Jinqiu, Tan Lin. Autocomment: Mining question and answer sites for automatic comment generation[C] //Proc of the 28th IEEE/ACM Int Conf on Automated Software Engineering. Piscataway, NJ: IEEE, 2013: 562−567
8
Sridhara G, Hill E, Muppaneni D, et al. Towards automatically generating summary comments for Java methods[C] //Proc of the 25th IEEE/ACM Int Conf on Automated Software Engineering. New York: ACM, 2010: 43−52
9
Sridhara G, Pollock L, Vijay-Shanker K. Generating parameter comments and integrating with method summaries[C] //Proc of the 19th Int Conf on Program Comprehension. Piscataway, NJ: IEEE, 2011: 71−80
10
Sridhara G, Pollock L, Vijay-Shanker K. Automatically detecting and describing high level actions within methods[C] //Proc of the 33rd Int Conf on Software Engineering. New York: ACM, 2011: 101−110
11
Abid N J, Dragan N, Collard M L, et al. Using stereotypes in the automatic generation of natural language summaries for C++ methods[C] //Proc of Int Conf on Software Maintenance and Evolution. Piscataway, NJ: IEEE, 2015: 561−565
12
Song Xiaotao, Sun Hailong, Wang Xu, et al. A survey of automatic generation of source code comments: Algorithms and techniques[J]. IEEE Access, 2019, 7: 111411−111428
13
Moreno L, Aponte J, Sridhara G, et al. Automatic generation of natural language summaries for Java classes[C] //Proc of the 21st Int Conf on Program Comprehension. Piscataway, NJ: IEEE, 2013: 23−32
14
Li Mingchen, Yu Huiqun, Fan Guisheng, et al. ClassSum: A deep learning model for class-level code summarization[J]. Neural Computing and Applications, 2023, 35(4): 3373−3393
15
Li Zheng, Wu Yonghao, Peng Bin, et al. Setransformer: A transformer-based code semantic parser for code comment generation[J]. IEEE Transactions on Reliability, 2022, 72(1): 258−273
16
Iyer S, Konstas I, Cheung A, et al. Summarizing source code using a neural attention model[C] //Proc of the 54th Annual Meeting of the Association for Computational Linguistics. Stroudsburg, PA: ACL, 2016: 2073−2083
17
Allamanis M, Peng H, Sutton C. A convolutional attention network for extreme summarization of source code[C] //Proc of the 33rd Int Conf on Machine Learning. New York: ACM, 2016: 2091−2100
18
Hu Xing, Li Ge, Xia Xin, et al. Deep code comment generation[C] //Proc of the 26th Conf on Program Comprehension. New York: ACM, 2018: 200−210
19
Leclair A, Jiang S, McMillan C. A neural model for generating natural language summaries of program subroutines[C] //Proc of the 41st Int Conf on Software Engineering. New York: ACM, 2019: 795−806
20
Hu Xing, Li Ge, Xia Xin, et al. Deep code comment generation with hybrid lexical and syntactical information[J]. Empirical Software Engineering, 2019, 25(3): 2179−2217
21
Zhou Ziyi, Yu Huiqun, Fan Guisheng. Effective approaches to combining lexical and syntactical information for code summarization[J]. Software: Practice and Experience, 2020, 50(12): 2313−2336
22
Ahmad W U, Chakraborty S, Ray B, et al. A transformer-based approach for source code summarization[J]. arXiv preprint, arXiv: 2005. 00653, 2020
23
Alon U, Brody S, Levy O, et al. Code2Seq: Generating sequences from structured representations of code[C/OL] //Proc of the 7th Int Conf on Learning Representations. Amherst, MA: OpenReview. Net, 2019 [2023-11-30].https://openreview.net/forum?id=H1gKYo09tX
24
Zhou Yu, Shen Juanjuan, Zhang Xiaoqing, et al. Automatic source code summarization with graph attention networks[J]. Journal of Systems and Software, 2022, 188: 111257
25
张世琨,谢睿,叶蔚,等. 基于关键词的代码自动摘要[J]. 计算机研究与发展,2020,57(9):1987−2000
Zhang Shikun, Xie Rui, Ye Wei, et al. Keyword-based source code summarization[J]. Journal of Computer Research and Development, 2020, 57(9): 1987−2000 (in Chinese)
26
Zhou Ziyi, Yu Huiqun, Fan Guisheng, et al. Summarizing source code with hierarchical code representation[J]. Information and Software Technology, 2022, 143: 106761
27
Wang Wenhua, Zhang Yuqun, Sui Yulei, et al. Reinforcement-learning-guided source code summarization using hierarchical attention[J]. IEEE Transactions on Software Engineering, 2020, 48(1): 102−119
28
Lin Chen, Ouyang Zhichao, Zhuang Junqing, et al. Improving code summarization with block-wise abstract syntax tree splitting[C] //Proc of the 2021 IEEE/ACM 29th Int Conf on Program Comprehension. Los Alamitos, CA: IEEE Computer Society, 2021: 184−195
29
Shi Ensheng, Wang Youlin, Du Lun, et al. Cast: Enhancing code summarization with hierarchical splitting and reconstruction of abstract syntax trees[C] //Proc of the 2021 Conf on Empirical Methods in Natural Language Processing. Stroudsburg, PA: ACL, 2021: 4053−4062
30
Mcburney P W, McMillan C. Automatic source code summarization of context for Java methods[J]. IEEE Transactions on Software Engineering, 2016, 42(2): 103−119
31
Hill E, Pollock L, Vijay-Shanker K. Automatically capturing source code context of NL-queries for software maintenance and reuse[C] //Proc of the 31st Int Conf on Software Engineering. Piscataway, NJ: IEEE, 2009: 232−242
32
Yu Xiaohan, Huang Quzhe, Wang Zheng, et al. Towards context-aware code comment generation[C] //Proc of Findings of the Association for Computational Linguistics: EMNLP. Stroudsburg, PA: ACL, 2020: 3938−3947
33
Wang Yanlin, Shi Ensheng, Du Lun, et al. Cocosum: Contextual code summarization with multi-relational graph neural network[J]. arXiv preprint, arXiv: 2107. 01933, 2021
34
Haque S, Leclair A, Wu Lingfei, et al. Improved automatic summarization of subroutines via attention to file context[C] //Proc of the 17th Int Conf on Mining Software Repositories. New York: ACM, 2020: 300−310
35
Bansal A, Haque S, McMillan C. Project-level encoding for neural source code summarization of subroutines[C] //Proc of the 29th Int Conf on Program Comprehension. Piscataway, NJ: IEEE, 2021: 253−264
36
Devlin J, Chang M W, Lee K, et al. BERT: Pre-training of deep bidirectional transformers for language understanding[J]. arXiv preprint, arXiv: 1810. 04805, 2018
37
Radford A, Wu J, Child R, et al. Language models are unsupervised multitask learners[J]. OpenAI Blog, 2019, 1(8): 9
38
Brown T, Mann B, Ryder N, et al. Language models are few-shot learners[J]. Advances in Neural Information Processing Systems, 2020, 33: 1877−1901
39
Ouyang Long, Wu J, Jiang Xu, et al. Training language models to follow instructions with human feedback[J]. Advances in Neural Information Processing Systems, 2022, 35: 27730−27744
40
Feng Zhangyin, Guo Daya, Tang Duyu, et al. CodeBERT: A pre-trained model for programming and natural languages[J]. arXiv preprint, arXiv: 2002. 08155, 2020
41
Wang Yue, Wang Weishi, Joty S, et al. Codet5: Identifier-aware unified pre-trained encoder-decoder models for code understanding and generation[J]. arXiv preprint, arXiv: 2109. 00859, 2021
42
Guo Daya, Ren Shuo, Lu Shuai, et al. GraphCodeBERT: Pre-training code representations with data flow[J]. arXiv preprint, arXiv: 2009. 08366, 2020
43
OpenAI. GPT-4 technical report[J]. arXiv preprint, arXiv: 2303. 08774, 2023
44
Chen M, Tworek J, Jun H, et al. Evaluating large language models trained on code[J]. arXiv preprint, arXiv: 2107. 03374, 2021
45
Roziere B, Gehring J, Gloeckle F, et al. Code Llama: Open foundation models for code[J]. arXiv preprint, arXiv: 2308. 12950, 2023
46
Luo Ziyang, Xu Can, Zhao Pu, et al. WizardCoder: Empowering code large language models with evol-Instruct[J]. arXiv preprint, arXiv: 2306. 08568, 2023
47
Sutskever I, Vinyals O, Le Q V. Sequence to sequence learning with neural networks[J]. Advances in Neural Information Processing Systems, 2014, 27: 3104−3112
48
Hochreiter S, Schmidhuber J. Long short-term memory[J]. Neural Computation, 1997, 9(8): 1735−1780
49
Ge Fan, Kuang Li. Keywords guided method name generation[C] //Proc of the 29th Int Conf on Program Comprehension. Piscataway, NJ: IEEE, 2021: 196−206
50
Vaswani A, Shazeer N, Parmar N, et al. Attention is all you need[C] //Proc of the Annual Conf on Neural Information Processing Systems. Cambridge, MA: MIT, 2017: 5998−6008
51
Papineni K, Roukos S, Ward T, et al. BLEU: A method for automatic evaluation of machine translation[C] //Proc of the 40th Annual Meeting of the Association for Computational Linguistics. New York: ACM, 2002: 311−318
52
Denkowski M, Lavie A. METEOR universal: Language specific translation evaluation for any target language[C] //Proc of the 9th Workshop on Statistical Machine Translation. Stroudsburg, PA: ACL 2014: 376−380
53
Lin C Y. ROUGE: A package for automatic evaluation of summaries[C] // Proc of the Workshop on Text Summarization Branches Out. Stroudsburg, PA: ACL, 2004: 74−81
54
Kingma D P, Ba J. Adam: A method for stochastic optimization[J]. arXiv preprint, arXiv: 1412. 6980, 2014
55
Wu Yonghui, Schuster M, Chen Zhifeng, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation[J]. arXiv preprint, arXiv: 1609. 08144, 2014
56
Ji Ziwei, Lee N, Frieske R, et al. Survey of hallucination in natural language generation[J]. ACM Computing Surveys, 2023, 55(12): 1−38
2024年第61卷第2期
76
35
0
引用本文
BibTeX
文章信息
doi: 10.7544/issn1000-1239.202330730
  • 接收时间:2023-09-11
  • 首发时间:2026-11-17
  • 出版时间:2024-02-02
补充材料
相关文章
文章信息
作者
出版历史
  • 收稿日期:2023-09-11
  • 修回日期:2023-12-05
基金
作者信息
    1华东理工大学计算机科学与工程系 上海 200237

通讯作者:

虞慧群()
参考文献
分享链接
https://castjournals.cast.org.cn/joweb/jsjyjyfz/CN/10.7544/issn1000-1239.202330730
分享至
全文二维码

扫描看全文

引用本文
BibTeX
本文的引用情况
2种不同金属材料的力学参数
科
Family
属数
Number of
genus
种数
Number of
species
占总种数比例
Percentage of
total species (%)
属
Genus
种数
Number of
species
占总种数比例
Percentage of total
species (%)
鹅膏菌科Amanitaceae 2 11 5.26 鹅膏菌属 Amanita 10 4.78
小菇科 Mycenaceae 2 12 5.74 丝盖伞属 Inocybe 5 2.39
多孔菌科 Polyporaceae 8 14 6.70 蜡蘑属 Laccaria 5 2.39
红菇科 Russulaceae 3 23 11.00 小皮伞属 Marasmius 6 2.87
小菇属 Mycena 11 5.26
光柄菇属 Pluteus 5 2.39
红菇属 Russula 17 8.13
栓菌属 Trametes 5 2.39
关闭全屏