arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2209.06273cs.CL
收藏

基于神经网络的代码风格转换研究

Exploring Code Style Transfer with Neural Networks

University of California, Santa Cruz(加利福尼亚大学圣克鲁兹分校);IBM Research(IBM研究院)

Karl Munson, Anish Savla, Chih-Kai Ting, Serenity Wade, Kiran Kate, Kavitha Srinivas

摘要:

风格是自然语言文本的重要组成部分,它反映了文本基调的变化,同时保持了底层信息的不变。即使程序设计语言有严格的语法规则,它们也有风格。代码可以用相同的功能编写,但使用不同的语言功能。然而,编程风格很难量化,因此作为这项工作的一部分,我们专门为Python定义了风格属性。为了构建样式的定义,我们利用层次聚类来捕获样式定义,而不需要指定转换。除了定义样式之外,我们还探索了预训练的代码语言模型捕获有关代码样式的信息的能力。为此,我们微调了预训练的代码-语言模型,并评估了它们在代码风格转换任务中的表现。

英文摘要:

Style is a significant component of natural language text, reflecting a change in the tone of text while keeping the underlying information the same. Even though programming languages have strict syntax rules, they also have style. Code can be written with the same functionality but using different language features. However, programming style is difficult to quantify, and thus as part of this work, we define style attributes, specifically for Python. To build a definition of style, we utilized hierarchical clustering to capture a style definition without needing to specify transformations. In addition to defining style, we explore the capability of a pre-trained code language model to capture information about code style. To do this, we fine-tuned pre-trained code-language models and evaluated their performance in code style transfer tasks.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑