Learning to Recommend Method Names with Global Context

被引:7
|
作者
Liu, Fang [1 ]
Li, Ge [1 ]
Fu, Zhiyi [1 ]
Lu, Shuai [1 ]
Hao, Yiyang [2 ]
Jin, Zhi [1 ]
机构
[1] Peking Univ, MoE, Key Lab High Confidence Software Technol, Beijing, Peoples R China
[2] Silicon Heart Tech Co Ltd, Beijing, Peoples R China
来源
2022 ACM/IEEE 44TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2022) | 2022年
基金
国家重点研发计划; 中国国家自然科学基金;
关键词
method name recommendation; global context; deep learning; PROGRAM;
D O I
10.1145/3510003.3510154
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
In programming, the names for the program entities, especially for the methods, are the intuitive characteristic for understanding the functionality of the code. To ensure the readability and maintainability of the programs, method names should be named properly. Specifically, the names should be meaningful and consistent with other names used in related contexts in their codebase. In recent years, many automated approaches are proposed to suggest consistent names for methods, among which neural machine translation (NMT) based models are widely used and have achieved state-of-the-art results. However, these NMT-based models mainly focus on extracting the code-specific features from the method body or the surrounding methods, the project-specific context and documentation of the target method are ignored. We conduct a statistical analysis to explore the relationship between the method names and their contexts. Based on the statistical results, we propose GTNM, a Global Transformer-based Neural Model for method name suggestion, which considers the local context, the project-specific context, and the documentation of the method simultaneously. Experimental results on java methods show that our model can outperform the state-of-the-art results by a large margin on method name suggestion, demonstrating the effectiveness of our proposed model.
引用
收藏
页码:1294 / 1306
页数:13
相关论文
共 50 条
  • [1] Learning to Recommend Method Names with Global Context
    Liu, Fang
    Li, Ge
    Fu, Zhiyi
    Lu, Shuai
    Hao, Yiyang
    Jin, Zhi
    arXiv, 2022,
  • [2] Learning to Recommend Method Names with Global Context
    MoE , Key Lab of High Confidence Software Technology, Beijing, China
    不详
    Proc Int Conf Software Eng, 1600, (1294-1306):
  • [3] Learning to context-aware recommend with hierarchical factorization machines
    Wang, Shaoqing
    Li, Cuiping
    Zhao, Kankan
    Chen, Hong
    INFORMATION SCIENCES, 2017, 409 : 121 - 138
  • [4] Organizational Learning in the Global Context
    Clarke, Michael
    POLITICAL STUDIES REVIEW, 2008, 6 (02) : 257 - 257
  • [5] Quality learning in a global context
    Debowski, Shelda
    INTERNATIONAL JOURNAL FOR ACADEMIC DEVELOPMENT, 2010, 15 (01) : 5 - 6
  • [6] Robust Tracking Via Color Names and Spatial Context Learning
    Chen, Guomei
    Miao, Lanfang
    Wang, Hui
    2015 5TH INTERNATIONAL CONFERENCE ON VIRTUAL REALITY AND VISUALIZATION (ICVRV 2015), 2015, : 76 - 80
  • [7] Learning to Spot and Refactor Inconsistent Method Names
    Liu, Kui
    Kim, Dongsun
    Bissyande, Tegawende F.
    Kim, Taeyoung
    Kim, Kisub
    Koyuncu, Anil
    Kim, Suntae
    Le Traon, Yves
    2019 IEEE/ACM 41ST INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2019), 2019, : 1 - 12
  • [8] Video Contrastive Learning with Global Context
    Kuang, Haofei
    Zhu, Yi
    Zhang, Zhi
    Li, Xinyu
    Tighe, Joseph
    Schwertfeger, Soeren
    Stachniss, Cyrill
    Li, Mu
    2021 IEEE/CVF INTERNATIONAL CONFERENCE ON COMPUTER VISION WORKSHOPS (ICCVW 2021), 2021, : 3188 - 3197
  • [9] Teaching and learning in a global cultural context
    Wu, Anette
    Noel, Geoffroy P. J. C.
    Wingate, Richard
    FRONTIERS IN EDUCATION, 2024, 8
  • [10] Learning from Context or Names? An Empirical Study on Neural Relation Extraction
    Peng, Hao
    Gao, Tianyu
    Han, Xu
    Lin, Yankai
    Li, Peng
    Zhiyuan, Liu
    Sun, Maosong
    Zhou, Jie
    PROCEEDINGS OF THE 2020 CONFERENCE ON EMPIRICAL METHODS IN NATURAL LANGUAGE PROCESSING (EMNLP), 2020, : 3661 - 3672