TGPRO32 commited on
Commit
be02728
·
verified ·
1 Parent(s): 260c961

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +84 -33
README.md CHANGED
@@ -15,73 +15,100 @@ tags:
15
  - c
16
  - cpp
17
  - rust
 
 
 
18
  pretty_name: Multi-Language Programming Code Dataset
19
  size_categories:
20
- - n<1K
21
  ---
22
 
23
  # Multi-Language Programming Code Dataset
24
 
25
- A small, hand-curated dataset of **original, non-scraped** code examples across 7
26
- programming environments: **Python, JavaScript, Node.js, Java, C, C++, and Rust**.
27
 
28
- Every task/code pair covers the same 15 core programming concepts in each language,
29
- making the dataset useful for cross-language comparison, few-shot prompting,
30
- code-explanation fine-tuning, or as a seed set to expand with your own generation
31
- pipeline.
32
 
33
- > **Note:** Node.js is a JavaScript *runtime*, not a separate language. It's included
34
- > as its own split here because it exposes different APIs (filesystem, `Buffer`,
35
- > `process`, `http`, CommonJS modules) than browser-context JavaScript, which is
36
- > often exactly what people mean when they say "Node.js code."
 
 
 
 
 
37
 
38
  ## Dataset Structure
39
 
 
 
40
  | Column | Description |
41
  |---|---|
42
- | `id` | Unique row identifier |
43
  | `language` | One of: Python, JavaScript, Node.js, Java, C, C++, Rust |
44
- | `category` | Concept covered (see list below) |
45
  | `difficulty` | `beginner`, `intermediate`, or `advanced` |
46
  | `task_description` | Natural-language description of the coding task |
47
- | `code` | The original code snippet solving the task |
48
  | `explanation` | A short note on the key language feature/idiom used |
49
 
50
- **105 rows** = 7 languages × 15 categories.
51
-
52
- ## Categories (15 per language)
53
 
 
54
  Hello World · Variables and Data Types · Control Flow · Loops · Functions ·
55
  Arrays and Lists · Dictionaries and Maps · Classes and OOP · Error Handling ·
56
  File I/O · String Manipulation · Recursion · Sorting Algorithm ·
57
  Async and Concurrency · Data Structures
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  ## Files
60
 
61
- - `code_dataset.jsonl` — one JSON object per line (recommended for HF `datasets.load_dataset("json", ...)`)
62
- - `code_dataset.csv` — same data, spreadsheet-friendly
 
 
63
 
64
  ## Provenance & License
65
 
66
- All code snippets were **written from scratch** for this dataset (not scraped from
67
- GitHub or any other source), so there are no third-party license conflicts.
68
- Released under **MIT** — free to use, modify, and redistribute, including for
69
- model training.
 
70
 
71
  ## Known Limitations
72
 
73
- - Small (105 rows) — meant as a clean seed set / benchmark slice, not a
74
- large-scale pretraining corpus. For that, pair it with something like
 
 
 
75
  [The Stack](https://huggingface.co/datasets/bigcode/the-stack) or
76
  [CodeSearchNet](https://huggingface.co/datasets/code_search_net).
77
- - Only 7 languages/environments — easy to extend by adding more `add(...)` calls
78
- to the included generator script (`generate_dataset.py`) if you want to grow
79
- coverage yourself.
80
- - Snippets favor clarity/idiom over production hardening (e.g., minimal input
81
- validation) — they're meant to teach the *pattern*, not be copy-paste production code.
82
 
83
- ## Example Row
84
 
 
85
  ```json
86
  {
87
  "id": 1,
@@ -94,18 +121,34 @@ model training.
94
  }
95
  ```
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  ## Loading
98
 
99
  **Hugging Face `datasets`:**
100
  ```python
101
  from datasets import load_dataset
102
- ds = load_dataset("json", data_files="code_dataset.jsonl")
 
103
  ```
104
 
105
  **Pandas / Kaggle:**
106
  ```python
107
  import pandas as pd
108
- df = pd.read_csv("code_dataset.csv")
 
 
109
  ```
110
 
111
  ## Suggested Uses
@@ -114,4 +157,12 @@ df = pd.read_csv("code_dataset.csv")
114
  - Few-shot prompting examples for a coding assistant
115
  - Cross-language idiom comparison (e.g., "how does error handling differ
116
  between Python and Rust?")
 
 
117
  - A regression-test seed set for code-generation model evals
 
 
 
 
 
 
 
15
  - c
16
  - cpp
17
  - rust
18
+ - sorting-algorithms
19
+ - data-structures
20
+ - synthetic
21
  pretty_name: Multi-Language Programming Code Dataset
22
  size_categories:
23
+ - 1K<n<10K
24
  ---
25
 
26
  # Multi-Language Programming Code Dataset
27
 
28
+ A curated dataset of **original, non-scraped** code examples across 7 programming
29
+ environments: **Python, JavaScript, Node.js, Java, C, C++, and Rust**.
30
 
31
+ The dataset ships in two parts that can be used separately or combined:
 
 
 
32
 
33
+ | File | Rows | Description |
34
+ |---|---|---|
35
+ | `code_dataset.jsonl` / `.csv` | 105 | Hand-written "core concepts" set — one clean example per language per concept (Hello World, OOP, error handling, recursion, async, etc.) |
36
+ | `code_dataset_large.jsonl` / `.csv` | 2,255 | Template-generated, parameter-varied set covering **sorting algorithms, data structures, and string manipulation** in depth |
37
+
38
+ > **Note on Node.js:** Node.js is a JavaScript *runtime*, not a separate language.
39
+ > It's included as its own split because it exposes different APIs (filesystem,
40
+ > `Buffer`, `process`, `http`, CommonJS modules) than browser-context JavaScript —
41
+ > which is usually what people actually mean by "Node.js code."
42
 
43
  ## Dataset Structure
44
 
45
+ Both files share the same schema:
46
+
47
  | Column | Description |
48
  |---|---|
49
+ | `id` | Unique row identifier (per file) |
50
  | `language` | One of: Python, JavaScript, Node.js, Java, C, C++, Rust |
51
+ | `category` | Concept/topic covered |
52
  | `difficulty` | `beginner`, `intermediate`, or `advanced` |
53
  | `task_description` | Natural-language description of the coding task |
54
+ | `code` | The code snippet solving the task |
55
  | `explanation` | A short note on the key language feature/idiom used |
56
 
57
+ ## `code_dataset` (105 rows) — Core Concepts
 
 
58
 
59
+ 15 categories × 7 languages, one example each:
60
  Hello World · Variables and Data Types · Control Flow · Loops · Functions ·
61
  Arrays and Lists · Dictionaries and Maps · Classes and OOP · Error Handling ·
62
  File I/O · String Manipulation · Recursion · Sorting Algorithm ·
63
  Async and Concurrency · Data Structures
64
 
65
+ ## `code_dataset_large` (2,255 rows) — Deep Coverage on 3 Categories
66
+
67
+ Generated by varying real parameters — algorithm choice, data type, sample
68
+ values, operation sequences, and identifier names — **not** by duplicating
69
+ templates with find-and-replace. Breakdown:
70
+
71
+ | Category | Rows | What varies |
72
+ |---|---|---|
73
+ | Sorting Algorithm | 756 | Algorithm (bubble/selection/insertion), data type (int/float), array size (5–20 elements), 3 random samples per config |
74
+ | Data Structures | 448 | Stack vs. Queue, data type (int/float), 4 distinct push/pop operation sequences, random values |
75
+ | String Manipulation | 1,051 | Operation (palindrome check, reverse, word count, vowel count), 20 distinct test strings, varied function names |
76
+
77
+ Distribution is balanced across languages (~320–326 rows each) and skews
78
+ `intermediate` (1,727) over `beginner` (528), reflecting the algorithmic focus
79
+ of this batch. Exact-duplicate rows were checked and removed (~3% collision
80
+ rate from small-integer arrays landing on the same random sample).
81
+
82
  ## Files
83
 
84
+ - `code_dataset.jsonl` / `code_dataset_large.jsonl` — one JSON object per line (recommended for `datasets.load_dataset("json", ...)`)
85
+ - `code_dataset.csv` / `code_dataset_large.csv` — same data, spreadsheet-friendly
86
+ - `generate_dataset.py` — generator for the 105-row core set (add more languages/categories by adding `add(...)` calls)
87
+ - `generate_batch.py` — generator for the 2,255-row deep-coverage set (add more categories/algorithms by extending the template dicts)
88
 
89
  ## Provenance & License
90
 
91
+ All code was **written from scratch** (hand-authored for the core set;
92
+ programmatically templated with varied real parameters for the large set) —
93
+ nothing was scraped from GitHub or any other source, so there are no
94
+ third-party license conflicts. Released under **MIT** — free to use, modify,
95
+ and redistribute, including for model training.
96
 
97
  ## Known Limitations
98
 
99
+ - The 2,255-row set currently covers only 3 categories in depth (sorting,
100
+ data structures, strings). Categories like "Hello World" or "Variables"
101
+ don't have enough genuine variation to scale the same way — padding them
102
+ would mean shallow repetition rather than useful diversity.
103
+ - For large-scale pretraining, pair this with an established corpus like
104
  [The Stack](https://huggingface.co/datasets/bigcode/the-stack) or
105
  [CodeSearchNet](https://huggingface.co/datasets/code_search_net).
106
+ - Snippets favor clarity/idiom over production hardening (minimal input
107
+ validation) — they teach the *pattern*, not production-ready code.
 
 
 
108
 
109
+ ## Example Rows
110
 
111
+ **Core set:**
112
  ```json
113
  {
114
  "id": 1,
 
121
  }
122
  ```
123
 
124
+ **Large set:**
125
+ ```json
126
+ {
127
+ "id": 11,
128
+ "language": "Python",
129
+ "category": "Sorting Algorithm",
130
+ "difficulty": "intermediate",
131
+ "task_description": "Sort a 12-element array of ints in ascending order using bubble sort.",
132
+ "code": "def bubble_sort(entries):\n n = len(entries)\n ...",
133
+ "explanation": "Bubble sort on int data, variable named 'entries', 12 elements."
134
+ }
135
+ ```
136
+
137
  ## Loading
138
 
139
  **Hugging Face `datasets`:**
140
  ```python
141
  from datasets import load_dataset
142
+ core = load_dataset("json", data_files="code_dataset.jsonl")
143
+ large = load_dataset("json", data_files="code_dataset_large.jsonl")
144
  ```
145
 
146
  **Pandas / Kaggle:**
147
  ```python
148
  import pandas as pd
149
+ core = pd.read_csv("code_dataset.csv")
150
+ large = pd.read_csv("code_dataset_large.csv")
151
+ combined = pd.concat([core, large], ignore_index=True)
152
  ```
153
 
154
  ## Suggested Uses
 
157
  - Few-shot prompting examples for a coding assistant
158
  - Cross-language idiom comparison (e.g., "how does error handling differ
159
  between Python and Rust?")
160
+ - Algorithm-variant training data (many sorting/data-structure/string
161
+ examples with controlled, labeled variation)
162
  - A regression-test seed set for code-generation model evals
163
+
164
+ ## Roadmap
165
+
166
+ The large set can be extended the same way to more categories (recursion,
167
+ OOP, error handling, file I/O, async) by adding template functions to
168
+ `generate_batch.py` — happy to keep scaling this up on request.