arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2210.15845cs.SE
收藏

我知道你在找什么:来自Stack Overflow帖子的代码嗅探器推荐

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

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

摘要:

Stack Overflow已经被软件开发人员大量使用来寻找与编程相关的信息。越来越多的开发人员使用社区问答论坛(如Stack Overflow)来搜索如何完成特定编码任务的代码示例。这通常被认为比从源文档,教程或完整的工作示例中工作更有效。然而,由于这些在线问答论坛的复杂性以及它们包含的大量信息,开发人员可能会被大量的可用信息所淹没。这使得很难找到和/或甚至知道最相关的代码示例来满足他们的需求。为了缓解这个问题,在这项工作中,我们提出了一个查询驱动的代码推荐工具,名为Que 2Code,它可以从Stack Overflow帖子中识别用户查询的最佳代码片段。我们的方法有两个主要阶段:(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.

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

↑