Existing code similarity metrics, such as BLEU, CodeBLEU, and TSED, largely rely on surface-level string overlap or abstract syntax tree structures, and often fail to capture deeper semantic relationships between programs.We propose CSSG (Code Similarity using Semantic Graphs), a novel metric that leverages program dependence graphs to explicitly model control dependencies and variable interactions, providing a semantics-aware representation of code.Experiments on the CodeContests+ dataset show that CSSG consistently outperforms existing metrics in distinguishing more similar code from less similar code under both monolingual and cross-lingual settings, demonstrating that dependency-aware graph representations offer a more effective alternative to surface-level or syntax-based similarity measures.


翻译:现有的代码相似性度量方法,如BLEU、CodeBLEU和TSED,主要依赖于表层的字符串重叠或抽象语法树结构,往往无法捕捉程序间更深层的语义关系。我们提出了CSSG(基于语义图的代码相似性度量),这是一种新颖的度量方法,它利用程序依赖图来显式建模控制依赖关系和变量交互,从而提供一种语义感知的代码表示。在CodeContests+数据集上的实验表明,无论是在单语言还是跨语言场景下,CSSG在区分相似度较高与较低的代码方面均持续优于现有度量方法,这证明依赖感知的图表示比基于表层或语法的相似性度量提供了更有效的替代方案。

0
下载
关闭预览

相关内容

【CVPR2022】语言引导与基于视觉的深度度量学习的集成
专知会员服务
17+阅读 · 2022年3月17日
专知会员服务
17+阅读 · 2021年5月13日
【Code】GraphSAGE 源码解析
AINLP
31+阅读 · 2020年6月22日
【深度语义匹配模型】原理篇二:交互篇
AINLP
16+阅读 · 2020年5月18日
计算文本相似度常用的四种方法
论智
33+阅读 · 2018年5月18日
实战 | 基于深度学习模型VGG的图像识别(附代码)
七月在线实验室
13+阅读 · 2018年3月30日
推荐 | 基于深度学习的图像语义分割方法回顾(附PDF下载)
机器学习算法与Python学习
25+阅读 · 2017年12月30日
python文本相似度计算
北京思腾合力科技有限公司
24+阅读 · 2017年11月6日
各种相似性度量及Python实现
机器学习算法与Python学习
11+阅读 · 2017年7月6日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
VIP会员
相关资讯
【Code】GraphSAGE 源码解析
AINLP
31+阅读 · 2020年6月22日
【深度语义匹配模型】原理篇二:交互篇
AINLP
16+阅读 · 2020年5月18日
计算文本相似度常用的四种方法
论智
33+阅读 · 2018年5月18日
实战 | 基于深度学习模型VGG的图像识别(附代码)
七月在线实验室
13+阅读 · 2018年3月30日
推荐 | 基于深度学习的图像语义分割方法回顾(附PDF下载)
机器学习算法与Python学习
25+阅读 · 2017年12月30日
python文本相似度计算
北京思腾合力科技有限公司
24+阅读 · 2017年11月6日
各种相似性度量及Python实现
机器学习算法与Python学习
11+阅读 · 2017年7月6日
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
Top
微信扫码咨询专知VIP会员