Alverciito commited on
Commit
6a3f9bb
·
verified ·
1 Parent(s): 6960229

update readme metadata

Browse files
Files changed (1) hide show
  1. README.md +337 -312
README.md CHANGED
@@ -1,312 +1,337 @@
1
- # Wikipedia Article Segmentation ES — Tokenized Dataset
2
-
3
- ## Overview
4
-
5
- **Wikipedia Article Segmentation ES — Tokenized** is a large-scale, fully tokenized version of the *Wikipedia Article Segmentation ES* dataset.
6
- It is designed for **efficient training of sentence and document segmentation models**, enabling high-throughput access through memory-mapped arrays.
7
-
8
- This dataset provides **pre-tokenized inputs, segmentation labels, and masks**, removing the need for on-the-fly tokenization and sentence splitting during training.
9
-
10
- ---
11
-
12
- ## Contents
13
-
14
- - [Overview](#overview)
15
- - [Dataset Origin](#dataset-origin)
16
- - [Task Categories](#task-categories)
17
- - [Language](#language)
18
- - [License](#license)
19
- - [Dataset Splits](#dataset-splits)
20
- - [Tokenized Dataset Structure](#tokenized-dataset-structure)
21
- - [Metadata (`info.json`)](#metadata-infojson)
22
- - [Example Structure](#example-structure)
23
- - [Derived Attributes](#derived-attributes)
24
- - [`max_sentences`](#max_sentences)
25
- - [`max_tokens`](#max_tokens)
26
- - [Data Fields (Per Sample)](#data-fields-per-sample)
27
- - [Notes](#notes)
28
- - [Loading the Tokenized Dataset](#loading-the-tokenized-dataset)
29
- - [Using a DataLoader](#using-a-dataloader)
30
- - [Output Formats](#output-formats)
31
- - [Design Goals](#design-goals)
32
- - [Reproducibility](#reproducibility)
33
- - [Known Limitations](#known-limitations)
34
- - [Intended Use](#intended-use)
35
- - [Citation](#citation)
36
- - [Author](#author)
37
-
38
-
39
- ---
40
-
41
- ## Dataset Origin
42
-
43
- This tokenized dataset is derived from the base dataset:
44
-
45
- **Wikipedia Article Segmentation ES**
46
-
47
- The base dataset consists of segmented Spanish Wikipedia articles, where each sample may contain **multiple concatenated articles**, preserving paragraph and sentence structure.
48
-
49
- The tokenized version applies:
50
- - Sentence segmentation using SpaCy
51
- - Subword tokenization using a custom-trained **BPE tokenizer**
52
- - Fixed-size padding and masking
53
- - Memory-mapped storage for scalability
54
-
55
- ---
56
-
57
- ## Task Categories
58
-
59
- - Text segmentation
60
- - Sentence boundary detection
61
- - Long-document modeling
62
- - Text classification
63
- - Sentence similarity
64
- - Document-level representation learning
65
-
66
- ---
67
-
68
- ## Language
69
-
70
- - Spanish (`es`)
71
-
72
- ---
73
-
74
- ## License
75
-
76
- - **MIT**
77
-
78
- Wikipedia content is redistributed under its original license terms.
79
-
80
- ---
81
-
82
- ## Dataset Splits
83
-
84
- The dataset is divided into three subsets:
85
-
86
- | Split | Name | Description |
87
- |------|------|-------------|
88
- | Train | `wikipedia-es-A000` | 26,510 grouped samples |
89
- | Validation | `wikipedia-es-A001` | 3,336 grouped samples |
90
- | Test | `wikipedia-es-A002` | 6,557 grouped samples |
91
-
92
- Each split is tokenized independently using the same tokenizer configuration.
93
-
94
- ---
95
-
96
- ## Tokenized Dataset Structure
97
-
98
- Each tokenized dataset directory contains:
99
-
100
- ```text
101
- tokenized_dataset/
102
- ├── info.json
103
- ├── x.memmap # Tokenized input IDs
104
- ├── y.memmap # Sentence boundary labels
105
- ├── x_mask.memmap # Attention masks
106
- ├── y_mask.memmap # Sentence validity mask
107
- ├── y_cand.memmap # Sentence candidate mask
108
- ```
109
-
110
- All arrays are stored as NumPy memmaps for fast, low-memory access.
111
-
112
- ## Metadata (`info.json`)
113
-
114
- The `info.json` file describes the **layout, data types, and tensor shapes** of the tokenized dataset stored on disk.
115
- It is required to correctly map the memory-mapped arrays and guarantees dataset integrity through a unique fingerprint.
116
-
117
- ### Example Structure
118
-
119
- ```json
120
- {
121
- "samples": 26510,
122
- "fingerprint": "...",
123
- "x": {
124
- "name": "x",
125
- "dtype": "int32",
126
- "samples": 26510,
127
- "element_shape": [max_sentences, max_tokens]
128
- },
129
- "y": {
130
- "name": "y",
131
- "dtype": "int8",
132
- "samples": 26510,
133
- "element_shape": [max_sentences]
134
- },
135
- "x_mask": {
136
- "name": "x_mask",
137
- "dtype": "int8",
138
- "samples": 26510,
139
- "element_shape": [max_sentences, max_tokens]
140
- },
141
- "y_mask": {
142
- "name": "y_mask",
143
- "dtype": "int8",
144
- "samples": 26510,
145
- "element_shape": [max_sentences]
146
- },
147
- "y_cand": {
148
- "name": "y_cand",
149
- "dtype": "int8",
150
- "samples": 26510,
151
- "element_shape": [max_sentences]
152
- }
153
- }
154
- ```
155
-
156
- ## Derived Attributes
157
-
158
- The following attributes are inferred from the metadata and are consistent across the dataset:
159
-
160
- ### `max_sentences`
161
- Maximum number of sentences per sample.
162
- Samples with fewer sentences are padded up to this limit.
163
-
164
- ### `max_tokens`
165
- Maximum number of tokens per sentence.
166
- Sentences longer than this value are truncated.
167
-
168
- These fixed dimensions allow efficient batching and fast memory-mapped access.
169
-
170
- ---
171
-
172
- ## Data Fields (Per Sample)
173
-
174
- Each sample in the tokenized dataset consists of the following tensors:
175
-
176
- | Field | Shape | Type | Description |
177
- |------|------|------|-------------|
178
- | `x` | `max_sentences × max_tokens` | `int32` | Tokenized input IDs |
179
- | `x_mask` | `max_sentences × max_tokens` | `int8` | Attention mask for valid tokens |
180
- | `y` | `max_sentences` | `int8` | Sentence boundary labels (1 = boundary) |
181
- | `y_mask` | `max_sentences` | `int8` | Mask indicating valid sentences |
182
- | `y_cand` | `max_sentences` | `int8` | Candidate positions for sentence boundaries |
183
-
184
- ---
185
-
186
- #### Notes
187
-
188
- - All arrays are stored as **NumPy memory-mapped files** for efficient disk access.
189
- - Padding positions are always masked out using `x_mask` and `y_mask`.
190
- - `y_cand` restricts boundary prediction to structurally valid positions (e.g. paragraph breaks or article starts).
191
- - The dataset `fingerprint` ensures compatibility between the dataset and the tokenizer configuration.
192
-
193
- This structure allows models to reason explicitly about **sentence structure, boundaries, and padding**, while maintaining high training throughput.
194
-
195
-
196
- ---
197
-
198
- ## Loading the Tokenized Dataset
199
-
200
- The tokenized dataset is designed to be loaded directly from disk using memory-mapped arrays.
201
-
202
- ```python
203
- from src.tokenized_dataset import TokenizedSegmentationDataset
204
-
205
- dataset = TokenizedSegmentationDataset(
206
- tokenized_dataset="/path/to/tokenized_dataset",
207
- percentage=1.0,
208
- return_type=dict
209
- )
210
- ```
211
-
212
- ---
213
-
214
- ## Using a DataLoader
215
-
216
- ````python
217
- loader = dataset.get_loader(
218
- batch_size=8,
219
- shuffle=True,
220
- num_workers=0
221
- )
222
- ````
223
-
224
- The loader yields fully prepared tensors, ready to be passed to a model without additional preprocessing.
225
-
226
- ---
227
-
228
- ## Output Formats
229
-
230
- The dataset supports two output formats, configurable via the return_type parameter.
231
-
232
- ````python
233
- # Dictionary format (default)
234
- {
235
- "input": x,
236
- "input_mask": x_mask,
237
- "labels": y,
238
- "output_mask": y_mask,
239
- "candidate_mask": y_cand
240
- }
241
-
242
- # Tuple format
243
- (x, y, x_mask, y_mask, y_cand)
244
- ````
245
-
246
-
247
- The tuple format is intended for lightweight or legacy training loops.
248
-
249
- ---
250
-
251
- ## Design Goals
252
-
253
- This tokenized dataset is designed to:
254
-
255
- - Remove runtime tokenization and sentence segmentation overhead
256
- - Enable fast iteration over very large datasets
257
- - Support long-context document segmentation models
258
- - Minimize RAM usage through memory mapping
259
- - Provide explicit structural supervision for sentence boundaries
260
-
261
- ---
262
-
263
- ## Reproducibility
264
-
265
- The dataset is fully reproducible given:
266
-
267
- - The same Wikipedia ZIM snapshot
268
- - The same tokenizer configuration
269
- - The same sentence segmentation parameters
270
- - The same random seed
271
-
272
- No heuristic filtering is applied beyond sentence segmentation and whitespace normalization, making the dataset suitable for controlled experiments and benchmarking.
273
-
274
- ---
275
-
276
- ## Known Limitations
277
-
278
- - The number of sentences per sample is capped at `max_sentences`
279
- - Token sequences are truncated to `max_tokens`
280
- - Titles are not included in the tokenized representation
281
- - Internal Wikipedia references are not preserved
282
- - Sentence boundaries are restricted to predefined candidate positions
283
-
284
- ---
285
-
286
- ## Intended Use
287
-
288
- This dataset is intended for research and development in:
289
-
290
- - Sentence and document segmentation
291
- - Boundary detection models
292
- - Long-context language modeling
293
- - Structured document understanding
294
- - Spanish-language NLP benchmarks
295
-
296
- ---
297
-
298
- ## Citation
299
-
300
- If you use this dataset in academic or research work, please cite:
301
-
302
- **Alberto Palomo Alonso**
303
- Universidad de Alcalá Escuela Politécnica Superior
304
- Spanish Wikipedia (offline ZIM snapshot)
305
-
306
- ---
307
-
308
- ## Author
309
-
310
- **Alberto Palomo Alonso**
311
- Universidad de Alcalá
312
- Escuela Politécnica Superior
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - text-classification
5
+ - sentence-similarity
6
+ - token-classification
7
+ language:
8
+ - es
9
+ tags:
10
+ - wikipedia
11
+ - spanish
12
+ - es
13
+ - segmentation
14
+ - sentence-segmentation
15
+ - document-segmentation
16
+ - sentence-transformer
17
+ - long-context
18
+ - bpe
19
+ - tokenized
20
+ - memory-mapped
21
+ - nlp
22
+ pretty_name: Wikipedia Article Segmentation ES - Tokenized
23
+ size_categories:
24
+ - 100M<n<1B
25
+ ---
26
+ # Wikipedia Article Segmentation ES — Tokenized Dataset
27
+
28
+ ## Overview
29
+
30
+ **Wikipedia Article Segmentation ES — Tokenized** is a large-scale, fully tokenized version of the *Wikipedia Article Segmentation ES* dataset.
31
+ It is designed for **efficient training of sentence and document segmentation models**, enabling high-throughput access through memory-mapped arrays.
32
+
33
+ This dataset provides **pre-tokenized inputs, segmentation labels, and masks**, removing the need for on-the-fly tokenization and sentence splitting during training.
34
+
35
+ ---
36
+
37
+ ## Contents
38
+
39
+ - [Overview](#overview)
40
+ - [Dataset Origin](#dataset-origin)
41
+ - [Task Categories](#task-categories)
42
+ - [Language](#language)
43
+ - [License](#license)
44
+ - [Dataset Splits](#dataset-splits)
45
+ - [Tokenized Dataset Structure](#tokenized-dataset-structure)
46
+ - [Metadata (`info.json`)](#metadata-infojson)
47
+ - [Example Structure](#example-structure)
48
+ - [Derived Attributes](#derived-attributes)
49
+ - [`max_sentences`](#max_sentences)
50
+ - [`max_tokens`](#max_tokens)
51
+ - [Data Fields (Per Sample)](#data-fields-per-sample)
52
+ - [Notes](#notes)
53
+ - [Loading the Tokenized Dataset](#loading-the-tokenized-dataset)
54
+ - [Using a DataLoader](#using-a-dataloader)
55
+ - [Output Formats](#output-formats)
56
+ - [Design Goals](#design-goals)
57
+ - [Reproducibility](#reproducibility)
58
+ - [Known Limitations](#known-limitations)
59
+ - [Intended Use](#intended-use)
60
+ - [Citation](#citation)
61
+ - [Author](#author)
62
+
63
+
64
+ ---
65
+
66
+ ## Dataset Origin
67
+
68
+ This tokenized dataset is derived from the base dataset:
69
+
70
+ **Wikipedia Article Segmentation ES**
71
+
72
+ The base dataset consists of segmented Spanish Wikipedia articles, where each sample may contain **multiple concatenated articles**, preserving paragraph and sentence structure.
73
+
74
+ The tokenized version applies:
75
+ - Sentence segmentation using SpaCy
76
+ - Subword tokenization using a custom-trained **BPE tokenizer**
77
+ - Fixed-size padding and masking
78
+ - Memory-mapped storage for scalability
79
+
80
+ ---
81
+
82
+ ## Task Categories
83
+
84
+ - Text segmentation
85
+ - Sentence boundary detection
86
+ - Long-document modeling
87
+ - Text classification
88
+ - Sentence similarity
89
+ - Document-level representation learning
90
+
91
+ ---
92
+
93
+ ## Language
94
+
95
+ - Spanish (`es`)
96
+
97
+ ---
98
+
99
+ ## License
100
+
101
+ - **MIT**
102
+
103
+ Wikipedia content is redistributed under its original license terms.
104
+
105
+ ---
106
+
107
+ ## Dataset Splits
108
+
109
+ The dataset is divided into three subsets:
110
+
111
+ | Split | Name | Description |
112
+ |------|------|-------------|
113
+ | Train | `wikipedia-es-A000` | 26,510 grouped samples |
114
+ | Validation | `wikipedia-es-A001` | 3,336 grouped samples |
115
+ | Test | `wikipedia-es-A002` | 6,557 grouped samples |
116
+
117
+ Each split is tokenized independently using the same tokenizer configuration.
118
+
119
+ ---
120
+
121
+ ## Tokenized Dataset Structure
122
+
123
+ Each tokenized dataset directory contains:
124
+
125
+ ```text
126
+ tokenized_dataset/
127
+ ├── info.json
128
+ ├── x.memmap # Tokenized input IDs
129
+ ├── y.memmap # Sentence boundary labels
130
+ ├── x_mask.memmap # Attention masks
131
+ ├── y_mask.memmap # Sentence validity mask
132
+ ├── y_cand.memmap # Sentence candidate mask
133
+ ```
134
+
135
+ All arrays are stored as NumPy memmaps for fast, low-memory access.
136
+
137
+ ## Metadata (`info.json`)
138
+
139
+ The `info.json` file describes the **layout, data types, and tensor shapes** of the tokenized dataset stored on disk.
140
+ It is required to correctly map the memory-mapped arrays and guarantees dataset integrity through a unique fingerprint.
141
+
142
+ ### Example Structure
143
+
144
+ ```json
145
+ {
146
+ "samples": 26510,
147
+ "fingerprint": "...",
148
+ "x": {
149
+ "name": "x",
150
+ "dtype": "int32",
151
+ "samples": 26510,
152
+ "element_shape": [max_sentences, max_tokens]
153
+ },
154
+ "y": {
155
+ "name": "y",
156
+ "dtype": "int8",
157
+ "samples": 26510,
158
+ "element_shape": [max_sentences]
159
+ },
160
+ "x_mask": {
161
+ "name": "x_mask",
162
+ "dtype": "int8",
163
+ "samples": 26510,
164
+ "element_shape": [max_sentences, max_tokens]
165
+ },
166
+ "y_mask": {
167
+ "name": "y_mask",
168
+ "dtype": "int8",
169
+ "samples": 26510,
170
+ "element_shape": [max_sentences]
171
+ },
172
+ "y_cand": {
173
+ "name": "y_cand",
174
+ "dtype": "int8",
175
+ "samples": 26510,
176
+ "element_shape": [max_sentences]
177
+ }
178
+ }
179
+ ```
180
+
181
+ ## Derived Attributes
182
+
183
+ The following attributes are inferred from the metadata and are consistent across the dataset:
184
+
185
+ ### `max_sentences`
186
+ Maximum number of sentences per sample.
187
+ Samples with fewer sentences are padded up to this limit.
188
+
189
+ ### `max_tokens`
190
+ Maximum number of tokens per sentence.
191
+ Sentences longer than this value are truncated.
192
+
193
+ These fixed dimensions allow efficient batching and fast memory-mapped access.
194
+
195
+ ---
196
+
197
+ ## Data Fields (Per Sample)
198
+
199
+ Each sample in the tokenized dataset consists of the following tensors:
200
+
201
+ | Field | Shape | Type | Description |
202
+ |------|------|------|-------------|
203
+ | `x` | `max_sentences × max_tokens` | `int32` | Tokenized input IDs |
204
+ | `x_mask` | `max_sentences × max_tokens` | `int8` | Attention mask for valid tokens |
205
+ | `y` | `max_sentences` | `int8` | Sentence boundary labels (1 = boundary) |
206
+ | `y_mask` | `max_sentences` | `int8` | Mask indicating valid sentences |
207
+ | `y_cand` | `max_sentences` | `int8` | Candidate positions for sentence boundaries |
208
+
209
+ ---
210
+
211
+ #### Notes
212
+
213
+ - All arrays are stored as **NumPy memory-mapped files** for efficient disk access.
214
+ - Padding positions are always masked out using `x_mask` and `y_mask`.
215
+ - `y_cand` restricts boundary prediction to structurally valid positions (e.g. paragraph breaks or article starts).
216
+ - The dataset `fingerprint` ensures compatibility between the dataset and the tokenizer configuration.
217
+
218
+ This structure allows models to reason explicitly about **sentence structure, boundaries, and padding**, while maintaining high training throughput.
219
+
220
+
221
+ ---
222
+
223
+ ## Loading the Tokenized Dataset
224
+
225
+ The tokenized dataset is designed to be loaded directly from disk using memory-mapped arrays.
226
+
227
+ ```python
228
+ from src.tokenized_dataset import TokenizedSegmentationDataset
229
+
230
+ dataset = TokenizedSegmentationDataset(
231
+ tokenized_dataset="/path/to/tokenized_dataset",
232
+ percentage=1.0,
233
+ return_type=dict
234
+ )
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Using a DataLoader
240
+
241
+ ````python
242
+ loader = dataset.get_loader(
243
+ batch_size=8,
244
+ shuffle=True,
245
+ num_workers=0
246
+ )
247
+ ````
248
+
249
+ The loader yields fully prepared tensors, ready to be passed to a model without additional preprocessing.
250
+
251
+ ---
252
+
253
+ ## Output Formats
254
+
255
+ The dataset supports two output formats, configurable via the return_type parameter.
256
+
257
+ ````python
258
+ # Dictionary format (default)
259
+ {
260
+ "input": x,
261
+ "input_mask": x_mask,
262
+ "labels": y,
263
+ "output_mask": y_mask,
264
+ "candidate_mask": y_cand
265
+ }
266
+
267
+ # Tuple format
268
+ (x, y, x_mask, y_mask, y_cand)
269
+ ````
270
+
271
+
272
+ The tuple format is intended for lightweight or legacy training loops.
273
+
274
+ ---
275
+
276
+ ## Design Goals
277
+
278
+ This tokenized dataset is designed to:
279
+
280
+ - Remove runtime tokenization and sentence segmentation overhead
281
+ - Enable fast iteration over very large datasets
282
+ - Support long-context document segmentation models
283
+ - Minimize RAM usage through memory mapping
284
+ - Provide explicit structural supervision for sentence boundaries
285
+
286
+ ---
287
+
288
+ ## Reproducibility
289
+
290
+ The dataset is fully reproducible given:
291
+
292
+ - The same Wikipedia ZIM snapshot
293
+ - The same tokenizer configuration
294
+ - The same sentence segmentation parameters
295
+ - The same random seed
296
+
297
+ No heuristic filtering is applied beyond sentence segmentation and whitespace normalization, making the dataset suitable for controlled experiments and benchmarking.
298
+
299
+ ---
300
+
301
+ ## Known Limitations
302
+
303
+ - The number of sentences per sample is capped at `max_sentences`
304
+ - Token sequences are truncated to `max_tokens`
305
+ - Titles are not included in the tokenized representation
306
+ - Internal Wikipedia references are not preserved
307
+ - Sentence boundaries are restricted to predefined candidate positions
308
+
309
+ ---
310
+
311
+ ## Intended Use
312
+
313
+ This dataset is intended for research and development in:
314
+
315
+ - Sentence and document segmentation
316
+ - Boundary detection models
317
+ - Long-context language modeling
318
+ - Structured document understanding
319
+ - Spanish-language NLP benchmarks
320
+
321
+ ---
322
+
323
+ ## Citation
324
+
325
+ If you use this dataset in academic or research work, please cite:
326
+
327
+ **Alberto Palomo Alonso**
328
+ Universidad de Alcalá — Escuela Politécnica Superior
329
+ Spanish Wikipedia (offline ZIM snapshot)
330
+
331
+ ---
332
+
333
+ ## Author
334
+
335
+ **Alberto Palomo Alonso**
336
+ Universidad de Alcalá
337
+ Escuela Politécnica Superior