arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1809.07945cs.SEcs.LGstat.ML
收藏

SCC:代码段自动分类

SCC: Automatic Classification of Code Snippets

University of Victoria(维多利亚大学)

Kamel Alreshedy, Dhanush Dharmaretnam, Daniel M. German, Venkatesh Srinivasan, T. Aaron Gulliver

摘要:

确定源代码文件的编程语言已经在研究界中被考虑;已经表明,机器学习(ML)和自然语言处理(NLP)算法可以有效地识别源代码文件的程序设计语言。但是,确定代码片段或几行源代码的程序设计语言仍然是一项具有挑战性的任务。Stack Overflow等在线论坛和GitHub等代码库包含大量代码片段。在本文中,我们描述了源代码分类(SCC),一个分类器,可以识别的编程语言编写的代码段在21个不同的程序设计语言。采用使用堆栈溢出帖子训练的多项朴素贝叶斯(MNB)分类器。结果表明,它实现了75%的准确性,这是高于程序设计语言识别(PLI专有的在线分类器的片段),其准确性只有55.5%。该工具的精确度,召回率和F1分数的平均分数分别为0.76,0.75和0.75。此外,它还可以区分来自C、C++和C#等程序设计语言家族的代码片段,还可以识别C# 3.0、C# 4.0和C# 5.0等程序设计语言版本。

英文摘要:

Determining the programming language of a source code file has been considered in the research community; it has been shown that Machine Learning (ML) and Natural Language Processing (NLP) algorithms can be effective in identifying the programming language of source code files. However, determining the programming language of a code snippet or a few lines of source code is still a challenging task. Online forums such as Stack Overflow and code repositories such as GitHub contain a large number of code snippets. In this paper, we describe Source Code Classification (SCC), a classifier that can identify the programming language of code snippets written in 21 different programming languages. A Multinomial Naive Bayes (MNB) classifier is employed which is trained using Stack Overflow posts. It is shown to achieve an accuracy of 75% which is higher than that with Programming Languages Identification (PLI a proprietary online classifier of snippets) whose accuracy is only 55.5%. The average score for precision, recall and the F1 score with the proposed tool are 0.76, 0.75 and 0.75, respectively. In addition, it can distinguish between code snippets from a family of programming languages such as C, C++ and C#, and can also identify the programming language version such as C# 3.0, C# 4.0 and C# 5.0.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑