File size: 5,514 Bytes
74cca87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: odbl
task_categories:
- text-classification
- sentence-similarity
language:
- en
tags:
- code
pretty_name: code-vs-text
size_categories:
- 10K<n<100K
---


This dataset was created for SemEval-2026 Task 13, which focuses on distinguishing machine-generated code from human-written code across multiple programming languages and domains.

While the original SemEval task operates at the code snippet level, this dataset provides line-level annotations that enable finer-grained analysis of how code-like and text-like content is distributed within mixed inputs. The dataset is intended to support research in machine-generated code detection, robust preprocessing, and stylometric analysis, particularly in settings where natural language and programming code naturally coexist.

Each row corresponds to a single line, extracted from real-world sources such as Stack Overflow posts and Twitch chat messages.

## **Task Definition**

**Binary line-level classification:**

* **label = 0** — natural language text
* **label = 1** — programming code

The task is intentionally defined at the **line granularity**, rather than document or block level, to support applications such as preprocessing pipelines, mixed-content filtering, and robustness evaluation.

---

## **Dataset Structure**

The dataset consists of **three columns**:

| Column   | Description                                                                          |
| -------- | ------------------------------------------------------------------------------------ |
| `line`   | Raw line content (text or code). Punctuation, symbols, and formatting are preserved. |
| `label`  | Binary label (0 = text, 1 = code).                                                   |
| `source` | Data origin: `stackoverflow_2019`, `stackoverflow_2020`, or `twitch`.                |

No aggressive normalization has been applied; punctuation, symbols, and formatting are preserved.

---

## **Data Collection and Processing**

### **Stack Overflow Data**

The Stack Overflow portion of the dataset was created by parsing **HTML post bodies** and explicitly separating structural elements:

* Code lines are extracted from `&lt;code&gt;` tags
* Text lines are extracted from `&lt;p&gt;` (paragraph) tags

To ensure that extracted code corresponds to **actual programming content**, code blocks are filtered by post tags, retaining only posts associated with the following technologies:

* `&lt;c++&gt;`, `&lt;java&gt;`, `&lt;python&gt;`, `&lt;php&gt;`, `&lt;c#&gt;`, `&lt;javascript&gt;`, `&lt;c&gt;`, `&lt;go&gt;`
* `&lt;react-native&gt;`, `&lt;laravel&gt;`, `&lt;django&gt;`, `&lt;typescript&gt;`, `&lt;node.js&gt;`, `&lt;.net-core&gt;`

**Additional filtering steps:**

* Lines containing package installation commands (e.g. `pip`) are excluded
* Lines dominated by error messages or stack traces are ignored
* Duplicate lines are removed after normalization

This filtering aims to retain **clean, representative programming code** while avoiding noisy or auxiliary content.

---

### **Twitch Data**

The Twitch portion consists exclusively of **natural language text** and is included to introduce **informal, unstructured, and ambiguous language** that is difficult to distinguish from code using surface-level heuristics.

**Key properties:**

* No code labels are present in this subset
* Duplicate lines are removed
* Language is short, conversational, and noisy

The purpose of this source is to **increase dataset difficulty** and improve **robustness to domain shift**.

---

## **Dataset Statistics**

### **Overall Size**

* **Total lines:** 52,270
* **Text (label 0):** 27,330
* **Code (label 1):** 24,940

The dataset is approximately balanced, enabling standard classification benchmarks without mandatory resampling.

---

### **Label Distribution by Source**

| Source             | Text (0) | Code (1) |
| ------------------ | -------: | -------: |
| stackoverflow_2019 |   14,698 |        0 |
| stackoverflow_2020 |    7,948 |   24,940 |
| twitch             |    4,684 |        0 |

---

### **Source Distribution**

* **Stack Overflow 2020:** 32,888 lines (62.9%)
* **Stack Overflow 2019:** 14,698 lines (28.1%)
* **Twitch:** 4,684 lines (9.0%)

---

### **Line Length Statistics (Characters)**

**Overall:**

* **Mean:** 59.53
* **Median:** 34
* **Minimum:** 1
* **Maximum:** 9,082
* **Standard deviation:** 85.95

**By source:**

* **Stack Overflow 2019:** mean 88.71, median 58
* **Stack Overflow 2020:** mean 51.60, median 33
* **Twitch:** mean 23.62, median 17

---

## **Intended Use Cases**

* Line-level code vs text classification
* Mixed-content preprocessing and filtering
* Robustness evaluation across domains
* Stylometry and authorship analysis
* Code-aware language modeling pipelines

---

## **Limitations**

* Labels are **structural**, not semantic
* Code-like text outside `&lt;code&gt;` tags is labeled as text
* Logs or pseudo-code inside code blocks are labeled as code
* Line-level context across adjacent lines is not preserved

Users should account for these properties when designing downstream tasks.

---

## **Data Sources and Licensing**

This dataset is derived from **publicly available sources**.
Please refer to the following datasets for original data and licensing information:

* **Stack Overflow dataset:** *(link to be added)*
* **Twitch dataset:** *(link to be added)*

Users are responsible for complying with the original licenses when redistributing or building upon this dataset.