The ability to generate natural language sequences from source code snippets has a variety of applications such as code summarization, documentation, and retrieval. Sequence-to-sequence (seq2seq) models, adopted from neural machine translation (NMT), have achieved state-of-the-art performance on these tasks by treating source code as a sequence of tokens. We present ${\rm {\scriptsize CODE2SEQ}}$: an alternative approach that leverages the syntactic structure of programming languages to better encode source code. Our model represents a code snippet as the set of compositional paths in its abstract syntax tree (AST) and uses attention to select the relevant paths while decoding. We demonstrate the effectiveness of our approach for two tasks, two programming languages, and four datasets of up to $16$M examples. Our model significantly outperforms previous models that were specifically designed for programming languages, as well as state-of-the-art NMT models. An interactive online demo of our model is available at http://code2seq.org. Our code, data and trained models are available at http://github.com/tech-srl/code2seq.


翻译:从源代码片断生成自然语言序列的能力有多种应用,如代码总和、文档和检索等。从神经机器翻译(NMT)中采用的序列到序列(seq2seq)模型,通过将源代码作为象征序列处理,在这些任务上取得了最先进的表现。我们展示了$@rm=Scruitsize CODE2SE ⁇ $:一种利用编程语言合成结构更好地编码源代码的替代方法。我们的模型代表一个代码片段,作为抽象合成图树(AST)中的成份路径集,在解码过程中,利用注意力选择相关路径。我们展示了我们的方法在两种任务(两种程序语言)和四个高达16美元的数据集上的有效性。我们的模型大大超越了以前专门设计用于编程语言的模型,以及NMTMT模式的状态。我们的模型互动在线演示可在http://code2seq.org上查阅。我们的代码、数据和经过培训的模型可在 http://codecodes2-rcodeal/codegred. httpgreabs/teqrcode.

3
下载
关闭预览

相关内容

ACM/IEEE第23届模型驱动工程语言和系统国际会议,是模型驱动软件和系统工程的首要会议系列,由ACM-SIGSOFT和IEEE-TCSE支持组织。自1998年以来,模型涵盖了建模的各个方面,从语言和方法到工具和应用程序。模特的参加者来自不同的背景,包括研究人员、学者、工程师和工业专业人士。MODELS 2019是一个论坛,参与者可以围绕建模和模型驱动的软件和系统交流前沿研究成果和创新实践经验。今年的版本将为建模社区提供进一步推进建模基础的机会,并在网络物理系统、嵌入式系统、社会技术系统、云计算、大数据、机器学习、安全、开源等新兴领域提出建模的创新应用以及可持续性。 官网链接:http://www.modelsconference.org/
最新《生成式对抗网络》简介,25页ppt
专知会员服务
167+阅读 · 2020年6月28日
专知会员服务
59+阅读 · 2020年3月19日
ExBert — 可视化分析Transformer学到的表示
专知会员服务
30+阅读 · 2019年10月16日
Hierarchically Structured Meta-learning
CreateAMind
23+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
24+阅读 · 2019年5月18日
强化学习的Unsupervised Meta-Learning
CreateAMind
17+阅读 · 2019年1月7日
无监督元学习表示学习
CreateAMind
25+阅读 · 2019年1月4日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
gan生成图像at 1024² 的 代码 论文
CreateAMind
4+阅读 · 2017年10月31日
MoCoGAN 分解运动和内容的视频生成
CreateAMind
18+阅读 · 2017年10月21日
【论文】图上的表示学习综述
机器学习研究会
12+阅读 · 2017年9月24日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Music Transformer
Arxiv
5+阅读 · 2018年12月12日
Arxiv
5+阅读 · 2018年6月4日
Arxiv
6+阅读 · 2018年4月21日
VIP会员
相关资讯
Hierarchically Structured Meta-learning
CreateAMind
23+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
24+阅读 · 2019年5月18日
强化学习的Unsupervised Meta-Learning
CreateAMind
17+阅读 · 2019年1月7日
无监督元学习表示学习
CreateAMind
25+阅读 · 2019年1月4日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
gan生成图像at 1024² 的 代码 论文
CreateAMind
4+阅读 · 2017年10月31日
MoCoGAN 分解运动和内容的视频生成
CreateAMind
18+阅读 · 2017年10月21日
【论文】图上的表示学习综述
机器学习研究会
12+阅读 · 2017年9月24日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Top
微信扫码咨询专知VIP会员