让Python代码自动翻译成多语言,降低非英语用户的编程门槛
Automated Python Translation
- 构建自动化翻译流水线,将关键词、错误类型等Python元素转译为其他语言
- 在7种语言中完成5个主流库的术语翻译,并在法、希、孟加拉语中验证质量
- 为全球非英语开发者提供可读性更强的本地化Python环境,适合教育与开源社区
Python是工业界和教育领域最常用的语言之一,其英文关键字和内置函数/模块使其接近伪代码,具有高可读性和易写性。然而,非英语使用者可能无法享受这些优势,甚至因术语的英语属性而增加理解负担。为此,我们提出自动翻译Python自然模态(如关键字、错误类型、标识符等)到其他人类语言的任务。该任务面临术语简短及跨语言难以表达高级数学/编程概念的挑战。因此,我们设计了一个自动化流水线,对比机器翻译与大语言模型的策略。利用该流水线,我们将五个常见Python库(pytorch、pandas、tensorflow、numpy、random)翻译为七种语言,并对法语、希腊语和孟加拉语中的部分术语进行质量测试。这项工作旨在为实现人人可访问的通用Python铺平道路,无论国籍或语言背景。
原文摘要 · Abstract (English)
Python is one of the most commonly used programming languages in industry and education. Its English keywords and built-in functions/modules allow it to come close to pseudo-code in terms of its readability and ease of writing. However, those who do not speak English may not experience these advantages. In fact, they may even be hindered in their ability to understand Python code, as the English nature of its terms creates an additional layer of overhead. To that end, we introduce the task of automatically translating Python's natural modality (keywords, error types, identifiers, etc.) into other human languages. This presents a unique challenge, considering the abbreviated nature of these forms, as well as potential untranslatability of advanced mathematical/programming concepts across languages. We therefore create an automated pipeline to translate Python into other human languages, comparing strategies using machine translation and large language models. We then use this pipeline to acquire translations from five common Python libraries (pytorch, pandas, tensorflow, numpy, and random) in seven languages, and do a quality test on a subset of these terms in French, Greek, and Bengali. We hope this will provide a clearer path forward towards creating a universal Python, accessible to anyone regardless of nationality or language background.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。