File size: 7,341 Bytes
6ab59c4
 
7a3a018
 
f3277c2
 
 
 
a5fe6e0
f3277c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ab59c4
7a3a018
f3277c2
7a3a018
1ea399d
f3277c2
273a8d3
f3277c2
1ea399d
f3277c2
1ea399d
 
 
 
 
273a8d3
1ea399d
f3277c2
1ea399d
f3277c2
1ea399d
 
 
 
 
 
 
 
 
273a8d3
1ea399d
f3277c2
273a8d3
 
 
 
 
 
 
 
 
 
 
1ea399d
f3277c2
 
 
1ea399d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273a8d3
 
 
1ea399d
 
 
 
 
 
1af084c
 
1ea399d
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
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.