论文标题

我知道您在搜索什么:来自堆栈溢出帖子的代码段推荐

I Know What You Are Searching For: Code Snippet Recommendation from Stack Overflow Posts

论文作者

Gao, Zhipeng, Xia, Xin, Lo, David, Grundy, John, Zhang, Xindong, Xing, Zhenchang

论文摘要

软件开发人员大量使用了堆栈溢出来寻求与编程相关的信息。越来越多的开发人员使用社区问答论坛(例如堆栈溢出)来搜索如何完成某项编码任务的代码示例。通常认为这比从源文档,教程或完整的示例中工作要高效。但是,由于这些在线问题和答案论坛的复杂性以及它们所包含的大量信息,开发人员可能会被大量可用信息所淹没。这使得很难找到和/甚至意识到满足他们需求的最相关的代码示例。为了减轻此问题,在这项工作中,我们提出了一个名为Que2Code的查询驱动的代码建议工具,该工具标识了堆栈溢出帖子中用户查询的最佳代码段。我们的方法有两个主要阶段:(i)语义上等效的问题检索和(ii)最佳代码段推荐。为了评估我们提出的模型的性能,我们进行了大规模的实验,以评估语义上等效的问题检索任务的有效性和最佳代码段推荐任务,分别在堆栈溢出中的Python和Java数据集上。我们还进行了人类研究,以衡量现实世界开发人员如何看待我们的模型产生的结果。自动和人类评估结果都证明了我们的模型的有希望的表现,并且我们发布了代码和数据以协助其他研究人员。

Stack Overflow has been heavily used by software developers to seek programming-related information. More and more developers use Community Question and Answer forums, such as Stack Overflow, to search for code examples of how to accomplish a certain coding task. This is often considered to be more efficient than working from source documentation, tutorials or full worked examples. However, due to the complexity of these online Question and Answer forums and the very large volume of information they contain, developers can be overwhelmed by the sheer volume of available information. This makes it hard to find and/or even be aware of the most relevant code examples to meet their needs. To alleviate this issue, in this work we present a query-driven code recommendation tool, named Que2Code, that identifies the best code snippets for a user query from Stack Overflow posts. Our approach has two main stages: (i) semantically-equivalent question retrieval and (ii) best code snippet recommendation. To evaluate the performance of our proposed model, we conduct a large scale experiment to evaluate the effectiveness of the semantically-equivalent question retrieval task and best code snippet recommendation task separately on Python and Java datasets in Stack Overflow. We also perform a human study to measure how real-world developers perceive the results generated by our model. Both the automatic and human evaluation results demonstrate the promising performance of our model, and we have released our code and data to assist other researchers.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源