--- license: cc-by-sa-4.0 language: - en tags: - knowledge-graph - rdf - wikidata - preprocessed - text-corpus - world-model size_categories: - 1M`): the suffix is parsed off so it doesn't leak into training tokens. The datatype is consulted to decide normalization rules and then dropped. ## Known issues with raw Wikidata that this corpus addresses 1. **Catalog / identifier explosion.** ~82 % of Wikidata's property types by count are external identifiers, URLs, or other non-semantic catalog refs. Training on them teaches the model catalog formats rather than world knowledge. We strip them by datatype. 2. **Property `rdfs:label` corruption when materialised through some RDF-star executors.** A `<> rdfs:label "..."@en` annotation row, depending on the executor, can surface as `wdt:Pnnn rdfs:label "object-value"@en` — i.e. the property gets keyed against the inner triple's object value instead of its real label. Entity labels are unaffected. We work around this by sourcing property labels from a curated cache and never from in-corpus `rdfs:label` rows on properties. 3. **Datatype suffix leakage.** `"2012-10-15T00:00:00Z"^^<...dateTime>` if processed naively leaks tokens like `xmlschema`, `dateTime` etc. into the training corpus. We strip these. 4. **Mixed-language values.** Wikidata's `monolingualtext` includes all languages; we keep them but strip the `@lang` tag so values like `Tokyo` and `東京` are plain strings. ## How it was built The current preprocessor streams `philippesaade/wikidata` directly from Hugging Face, with a SQLite label cache that persists across runs: ```bash python tools/preprocess_from_hf.py \ --max-rows 100000 \ # entity-row count, sets the size tier --label-db training/data/wikidata_labels.sqlite \ --output training/data/normalized/normalized_wikidata_v12_100k.txt ``` Two passes over the dataset: - **Pass 1** scans every row to extract English `labels.en.value` into the SQLite cache (constant memory regardless of corpus size). - **Pass 2** streams again to emit the tab-separated text corpus, using the cache for label lookups, applying the noise-datatype filter, normalising time/quantity values, and dropping engine-bug-#2 RDF-star fallout at the s/o level. Source code: [`tools/preprocess_from_hf.py`](https://github.com/EmmaLeonhart/Loka/blob/main/tools/preprocess_from_hf.py), [`tools/hf_push_normalized.py`](https://github.com/EmmaLeonhart/Loka/blob/main/tools/hf_push_normalized.py). An earlier two-pass version that fetched from a Loka `.sdb` over SPARQL (`tools/preprocess_streaming.py`) hit O(offset) cost at multi-million-triple scale; the HF-direct version sidesteps that by streaming the upstream parquet. ## Provenance See [`Loka` on GitHub](https://github.com/EmmaLeonhart/Loka) for the engine, the preprocessor source, the trained model checkpoints, and the paper describing the world-model training pipeline that motivated this corpus. The Loka model series on Hugging Face: [`EmmaLeonhart/loka`](https://huggingface.co/datasets/EmmaLeonhart/loka). ## Citation Wikidata is the upstream source. Please cite Wikidata as well as this dataset if you use the corpus.