Vojtech Hejlek commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -15,37 +15,37 @@ size_categories:
|
|
| 15 |
# Dataset Card for C-to-Rust Parallel Semantic Similarity Corpus
|
| 16 |
|
| 17 |
## Dataset Summary
|
| 18 |
-
The **C-to-Rust Parallel Semantic Similarity Corpus** is a curated dataset consisting of **1,886 aligned, function-level C and Rust code pairs**
|
| 19 |
|
| 20 |
-
The source code snippets are drawn from accepted competitive programming submissions across **Project CodeNet**, **xCodeEval**, and **The Algorithms
|
| 21 |
|
| 22 |
## Dataset Structure
|
| 23 |
|
| 24 |
-
The dataset is distributed as a single JSONL file where each row represents an aligned problem pair
|
| 25 |
|
| 26 |
### Data Fields
|
| 27 |
-
* `problem_id` (`string`): A zero-padded sequential identifier spanning `0001` to `1886`
|
| 28 |
-
* `problem_description` (`string`): The full natural language problem statement provided by the source platform
|
| 29 |
-
* `c_code` (`string`): The normalized, fully functional C implementation
|
| 30 |
-
* `rust_code` (`string`): The normalized, fully functional Rust implementation
|
| 31 |
-
* `difficulty` (`string`): The alignment difficulty tier assigned to the pair (`easy`, `medium`, or `hard`)
|
| 32 |
|
| 33 |
---
|
| 34 |
|
| 35 |
## Dataset Creation & Curation
|
| 36 |
|
| 37 |
### Filtering and Preprocessing Pipeline
|
| 38 |
-
1. **Functional Correctness:** Restricted exclusively to submissions marked as "Accepted" by online judges to guarantee true semantic alignment
|
| 39 |
-
2. **Compilation Validation:** Submissions were strictly compiled locally using GCC (C17 standard) and Rust 1.94.0 to eliminate syntax errors or compiler drift
|
| 40 |
-
3. **Code Normalization:** Dead code, redundant macros, comments, and explicit Rust `#[allow(...)]` attributes were systematically stripped
|
| 41 |
-
4. **Function Inlining:** Core logic was restricted to a single function block, and all function identifiers were normalized to `solution` to eliminate superficial retrieval shortcuts
|
| 42 |
-
5. **Semantic
|
| 43 |
-
|
| 44 |
### Difficulty Categorization
|
| 45 |
-
Difficulty tiers were empirically mapped using zero-shot cosine similarity scores from the `SFR-Embedding-Code-400M_R` model
|
| 46 |
-
* **Easy (25%):** Similarity $\ge 0.868$
|
| 47 |
-
* **Medium (50%):** Similarity between $0.781$ and $0.868$
|
| 48 |
-
* **Hard (25%):** Similarity $< 0.781$ (Representing heavy syntax/paradigm divergence)
|
| 49 |
|
| 50 |
---
|
| 51 |
|
|
|
|
| 15 |
# Dataset Card for C-to-Rust Parallel Semantic Similarity Corpus
|
| 16 |
|
| 17 |
## Dataset Summary
|
| 18 |
+
The **C-to-Rust Parallel Semantic Similarity Corpus** is a curated dataset consisting of **1,886 aligned, function-level C and Rust code pairs**. It was developed to evaluate cross-language semantic similarity and functional equivalence between a traditional legacy language (C) and a modern memory-safe language (Rust).
|
| 19 |
|
| 20 |
+
The source code snippets are drawn from accepted competitive programming submissions across **Project CodeNet**, **xCodeEval**, and **The Algorithms. Every pair shares identical algorithmic logic, has been validated to compile under modern environments (GCC C17 and Rust 1.94.0), and is filtered to ensure functional correctness.
|
| 21 |
|
| 22 |
## Dataset Structure
|
| 23 |
|
| 24 |
+
The dataset is distributed as a single JSONL file where each row represents an aligned problem pair.
|
| 25 |
|
| 26 |
### Data Fields
|
| 27 |
+
* `problem_id` (`string`): A zero-padded sequential identifier spanning `0001` to `1886`.
|
| 28 |
+
* `problem_description` (`string`): The full natural language problem statement provided by the source platform.
|
| 29 |
+
* `c_code` (`string`): The normalized, fully functional C implementation.
|
| 30 |
+
* `rust_code` (`string`): The normalized, fully functional Rust implementation.
|
| 31 |
+
* `difficulty` (`string`): The alignment difficulty tier assigned to the pair (`easy`, `medium`, or `hard`).
|
| 32 |
|
| 33 |
---
|
| 34 |
|
| 35 |
## Dataset Creation & Curation
|
| 36 |
|
| 37 |
### Filtering and Preprocessing Pipeline
|
| 38 |
+
1. **Functional Correctness:** Restricted exclusively to submissions marked as "Accepted" by online judges to guarantee true semantic alignment.
|
| 39 |
+
2. **Compilation Validation:** Submissions were strictly compiled locally using GCC (C17 standard) and Rust 1.94.0 to eliminate syntax errors or compiler drift.
|
| 40 |
+
3. **Code Normalization:** Dead code, redundant macros, comments, and explicit Rust `#[allow(...)]` attributes were systematically stripped. Code layouts were standardized using `clang-format` and `rustfmt`.
|
| 41 |
+
4. **Function Inlining:** Core logic was restricted to a single function block, and all function identifiers were normalized to `solution` to eliminate superficial retrieval shortcuts.
|
| 42 |
+
5. **Semantic Diversity:** The final corpus contains a diverse set of unique problems with no overlapping duplicates, providing a clean benchmark for cross-language evaluation.
|
| 43 |
+
6.
|
| 44 |
### Difficulty Categorization
|
| 45 |
+
Difficulty tiers were empirically mapped using zero-shot cosine similarity scores from the `SFR-Embedding-Code-400M_R` model. Quantile thresholds at the 25th and 75th percentiles partition the dataset:
|
| 46 |
+
* **Easy (25%):** Similarity $\ge 0.868$
|
| 47 |
+
* **Medium (50%):** Similarity between $0.781$ and $0.868$
|
| 48 |
+
* **Hard (25%):** Similarity $< 0.781$ (Representing heavy syntax/paradigm divergence)
|
| 49 |
|
| 50 |
---
|
| 51 |
|