Learning to Generate Code Comments from Class Hierarchies

03/24/2021
by   Jiyang Zhang, et al.
0

Descriptive code comments are essential for supporting code comprehension and maintenance. We propose the task of automatically generating comments for overriding methods. We formulate a novel framework which accommodates the unique contextual and linguistic reasoning that is required for performing this task. Our approach features: (1) incorporating context from the class hierarchy; (2) conditioning on learned, latent representations of specificity to generate comments that capture the more specialized behavior of the overriding method; and (3) unlikelihood training to discourage predictions which do not conform to invariant characteristics of the comment corresponding to the overridden method. Our experiments show that the proposed approach is able to generate comments for overriding methods of higher quality compared to prevailing comment generation techniques.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
07/25/2019

A Survey of Automatic Generation of Source Code Comments: Algorithms and Techniques

As an integral part of source code files, code comments help improve pro...
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
09/22/2017

Code Attention: Translating Code to Comments by Exploiting Domain Features

Appropriate comments of code snippets provide insight for code functiona...
research
12/22/2014

Reply to the commentary "Be careful when assuming the obvious", by P. Alday

Here we respond to some comments by Alday concerning headedness in lingu...
research
03/03/2023

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

Code comments are significantly helpful in comprehending software progra...
research
06/12/2018

Deep Learning to Detect Redundant Method Comments

Comments in software are critical for maintenance and reuse. But apart f...
research
05/23/2020

What do class comments tell us? An investigation of comment evolution and practices in Pharo

Previous studies have characterized code comments in different programmi...

Please sign up or login with your details

Forgot password? Click here to reset