跳到正文
EasyXiv 检索
投稿 关于 登录

按回车检索 · 直接输入编号(如 1706.03762)可跳转到论文

计算机科学 > 计算与语言

arXiv:1910.03704 (cs)
[提交于 2019年10月10日]

标题:Do People Prefer "Natural" code?

作者:Casey Casalnuovo, Kevin Lee, Hulin Wang, Prem Devanbu, Emily Morgan
查看论文《Do People Prefer "Natural" code?》的 PDF
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读
摘要:Natural code is known to be very repetitive (much more so than natural language corpora); furthermore, this repetitiveness persists, even after accounting for the simpler syntax of code. However, programming languages are very expressive, allowing a great many different ways (all clear and unambiguous) to express even very simple computations. So why is natural code repetitive? We hypothesize that the reasons for this lie in fact that code is bimodal: it is executed by machines, but also read by humans. This bimodality, we argue, leads developers to write code in certain preferred ways that would be familiar to code readers. To test this theory, we 1) model familiarity using a language model estimated over a large training corpus and 2) run an experiment applying several meaning preserving transformations to Java and Python expressions in a distinct test corpus to see if forms more familiar to readers (as predicted by the language models) are in fact the ones actually written. We find that these transformations generally produce program structures that are less common in practice, supporting the theory that the high repetitiveness in code is a matter of deliberate preference. Finally, 3) we use a human subject study to show alignment between language model score and human preference for the first time in code, providing support for using this measure to improve code.
主题: 计算与语言 (cs.CL); 信息论 (cs.IT); 程序设计语言 (cs.PL); 信息论 (math.IT)
引用方式: arXiv:1910.03704 [cs.CL]
  (或者 arXiv:1910.03704v1 [cs.CL] 对于此版本)
  https://doi.org/10.48550/arXiv.1910.03704

提交历史

来自:Casey Casalnuovo
[v1] 2019年10月10日 星期四 00:00:00 UTC
全文链接:

访问论文:

  • 查看原文 PDF
  • 中文 PDF (下批处理)
  • EasyResearch 阅读
  • TeX 源文件
  • arXiv 原文页面
查看许可

当前浏览上下文:

cs.CL
< 上一篇   |   下一篇 >
最新 | 近期 | 2019-10
切换浏览方式为:
cs
cs.IT
cs.PL
math.IT

参考文献与引用

  • Google Scholar
  • Semantic Scholar

BibTeX 格式的引用

EasyXiv 是独立运营的中文预印本站点,与 arXiv 及康奈尔大学无隶属关系。 论文元数据与原文来自 arXiv.org,感谢 arXiv 提供开放获取服务。
关于 · 帮助 · 投稿指南 · 版权 · arXiv 原站