NNEngine commited on
Commit
459e405
·
verified ·
1 Parent(s): 1e39fa6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +189 -3
README.md CHANGED
@@ -1,3 +1,189 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - text-classification
5
+ language:
6
+ - en
7
+ tags:
8
+ - text-generation
9
+ - causal
10
+ - training
11
+ - transformers
12
+ - pytorch
13
+ - jsonl
14
+ - segmentation
15
+ - validation
16
+ size_categories:
17
+ - 10M<n<100M
18
+ ---
19
+
20
+
21
+ # 📚 TinyWay-Gutenberg-Clean-40M
22
+
23
+ A large-scale, high-quality English text dataset derived from Project Gutenberg, cleaned, normalized, deduplicated, and segmented into fixed-length samples for efficient language model pretraining.
24
+
25
+ This dataset is designed to support training small and medium language models such as **TinyWay**, tokenizer training, embedding models, and large-scale NLP experimentation.
26
+
27
+ ---
28
+
29
+ ## Dataset Overview
30
+
31
+ * **Name:** TinyWay-Gutenberg-Clean-40M
32
+ * **Samples:** ~40,000,000
33
+ * **Language:** English
34
+ * **Format:** JSONL (optionally gzip-compressed)
35
+ * **Source:** Project Gutenberg (public domain books)
36
+ * **License:** Public Domain
37
+ * **Intended Use:** Language model pretraining, tokenizer training, representation learning
38
+
39
+ Each line in the dataset contains a clean text segment between **30 and 60 words**.
40
+
41
+ ---
42
+
43
+ ## Data Format
44
+
45
+ Each record is stored as a JSON object:
46
+
47
+ ```json
48
+ {
49
+ "id": "twg_000000000123",
50
+ "text": "Cleaned text segment of natural English language between thirty and sixty words.",
51
+ "word_count": 42,
52
+ "source": "gutenberg"
53
+ }
54
+ ```
55
+
56
+ ### Fields
57
+
58
+ | Field | Description |
59
+ | ------------ | ----------------------------- |
60
+ | `id` | Unique sample identifier |
61
+ | `text` | Clean English text segment |
62
+ | `word_count` | Number of words in the sample |
63
+ | `source` | Data source identifier |
64
+
65
+ ---
66
+
67
+ ## Data Processing Pipeline
68
+
69
+ The dataset was generated using a fully streaming pipeline to ensure scalability and low memory usage.
70
+
71
+ ### Steps
72
+
73
+ 1. **Streaming Input**
74
+
75
+ * Data loaded from a Project Gutenberg mirror using Hugging Face streaming APIs.
76
+
77
+ 2. **Text Cleaning**
78
+
79
+ * Removed Gutenberg headers and footers
80
+ * Removed chapter titles and page numbers
81
+ * Normalized whitespace and line breaks
82
+ * Removed non-ASCII and control characters
83
+ * Removed URLs and artifacts
84
+
85
+ 3. **Segmentation**
86
+
87
+ * Text split into fixed segments of **30–60 words**.
88
+
89
+ 4. **Validation**
90
+
91
+ * Enforced word count constraints
92
+ * Filtered short or malformed segments
93
+
94
+ 5. **Deduplication**
95
+
96
+ * Exact hash-based deduplication applied during generation.
97
+
98
+ 6. **Output**
99
+
100
+ * Stored as JSONL files (optionally gzip-compressed).
101
+ * Sharded for easier distribution and loading.
102
+
103
+ ---
104
+
105
+ ## How to Load the Dataset
106
+
107
+ ### Using Hugging Face Datasets
108
+
109
+ ```python
110
+ from datasets import load_dataset
111
+
112
+ dataset = load_dataset(
113
+ "NNEngine/TinyWay-Gutenberg-Clean-40M",
114
+ split="train",
115
+ streaming=True
116
+ )
117
+
118
+ for sample in dataset.take(3):
119
+ print(sample)
120
+ ```
121
+
122
+ ---
123
+
124
+ ### Reading JSONL Manually
125
+
126
+ ```python
127
+ import json
128
+
129
+ with open("data/train-00000.jsonl", "r", encoding="utf-8") as f:
130
+ for _ in range(3):
131
+ print(json.loads(next(f)))
132
+ ```
133
+
134
+ If files are compressed:
135
+
136
+ ```python
137
+ import gzip
138
+ import json
139
+
140
+ with gzip.open("train-00000.jsonl.gz", "rt", encoding="utf-8") as f:
141
+ for _ in range(3):
142
+ print(json.loads(next(f)))
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Dataset Characteristics
148
+
149
+ Approximate properties:
150
+
151
+ * **Average words per sample:** ~45
152
+ * **Vocabulary:** Large natural English vocabulary
153
+ * **Style:** Literary and narrative English
154
+ * **Domain:** Fiction, non-fiction, historical texts
155
+
156
+ ---
157
+
158
+ ## Limitations
159
+
160
+ * Content is primarily literary and historical in nature.
161
+ * No conversational, chat, or code data.
162
+ * Some archaic vocabulary and sentence structure may appear.
163
+ * Deduplication is hash-based (near-duplicates may remain).
164
+
165
+ For conversational or modern web text, additional datasets should be mixed.
166
+
167
+ ---
168
+
169
+ ## License
170
+
171
+ All source texts originate from Project Gutenberg and are in the **public domain**.
172
+ This processed dataset is released for unrestricted research and commercial use.
173
+
174
+ ---
175
+
176
+ ## Citation
177
+
178
+ If you use this dataset in research or publications, please cite:
179
+
180
+ ```
181
+ TinyWay-Gutenberg-Clean-40M
182
+ NNEngine, 2026
183
+ ```
184
+
185
+ ---
186
+
187
+ ## 🧠 Maintainer
188
+
189
+ Created and maintained by **Shivam Sharma**