ACM Transactions on Software Engineering and Methodology · 2023 · 19 citations · 52 references
ComputingComputer ScienceNatural Language ProcessingSoftware EngineeringSyntaxAnnotationCode GenerationStatic Code AnalysisSyntactic AnalysisSyntax AnalysisSyntax ParsingAutomated Comment GenerationCode MaintainabilityCode ReadabilityMaintainabilityProgram ComprehensionReadabilitySnippet GenerationSoftware Maintenance Process
Code commenting plays an important role in program comprehension. Automatic comment generation helps improve software maintenance efficiency. The code comments to annotate a method mainly include header comments and snippet comments. The header comment aims to describe the functionality of the entire method, thereby providing a general comment at the beginning of the method. The snippet comment appears at multiple code segments in the body of a method, where a code segment is called a code snippet. Both of them help developers quickly understand code semantics, thereby improving code readability and code maintainability. However, existing automatic comment generation models mainly focus more on header comments, because there are public datasets to validate the performance. By contrast, it is challenging to collect datasets for snippet comments, because it is difficult to determine their scope. Even worse, code snippets are often too short to capture complete syntax and semantic information. To address this challenge, we propose a novel S nippet C omment Gen eration approach called SCGen . First, we utilize the context of the code snippet to expand the syntax and semantic information. Specifically, 600,243 snippet code-comment pairs are collected from 959 Java projects. Then, we capture variables from code snippets and extract variable-related statements from the context. After that, we devise an algorithm to parse and traverse abstract syntax tree (AST) information of code snippets and corresponding context. Finally, SCGen generates snippet comments after inputting the source code snippet and corresponding AST information into a sequence-to-sequence-based model. We conducted extensive experiments on the dataset we collected to evaluate our SCGen . Our approach obtains 18.23 in BLEU-4 metrics, 18.83 in METEOR, and 23.65 in ROUGE-L, which outperforms state-of-the-art comment generation models.
52
CodeBERT: A Pre-Trained Model for Programming and Natural Languages
Zhangyin Feng, Daya Guo, Duyu Tang et al. · 2020 · 2.4K citations · Full text
Summarizing Source Code using a Neural Attention Model
Srinivasan Iyer, Ioannis Konstas, Alvin Cheung et al. · 2016 · 725 citations · Full text
Gabriel Murray, Steve Renals, Jean Carletta et al. · Meeting of the Association for Computational Linguistics · 2005 · 719 citations
A Blockchain-Based Decentralized Federated Learning Framework with Committee Consensus
Yuzheng Li, Chuan Chen, Nan Liu et al. · IEEE Network · 2020 · 627 citations · Full text