Add dataset card, license, and Parquet shards (viewer)
Browse files- LICENSE.md +41 -0
- README.md +195 -0
- data/train-00000-of-00009.parquet +3 -0
- data/train-00001-of-00009.parquet +3 -0
- data/train-00002-of-00009.parquet +3 -0
- data/train-00003-of-00009.parquet +3 -0
- data/train-00004-of-00009.parquet +3 -0
- data/train-00005-of-00009.parquet +3 -0
- data/train-00006-of-00009.parquet +3 -0
- data/train-00007-of-00009.parquet +3 -0
- data/train-00008-of-00009.parquet +3 -0
LICENSE.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Licensing
|
| 2 |
+
|
| 3 |
+
This dataset combines two layers under **different** licenses. Read both before reuse.
|
| 4 |
+
|
| 5 |
+
## 1. Tooling and packaging — Apache-2.0
|
| 6 |
+
|
| 7 |
+
The database schema, the FAISS index, the BM25 index, the embeddings, the Parquet packaging,
|
| 8 |
+
and this dataset card are released under the **Apache License 2.0**, consistent with the
|
| 9 |
+
canonical Zenodo record (DOI [10.5281/zenodo.20586256](https://doi.org/10.5281/zenodo.20586256)).
|
| 10 |
+
|
| 11 |
+
## 2. Source snippets (the `code` field) — upstream free/open-source licenses
|
| 12 |
+
|
| 13 |
+
The `code` values in `snippets.db` and in the Parquet shards are **excerpts derived from upstream
|
| 14 |
+
MediaWiki / Wikimedia repositories**. Each excerpt remains under **the license of its origin
|
| 15 |
+
repository** — predominantly **GPL-2.0-or-later**, with some MIT, BSD, Apache-2.0, and others.
|
| 16 |
+
The Apache-2.0 grant in section 1 does **not** relicense this upstream code.
|
| 17 |
+
|
| 18 |
+
There is **no per-row `license` column** in the data. Instead, **every entity carries a Software
|
| 19 |
+
Heritage identifier (`swhid`)** with an `origin=` qualifier (and `lines=` range). This lets you
|
| 20 |
+
resolve the exact upstream repository, revision, and file — and therefore the authoritative
|
| 21 |
+
license and copyright — via:
|
| 22 |
+
|
| 23 |
+
- Software Heritage: <https://archive.softwareheritage.org/>
|
| 24 |
+
- the `origin=` repository URL embedded in each SWHID.
|
| 25 |
+
|
| 26 |
+
## Caveats
|
| 27 |
+
|
| 28 |
+
- Snippets are **fragments** (individual functions, types, or templates) and may not carry the
|
| 29 |
+
original file's license header or copyright notice. **Consult the origin repository before
|
| 30 |
+
redistributing or reusing** a snippet.
|
| 31 |
+
- If you are a copyright holder and believe a snippet should not be redistributed here, please
|
| 32 |
+
open an issue on the GitHub repository
|
| 33 |
+
(<https://github.com/ftosoni/mediawiki-code2code-search>) or contact the author; it will be
|
| 34 |
+
removed promptly.
|
| 35 |
+
|
| 36 |
+
## Summary
|
| 37 |
+
|
| 38 |
+
| Layer | License |
|
| 39 |
+
|---|---|
|
| 40 |
+
| Schema, indexes, embeddings, packaging, card | Apache-2.0 |
|
| 41 |
+
| `code` snippets | Upstream FOSS licenses (predominantly GPL-2.0-or-later); resolve per entity via `swhid` |
|
README.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: MediaWiki Code2Code Search
|
| 3 |
+
license: other
|
| 4 |
+
license_name: apache-2.0-tooling-plus-upstream-foss
|
| 5 |
+
license_link: LICENSE.md
|
| 6 |
+
language:
|
| 7 |
+
- code
|
| 8 |
+
task_categories:
|
| 9 |
+
- text-retrieval
|
| 10 |
+
- sentence-similarity
|
| 11 |
+
- feature-extraction
|
| 12 |
+
tags:
|
| 13 |
+
- code
|
| 14 |
+
- code-search
|
| 15 |
+
- code-retrieval
|
| 16 |
+
- semantic-search
|
| 17 |
+
- neural-retrieval
|
| 18 |
+
- mediawiki
|
| 19 |
+
- wikimedia
|
| 20 |
+
- faiss
|
| 21 |
+
- embeddings
|
| 22 |
+
- bm25
|
| 23 |
+
- swhid
|
| 24 |
+
- software-heritage
|
| 25 |
+
size_categories:
|
| 26 |
+
- 1M<n<10M
|
| 27 |
+
source_datasets:
|
| 28 |
+
- original
|
| 29 |
+
configs:
|
| 30 |
+
- config_name: default
|
| 31 |
+
data_files:
|
| 32 |
+
- split: train
|
| 33 |
+
path: data/train-*.parquet
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
# MediaWiki Code2Code Search — Dataset
|
| 37 |
+
|
| 38 |
+
Pre-computed retrieval artifacts for **MediaWiki Code2Code Search**, a neural system for the
|
| 39 |
+
semantic discovery of open-source software entities (functions, types, templates) across the
|
| 40 |
+
MediaWiki / Wikimedia ecosystem.
|
| 41 |
+
|
| 42 |
+
This Hugging Face dataset is a **complementary mirror** of the pre-computed artifacts archived on
|
| 43 |
+
Zenodo. **The canonical, citable record is the Zenodo deposit** — please cite that DOI:
|
| 44 |
+
|
| 45 |
+
> **Zenodo DOI (canonical): [10.5281/zenodo.20586256](https://doi.org/10.5281/zenodo.20586256)**
|
| 46 |
+
|
| 47 |
+
The Hugging Face copy exists to make the corpus **browsable in the dataset Viewer** and easy to
|
| 48 |
+
pull with the `datasets` / `huggingface_hub` libraries. It does not supersede Zenodo.
|
| 49 |
+
|
| 50 |
+
- **Code / system:** <https://github.com/ftosoni/mediawiki-code2code-search>
|
| 51 |
+
- **Paper:** *MediaWiki Code2Code Search: Neural Retrieval for the Semantic Discovery of
|
| 52 |
+
Open-Source Software Entities* — Francesco Tosoni, Sant'Anna School of Advanced Studies, Pisa.
|
| 53 |
+
Peer-reviewed version **forthcoming in *SoftwareX*** (ms. SOFTX-D-26-00628). See
|
| 54 |
+
[Citation](#citation).
|
| 55 |
+
|
| 56 |
+
---
|
| 57 |
+
|
| 58 |
+
## Contents
|
| 59 |
+
|
| 60 |
+
| File | Size | Format | Description |
|
| 61 |
+
|---|---|---|---|
|
| 62 |
+
| `data/train-*.parquet` (9 shards) | ~172 MiB | Parquet (zstd) | The full `snippets` table, exposed for the **dataset Viewer** and `load_dataset`. Same 1,289,452 rows as `snippets.db`. |
|
| 63 |
+
| `snippets.db` | 1.74 GiB | SQLite | Serving metadata + code for every entity (single `snippets` table). |
|
| 64 |
+
| `embeddings.npy` | 4.92 GiB | NumPy `float32` | Dense embeddings, shape `(1289452, 1024)`, **L2-normalised**, from `Qwen/Qwen3-Embedding-0.6B`. Row *i* aligns with `snippets.db` row `id = i`. |
|
| 65 |
+
| `mediawiki.index` | 168.6 MiB | FAISS | `IndexIVFPQ` (L2) with an `IndexFlatL2` coarse quantizer, 128 sub-quantizers × 8 bits, dim 1024. Built over the embeddings above. |
|
| 66 |
+
| `bm25_index.pkl` | 423.6 MiB | Pickle | BM25 lexical baseline built over the `code` field (identifier tokeniser; keywords and tokens shorter than three characters dropped). |
|
| 67 |
+
|
| 68 |
+
> **Note on `.npy` / `.index` / `.pkl`:** these binary artifacts do not render in the Viewer by
|
| 69 |
+
> design; the Parquet shards provide the browsable view of the same underlying rows.
|
| 70 |
+
|
| 71 |
+
### Data fields (`snippets` table / Parquet)
|
| 72 |
+
|
| 73 |
+
| Column | Type | Description |
|
| 74 |
+
|---|---|---|
|
| 75 |
+
| `id` | int64 | Row id; aligns with the corresponding row of `embeddings.npy`. |
|
| 76 |
+
| `original_id` | string | Upstream extraction id (content hash). |
|
| 77 |
+
| `swhid` | string | **[SWHID](https://www.swhid.org/)** of the source content, with `origin=` and `lines=` qualifiers — resolvable on [Software Heritage](https://archive.softwareheritage.org/) for exact provenance and upstream licensing. |
|
| 78 |
+
| `sha1` | string | SHA-1 of the source blob. |
|
| 79 |
+
| `repo_name` | string | Upstream repository name. |
|
| 80 |
+
| `repo_group` | string | Repository group / namespace. |
|
| 81 |
+
| `filepath` | string | Path of the source file within the repository. |
|
| 82 |
+
| `name` | string | Entity name / signature (e.g. `check_dumps_log_path(path)`). |
|
| 83 |
+
| `type` | string | One of `function`, `type`, `template`. |
|
| 84 |
+
| `code` | string | Source snippet text for the entity (see [Licensing](#licensing-important)). |
|
| 85 |
+
|
| 86 |
+
### Corpus statistics
|
| 87 |
+
|
| 88 |
+
- **1,289,452** structural entities:
|
| 89 |
+
- `function`: 1,050,748
|
| 90 |
+
- `type`: 237,653
|
| 91 |
+
- `template`: 1,051
|
| 92 |
+
- **2,242** active repositories (distinct `(repo_group, repo_name)` pairs) across the MediaWiki /
|
| 93 |
+
Wikimedia ecosystem.
|
| 94 |
+
- **12** programming languages extracted via language-specific structural parsing.
|
| 95 |
+
- Embedding model: **`Qwen/Qwen3-Embedding-0.6B`** (1024-dim). Retrieval is nearest-neighbour by
|
| 96 |
+
**Euclidean (L2) distance** over L2-normalised vectors.
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
## Usage
|
| 101 |
+
|
| 102 |
+
Browse the corpus in the **Viewer** above, or load it programmatically.
|
| 103 |
+
|
| 104 |
+
**Tabular rows (Parquet) with `datasets`:**
|
| 105 |
+
|
| 106 |
+
```python
|
| 107 |
+
from datasets import load_dataset
|
| 108 |
+
|
| 109 |
+
ds = load_dataset("ftosoni/mediawiki-code2code-search", split="train")
|
| 110 |
+
print(ds)
|
| 111 |
+
print(ds[0]["name"], ds[0]["type"])
|
| 112 |
+
print(ds[0]["swhid"])
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
**Raw serving artifacts with `huggingface_hub`:**
|
| 116 |
+
|
| 117 |
+
```python
|
| 118 |
+
from huggingface_hub import hf_hub_download
|
| 119 |
+
|
| 120 |
+
repo = "ftosoni/mediawiki-code2code-search"
|
| 121 |
+
db = hf_hub_download(repo, "snippets.db", repo_type="dataset")
|
| 122 |
+
emb = hf_hub_download(repo, "embeddings.npy", repo_type="dataset")
|
| 123 |
+
index = hf_hub_download(repo, "mediawiki.index", repo_type="dataset")
|
| 124 |
+
bm25 = hf_hub_download(repo, "bm25_index.pkl", repo_type="dataset")
|
| 125 |
+
|
| 126 |
+
import numpy as np, faiss
|
| 127 |
+
X = np.load(emb, mmap_mode="r") # (1289452, 1024) float32, L2-normalised
|
| 128 |
+
faiss_index = faiss.read_index(index) # IndexIVFPQ (L2)
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
`embeddings.npy` row `i` corresponds to `snippets.db` row `id = i` and to FAISS vector `i`.
|
| 132 |
+
|
| 133 |
+
---
|
| 134 |
+
|
| 135 |
+
## Licensing (important)
|
| 136 |
+
|
| 137 |
+
This dataset combines two distinct layers, and they carry **different licenses**:
|
| 138 |
+
|
| 139 |
+
1. **Tooling / packaging** (schema, indexes, embeddings, this card): **Apache-2.0**, matching the
|
| 140 |
+
canonical [Zenodo record](https://doi.org/10.5281/zenodo.20586256).
|
| 141 |
+
2. **The `code` snippets** in `snippets.db` / the Parquet shards are **derived from upstream
|
| 142 |
+
MediaWiki / Wikimedia repositories**, each under **its own free/open-source license**
|
| 143 |
+
(predominantly **GPL-2.0-or-later**, with some MIT / BSD / Apache-2.0 and others). These
|
| 144 |
+
upstream licenses govern the snippet text; redistribution here relies on their permission to
|
| 145 |
+
redistribute.
|
| 146 |
+
|
| 147 |
+
There is **no per-row `license` column**. Instead, **every entity carries an `swhid`** with an
|
| 148 |
+
`origin=` qualifier, so the exact upstream repository — and therefore its authoritative license and
|
| 149 |
+
copyright — can be resolved on [Software Heritage](https://archive.softwareheritage.org/) and at
|
| 150 |
+
the origin repository. Snippets are fragments and may not carry their file's original license
|
| 151 |
+
header; consult the origin before reuse.
|
| 152 |
+
|
| 153 |
+
See [`LICENSE.md`](LICENSE.md) for the full statement.
|
| 154 |
+
|
| 155 |
+
---
|
| 156 |
+
|
| 157 |
+
## Citation
|
| 158 |
+
|
| 159 |
+
Please cite the **canonical Zenodo dataset**:
|
| 160 |
+
|
| 161 |
+
```bibtex
|
| 162 |
+
@dataset{tosoni2026mediawiki_c2c_data,
|
| 163 |
+
author = {Tosoni, Francesco},
|
| 164 |
+
title = {Pre-computed {FAISS} Vector Index and {SQLite} Metadata Database
|
| 165 |
+
for {MediaWiki} {Code2Code} Search},
|
| 166 |
+
year = {2026},
|
| 167 |
+
publisher = {Zenodo},
|
| 168 |
+
doi = {10.5281/zenodo.20586256},
|
| 169 |
+
url = {https://doi.org/10.5281/zenodo.20586256}
|
| 170 |
+
}
|
| 171 |
+
```
|
| 172 |
+
|
| 173 |
+
The accompanying paper is **forthcoming in *SoftwareX*** (this entry will be updated with the
|
| 174 |
+
published DOI once available):
|
| 175 |
+
|
| 176 |
+
```bibtex
|
| 177 |
+
@article{tosoni2026mediawiki,
|
| 178 |
+
author = {Tosoni, Francesco},
|
| 179 |
+
title = {{MediaWiki} {Code2Code} Search: Neural Retrieval for the
|
| 180 |
+
Semantic Discovery of Open-Source Software Entities},
|
| 181 |
+
journal = {SoftwareX},
|
| 182 |
+
year = {2026},
|
| 183 |
+
note = {To appear; under review (ms. SOFTX-D-26-00628)}
|
| 184 |
+
}
|
| 185 |
+
```
|
| 186 |
+
|
| 187 |
+
---
|
| 188 |
+
|
| 189 |
+
## Acknowledgements
|
| 190 |
+
|
| 191 |
+
Corpus derived from the MediaWiki / Wikimedia software ecosystem. Provenance is tracked with
|
| 192 |
+
[SWHID](https://www.swhid.org/) identifiers resolvable on
|
| 193 |
+
[Software Heritage](https://archive.softwareheritage.org/). Embeddings computed with
|
| 194 |
+
[`Qwen/Qwen3-Embedding-0.6B`](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B); indexing with
|
| 195 |
+
[FAISS](https://github.com/facebookresearch/faiss).
|
data/train-00000-of-00009.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc82887bf82d96b054981fa079546b49de0c28d6ac4bfa1143aeade68672cacc
|
| 3 |
+
size 19791348
|
data/train-00001-of-00009.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ee15bc6434e2d615d4657154a199da31de9fdc28bc0d3d8cc8fb3c916c120033
|
| 3 |
+
size 19826495
|
data/train-00002-of-00009.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:71ef33f0a17fbff7b91fc93ef46c4c776ad20b8a0c773bdb30bd38cab049e04b
|
| 3 |
+
size 20451788
|
data/train-00003-of-00009.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d54b877b3b24680db1e53382fb43c15a14f4c3dc4c186c4b13217da3c8362f81
|
| 3 |
+
size 22192677
|
data/train-00004-of-00009.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:105c1f80f229572f72e8adb045347cb6fe3bd38af2ef2214943bbec9b539562c
|
| 3 |
+
size 23848518
|
data/train-00005-of-00009.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5274a22eacb1054dda33cab86d29c49ad8d79d77333691a359c24c4ea0cd6fb7
|
| 3 |
+
size 20463675
|
data/train-00006-of-00009.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:99eac3ea72013e8cfd71a457a9d46191ef77a0364265b2866a283945e5771819
|
| 3 |
+
size 15893224
|
data/train-00007-of-00009.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4a1a64e2bc362bd9ff006f91f608efae80d86864810d8a4776902c21b83f784c
|
| 3 |
+
size 23558734
|
data/train-00008-of-00009.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:941914b84e561084f936f7b9cd25a1d52836735965afccfd41c3c685c4f6b1c4
|
| 3 |
+
size 14564468
|