{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/code-attention-translating-code-to-comments","title":"Code Attention: Translating Code to Comments by Exploiting Domain Features","arxiv_id":"1709.07642","date":"2017-09-22","proceeding":null,"authors":["Wenhao Zheng","Hong-Yu Zhou","Ming Li","Jianxin Wu"],"abstract":"Appropriate comments of code snippets provide insight for code functionality,\nwhich are helpful for program comprehension. However, due to the great cost of\nauthoring with the comments, many code projects do not contain adequate\ncomments. Automatic comment generation techniques have been proposed to\ngenerate comments from pieces of code in order to alleviate the human efforts\nin annotating the code. Most existing approaches attempt to exploit certain\ncorrelations (usually manually given) between code and generated comments,\nwhich could be easily violated if the coding patterns change and hence the\nperformance of comment generation declines. In this paper, we first build\nC2CGit, a large dataset from open projects in GitHub, which is more than\n20$\\times$ larger than existing datasets. Then we propose a new attention\nmodule called Code Attention to translate code to comments, which is able to\nutilize the domain features of code snippets, such as symbols and identifiers.\nWe make ablation studies to determine effects of different parts in Code\nAttention. Experimental results demonstrate that the proposed module has better\nperformance over existing approaches in both BLEU and METEOR.","url_abs":"http://arxiv.org/abs/1709.07642v2","url_pdf":"http://arxiv.org/pdf/1709.07642v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"code-attention-translating-code-to-comments","repo_url":"https://github.com/mf1832146/tree-transformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"code-attention-translating-code-to-comments","repo_url":"https://github.com/mf1832146/tree_transformer_2.0","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"comment-generation","task_name":"Comment Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":null,"mcp":null,"developers":"https://syntology.ai/developers"},"arxiv_metadata":null,"syntology_extracted_results":null}