TCCCD: Triplet-Based Cross-Language Code Clone Detection

Author:

Fang Yong1,Zhou Fangzheng1ORCID,Xu Yijia1ORCID,Liu Zhonglin1

Affiliation:

1. College of Cybersecurity, Sichuan University, Chengdu 610065, China

Abstract

Code cloning is a common practice in software development, where developers reuse existing code to accelerate programming speed and enhance work efficiency. Existing clone-detection methods mainly focus on code clones within a single programming language. To address the challenge of code clone instances in cross-platform development, we propose a novel method called TCCCD, which stands for Triplet-Based Cross-Language Code Clone Detection. Our approach is based on machine learning and can accurately detect code clone instances between different programming languages. We used the pre-trained model UniXcoder to map programs written in different languages into the same vector space and learn their code representations. Then, we fine-tuned TCCCD using triplet learning to improve its effectiveness in cross-language clone detection. To assess the effectiveness of our proposed approach, we conducted thorough comparative experiments using the dataset provided by the paper titled CLCDSA (Cross Language Code Clone Detection using Syntactical Features and API Documentation). The experimental results demonstrated a significant improvement of our approach over the state-of-the-art baselines, with precision, recall, and F1-measure scores of 0.96, 0.91, and 0.93, respectively. In summary, we propose a novel cross-language code-clone-detection method called TCCCD. TCCCD leverages the pre-trained model UniXcode for source code representation and fine-tunes the model using triplet learning. In the experimental results, TCCCD outperformed the state-of-the-art baselines in terms of the precision, recall, and F1-measure.

Funder

National Science Foundation of China

Publisher

MDPI AG

Subject

Fluid Flow and Transfer Processes,Computer Science Applications,Process Chemistry and Technology,General Engineering,Instrumentation,General Materials Science

Reference53 articles.

1. A survey on software clone detection research;Roy;Queen’s Sch. Comput. TR,2007

2. Analyzing cloning evolution in the linux kernel;Antoniol;Inf. Softw. Technol.,2002

3. Dang, Y., Ge, S., Huang, R., and Zhang, D. (2011, January 23). Code clone detection experience at Microsoft. Proceedings of the 5th International Workshop on Software Clones, Waikiki, HI, USA.

4. Comparison and evaluation of clone detection tools;Bellon;IEEE Trans. Softw. Eng.,2007

5. Juergens, E., Deissenboeck, F., Hummel, B., and Wagner, S. (2009). Proceedings of the IEEE 31st International Conference on Software Engineering, IEEE.

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3