File size: 4,216 Bytes
74f9a6d
c57c7da
 
 
74f9a6d
c57c7da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74f9a6d
c57c7da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
---
language:
- en

license: mit

task_categories:
- text-classification


tags:
- code
- source-code
- programming-languages
- language-identification
- language-classification
- code-classification
- machine-learning
- classification
- benchmark
- code-intelligence
- software-engineering

pretty_name: Programming Language Classification Dataset

size_categories:
- 1M<n<10M
---

# Programming Language Classification Dataset

A large-scale, balanced dataset for programming language identification from source code snippets.

## Overview

This dataset contains **1.664 million cleaned and labeled source code samples** across **16 programming languages**, specifically designed for programming language classification and identification tasks.

Unlike many code datasets that are primarily built for code generation or retrieval, this dataset was curated specifically for language classification. Significant effort was invested in deduplication, quality filtering, class balancing, and evaluation split construction to create a reliable benchmark for training and evaluating language identification models.

### Key Features

- 1.664 million labeled samples
- 16 programming languages
- Class-balanced dataset
- Multi-stage deduplication pipeline
- Quality-filtered samples
- Fixed train/validation/test splits
- Suitable for both traditional ML and neural approaches

## Supported Languages

| Language |
|-----------|
| Assembly |
| C |
| C++ |
| C# |
| CSS |
| Dart |
| Go |
| HTML |
| Java |
| JavaScript |
| Kotlin |
| Lua |
| Markdown |
| Python |
| Rust |
| TypeScript |

## Dataset Statistics

| Split | Samples per Language | Total Samples |
|---------|---------:|---------:|
| Train | 100,000 | 1,600,000 |
| Validation | 2,000 | 32,000 |
| Test | 2,000 | 32,000 |
| Total | 104,000 | 1,664,000 |

The dataset is fully balanced across all languages to reduce class imbalance and evaluation bias.

## Data Format

Samples are stored in JSONL format.

```json
{
  "content": "def hello_world():\n    print('Hello World')",
  "label": "Python"
}
```

## Source Dataset

This dataset was derived from:

https://huggingface.co/datasets/lumees/github-code-2025-language-split

The original dataset was language-separated and used as the foundation for further processing, cleaning, filtering, balancing, and dataset construction.

## Dataset Construction Pipeline

The dataset was created through a multi-stage processing pipeline.

### 1. Language-Based Collection

Source code was collected from the source dataset and organized by programming language.

### 2. Code Chunk Generation

Large source files were segmented into smaller code snippets suitable for language classification tasks.

This increases sample diversity while making training more efficient.

### 3. Multi-Stage Deduplication

Several rounds of deduplication were applied to reduce repeated and near-duplicate code fragments.

The objective was to improve diversity and reduce memorization of highly repetitive samples.

### 4. Quality Filtering

A custom filtering pipeline was applied to remove low-quality samples.

Filtering stages included:

- Low-information sample detection
- Repetitive content removal
- Character distribution analysis
- Symbol-density analysis
- Structural code heuristics
- Corrupted fragment removal

Conservative filtering thresholds were intentionally used to preserve valid code across languages with very different syntactic structures such as Assembly, CSS, HTML, Markdown, and Python.

### 5. Balanced Sampling

Many languages originally contained substantially different numbers of samples.

To prevent majority-language bias, a balanced subset was created for every language.

Each language contributes exactly:

- 100,000 training samples
- 2,000 validation samples
- 2,000 test samples

### 6. Split Construction

Validation and test sets were sampled independently for each language to ensure balanced and reliable evaluation.

## Design Goals

The dataset was built with the following objectives:

- Balanced language representation
- Reduced duplication
- High sample diversity
- Reliable evaluation splits
- Efficient classifier training
- Support for both classical ML and neural approaches