SCC-GPT: Source Code Classification Based on Generative Pre-Trained Transformers

被引:0
|
作者
Alahmadi, Mohammad D. [1 ]
Alshangiti, Moayad [1 ]
Alsubhi, Jumana [2 ]
机构
[1] Univ Jeddah, Coll Comp Sci & Engn, Dept Software Engn, Jeddah 23890, Saudi Arabia
[2] Univ Georgia, Sch Comp, Athens, GA 30602 USA
关键词
SCC (Source Code Classification); NLP (Natural Language Processing); Large Lagnuage Model (LLM);
D O I
10.3390/math12132128
中图分类号
O1 [数学];
学科分类号
0701 ; 070101 ;
摘要
Developers often rely on online resources, such as Stack Overflow (SO), to seek assistance for programming tasks. To facilitate effective search and resource discovery, manual tagging of questions and posts with the appropriate programming language is essential. However, accurate tagging is not consistently achieved, leading to the need for the automated classification of code snippets into the correct programming language as a tag. In this study, we introduce a novel approach to automated classification of code snippets from Stack Overflow (SO) posts into programming languages using generative pre-trained transformers (GPT). Our method, which does not require additional training on labeled data or dependency on pre-existing labels, classifies 224,107 code snippets into 19 programming languages. We employ the text-davinci-003 model of ChatGPT-3.5 and postprocess its responses to accurately identify the programming language. Our empirical evaluation demonstrates that our GPT-based model (SCC-GPT) significantly outperforms existing methods, achieving a median F1-score improvement that ranges from +6% to +31%. These findings underscore the effectiveness of SCC-GPT in enhancing code snippet classification, offering a cost-effective and efficient solution for developers who rely on SO for programming assistance.
引用
收藏
页数:12
相关论文
empty
未找到相关数据