Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,117 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- text-generation
|
| 5 |
+
- text2text-generation
|
| 6 |
+
language:
|
| 7 |
+
- code
|
| 8 |
+
tags:
|
| 9 |
+
- code
|
| 10 |
+
- programming-languages
|
| 11 |
+
- python
|
| 12 |
+
- javascript
|
| 13 |
+
- nodejs
|
| 14 |
+
- java
|
| 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,
|
| 88 |
+
"language": "Python",
|
| 89 |
+
"category": "Hello World",
|
| 90 |
+
"difficulty": "beginner",
|
| 91 |
+
"task_description": "Print 'Hello, World!' to the console.",
|
| 92 |
+
"code": "print(\"Hello, World!\")",
|
| 93 |
+
"explanation": "Python's print() function writes text to standard output."
|
| 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
|
| 112 |
+
|
| 113 |
+
- Fine-tuning a code-explanation or code-generation model
|
| 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
|