arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 1806.02437cs.CL
收藏

自然语言与程序设计语言语料库的差异研究

Studying the Difference Between Natural and Programming Language Corpora

Department of Computer Science, University of California, Davis(加利福尼亚大学戴维斯分校计算机科学系);Department of Linguistics, University of California, Davis(加利福尼亚大学戴维斯分校语言学系)

Casey Casalnuovo, Kenji Sagae, Prem Devanbu

摘要:

正如在大型软件系统中所观察到的,现在已知代码语料库比自然语言语料库更具有重复性和可预测性。但为什么呢?这种差异仅仅是由于程序设计语言的语法限制造成的吗?或者它是由这些自然语言和程序设计语言文本的作者在创作决策上的差异引起的?我们推测,这些差异并不完全是由于语法,而且还因为阅读和编写代码对人类来说是不自然的,需要大量的脑力劳动;因此,人们更喜欢以读者和作者都熟悉的方式编写代码。为了支持这一论点,我们提出了两组研究的结果:1)第一组旨在减弱句法的影响,2)第二组旨在测量在其他环境(例如第二语言,技术/专业术语)中编写的文本的重复性,这也是很难写的。我们发现源代码中的重复并不完全是语法约束的结果,因此某些重复必须是人类选择的结果。虽然我们在技术和学习者语料库中发现的类似重复行为的证据并不能最终表明人类使用这种语言来减轻困难,但它与这一理论是一致的。

英文摘要:

Code corpora, as observed in large software systems, are now known to be far more repetitive and predictable than natural language corpora. But why? Does the difference simply arise from the syntactic limitations of programming languages? Or does it arise from the differences in authoring decisions made by the writers of these natural and programming language texts? We conjecture that the differences are not entirely due to syntax, but also from the fact that reading and writing code is un-natural for humans, and requires substantial mental effort; so, people prefer to write code in ways that are familiar to both reader and writer. To support this argument, we present results from two sets of studies: 1) a first set aimed at attenuating the effects of syntax, and 2) a second, aimed at measuring repetitiveness of text written in other settings (e.g. second language, technical/specialized jargon), which are also effortful to write. We find find that this repetition in source code is not entirely the result of grammar constraints, and thus some repetition must result from human choice. While the evidence we find of similar repetitive behavior in technical and learner corpora does not conclusively show that such language is used by humans to mitigate difficulty, it is consistent with that theory.

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

↑