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

通过读取API文档生成未知库的代码

Code Generation for Unknown Libraries via Reading API Documentations

The University of Tokyo(东京大学)

Koki Washio, Yusuke Miyao

摘要:

开放域代码生成是一个具有挑战性的问题,因为我们使用的函数和类的集合在编程社区中经常被更改和扩展。我们考虑的挑战,代码生成未知的库,而无需额外的培训。在本文中,我们探索了一个代码生成的框架,它可以像人类程序员一样引用相关的API文档来处理未知的库。作为这个方向的第一步,我们实现了一个模型,可以提取相关的代码签名从API文档的基础上的自然语言的意图和复制原语从提取的签名。此外,为了评估未知库和我们的框架的代码生成,我们扩展了现有的开放域代码生成的数据集,并重新拆分它,使评估数据只包括使用不出现在训练数据中的库的例子。我们的新分裂的实验表明,基线编码器-解码器模型不能生成代码使用未知库的原语预期。相比之下,我们的模型在新的分割上优于基线,并且当提取的代码签名是无噪声的时,可以正确地生成未知的原语。

英文摘要:

Open-domain code generation is a challenging problem because the set of functions and classes that we use are frequently changed and extended in programming communities. We consider the challenge of code generation for unknown libraries without additional training. In this paper, we explore a framework of code generation that can refer to relevant API documentations like human programmers to handle unknown libraries. As a first step of this direction, we implement a model that can extract relevant code signatures from API documentations based on a natural language intent and copy primitives from the extracted signatures. Moreover, to evaluate code generation for unknown libraries and our framework, we extend an existing dataset of open-domain code generation and resplit it so that the evaluation data consist of only examples using the libraries that do not appear in the training data. Experiments on our new split show that baseline encoder-decoder models cannot generate code using primitives of unknown libraries as expected. In contrast, our model outperforms the baseline on the new split and can properly generate unknown primitives when extracted code signatures are noiseless.

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

↑