Mini-llm-base / README.md
Diplaysbook's picture
Upload folder using huggingface_hub
b93c735 verified
|
Raw History Blame Contribute Delete
9.42 kB
---
language:
- en
- zh
- ja
- ko
- fr
- de
- es
- it
- pt
- nl
- ru
- uk
- pl
- ar
- fa
- ur
- hi
- bn
- th
- vi
- id
- tl
- sw
- tr
license: other
license_name: public-domain-with-attribution
license_link: https://huggingface.co/datasets/Diplaysbook/Mini-llm-base/blob/main/LICENSE-NOTES.md
task_categories:
- text-generation
tags:
- pretraining
- public-domain
- historical
- textbooks
- multilingual
size_categories:
- 1M<n<10M
configs:
- config_name: novels
data_files:
- split: train
path: data/novels/train-*.jsonl.gz
- split: validation
path: data/novels/validation-*.jsonl.gz
- config_name: academic
data_files:
- split: train
path: data/academic/train-*.jsonl.gz
- split: validation
path: data/academic/validation-*.jsonl.gz
- config_name: textbooks
data_files:
- split: train
path: data/textbooks/train-*.jsonl.gz
- split: validation
path: data/textbooks/validation-*.jsonl.gz
- config_name: cjk_textbooks
data_files:
- split: train
path: data/cjk_textbooks/train-*.jsonl.gz
- split: validation
path: data/cjk_textbooks/validation-*.jsonl.gz
- config_name: wordlists
data_files:
- split: train
path: data/lexicon/wordlists/*.jsonl
- config_name: concepts
data_files:
- split: train
path: data/lexicon/concepts.jsonl
- config_name: dictionary
data_files:
- split: train
path: data/lexicon/dictionary.jsonl
---
# Public-Domain Multilingual Corpus + Lexicon
Two resource families in one repository:
* **corpus** (`novels`, `academic`, `textbooks`, `cjk_textbooks`) — public-domain
text from 1850–1928, 24 languages, 57 disciplines;
* **lexicon** (`wordlists`, `concepts`, `dictionary`) — 24-language vocabulary,
110k WordNet-aligned concepts, and a 912-concept hand-written dictionary.
## Corpus configs
A pretraining corpus assembled from public-domain sources, covering **24 languages** and **57 academic disciplines**, plus a dedicated textbook subset and an East-Asian textbook subset.
| config | rows | chars | est. tokens | languages |
|---|---|---|---|---|
| `novels` | 16,624 | 44.6M | 15.3M | 24 |
| `academic` | 1,236,046 | 3.65B | 938.7M | 23 |
| `textbooks` | 142,638 | 422.6M | 105.6M | 13 |
| `cjk_textbooks` | 7,833 | 12.4M | 9.9M | 3 |
| **total** | **1,403,141** | **4.13B** | **~1.07B** | **24** |
Token counts are estimates (CJK 1.5 chars/token, others 4 chars/token); measure with your own tokenizer.
## Schema
Every record has the same fields:
| field | type | meaning |
|---|---|---|
| `text` | string | the text chunk (see chunking below) |
| `lang` | string | ISO-ish language tag (`en`, `zh`, `ja`, …) |
| `corpus` | string | `novel` / `academic` / `textbook` / `cjk_textbook` |
| `discipline` | string | one of 57 disciplines, empty when unknown |
| `kind` | string | `monograph` / `periodical` / `textbook` / empty |
| `source` | string | `gutenberg` / `internet_archive` / `wikisource_*` / `ndl_fulltext` |
| `doc_id` | string | per-book identifier (Gutenberg id, IA identifier, Wikisource title) |
| `chars` | int | characters in `text` |
| `est_tokens` | int | estimated tokens |
| `split` | string | `train` / `validation` |
## Provenance
* **Project Gutenberg** — US public domain, proofread text.
* **Internet Archive** — scanned books published ≤1928; OCR text; quality varies (see *Known issues*).
* **Wikisource** (zh/ja/ko) — transcribed text, CC BY-SA for the transcription; underlying works are public domain.
* **National Diet Library of Japan, Next Digital Library API** — Japanese books whose copyright expired; NDL OCR text.
Per-book provenance is in `metadata/sources.jsonl`.
## Chunking and cleaning
* Paragraphs merged to ≈1,800 characters, hard cap 3,000 (CJK subset ≈2,000).
* Boilerplate removed: Gutenberg headers/footers, `Produced by…`, `Digitized by…`,
transcription notes, page numbers, URLs, library stamps, NDL `〓` placeholders.
* Duplicate chunks removed by SHA-256 across the whole corpus (25,276 duplicates dropped).
* Garbage chunks dropped (short fragments, symbol spam, script mismatch): 716 chunks.
* Validation split: 0.5% of documents chosen by document-id hash.
## Intended use
Base-model pretraining or continued pretraining, especially for:
* historical (1850–1928) scientific, medical, legal, and humanistic prose,
* textbook-style expository text (structured, chapter/section oriented),
* low-resource languages with scarce modern web text.
Not suitable for: instruction tuning, factual QA benchmarks (the knowledge is a century old), or any use requiring contemporary facts.
## Known issues and cautions
1. **Heavy language imbalance.** `academic` is ~47% English by characters; `id`, `vi`, `sw` have almost no data. Down-sample or use per-language sampling.
2. **OCR noise.** Internet Archive and NDL texts contain OCR errors, page headers, ruby/furigana merged into text, and layout artifacts. Wikisource and Gutenberg parts are clean.
3. **Korean is thin.** Hanja-mixed *eonhae* texts dominate; modern Korean is nearly absent.
4. **Chinese textbooks are primers.** Only *mengxue* primers (三字經, 千字文, 幼學瓊林…) survived; Republic-era school textbooks were not available as text.
5. **Historical bias.** Content reflects the views of 1850–1928 authors, including colonial, racial, and eugenic framings. Filter before any user-facing deployment.
6. **Duplicate-looking passages across disciplines.** The same book may have been classified into several disciplines; chunk-level dedup keeps only one copy, but document metadata may differ.
## Lexicon configs
### `wordlists`
One JSONL per language in `data/lexicon/wordlists/<lang>.jsonl` — **24 languages,
1,108,218 word forms** (~50k per language):
```json
{"word": "good", "rank": 118, "count": 1234567, "per_million": 6421.3}
```
Two merged frequency sources: OpenSubtitles 2018 via `hermitdave/FrequencyWords`
(CC BY-SA 4.0, weight 0.6) and Leipzig Corpora Collection news 2020
(CC BY 4.0, weight 0.4). Cleaned for script, punctuation, digits, duplicates;
Japanese >=2 characters, Thai >=3 characters.
### `concepts`
`data/lexicon/concepts.jsonl` — **110,148 concepts x 24 languages**. Concept IDs
are Princeton WordNet synset offsets, so the same ID is the same concept in every
language; synonyms are joined by `;`. Each row carries a `sources` object:
```json
{"concept": "02139199-n", "langs": 4,
"en": "bat;chiropteran", "ru": "летучая мышь", "uk": "кажан",
"ja": "コウモリ;蝙蝠",
"sources": {"en": "wordnet", "ru": "wordnet", "uk": "wordnet", "ja": "wordnet"}}
```
`sources` values:
| value | languages | nature |
|---|---|---|
| `wordnet` | en es fr id it ja nl pl pt th zh ru uk fa | sense-level alignment (WordNet synsets / ILI) |
| `wiktionary` | ko hi bn ur tr vi tl sw | word-level translations from English Wiktionary |
| `mixed` | de ar | WordNet lemmas + Wiktionary translations |
Per-language row counts are in `metadata/concept_sources.tsv`.
### `dictionary`
`data/lexicon/dictionary.jsonl` — the curated **912-concept x 24-language**
dictionary (21,888 rows), each entry with a definition written in the target
language itself:
```json
{"concept_id": "001", "headword": "好", "lang": "en", "word": "good",
"reading": "", "definition": "adjective: of high quality or satisfactory. Example: This book is good."}
```
## Lexicon issues
1. Wordlists come from subtitles and news: spoken-language bias, names and
interjections are over-represented. They are **not** official national word lists.
2. The 8 `wiktionary` languages are word-level translations, not sense-aligned —
expect some wrong-sense words; use only `wordnet` rows for strict evaluation.
3. No POS, IPA or inflection tables in `wordlists` / `concepts`.
4. Urdu (21k), Hindi (29k), Tagalog (33k) and Swahili (29k) are below the 50k cap
because both sources are shorter for them.
## Loading
```python
from datasets import load_dataset
# corpus
ds = load_dataset("Diplaysbook/Mini-llm-base", "academic", split="train", streaming=True)
for row in ds.take(3):
print(row["lang"], row["discipline"], row["text"][:120])
# lexicon
wl = load_dataset("Diplaysbook/Mini-llm-base", "wordlists", split="train", streaming=True)
cs = load_dataset("Diplaysbook/Mini-llm-base", "concepts", split="train", streaming=True)
dd = load_dataset("Diplaysbook/Mini-llm-base", "dictionary", split="train", streaming=True)
```
## Licence
**Corpus:** source texts are public domain (published ≤1928 in the US /
copyright expired in Japan). Wikisource transcriptions are CC BY-SA 4.0 —
attribution to Wikisource is required when redistributing those parts. See
`LICENSE-NOTES.md`.
**Lexicon:** wordlists are CC BY-SA 4.0 (FrequencyWords) and CC BY 4.0
(Leipzig); concepts come from OMW / WordNet projects under their respective
CC BY / CC BY-SA licences plus Wiktionary translations (CC BY-SA); the curated
912-concept dictionary is original work of this project. See
`LICENSE-NOTES-LEXICON.md`.
## Citation
```bibtex
@misc{pd_multilingual_corpus,
title = {Public-Domain Multilingual Base Corpus (1850–1928)},
year = {2025},
note = {Assembled from Project Gutenberg, Internet Archive, Wikisource and NDL}
}
```