基于关系图卷积网络的代码搜索方法
作者:
作者单位:

作者简介:

通讯作者:

中图分类号:

TP311

基金项目:

国家自然科学基金(61972173); 中央高校自主科研经费(CCNU22QN015); 武汉市知识创新专项基础研究项目(2022010801010278)


Code Search Method Based on Relational Graph Convolutional Network
Author:
Affiliation:

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    代码搜索是当下自然语言处理和软件工程交叉领域的一个重要分支. 开发高效的代码搜索算法能够显著提高代码重用的能力, 从而有效提高软件开发人员的工作效率. 代码搜索任务是以描述代码片段功能的自然语言作为输入, 在海量代码库中搜索得到相关代码片段的过程. 基于序列模型的代码搜索方法DeepCS虽然取得了很好的效果, 但这种方法不能捕捉代码的深层语义. 基于图嵌入的代码搜索方法GraphSearchNet能缓解这个问题, 但没有对代码与文本进行细粒度匹配, 也忽视了代码图和文本图的全局关系. 为了解决以上局限性, 提出基于关系图卷积网络的代码搜索方法, 对构建的文本图和代码图编码, 从节点层面对文本查询和代码片段进行细粒度匹配, 并应用神经张量网络捕捉它们的全局关系. 在两个公开数据集上的实验结果表明, 所提方法比先进的基线模型DeepCS和GraphSearchNet搜索精度更高.

    Abstract:

    Code search is an important research topic in natural language processing and software engineering. Developing efficient code search algorithms can significantly improve the code reuse and the working efficiency of software developers. The task of code search is to retrieve code fragments that meet the requirements from the massive code repository by taking the natural language describing the function of the code fragments as input. Although the sequence model-based code search method, namely DeepCS has achieved promising results, it cannot capture the deep semantics of the code. GraphSearchNet, a code search method based on graph embedding, can alleviate this problem, but it does not perform fine-grained matching on codes and texts and ignores the global relationship between code graphs and text graphs. To address the above limitations, this study proposes a code search method based on a relational graph convolutional network, which encodes the constructed text graphs and code graphs, performs fine-grained matching on text query and code fragments at the node level, and applies neural tensor networks to capture their global relationship. Experimental results on two public datasets show that the proposed method achieves higher search accuracy than state-of-the-art baseline models, namely DeepCS and GraphSearchNet.

    参考文献
    相似文献
    引证文献
引用本文

周光有,谢琦,余啸.基于关系图卷积网络的代码搜索方法.软件学报,,():1-18

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2022-03-24
  • 最后修改日期:2022-06-14
  • 录用日期:
  • 在线发布日期: 2023-07-12
  • 出版日期:
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号