Bag-of-Words Baselines for Semantic Code Search

Xinyu Zhang, Ji Xin, Andrew Yates, Jimmy J. Lin, D. Cheriton
{"title":"Bag-of-Words Baselines for Semantic Code Search","authors":"Xinyu Zhang, Ji Xin, Andrew Yates, Jimmy J. Lin, D. Cheriton","doi":"10.18653/v1/2021.nlp4prog-1.10","DOIUrl":null,"url":null,"abstract":"The task of semantic code search is to retrieve code snippets from a source code corpus based on an information need expressed in natural language. The semantic gap between natural language and programming languages has for long been regarded as one of the most significant obstacles to the effectiveness of keyword-based information retrieval (IR) methods. It is a common assumption that “traditional” bag-of-words IR methods are poorly suited for semantic code search: our work empirically investigates this assumption. Specifically, we examine the effectiveness of two traditional IR methods, namely BM25 and RM3, on the CodeSearchNet Corpus, which consists of natural language queries paired with relevant code snippets. We find that the two keyword-based methods outperform several pre-BERT neural models. We also compare several code-specific data pre-processing strategies and find that specialized tokenization improves effectiveness.","PeriodicalId":435990,"journal":{"name":"Proceedings of the 1st Workshop on Natural Language Processing for Programming (NLP4Prog 2021)","volume":"142 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"1900-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 1st Workshop on Natural Language Processing for Programming (NLP4Prog 2021)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.18653/v1/2021.nlp4prog-1.10","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

The task of semantic code search is to retrieve code snippets from a source code corpus based on an information need expressed in natural language. The semantic gap between natural language and programming languages has for long been regarded as one of the most significant obstacles to the effectiveness of keyword-based information retrieval (IR) methods. It is a common assumption that “traditional” bag-of-words IR methods are poorly suited for semantic code search: our work empirically investigates this assumption. Specifically, we examine the effectiveness of two traditional IR methods, namely BM25 and RM3, on the CodeSearchNet Corpus, which consists of natural language queries paired with relevant code snippets. We find that the two keyword-based methods outperform several pre-BERT neural models. We also compare several code-specific data pre-processing strategies and find that specialized tokenization improves effectiveness.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
语义代码搜索的词袋基线
语义代码搜索的任务是根据用自然语言表达的信息需求,从源代码语料库中检索代码片段。自然语言和程序设计语言之间的语义差异一直被认为是影响基于关键字的信息检索(IR)方法有效性的主要障碍之一。人们普遍认为,“传统的”词袋IR方法不适合语义代码搜索:我们的工作对这一假设进行了实证研究。具体来说,我们研究了两种传统的IR方法BM25和RM3在CodeSearchNet语料库上的有效性,该语料库由自然语言查询与相关代码片段配对组成。我们发现这两种基于关键字的方法优于几种pre-BERT神经模型。我们还比较了几种特定于代码的数据预处理策略,发现专门的标记化可以提高效率。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Time-Efficient Code Completion Model for the R Programming Language Bag-of-Words Baselines for Semantic Code Search ConTest: A Unit Test Completion Benchmark featuring Context
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1