DeepAI AI Chat
Log In Sign Up

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

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...
08/23/2022

Preprocessing Source Code Comments for Linguistic Models

Comments are an important part of the source code and are a primary sour...
09/22/2017

Code Attention: Translating Code to Comments by Exploiting Domain Features

Appropriate comments of code snippets provide insight for code functiona...
03/19/2021

API2Com: On the Improvement of Automatically Generated Code Comments Using API Documentations

Code comments can help in program comprehension and are considered as im...
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...
03/03/2023

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

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

Deep Learning to Detect Redundant Method Comments

Comments in software are critical for maintenance and reuse. But apart f...