Code Attention: Translating Code to Comments by Exploiting Domain Features

09/22/2017
by   Wenhao Zheng, et al.
0

Appropriate comments of code snippets provide insight for code functionality, which are helpful for program comprehension. However, due to the great cost of authoring with the comments, many code projects do not contain adequate comments. Automatic comment generation techniques have been proposed to generate comments from pieces of code in order to alleviate the human efforts in annotating the code. Most existing approaches attempt to exploit certain correlations (usually manually given) between code and generated comments, which could be easily violated if the coding patterns change and hence the performance of comment generation declines. In this paper, we first build C2CGit, a large dataset from open projects in GitHub, which is more than 20× larger than existing datasets. Then we propose a new attention module called Code Attention to translate code to comments, which is able to utilize the domain features of code snippets, such as symbols and identifiers. We make ablation studies to determine effects of different parts in Code Attention. Experimental results demonstrate that the proposed module has better performance over existing approaches in both BLEU and METEOR.

READ FULL TEXT

page 5

page 9

research
05/06/2019

Analyzing Code Comments to Boost Program Comprehension

We are trying to find source code comments that help programmers underst...
research
03/31/2022

Comments on Comments: Where Code Review and Documentation Meet

A central function of code review is to increase understanding; helping ...
research
08/23/2022

Preprocessing Source Code Comments for Linguistic Models

Comments are an important part of the source code and are a primary sour...
research
03/24/2021

Learning to Generate Code Comments from Class Hierarchies

Descriptive code comments are essential for supporting code comprehensio...
research
03/03/2023

APIContext2Com: Code Comment Generation by Incorporating Pre-Defined API Documentation

Code comments are significantly helpful in comprehending software progra...
research
04/22/2023

An Empirical Study on Using Large Language Models for Multi-Intent Comment Generation

Code comment generation aims at generating natural language descriptions...
research
02/14/2023

Developer-Intent Driven Code Comment Generation

Existing automatic code comment generators mainly focus on producing a g...

Please sign up or login with your details

Forgot password? Click here to reset