Add dataset card
Browse files
README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: Annotated Wikipedia 2016
|
| 3 |
+
license: cc-by-sa-3.0
|
| 4 |
+
task_categories:
|
| 5 |
+
- text-generation
|
| 6 |
+
- token-classification
|
| 7 |
+
- text-retrieval
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
+
tags:
|
| 11 |
+
- wikipedia
|
| 12 |
+
- entity-linking
|
| 13 |
+
- wikification
|
| 14 |
+
- hyperlinks
|
| 15 |
+
- pretraining
|
| 16 |
+
size_categories:
|
| 17 |
+
- 1M<n<10M
|
| 18 |
+
configs:
|
| 19 |
+
- config_name: default
|
| 20 |
+
data_files:
|
| 21 |
+
- split: train
|
| 22 |
+
path: "data/*.parquet"
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
# Annotated Wikipedia 2016
|
| 26 |
+
|
| 27 |
+
English Wikipedia (~2016 snapshot) processed into JSON, with **inline hyperlinks preserved as gold-aligned entity-link annotations**. Each article carries its full plain text plus a list of `(surface_form, target_uri, character_offset)` tuples — one per wikilink in the source.
|
| 28 |
+
|
| 29 |
+
This release just re-shards the original ~5 GB stored zip (`extracted/AA/wiki00` … `extracted/NN/wiki47`, 35,148 JSONL chunk files) into parquet with a unified pyarrow schema. No filtering, no text normalisation, no entity-set restriction. Offsets are byte-faithful character offsets into `text` — verified to round-trip exactly.
|
| 30 |
+
|
| 31 |
+
Mirror of the raw zip: [alvations/stash · wikipedia-json/](https://huggingface.co/datasets/alvations/stash/tree/main/wikipedia-json).
|
| 32 |
+
|
| 33 |
+
## Usage
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
from datasets import load_dataset
|
| 37 |
+
|
| 38 |
+
ds = load_dataset("alvations/annotated-wiki-2016", split="train", streaming=True)
|
| 39 |
+
ex = next(iter(ds))
|
| 40 |
+
print(ex["title"], "—", len(ex["annotations"]), "links")
|
| 41 |
+
# Anarchism — 639 links
|
| 42 |
+
|
| 43 |
+
# offsets line up with text spans
|
| 44 |
+
for a in ex["annotations"][:3]:
|
| 45 |
+
s = ex["text"][a["offset"]:a["offset"] + len(a["surface_form"])]
|
| 46 |
+
assert s == a["surface_form"]
|
| 47 |
+
print(a["surface_form"], "->", a["uri"])
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
Streaming is recommended — the full train split is multi-GB and 1M+ rows.
|
| 51 |
+
|
| 52 |
+
## Schema
|
| 53 |
+
|
| 54 |
+
| Column | Type | Description |
|
| 55 |
+
| ------------- | ------------------------------------------------------------- | ----------- |
|
| 56 |
+
| `title` | string | Article title, URL-decoded from the wiki URL path. |
|
| 57 |
+
| `url` | string | Original Wikipedia URL, e.g. `http://en.wikipedia.org/wiki/Anarchism`. |
|
| 58 |
+
| `wiki_id` | int64 | Wikipedia page ID (the source dump stored it as a 1-element list — flattened here). |
|
| 59 |
+
| `text` | string | Full article plain text (no markup, no infoboxes). |
|
| 60 |
+
| `annotations` | list<struct<surface_form: string, uri: string, offset: int32>> | One entry per outgoing wikilink in the article. |
|
| 61 |
+
| `language` | string | Always `"en"` in this release. |
|
| 62 |
+
|
| 63 |
+
### Annotation semantics
|
| 64 |
+
|
| 65 |
+
Each annotation marks one outgoing hyperlink in the source wikitext:
|
| 66 |
+
|
| 67 |
+
- `surface_form` — the literal text span as it appears in the article (the link's anchor text).
|
| 68 |
+
- `uri` — the linked target page, in Wikipedia URL form with underscores, e.g. `Political_philosophy`. Use as-is for joining against page-id tables; no namespace prefix.
|
| 69 |
+
- `offset` — zero-based **character** offset into `text` where `surface_form` begins. `text[offset : offset + len(surface_form)] == surface_form` is guaranteed.
|
| 70 |
+
|
| 71 |
+
Anchors are not deduplicated, redirected, or filtered — multiple links to the same target appear separately, and dangling/redirect targets are kept verbatim.
|
| 72 |
+
|
| 73 |
+
## Sharding
|
| 74 |
+
|
| 75 |
+
Parquet shards are grouped by the source zip's two-letter subdirectory (`extracted/<XX>/`):
|
| 76 |
+
|
| 77 |
+
```
|
| 78 |
+
data/AA.parquet
|
| 79 |
+
data/AB.parquet
|
| 80 |
+
...
|
| 81 |
+
data/NN.parquet (352 shards total)
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
Each shard is ~25 MB compressed (snappy), holding roughly 1,800–4,500 articles depending on average article length in that bucket.
|
| 85 |
+
|
| 86 |
+
## Source
|
| 87 |
+
|
| 88 |
+
Re-packaged from the upstream zip `wikipedia-json.zip` (5.0 GB stored / 18 GB uncompressed), which was itself the output of processing an English Wikipedia dump with a wikiextractor-style pipeline that retained wikilinks as offset annotations. The dataset is named `2016` after the apparent dump year of the upstream archive.
|
| 89 |
+
|
| 90 |
+
## License
|
| 91 |
+
|
| 92 |
+
Wikipedia text is distributed under [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/) (with parts also under the GFDL). Attribution: contributors to the English Wikipedia. Reuse must preserve attribution and ShareAlike.
|
| 93 |
+
|
| 94 |
+
## Provenance of this release
|
| 95 |
+
|
| 96 |
+
- Source: `wikipedia-json.zip` — mirrored at [`alvations/stash · wikipedia-json/wikipedia-json.zip`](https://huggingface.co/datasets/alvations/stash/tree/main/wikipedia-json).
|
| 97 |
+
- Conversion: streamed via `zipfile.ZipFile.open()` without on-disk extraction; one parquet shard per source subdir; nested annotations stored as `list<struct>` for native pyarrow / Polars / DuckDB consumption.
|
| 98 |
+
- No row filtering, deduplication, redirect resolution, or text cleanup applied.
|