chuckreynolds/wikimedia-enterprise-structured-contents-enwiki
收藏资源简介:
--- pretty_name: Wikimedia Enterprise Structured Contents — enwiki_namespace_0 language: - en license: cc-by-sa-4.0 task_categories: - text-generation - question-answering - text-retrieval tags: - wikipedia - wikimedia-enterprise - structured-contents size_categories: - 1M<n<10M configs: - config_name: default data_files: - split: train path: data/*.parquet --- # enwiki_namespace_0 Structured Contents snapshot of `enwiki_namespace_0` from the [Wikimedia Enterprise API](https://enterprise.wikimedia.com/docs/snapshot/), converted to Parquet. ## Source - Upstream: [Wikimedia Enterprise Structured Contents API](https://enterprise.wikimedia.com/docs/snapshot/#structured-contents-snapshot-download-beta) - Snapshot identifier: `enwiki_namespace_0` - Format at source: `.tar.gz` containing sharded `.ndjson` - Shards in this release: 3 ## Processing 1. Downloaded the snapshot tarball from the Wikimedia Enterprise API. 2. Streamed each `.ndjson` shard through a normalization pass: - **JSON-encoded fields**: `sections`, `infoboxes`, `tables`, and `references[].metadata` are stored as JSON-encoded strings. These fields either have recursive nesting (depth > 50) that exceeds Apache Arrow's C Data Interface limit, or are open-dict structures whose keys vary across articles. Decode with `json.loads` on read. - Canonicalised struct field ordering (alphabetic, recursive) so schemas match byte-for-byte across shards. 3. Wrote one Parquet file per shard (zstd level 9 compression, row_group_size tuned for HF streaming). 4. Unified per-shard schemas with `pa.unify_schemas`; pinned result to `schema.json`; re-cast every shard so embedded schemas are identical. ## Loading ```python from datasets import load_dataset import json ds = load_dataset("chuckreynolds/wikimedia-enterprise-structured-contents-enwiki", split="train", streaming=True) row = next(iter(ds)) print(row["name"], row["url"]) # JSON-encoded columns sections = json.loads(row["sections"]) infoboxes = json.loads(row["infoboxes"]) ``` ## Notes - Fields stored as JSON strings: `sections`, `infoboxes`, `tables`, and `references[].metadata`. All other fields (`references[]`, `license[]`, `version`, `event`, etc.) retain their native Arrow struct/list types and are queryable without decoding. - License passes through the upstream license for article text.
数据集名称:维基媒体企业结构化内容——enwiki_namespace_0 语言: - 英语 许可证:cc-by-sa-4.0 任务类别: - 文本生成 - 问答 - 文本检索 标签: - 维基百科 - wikimedia-enterprise - 结构化内容 数据量级: - 1M<n<10M 配置项: - 配置名称:default 数据文件: - 划分:train 路径:data/*.parquet # enwiki_namespace_0 本数据集为来自[维基媒体企业API(Wikimedia Enterprise API)](https://enterprise.wikimedia.com/docs/snapshot/)的`enwiki_namespace_0`结构化内容快照,已转换为Parquet格式。 ## 数据源 - 上游来源:[维基媒体企业结构化内容API(Wikimedia Enterprise Structured Contents API)](https://enterprise.wikimedia.com/docs/snapshot/#structured-contents-snapshot-download-beta) - 快照标识符:`enwiki_namespace_0` - 源文件格式:包含分块换行分隔JSON(ndjson)文件的Gzip压缩TAR归档(tar.gz) - 本次发布的分块数量:3 ## 处理流程 1. 从维基媒体企业API下载快照压缩包。 2. 对每个`.ndjson`分块执行流式标准化处理流程: - **JSON编码字段**:`sections`、`infoboxes`、`tables`以及`references[].metadata`以JSON编码字符串形式存储。此类字段要么存在递归嵌套(深度超过50层),超出Apache Arrow的C数据接口(Apache Arrow C Data Interface)限制;要么属于开放字典结构,不同文章的键名存在差异。读取时需通过`json.loads`进行解码。 - 对结构体字段顺序进行规范化处理(按字母顺序递归排序),确保所有分块的数据模式(Schema)完全逐字节一致。 3. 为每个分块生成对应的Parquet文件(采用Zstandard(zstd)等级9压缩,行组大小针对Hugging Face流式加载进行优化)。 4. 使用`pa.unify_schemas`统一各分块的数据模式,将结果固化至`schema.json`,并重新转换所有分块以保证内嵌数据模式完全一致。 ## 加载方式 python from datasets import load_dataset import json ds = load_dataset("chuckreynolds/wikimedia-enterprise-structured-contents-enwiki", split="train", streaming=True) row = next(iter(ds)) print(row["name"], row["url"]) # JSON编码字段 sections = json.loads(row["sections"]) infoboxes = json.loads(row["infoboxes"]) ## 注意事项 - 以下字段以JSON字符串形式存储:`sections`、`infoboxes`、`tables`以及`references[].metadata`。其余字段(如`references[]`、`license[]`、`version`、`event`等)均保留原生Arrow结构体/列表类型,无需解码即可直接查询。 - 文章文本的许可证沿用上游来源的许可证。



