TCCCD: Triplet-Based Cross-Language Code Clone Detection
Open Access
- 6 November 2023
- journal article
- research article
- Published by MDPI AG in Applied Sciences
- Vol. 13 (21) , 12084
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.Keywords
Funding Information
- National Natural Science Foundation of China (U20B2045)
This publication has 39 references indexed in Scilit:
- CLCMiner: Detecting Cross-Language Clones without IntermediatesIEICE Transactions on Information and Systems, 2017
- SourcererCC2016
- FaceNet: A unified embedding for face recognition and clustering2015
- Toward Deep Learning Software Repositories2015
- Glove: Global Vectors for Word Representation2014
- Boreas: an accurate and scalable token-based approach to code clone detection2012
- CMCD: Count Matrix Based Code Clone Detection2011
- DECKARD: Scalable and Accurate Tree-Based Detection of Code Clones29th International Conference on Software Engineering (ICSE'07), 2007
- Analyzing cloning evolution in the Linux kernelInformation and Software Technology, 2002
- CCFinder: a multilinguistic token-based code clone detection system for large scale source codeIEEE Transactions on Software Engineering, 2002