OCoR:一个重叠识别的代码检索器
OCoR: An Overlapping-Aware Code Retriever
摘要:
代码检索帮助开发人员在开源项目中重用代码片段。代码检索的目标是在给定的自然语言描述下,从一组代码中寻找最相关的代码。现有的最先进的方法将神经网络应用于代码检索。然而,这些方法仍然未能捕获重要的功能:重叠。不同人使用的不同名称之间的重叠指示两个不同名称可能潜在地相关(例如,“消息”和“msg”),并且代码中的标识符与自然语言描述中的单词之间的重叠指示代码片段和描述可能潜在地相关。为了解决这些问题,我们提出了一种名为OCoR的新型神经架构,其中我们引入了两个专门设计的组件来捕获重叠:第一个按字符嵌入标识符以捕获标识符之间的重叠,第二个引入了一个新的重叠矩阵来表示每个自然语言单词和每个标识符之间的重叠程度。评价是在两个已建立的数据集上进行的。实验结果表明,OCoR显着优于现有的国家的最先进的方法,并实现了13.1%至22.3%的改善。此外,我们还进行了一些深入的实验,以帮助了解OCoR中不同组件的性能。
英文摘要:
Code retrieval helps developers reuse the code snippet in the open-source projects. Given a natural language description, code retrieval aims to search for the most relevant code among a set of code. Existing state-of-the-art approaches apply neural networks to code retrieval. However, these approaches still fail to capture an important feature: overlaps. The overlaps between different names used by different people indicate that two different names may be potentially related (e.g., "message" and "msg"), and the overlaps between identifiers in code and words in natural language descriptions indicate that the code snippet and the description may potentially be related. To address these problems, we propose a novel neural architecture named OCoR, where we introduce two specifically-designed components to capture overlaps: the first embeds identifiers by character to capture the overlaps between identifiers, and the second introduces a novel overlap matrix to represent the degrees of overlaps between each natural language word and each identifier. The evaluation was conducted on two established datasets. The experimental results show that OCoR significantly outperforms the existing state-of-the-art approaches and achieves 13.1% to 22.3% improvements. Moreover, we also conducted several in-depth experiments to help understand the performance of different components in OCoR.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。