arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1605.08535cs.SEcs.CLcs.LGcs.NE
收藏

深度API学习

Deep API Learning

The Hong Kong University of Science and Technology(香港科技大学);The University of Newcastle(纽卡斯尔大学);Microsoft Research(微软研究院)

Xiaodong Gu, Hongyu Zhang, Dongmei Zhang, Sunghun Kim

摘要:

开发人员经常想知道如何实现某个功能(例如,如何解析XML文件)。在这方面,基于API相关的自然语言查询来获得API使用序列是非常有帮助的。给定查询,现有方法利用信息检索模型来搜索匹配的API序列。这些方法将查询和API视为词袋(即,关键字匹配或字到字对齐),并且缺乏对查询语义的深入理解。我们提出了DeepAPI,这是一种基于深度学习的方法,可以为给定的自然语言查询生成API使用序列。它学习查询中的单词序列和相关API的序列,而不是词袋假设。DeepAPI采用了一种名为RNN编码器-解码器的神经语言模型。它将词序列(用户查询)编码为固定长度的上下文向量,并基于上下文向量生成API序列。我们还通过考虑各个API的重要性来增强RNN编码器-解码器。我们用从GitHub收集的700多万个带注释的代码片段对我们的方法进行了经验评估。结果表明,我们的方法产生了很大程度上准确的API序列,并优于相关的方法。

英文摘要:

Developers often wonder how to implement a certain functionality (e.g., how to parse XML files) using APIs. Obtaining an API usage sequence based on an API-related natural language query is very helpful in this regard. Given a query, existing approaches utilize information retrieval models to search for matching API sequences. These approaches treat queries and APIs as bag-of-words (i.e., keyword matching or word-to-word alignment) and lack a deep understanding of the semantics of the query. We propose DeepAPI, a deep learning based approach to generate API usage sequences for a given natural language query. Instead of a bags-of-words assumption, it learns the sequence of words in a query and the sequence of associated APIs. DeepAPI adapts a neural language model named RNN Encoder-Decoder. It encodes a word sequence (user query) into a fixed-length context vector, and generates an API sequence based on the context vector. We also augment the RNN Encoder-Decoder by considering the importance of individual APIs. We empirically evaluate our approach with more than 7 million annotated code snippets collected from GitHub. The results show that our approach generates largely accurate API sequences and outperforms the related approaches.

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

↑