学习从类层次结构生成代码注释
Learning to Generate Code Comments from Class Hierarchies
摘要:
描述性代码注释对于支持代码理解和维护是必不可少的。我们提出的任务是为重写方法自动生成注释。我们制定了一个新的框架,可容纳独特的上下文和语言推理,需要执行这项任务。我们的方法特点:(1)结合来自类层次结构的上下文;(2)以学习到的、潜在的特异性表示为条件,以生成捕获覆盖方法的更专门的行为的注释;以及(3)不似然训练,以阻止不符合与覆盖方法相对应的注释的不变特征的预测。我们的实验表明,所提出的方法是能够产生更高质量的压倒性的方法相比,目前的评论生成技术的评论。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。