--- license: cc-by-sa-4.0 language: - ja configs: - config_name: all data_files: - split: train path: data/all/train-*.parquet - config_name: general_works data_files: - split: train path: data/general_works/train.parquet - config_name: philosophy data_files: - split: train path: data/philosophy/train.parquet - config_name: history data_files: - split: train path: data/history/train.parquet - config_name: social_sciences data_files: - split: train path: data/social_sciences/train.parquet - config_name: natural_sciences data_files: - split: train path: data/natural_sciences/train.parquet - config_name: technology data_files: - split: train path: data/technology/train.parquet - config_name: industry data_files: - split: train path: data/industry/train.parquet - config_name: arts data_files: - split: train path: data/arts/train.parquet - config_name: language data_files: - split: train path: data/language/train.parquet - config_name: literature data_files: - split: train path: data/literature/train.parquet --- # CleanedWiki-jp CleanedWiki-jp is a cleaned Japanese Wikipedia dataset prepared for LLM pre-training. It is built from Japanese Wikipedia article HTML, converted into Markdown, filtered for trainability. The dataset keeps useful article structure instead of flattening everything into plain text. Suitable body tables are preserved as Markdown tables, and mathematical expressions are preserved in TeX form. Each row also includes a predicted Nippon Decimal Classification (NDC) category and a jReadability difficulty level, allowing users to rebalance training mixtures by domain and reading difficulty. ## Dataset Features - Covers cleaned Japanese Wikipedia article text from HTML sources. - Preserves section headings, paragraphs, lists, and suitable tables in Markdown. - Preserves math expressions as TeX. - Removes non-training material such as references, external links, navigation-like content, infoboxes, noisy tables, unsuitable titles, and low-quality text. - Adds NDC metadata predicted with the National Diet Library NDC Predictor: https://lab.ndl.go.jp/service/ndc_predictor/ - Adds a jReadability difficulty level from 1 to 6 for each retained article. - Provides NDC-based subsets so downstream users can adjust the mixture ratio of broad topic categories. ## Columns | Column | Type | Description | |---|---:|---| | `id` | string | Wikipedia article identifier. | | `url` | string | Original Japanese Wikipedia article URL. | | `title` | string | Article title. | | `ndc_code` | string | Two-digit predicted NDC code, or `unknown` when no category is available. | | `ndc_category` | string | Japanese NDC category label with the code in parentheses. | | `ndc_confidence` | float32 | Confidence score returned by the NDC classifier. | | `gpt2_token_count` | int64 | Number of GPT-2 BPE tokens in `text`. | | `jreadability_level` | int64 | jReadability level from 1 to 6. Lower values indicate more difficult text, and higher values indicate easier text. | | `text` | string | Cleaned Markdown text for pre-training. | ### jReadability Levels | Value | Level | |---:|---| | `1` | Advanced second half | | `2` | Advanced first half | | `3` | Intermediate second half | | `4` | Intermediate first half | | `5` | Beginner second half | | `6` | Beginner first half | ## Subsets Subsets are defined from the first digit of the two-digit `ndc_code`. For example, `40`, `41`, and `49` are grouped into `natural_sciences`, while `70` through `79` are grouped into `arts`. The `all` subset contains every trainable article regardless of NDC category. | Config | NDC range | Contents | Rows | GPT-2 tokens | |---|---:|---|---:|---:| | `all` | all | All trainable cleaned Japanese Wikipedia articles. | 900,881 | 2,218,625,414 | | `general_works` | 00-09 | General works, libraries, bibliography, encyclopedias, journalism, and collections. | 7,780 | 17,968,675 | | `philosophy` | 10-19 | Philosophy, psychology, ethics, religion, Buddhism, and Christianity. | 17,040 | 35,194,421 | | `history` | 20-29 | History, regional histories, biography, geography, travel, and topography. | 113,750 | 222,295,472 | | `social_sciences` | 30-39 | Politics, law, economics, society, education, folklore, and military affairs. | 210,909 | 642,873,483 | | `natural_sciences` | 40-49 | Mathematics, physics, chemistry, astronomy, earth science, biology, medicine, and pharmacy. | 51,651 | 114,787,471 | | `technology` | 50-59 | Engineering, construction, architecture, machinery, electrical engineering, manufacturing, chemical industry, and home economics. | 92,681 | 246,839,362 | | `industry` | 60-69 | Agriculture, horticulture, animal industries, forestry, fisheries, commerce, transportation, and communications. | 88,928 | 218,534,066 | | `arts` | 70-79 | Fine arts, painting, photography, crafts, music, theater, film, sports, and games. | 260,123 | 573,058,364 | | `language` | 80-89 | Japanese, Chinese and other East Asian languages, English, European languages, and other languages. | 3,654 | 8,478,351 | | `literature` | 90-99 | Japanese literature, Chinese and other East Asian literature, English and American literature, and European literatures. | 54,365 | 138,595,749 | ## Filtering Pipeline The dataset is produced with the following pipeline: 1. Select the latest revision for each article identifier. 2. Reject unsuitable titles such as lists, disambiguation pages, redirects, and slash-based subpages. 3. Remove unwanted Wikipedia sections, including references, notes, external links, related items, bibliography, and navigation-like appendices. 4. Remove unwanted HTML classes and tags such as infoboxes, navboxes, reference markup, scripts, styles, images, and other non-body elements. 5. Convert MediaWiki math wrappers into canonical TeX before Markdown conversion. 6. Remove unsuitable tables while preserving body tables that contain useful prose. 7. Extract section headings, paragraphs, lists, and tables from HTML and convert them to Markdown. 8. Remove empty section headings and leading reading parentheses. 9. Normalize Unicode with NFKC and normalize whitespace, reference marks, and paragraph boundaries. 10. Reject text that is too short, has too few paragraphs or sentences, has low Japanese character ratio, has excessive symbols or list content, contains URLs or wikitext fragments, or appears to be disambiguation/reference-only prose. 11. Remove exact duplicate cleaned texts. 12. Compute the jReadability difficulty level for each retained article. 13. Predict the NDC category for each retained article. 14. Count GPT-2 BPE tokens on the final cleaned text. ## Usage ```python from datasets import load_dataset dataset = load_dataset("MK0727/CleanedWiki-jp", "all", split="train") natural_sciences = load_dataset("MK0727/CleanedWiki-jp", "natural_sciences", split="train") ``` ## License This dataset is derived from Japanese Wikipedia. The original text is contributed by Wikimedia contributors and is available under CC BY-SA 4.0 and the GNU Free Documentation License, subject to Wikimedia's licensing terms. This cleaned derivative dataset is distributed under CC BY-SA 4.0. Reusers must comply with the attribution and share-alike requirements of the source license.