Retrieve and Refine: Exemplar-based Neural Comment Generation

10/23/2019
by   Bolin Wei, et al.
0

Code comment generation is a crucial task in the field of automatic software development. Most previous neural comment generation systems used an encoder-decoder neural network and encoded only information from source code as input. Software reuse is common in software development. However, this feature has not been introduced to existing systems. Inspired by the traditional IR-based approaches, we propose to use the existing comments of similar source code as exemplars to guide the comment generation process. Based on an open source search engine, we first retrieve a similar code and treat its comment as an exemplar. Then we applied a seq2seq neural network to conduct an exemplar-based comment generation. We evaluate our approach on a large-scale Java corpus, and experimental results demonstrate that our model significantly outperforms the state-of-the-art methods.

READ FULL TEXT

page 1

page 2

page 3

research
07/27/2021

Yet Another Combination of IR- and Neural-based Comment Generation

Code comment generation techniques aim to generate natural language desc...
research
03/29/2019

A Convolutional Neural Network for Language-Agnostic Source Code Summarization

Descriptive comments play a crucial role in the software engineering pro...
research
03/15/2019

Toward Imitating Visual Attention of Experts in Software Development Tasks

Expert programmers' eye-movements during source code reading are valuabl...
research
04/08/2021

A Sketch-Based Neural Model for Generating Commit Messages from Diffs

Commit messages have an important impact in software development, especi...
research
10/14/2019

Code Generation as a Dual Task of Code Summarization

Code summarization (CS) and code generation (CG) are two crucial tasks i...
research
10/02/2020

Augmenting Machine Learning with Information Retrieval to Recommend Real Cloned Code Methods for Code Completion

Software developers frequently reuse source code from repositories as it...
research
06/27/2022

BashExplainer: Retrieval-Augmented Bash Code Comment Generation based on Fine-tuned CodeBERT

Developers use shell commands for many tasks, such as file system manage...

Please sign up or login with your details

Forgot password? Click here to reset