webxos commited on
Commit
5952c8b
·
verified ·
1 Parent(s): 0747cf0

Upload webXOS_typerighter_datasets.html

Browse files
Files changed (1) hide show
  1. webXOS_typerighter_datasets.html +1388 -0
webXOS_typerighter_datasets.html ADDED
@@ -0,0 +1,1388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>TYPE/RIGHTER - by webXOS</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap">
9
+ <link rel="manifest" href="manifest.json">
10
+ <style>
11
+ :root {
12
+ --primary: #4361ee;
13
+ --primary-dark: #3a56d4;
14
+ --secondary: #7209b7;
15
+ --success: #4cc9f0;
16
+ --warning: #f72585;
17
+ --light: #f8f9fa;
18
+ --dark: #212529;
19
+ --gray: #6c757d;
20
+ --border-radius: 8px;
21
+ --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
22
+ --transition: all 0.3s ease;
23
+ }
24
+
25
+ * {
26
+ margin: 0;
27
+ padding: 0;
28
+ box-sizing: border-box;
29
+ }
30
+
31
+ body {
32
+ font-family: 'Inter', sans-serif;
33
+ line-height: 1.6;
34
+ color: var(--dark);
35
+ background-color: #f5f7ff;
36
+ min-height: 100vh;
37
+ padding-bottom: 2rem;
38
+ }
39
+
40
+ .container {
41
+ max-width: 1200px;
42
+ margin: 0 auto;
43
+ padding: 0 1.5rem;
44
+ }
45
+
46
+ header {
47
+ background: linear-gradient(135deg, var(--primary), var(--secondary));
48
+ color: white;
49
+ padding: 1.5rem 0;
50
+ border-bottom-left-radius: 20px;
51
+ border-bottom-right-radius: 20px;
52
+ box-shadow: var(--shadow);
53
+ margin-bottom: 2rem;
54
+ }
55
+
56
+ .header-content {
57
+ display: flex;
58
+ justify-content: space-between;
59
+ align-items: center;
60
+ }
61
+
62
+ .logo {
63
+ display: flex;
64
+ align-items: center;
65
+ gap: 0.75rem;
66
+ }
67
+
68
+ .logo i {
69
+ font-size: 1.8rem;
70
+ }
71
+
72
+ .logo h1 {
73
+ font-size: 1.8rem;
74
+ font-weight: 700;
75
+ }
76
+
77
+ .tagline {
78
+ font-size: 0.9rem;
79
+ opacity: 0.9;
80
+ margin-top: 0.25rem;
81
+ }
82
+
83
+ .offline-badge {
84
+ background-color: var(--success);
85
+ color: var(--dark);
86
+ padding: 0.3rem 0.8rem;
87
+ border-radius: 20px;
88
+ font-size: 0.8rem;
89
+ font-weight: 600;
90
+ }
91
+
92
+ main {
93
+ display: grid;
94
+ grid-template-columns: 1fr;
95
+ gap: 2rem;
96
+ }
97
+
98
+ @media (min-width: 992px) {
99
+ main {
100
+ grid-template-columns: 1fr 2fr;
101
+ }
102
+ }
103
+
104
+ .card {
105
+ background: white;
106
+ border-radius: var(--border-radius);
107
+ box-shadow: var(--shadow);
108
+ padding: 1.5rem;
109
+ margin-bottom: 1.5rem;
110
+ transition: var(--transition);
111
+ }
112
+
113
+ .card:hover {
114
+ box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
115
+ }
116
+
117
+ .card h2 {
118
+ font-size: 1.4rem;
119
+ margin-bottom: 1rem;
120
+ color: var(--primary);
121
+ display: flex;
122
+ align-items: center;
123
+ gap: 0.5rem;
124
+ }
125
+
126
+ .card h2 i {
127
+ color: var(--secondary);
128
+ }
129
+
130
+ .upload-area {
131
+ border: 2px dashed var(--primary);
132
+ border-radius: var(--border-radius);
133
+ padding: 2.5rem 1.5rem;
134
+ text-align: center;
135
+ cursor: pointer;
136
+ transition: var(--transition);
137
+ background-color: rgba(67, 97, 238, 0.05);
138
+ }
139
+
140
+ .upload-area:hover {
141
+ background-color: rgba(67, 97, 238, 0.1);
142
+ }
143
+
144
+ .upload-area i {
145
+ font-size: 3rem;
146
+ color: var(--primary);
147
+ margin-bottom: 1rem;
148
+ }
149
+
150
+ .upload-area p {
151
+ margin-bottom: 1rem;
152
+ }
153
+
154
+ .file-input {
155
+ display: none;
156
+ }
157
+
158
+ .file-list {
159
+ margin-top: 1.5rem;
160
+ max-height: 300px;
161
+ overflow-y: auto;
162
+ }
163
+
164
+ .file-item {
165
+ display: flex;
166
+ justify-content: space-between;
167
+ align-items: center;
168
+ padding: 0.75rem;
169
+ border: 1px solid #e9ecef;
170
+ border-radius: var(--border-radius);
171
+ margin-bottom: 0.5rem;
172
+ background-color: #f8f9fa;
173
+ }
174
+
175
+ .file-info {
176
+ display: flex;
177
+ align-items: center;
178
+ gap: 0.75rem;
179
+ }
180
+
181
+ .file-icon {
182
+ color: var(--primary);
183
+ }
184
+
185
+ .file-name {
186
+ font-weight: 500;
187
+ }
188
+
189
+ .file-size {
190
+ font-size: 0.85rem;
191
+ color: var(--gray);
192
+ }
193
+
194
+ .file-remove {
195
+ color: var(--warning);
196
+ cursor: pointer;
197
+ background: none;
198
+ border: none;
199
+ font-size: 1.1rem;
200
+ }
201
+
202
+ .slider-container {
203
+ margin-bottom: 1.5rem;
204
+ }
205
+
206
+ .slider-header {
207
+ display: flex;
208
+ justify-content: space-between;
209
+ margin-bottom: 0.5rem;
210
+ }
211
+
212
+ .slider-label {
213
+ font-weight: 500;
214
+ }
215
+
216
+ .slider-value {
217
+ font-weight: 600;
218
+ color: var(--primary);
219
+ }
220
+
221
+ .slider {
222
+ width: 100%;
223
+ height: 8px;
224
+ border-radius: 4px;
225
+ background: #e9ecef;
226
+ outline: none;
227
+ -webkit-appearance: none;
228
+ }
229
+
230
+ .slider::-webkit-slider-thumb {
231
+ -webkit-appearance: none;
232
+ width: 20px;
233
+ height: 20px;
234
+ border-radius: 50%;
235
+ background: var(--primary);
236
+ cursor: pointer;
237
+ }
238
+
239
+ .slider::-moz-range-thumb {
240
+ width: 20px;
241
+ height: 20px;
242
+ border-radius: 50%;
243
+ background: var(--primary);
244
+ cursor: pointer;
245
+ border: none;
246
+ }
247
+
248
+ .process-btn {
249
+ background: linear-gradient(to right, var(--primary), var(--secondary));
250
+ color: white;
251
+ border: none;
252
+ border-radius: var(--border-radius);
253
+ padding: 1rem 2rem;
254
+ font-size: 1.1rem;
255
+ font-weight: 600;
256
+ cursor: pointer;
257
+ width: 100%;
258
+ transition: var(--transition);
259
+ margin-top: 1rem;
260
+ }
261
+
262
+ .process-btn:hover {
263
+ transform: translateY(-2px);
264
+ box-shadow: 0 6px 12px rgba(67, 97, 238, 0.3);
265
+ }
266
+
267
+ .process-btn:disabled {
268
+ opacity: 0.6;
269
+ cursor: not-allowed;
270
+ }
271
+
272
+ .process-btn:disabled:hover {
273
+ transform: none;
274
+ box-shadow: none;
275
+ }
276
+
277
+ .status-area {
278
+ margin-top: 1.5rem;
279
+ }
280
+
281
+ .status-header {
282
+ display: flex;
283
+ justify-content: space-between;
284
+ align-items: center;
285
+ margin-bottom: 1rem;
286
+ }
287
+
288
+ .progress-bar {
289
+ height: 10px;
290
+ background-color: #e9ecef;
291
+ border-radius: 5px;
292
+ overflow: hidden;
293
+ margin-bottom: 1rem;
294
+ }
295
+
296
+ .progress-fill {
297
+ height: 100%;
298
+ background: linear-gradient(to right, var(--success), #4cc9f0);
299
+ width: 0%;
300
+ transition: width 0.5s ease;
301
+ }
302
+
303
+ .status-message {
304
+ font-size: 0.9rem;
305
+ color: var(--gray);
306
+ min-height: 1.5rem;
307
+ }
308
+
309
+ .dataset-preview {
310
+ margin-top: 1.5rem;
311
+ max-height: 400px;
312
+ overflow-y: auto;
313
+ border: 1px solid #e9ecef;
314
+ border-radius: var(--border-radius);
315
+ padding: 1rem;
316
+ }
317
+
318
+ .preview-item {
319
+ margin-bottom: 1.5rem;
320
+ padding-bottom: 1.5rem;
321
+ border-bottom: 1px dashed #e9ecef;
322
+ }
323
+
324
+ .preview-item:last-child {
325
+ border-bottom: none;
326
+ }
327
+
328
+ .preview-label {
329
+ font-weight: 600;
330
+ color: var(--primary);
331
+ margin-bottom: 0.5rem;
332
+ display: flex;
333
+ align-items: center;
334
+ gap: 0.5rem;
335
+ }
336
+
337
+ .preview-text {
338
+ font-size: 0.9rem;
339
+ background-color: #f8f9fa;
340
+ padding: 0.75rem;
341
+ border-radius: 5px;
342
+ border-left: 3px solid var(--primary);
343
+ }
344
+
345
+ .export-btn {
346
+ background: linear-gradient(to right, #38b000, #2d8c00);
347
+ color: white;
348
+ border: none;
349
+ border-radius: var(--border-radius);
350
+ padding: 1rem 2rem;
351
+ font-size: 1.1rem;
352
+ font-weight: 600;
353
+ cursor: pointer;
354
+ width: 100%;
355
+ transition: var(--transition);
356
+ margin-top: 1rem;
357
+ display: flex;
358
+ justify-content: center;
359
+ align-items: center;
360
+ gap: 0.5rem;
361
+ }
362
+
363
+ .export-btn:hover {
364
+ transform: translateY(-2px);
365
+ box-shadow: 0 6px 12px rgba(56, 176, 0, 0.3);
366
+ }
367
+
368
+ .export-btn:disabled {
369
+ opacity: 0.6;
370
+ cursor: not-allowed;
371
+ }
372
+
373
+ .export-btn:disabled:hover {
374
+ transform: none;
375
+ box-shadow: none;
376
+ }
377
+
378
+ .use-case-example {
379
+ background: linear-gradient(135deg, #f8f9fa, #e9ecef);
380
+ border-left: 4px solid var(--secondary);
381
+ padding: 1.5rem;
382
+ margin-top: 2rem;
383
+ border-radius: var(--border-radius);
384
+ }
385
+
386
+ .use-case-example h3 {
387
+ color: var(--secondary);
388
+ margin-bottom: 0.75rem;
389
+ display: flex;
390
+ align-items: center;
391
+ gap: 0.5rem;
392
+ }
393
+
394
+ .step {
395
+ display: flex;
396
+ align-items: flex-start;
397
+ gap: 1rem;
398
+ margin-bottom: 1rem;
399
+ }
400
+
401
+ .step-number {
402
+ background-color: var(--primary);
403
+ color: white;
404
+ width: 24px;
405
+ height: 24px;
406
+ border-radius: 50%;
407
+ display: flex;
408
+ justify-content: center;
409
+ align-items: center;
410
+ font-size: 0.9rem;
411
+ font-weight: 600;
412
+ flex-shrink: 0;
413
+ }
414
+
415
+ .footer {
416
+ text-align: center;
417
+ margin-top: 3rem;
418
+ color: var(--gray);
419
+ font-size: 0.9rem;
420
+ padding-top: 1.5rem;
421
+ border-top: 1px solid #e9ecef;
422
+ }
423
+
424
+ .toast {
425
+ position: fixed;
426
+ bottom: 2rem;
427
+ right: 2rem;
428
+ background: var(--dark);
429
+ color: white;
430
+ padding: 1rem 1.5rem;
431
+ border-radius: var(--border-radius);
432
+ box-shadow: var(--shadow);
433
+ transform: translateY(100px);
434
+ opacity: 0;
435
+ transition: transform 0.5s ease, opacity 0.5s ease;
436
+ z-index: 1000;
437
+ max-width: 350px;
438
+ }
439
+
440
+ .toast.show {
441
+ transform: translateY(0);
442
+ opacity: 1;
443
+ }
444
+
445
+ .loading-spinner {
446
+ display: inline-block;
447
+ width: 20px;
448
+ height: 20px;
449
+ border: 3px solid rgba(255, 255, 255, 0.3);
450
+ border-radius: 50%;
451
+ border-top-color: white;
452
+ animation: spin 1s ease-in-out infinite;
453
+ }
454
+
455
+ @keyframes spin {
456
+ to { transform: rotate(360deg); }
457
+ }
458
+
459
+ .pwa-install {
460
+ background-color: var(--primary);
461
+ color: white;
462
+ padding: 0.75rem 1.5rem;
463
+ border-radius: var(--border-radius);
464
+ border: none;
465
+ font-weight: 600;
466
+ cursor: pointer;
467
+ display: none;
468
+ align-items: center;
469
+ gap: 0.5rem;
470
+ }
471
+
472
+ @media (max-width: 768px) {
473
+ .header-content {
474
+ flex-direction: column;
475
+ gap: 1rem;
476
+ text-align: center;
477
+ }
478
+
479
+ .card {
480
+ padding: 1rem;
481
+ }
482
+ }
483
+ </style>
484
+ </head>
485
+ <body>
486
+ <header>
487
+ <div class="container">
488
+ <div class="header-content">
489
+ <div class="logo">
490
+ <i class="fas fa-keyboard"></i>
491
+ <div>
492
+ <h1>TYPE/RIGHTER by webXOS</h1>
493
+ <div class="tagline">Transform documents into synthetic datasets for error correction</div>
494
+ </div>
495
+ </div>
496
+ <div>
497
+ <button id="installBtn" class="pwa-install">
498
+ <i class="fas fa-download"></i> Install App
499
+ </button>
500
+ <div class="offline-badge">
501
+ <i class="fas fa-wifi-slash"></i> Offline-First PWA
502
+ </div>
503
+ </div>
504
+ </div>
505
+ </div>
506
+ </header>
507
+
508
+ <div class="container">
509
+ <main>
510
+ <div class="left-column">
511
+ <div class="card">
512
+ <h2><i class="fas fa-file-upload"></i> Document Import</h2>
513
+ <div class="upload-area" id="uploadArea">
514
+ <i class="fas fa-cloud-upload-alt"></i>
515
+ <p><strong>Click to upload documents</strong></p>
516
+ <p>Supported formats: .txt, .csv, .md, .jsonl</p>
517
+ <p class="tagline">All processing happens locally in your browser</p>
518
+ <input type="file" id="fileInput" class="file-input" multiple accept=".txt,.csv,.md,.jsonl">
519
+ </div>
520
+
521
+ <div class="file-list" id="fileList">
522
+ <!-- Files will appear here -->
523
+ </div>
524
+ </div>
525
+
526
+ <div class="card">
527
+ <h2><i class="fas fa-sliders-h"></i> Error Injection Settings</h2>
528
+
529
+ <div class="slider-container">
530
+ <div class="slider-header">
531
+ <span class="slider-label">Keyboard Adjacent Errors</span>
532
+ <span class="slider-value" id="adjacentValue">5%</span>
533
+ </div>
534
+ <input type="range" min="0" max="20" value="5" class="slider" id="adjacentSlider">
535
+ <div class="status-message">Swaps keys with adjacent keyboard positions</div>
536
+ </div>
537
+
538
+ <div class="slider-container">
539
+ <div class="slider-header">
540
+ <span class="slider-label">Case Corruption</span>
541
+ <span class="slider-value" id="caseValue">3%</span>
542
+ </div>
543
+ <input type="range" min="0" max="15" value="3" class="slider" id="caseSlider">
544
+ <div class="status-message">Randomly changes letter casing (uPPER/lower)</div>
545
+ </div>
546
+
547
+ <div class="slider-container">
548
+ <div class="slider-header">
549
+ <span class="slider-label">Symbol Insertion</span>
550
+ <span class="slider-value" id="symbolValue">2%</span>
551
+ </div>
552
+ <input type="range" min="0" max="10" value="2" class="slider" id="symbolSlider">
553
+ <div class="status-message">Adds random symbols like !, @, # to words</div>
554
+ </div>
555
+
556
+ <div class="slider-container">
557
+ <div class="slider-header">
558
+ <span class="slider-label">OCR Line Noise</span>
559
+ <span class="slider-value" id="ocrValue">0%</span>
560
+ </div>
561
+ <input type="range" min="0" max="10" value="0" class="slider" id="ocrSlider">
562
+ <div class="status-message">Simulates vertical line noise from old scanners</div>
563
+ </div>
564
+
565
+ <button id="processBtn" class="process-btn">
566
+ <i class="fas fa-cogs"></i> Generate Synthetic Dataset
567
+ </button>
568
+ </div>
569
+
570
+ <!-- Example Use Case (General) -->
571
+ <div class="use-case-example">
572
+ <h3><i class="fas fa-lightbulb"></i> Example Use Case</h3>
573
+ <div class="step">
574
+ <div class="step-number">1</div>
575
+ <div>Upload your .txt, .csv, .md, or .jsonl files containing any text content</div>
576
+ </div>
577
+ <div class="step">
578
+ <div class="step-number">2</div>
579
+ <div>TYPE/RIGHTER normalizes the text and injects controlled errors based on your settings</div>
580
+ </div>
581
+ <div class="step">
582
+ <div class="step-number">3</div>
583
+ <div>Outputs a synthetic dataset of "error-clean" pairs ready to train custom correction models</div>
584
+ </div>
585
+ </div>
586
+ </div>
587
+
588
+ <div class="right-column">
589
+ <div class="card">
590
+ <div class="status-header">
591
+ <h2><i class="fas fa-tasks"></i> Processing Status</h2>
592
+ <div id="progressPercent">0%</div>
593
+ </div>
594
+
595
+ <div class="progress-bar">
596
+ <div class="progress-fill" id="progressFill"></div>
597
+ </div>
598
+
599
+ <div class="status-message" id="statusMessage">
600
+ Upload documents to begin processing...
601
+ </div>
602
+
603
+ <div class="dataset-preview" id="datasetPreview">
604
+ <div class="preview-item">
605
+ <div class="preview-label"><i class="fas fa-file-alt"></i> Original</div>
606
+ <div class="preview-text" id="originalText">No data yet. Upload documents to see preview.</div>
607
+ </div>
608
+ <div class="preview-item">
609
+ <div class="preview-label"><i class="fas fa-bomb"></i> Corrupted</div>
610
+ <div class="preview-text" id="corruptedText">The corrupted version with injected errors will appear here.</div>
611
+ </div>
612
+ <div class="preview-item">
613
+ <div class="preview-label"><i class="fas fa-bullseye"></i> Target</div>
614
+ <div class="preview-text" id="targetText">The cleaned, normalized version will appear here.</div>
615
+ </div>
616
+ </div>
617
+
618
+ <button id="exportBtn" class="export-btn" disabled>
619
+ <i class="fas fa-file-export"></i> Export to Hugging Face Format
620
+ </button>
621
+ </div>
622
+
623
+ <div class="card">
624
+ <h2><i class="fas fa-info-circle"></i> How It Works</h2>
625
+ <div class="step">
626
+ <div class="step-number">1</div>
627
+ <div><strong>Normalization (Cleaner):</strong> Uses simulated cleaning to fix existing typos, creating a "Ground Truth" clean version.</div>
628
+ </div>
629
+ <div class="step">
630
+ <div class="step-number">2</div>
631
+ <div><strong>Corruption (RNG Noiser):</strong> Injects fresh, controlled errors based on your slider settings.</div>
632
+ </div>
633
+ <div class="step">
634
+ <div class="step-number">3</div>
635
+ <div><strong>Tagging (Annotator):</strong> Performs content-based auto-labeling based on text content.</div>
636
+ </div>
637
+ <div class="step">
638
+ <div class="step-number">4</div>
639
+ <div><strong>Export:</strong> Creates a "triplet" dataset with original, corrupted, and target versions in Hugging Face format.</div>
640
+ </div>
641
+ </div>
642
+ </div>
643
+ </main>
644
+
645
+ <div class="footer">
646
+ <p>TYPE/RIGHTER • Offline-First PWA • webXOS 2026 • All processing happens locally in your browser</p>
647
+ <p>No data is uploaded to any server • Privacy by design</p>
648
+ </div>
649
+ </div>
650
+
651
+ <div class="toast" id="toast"></div>
652
+
653
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
654
+ <script>
655
+ // PWA Installation
656
+ let deferredPrompt;
657
+ const installBtn = document.getElementById('installBtn');
658
+
659
+ window.addEventListener('beforeinstallprompt', (e) => {
660
+ e.preventDefault();
661
+ deferredPrompt = e;
662
+ installBtn.style.display = 'flex';
663
+ });
664
+
665
+ installBtn.addEventListener('click', async () => {
666
+ if (!deferredPrompt) return;
667
+
668
+ deferredPrompt.prompt();
669
+ const { outcome } = await deferredPrompt.userChoice;
670
+
671
+ if (outcome === 'accepted') {
672
+ installBtn.style.display = 'none';
673
+ showToast('TYPE/RIGHTER installed successfully!');
674
+ }
675
+
676
+ deferredPrompt = null;
677
+ });
678
+
679
+ // Service Worker Registration for Offline Capability
680
+ if ('serviceWorker' in navigator) {
681
+ window.addEventListener('load', () => {
682
+ navigator.serviceWorker.register('/service-worker.js').catch(error => {
683
+ console.log('Service Worker registration failed:', error);
684
+ });
685
+ });
686
+ }
687
+
688
+ // App State
689
+ const state = {
690
+ files: [],
691
+ processing: false,
692
+ dataset: [],
693
+ progress: 0
694
+ };
695
+
696
+ // DOM Elements
697
+ const uploadArea = document.getElementById('uploadArea');
698
+ const fileInput = document.getElementById('fileInput');
699
+ const fileList = document.getElementById('fileList');
700
+ const processBtn = document.getElementById('processBtn');
701
+ const exportBtn = document.getElementById('exportBtn');
702
+ const progressFill = document.getElementById('progressFill');
703
+ const progressPercent = document.getElementById('progressPercent');
704
+ const statusMessage = document.getElementById('statusMessage');
705
+ const toast = document.getElementById('toast');
706
+ const sliders = {
707
+ adjacent: document.getElementById('adjacentSlider'),
708
+ case: document.getElementById('caseSlider'),
709
+ symbol: document.getElementById('symbolSlider'),
710
+ ocr: document.getElementById('ocrSlider')
711
+ };
712
+ const sliderValues = {
713
+ adjacent: document.getElementById('adjacentValue'),
714
+ case: document.getElementById('caseValue'),
715
+ symbol: document.getElementById('symbolValue'),
716
+ ocr: document.getElementById('ocrValue')
717
+ };
718
+ const preview = {
719
+ original: document.getElementById('originalText'),
720
+ corrupted: document.getElementById('corruptedText'),
721
+ target: document.getElementById('targetText')
722
+ };
723
+
724
+ // Event Listeners
725
+ uploadArea.addEventListener('click', () => fileInput.click());
726
+ uploadArea.addEventListener('dragover', (e) => {
727
+ e.preventDefault();
728
+ uploadArea.style.borderColor = 'var(--secondary)';
729
+ uploadArea.style.backgroundColor = 'rgba(114, 9, 183, 0.1)';
730
+ });
731
+ uploadArea.addEventListener('dragleave', () => {
732
+ uploadArea.style.borderColor = 'var(--primary)';
733
+ uploadArea.style.backgroundColor = 'rgba(67, 97, 238, 0.05)';
734
+ });
735
+ uploadArea.addEventListener('drop', (e) => {
736
+ e.preventDefault();
737
+ uploadArea.style.borderColor = 'var(--primary)';
738
+ uploadArea.style.backgroundColor = 'rgba(67, 97, 238, 0.05)';
739
+
740
+ if (e.dataTransfer.files.length) {
741
+ handleFiles(e.dataTransfer.files);
742
+ }
743
+ });
744
+
745
+ fileInput.addEventListener('change', (e) => {
746
+ if (e.target.files.length) {
747
+ handleFiles(e.target.files);
748
+ }
749
+ });
750
+
751
+ processBtn.addEventListener('click', processDocuments);
752
+ exportBtn.addEventListener('click', exportDataset);
753
+
754
+ // Update slider value displays
755
+ Object.keys(sliders).forEach(key => {
756
+ sliders[key].addEventListener('input', (e) => {
757
+ sliderValues[key].textContent = `${e.target.value}%`;
758
+ });
759
+ });
760
+
761
+ // File Handling
762
+ function handleFiles(fileList) {
763
+ for (let i = 0; i < fileList.length; i++) {
764
+ const file = fileList[i];
765
+ const ext = file.name.split('.').pop().toLowerCase();
766
+
767
+ if (['txt', 'csv', 'md', 'jsonl'].includes(ext)) {
768
+ state.files.push({
769
+ name: file.name,
770
+ size: formatFileSize(file.size),
771
+ type: ext,
772
+ content: null,
773
+ chunks: []
774
+ });
775
+
776
+ readFileContent(file, state.files.length - 1);
777
+ } else {
778
+ showToast(`Unsupported file type: .${ext}. Please upload .txt, .csv, .md, or .jsonl files.`);
779
+ }
780
+ }
781
+
782
+ renderFileList();
783
+ }
784
+
785
+ function readFileContent(file, index) {
786
+ const reader = new FileReader();
787
+
788
+ reader.onload = (e) => {
789
+ state.files[index].content = e.target.result;
790
+ state.files[index].chunks = chunkText(e.target.result);
791
+ updateProcessButton();
792
+ };
793
+
794
+ reader.readAsText(file);
795
+ }
796
+
797
+ function chunkText(text) {
798
+ // Simple sentence-level chunking
799
+ const sentences = text.split(/[.!?]+/).filter(s => s.trim().length > 0);
800
+ return sentences.map(s => s.trim()).filter(s => s.length > 10);
801
+ }
802
+
803
+ function renderFileList() {
804
+ if (state.files.length === 0) {
805
+ fileList.innerHTML = '<p style="text-align: center; color: var(--gray); padding: 1rem;">No files uploaded yet</p>';
806
+ return;
807
+ }
808
+
809
+ fileList.innerHTML = state.files.map((file, index) => `
810
+ <div class="file-item">
811
+ <div class="file-info">
812
+ <i class="fas fa-file-alt file-icon"></i>
813
+ <div>
814
+ <div class="file-name">${file.name}</div>
815
+ <div class="file-size">${file.size} • ${file.type.toUpperCase()} • ${file.chunks.length} chunks</div>
816
+ </div>
817
+ </div>
818
+ <button class="file-remove" onclick="removeFile(${index})">
819
+ <i class="fas fa-times"></i>
820
+ </button>
821
+ </div>
822
+ `).join('');
823
+ }
824
+
825
+ function removeFile(index) {
826
+ state.files.splice(index, 1);
827
+ renderFileList();
828
+ updateProcessButton();
829
+ }
830
+
831
+ function updateProcessButton() {
832
+ const hasFiles = state.files.length > 0;
833
+ processBtn.disabled = !hasFiles || state.processing;
834
+
835
+ if (!hasFiles) {
836
+ statusMessage.textContent = 'Upload documents to begin processing...';
837
+ } else {
838
+ const totalChunks = state.files.reduce((sum, file) => sum + file.chunks.length, 0);
839
+ statusMessage.textContent = `Ready to process ${state.files.length} file(s) with ${totalChunks} text chunks`;
840
+ }
841
+ }
842
+
843
+ // Processing Functions
844
+ async function processDocuments() {
845
+ if (state.processing || state.files.length === 0) return;
846
+
847
+ state.processing = true;
848
+ state.dataset = [];
849
+ updateProcessButton();
850
+ processBtn.innerHTML = '<span class="loading-spinner"></span> Processing...';
851
+
852
+ // Reset progress
853
+ updateProgress(0);
854
+ statusMessage.textContent = 'Starting document processing...';
855
+
856
+ // Get all chunks from all files
857
+ const allChunks = [];
858
+ state.files.forEach(file => {
859
+ file.chunks.forEach(chunk => {
860
+ allChunks.push({
861
+ text: chunk,
862
+ source: file.name,
863
+ type: file.type
864
+ });
865
+ });
866
+ });
867
+
868
+ // Process chunks in batches (simulated)
869
+ const batchSize = 5;
870
+ const totalChunks = allChunks.length;
871
+
872
+ for (let i = 0; i < totalChunks; i += batchSize) {
873
+ const batch = allChunks.slice(i, i + batchSize);
874
+
875
+ // Process each chunk in the batch
876
+ for (let j = 0; j < batch.length; j++) {
877
+ const chunk = batch[j];
878
+ const processed = processChunk(chunk.text, chunk.source, chunk.type);
879
+ state.dataset.push(processed);
880
+
881
+ // Update progress
882
+ const progress = Math.round(((i + j + 1) / totalChunks) * 100);
883
+ updateProgress(progress);
884
+ statusMessage.textContent = `Processing: ${i + j + 1} of ${totalChunks} chunks`;
885
+
886
+ // Update preview with the first processed item
887
+ if (state.dataset.length === 1) {
888
+ updatePreview(processed);
889
+ }
890
+
891
+ // Simulate processing time
892
+ await sleep(50);
893
+ }
894
+ }
895
+
896
+ // Complete processing
897
+ updateProgress(100);
898
+ statusMessage.textContent = `Processing complete! Generated ${state.dataset.length} synthetic examples.`;
899
+ processBtn.innerHTML = '<i class="fas fa-check"></i> Processing Complete';
900
+ exportBtn.disabled = false;
901
+
902
+ // Show success message
903
+ showToast(`Successfully generated ${state.dataset.length} synthetic examples!`);
904
+
905
+ // Re-enable process button after a delay
906
+ setTimeout(() => {
907
+ state.processing = false;
908
+ processBtn.innerHTML = '<i class="fas fa-cogs"></i> Generate Synthetic Dataset';
909
+ updateProcessButton();
910
+ }, 1000);
911
+ }
912
+
913
+ function processChunk(text, source, fileType) {
914
+ // Step 1: Normalization (simulated cleaning)
915
+ const normalized = normalizeText(text);
916
+
917
+ // Step 2: Corruption (error injection based on sliders)
918
+ const corrupted = corruptText(normalized);
919
+
920
+ // Step 3: Tagging (simulated zero-shot classification)
921
+ const tags = classifyText(normalized, fileType);
922
+
923
+ return {
924
+ original: text,
925
+ corrupted: corrupted,
926
+ target: normalized,
927
+ tags: tags,
928
+ source: source,
929
+ id: generateId()
930
+ };
931
+ }
932
+
933
+ function normalizeText(text) {
934
+ // Simulated text normalization
935
+ const commonTypos = {
936
+ 'teh': 'the',
937
+ 'adn': 'and',
938
+ 'th e': 'the',
939
+ 't he': 'the',
940
+ 'wiht': 'with',
941
+ 'recieve': 'receive',
942
+ 'seperate': 'separate',
943
+ 'occured': 'occurred',
944
+ 'definately': 'definitely',
945
+ 'goverment': 'government'
946
+ };
947
+
948
+ let result = text;
949
+
950
+ // Apply common typo fixes
951
+ Object.keys(commonTypos).forEach(typo => {
952
+ const regex = new RegExp(`\\b${typo}\\b`, 'gi');
953
+ result = result.replace(regex, commonTypos[typo]);
954
+ });
955
+
956
+ // Fix double spaces
957
+ result = result.replace(/\s+/g, ' ');
958
+
959
+ // Fix missing spaces after punctuation
960
+ result = result.replace(/([.,!?])([A-Za-z])/g, '$1 $2');
961
+
962
+ return result;
963
+ }
964
+
965
+ function corruptText(text) {
966
+ // Get corruption levels from sliders
967
+ const adjacentLevel = parseInt(sliders.adjacent.value) / 100;
968
+ const caseLevel = parseInt(sliders.case.value) / 100;
969
+ const symbolLevel = parseInt(sliders.symbol.value) / 100;
970
+ const ocrLevel = parseInt(sliders.ocr.value) / 100;
971
+
972
+ let result = text;
973
+
974
+ // Apply keyboard adjacent errors
975
+ if (adjacentLevel > 0) {
976
+ result = injectAdjacentErrors(result, adjacentLevel);
977
+ }
978
+
979
+ // Apply case corruption
980
+ if (caseLevel > 0) {
981
+ result = injectCaseErrors(result, caseLevel);
982
+ }
983
+
984
+ // Apply symbol insertion
985
+ if (symbolLevel > 0) {
986
+ result = injectSymbolErrors(result, symbolLevel);
987
+ }
988
+
989
+ // Apply OCR line noise simulation
990
+ if (ocrLevel > 0) {
991
+ result = injectOCRNoise(result, ocrLevel);
992
+ }
993
+
994
+ return result;
995
+ }
996
+
997
+ function injectAdjacentErrors(text, level) {
998
+ // Keyboard adjacency map
999
+ const adjacencyMap = {
1000
+ 'q': 'w', 'w': 'qe', 'e': 'wr', 'r': 'et', 't': 'ry', 'y': 'tu', 'u': 'yi', 'i': 'uo', 'o': 'ip', 'p': 'o[',
1001
+ 'a': 's', 's': 'ad', 'd': 'sf', 'f': 'dg', 'g': 'fh', 'h': 'gj', 'j': 'hk', 'k': 'jl', 'l': 'k;',
1002
+ 'z': 'x', 'x': 'zc', 'c': 'xv', 'v': 'cb', 'b': 'vn', 'n': 'bm', 'm': 'n,'
1003
+ };
1004
+
1005
+ return text.split('').map(char => {
1006
+ if (Math.random() < level && char.toLowerCase() in adjacencyMap) {
1007
+ const adjacent = adjacencyMap[char.toLowerCase()];
1008
+ return adjacent[Math.floor(Math.random() * adjacent.length)];
1009
+ }
1010
+ return char;
1011
+ }).join('');
1012
+ }
1013
+
1014
+ function injectCaseErrors(text, level) {
1015
+ return text.split('').map(char => {
1016
+ if (Math.random() < level && /[a-zA-Z]/.test(char)) {
1017
+ return Math.random() > 0.5 ? char.toUpperCase() : char.toLowerCase();
1018
+ }
1019
+ return char;
1020
+ }).join('');
1021
+ }
1022
+
1023
+ function injectSymbolErrors(text, level) {
1024
+ const symbols = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '+', '=', '[', ']', '{', '}'];
1025
+
1026
+ return text.split('').map(char => {
1027
+ if (Math.random() < level && /[a-zA-Z]/.test(char)) {
1028
+ // Sometimes replace, sometimes insert before/after
1029
+ if (Math.random() > 0.7) {
1030
+ return symbols[Math.floor(Math.random() * symbols.length)];
1031
+ } else if (Math.random() > 0.5) {
1032
+ return char + symbols[Math.floor(Math.random() * symbols.length)];
1033
+ } else {
1034
+ return symbols[Math.floor(Math.random() * symbols.length)] + char;
1035
+ }
1036
+ }
1037
+ return char;
1038
+ }).join('');
1039
+ }
1040
+
1041
+ function injectOCRNoise(text, level) {
1042
+ // Simulate vertical line noise from old scanners
1043
+ const noiseChars = ['|', 'l', 'I', '1', '!', ':', ';'];
1044
+
1045
+ return text.split('').map(char => {
1046
+ if (Math.random() < level) {
1047
+ // Add noise character after original
1048
+ return char + noiseChars[Math.floor(Math.random() * noiseChars.length)];
1049
+ }
1050
+ return char;
1051
+ }).join('');
1052
+ }
1053
+
1054
+ function classifyText(text, fileType) {
1055
+ // Content-based classification
1056
+ const tags = [fileType.toUpperCase(), 'User Content'];
1057
+
1058
+ // Add content-based tags
1059
+ const words = text.toLowerCase().split(/\s+/);
1060
+
1061
+ // Check for various content types
1062
+ const checks = [
1063
+ { terms: ['patient', 'clinical', 'diagnosis', 'treatment', 'hospital', 'doctor', 'medical', 'health'], tag: 'Medical' },
1064
+ { terms: ['agreement', 'contract', 'party', 'legal', 'law', 'clause', 'jurisdiction'], tag: 'Legal' },
1065
+ { terms: ['algorithm', 'function', 'variable', 'code', 'software', 'system', 'data', 'api'], tag: 'Technical' },
1066
+ { terms: ['email', 'dear', 'sincerely', 'regards', 'hello', 'hi'], tag: 'Correspondence' },
1067
+ { terms: ['chapter', 'section', 'paragraph', 'article', 'page'], tag: 'Document' }
1068
+ ];
1069
+
1070
+ checks.forEach(check => {
1071
+ if (check.terms.some(term => text.toLowerCase().includes(term))) {
1072
+ tags.push(check.tag);
1073
+ }
1074
+ });
1075
+
1076
+ // Add length-based tags
1077
+ if (text.length < 50) {
1078
+ tags.push('Short Text');
1079
+ } else if (text.length > 200) {
1080
+ tags.push('Long Text');
1081
+ }
1082
+
1083
+ return Array.from(new Set(tags)); // Remove duplicates
1084
+ }
1085
+
1086
+ function updatePreview(example) {
1087
+ preview.original.textContent = example.original.length > 200 ?
1088
+ example.original.substring(0, 200) + '...' : example.original;
1089
+
1090
+ preview.corrupted.textContent = example.corrupted.length > 200 ?
1091
+ example.corrupted.substring(0, 200) + '...' : example.corrupted;
1092
+
1093
+ preview.target.textContent = example.target.length > 200 ?
1094
+ example.target.substring(0, 200) + '...' : example.target;
1095
+ }
1096
+
1097
+ function updateProgress(percent) {
1098
+ state.progress = percent;
1099
+ progressFill.style.width = `${percent}%`;
1100
+ progressPercent.textContent = `${percent}%`;
1101
+ }
1102
+
1103
+ // Export Function - Fixed for Hugging Face compatibility
1104
+ async function exportDataset() {
1105
+ if (state.dataset.length === 0) return;
1106
+
1107
+ exportBtn.innerHTML = '<span class="loading-spinner"></span> Creating ZIP...';
1108
+ exportBtn.disabled = true;
1109
+
1110
+ try {
1111
+ // Create dataset in Hugging Face format
1112
+ const trainData = [];
1113
+ const testData = [];
1114
+
1115
+ // Split dataset into train/test (80/20)
1116
+ const splitIndex = Math.floor(state.dataset.length * 0.8);
1117
+
1118
+ // Prepare training data
1119
+ for (let i = 0; i < splitIndex; i++) {
1120
+ trainData.push({
1121
+ original: state.dataset[i].original,
1122
+ corrupted: state.dataset[i].corrupted,
1123
+ target: state.dataset[i].target,
1124
+ tags: state.dataset[i].tags,
1125
+ source: state.dataset[i].source
1126
+ });
1127
+ }
1128
+
1129
+ // Prepare test data
1130
+ for (let i = splitIndex; i < state.dataset.length; i++) {
1131
+ testData.push({
1132
+ original: state.dataset[i].original,
1133
+ corrupted: state.dataset[i].corrupted,
1134
+ target: state.dataset[i].target,
1135
+ tags: state.dataset[i].tags,
1136
+ source: state.dataset[i].source
1137
+ });
1138
+ }
1139
+
1140
+ // Create dataset info in correct Hugging Face format
1141
+ const datasetInfos = {
1142
+ "default": {
1143
+ description: "Synthetic error correction dataset generated by TYPE/RIGHTER",
1144
+ citation: "Generated locally in browser using TYPE/RIGHTER PWA",
1145
+ homepage: "",
1146
+ license: "cc-by-4.0",
1147
+ features: {
1148
+ original: {
1149
+ dtype: "string",
1150
+ id: null,
1151
+ _type: "Value"
1152
+ },
1153
+ corrupted: {
1154
+ dtype: "string",
1155
+ id: null,
1156
+ _type: "Value"
1157
+ },
1158
+ target: {
1159
+ dtype: "string",
1160
+ id: null,
1161
+ _type: "Value"
1162
+ },
1163
+ tags: {
1164
+ feature: {
1165
+ dtype: "string",
1166
+ id: null,
1167
+ _type: "Value"
1168
+ },
1169
+ length: -1,
1170
+ id: null,
1171
+ _type: "Sequence"
1172
+ },
1173
+ source: {
1174
+ dtype: "string",
1175
+ id: null,
1176
+ _type: "Value"
1177
+ }
1178
+ },
1179
+ post_processed: {
1180
+ cleaned: true,
1181
+ corrupted: true,
1182
+ error_types: {
1183
+ keyboard_adjacent: parseInt(sliders.adjacent.value),
1184
+ case_corruption: parseInt(sliders.case.value),
1185
+ symbol_insertion: parseInt(sliders.symbol.value),
1186
+ ocr_noise: parseInt(sliders.ocr.value)
1187
+ }
1188
+ },
1189
+ supervised_keys: {
1190
+ input: "corrupted",
1191
+ output: "target"
1192
+ },
1193
+ builder_name: "typerighter",
1194
+ config_name: "default",
1195
+ dataset_name: "typerighter_dataset",
1196
+ dataset_size: state.dataset.length * 100,
1197
+ splits: {
1198
+ train: {
1199
+ name: "train",
1200
+ num_bytes: trainData.length * 100,
1201
+ num_examples: trainData.length
1202
+ },
1203
+ test: {
1204
+ name: "test",
1205
+ num_bytes: testData.length * 100,
1206
+ num_examples: testData.length
1207
+ }
1208
+ },
1209
+ version: {
1210
+ version_str: "1.0.0",
1211
+ major: 1,
1212
+ minor: 0,
1213
+ patch: 0
1214
+ },
1215
+ download_checksums: {},
1216
+ download_size: state.dataset.length * 100,
1217
+ size_in_bytes: state.dataset.length * 200
1218
+ }
1219
+ };
1220
+
1221
+ // Create README
1222
+ const readme = `# Dataset: TYPE/RIGHTER Synthetic Error Correction
1223
+
1224
+ ## Dataset Summary
1225
+ This dataset was generated locally using the TYPE/RIGHTER offline-first PWA. It contains synthetic error-correction pairs for training text correction models.
1226
+
1227
+ ## Supported Tasks and Leaderboards
1228
+ - Text error correction
1229
+ - OCR post-processing
1230
+ - Typographical error correction
1231
+
1232
+ ## Languages
1233
+ English
1234
+
1235
+ ## Dataset Structure
1236
+
1237
+ ### Data Instances
1238
+ Each instance contains:
1239
+ - \`original\`: The text as it appeared in the uploaded file
1240
+ - \`corrupted\`: The procedurally "damaged" version for error detection training
1241
+ - \`target\`: The cleaned, normalized version for error correction training
1242
+ - \`tags\`: Content-based classification tags
1243
+ - \`source\`: Original file name
1244
+
1245
+ ### Data Fields
1246
+ - \`original\`: string - Original text
1247
+ - \`corrupted\`: string - Text with injected errors
1248
+ - \`target\`: string - Cleaned target text
1249
+ - \`tags\`: Sequence[string] - Content classification tags
1250
+ - \`source\`: string - Source file name
1251
+
1252
+ ### Data Splits
1253
+ - Train: ${trainData.length} examples
1254
+ - Test: ${testData.length} examples
1255
+
1256
+ ## Dataset Creation
1257
+
1258
+ ### Curation Rationale
1259
+ This dataset was created to provide synthetic data for training error correction models from user-provided documents.
1260
+
1261
+ ### Source Data
1262
+ The data was generated from user-uploaded documents in .txt, .csv, .md, or .jsonl formats.
1263
+
1264
+ ### Annotations
1265
+ Annotations were automatically generated through:
1266
+ 1. Text normalization (simulated cleaning)
1267
+ 2. Controlled error injection based on configurable parameters
1268
+ 3. Content-based classification
1269
+
1270
+ ### Personal and Sensitive Information
1271
+ All processing occurs locally in the browser. No data was uploaded to any server.
1272
+
1273
+ ## Considerations for Using the Data
1274
+
1275
+ ### Social Impact of Dataset
1276
+ This dataset enables the creation of error correction models for various text domains.
1277
+
1278
+ ### Discussion of Biases
1279
+ The error patterns are synthetic and may not perfectly represent real-world error distributions.
1280
+
1281
+ ### Other Known Limitations
1282
+ - Synthetic errors may not capture all real-world error patterns
1283
+ - Limited to text-based errors (no formatting or layout errors)
1284
+
1285
+ ## Additional Information
1286
+
1287
+ ### Dataset Curators
1288
+ Generated by TYPE/RIGHTER PWA
1289
+
1290
+ ### Licensing Information
1291
+ Creative Commons Attribution 4.0 International (CC BY 4.0)
1292
+
1293
+ ### Citation Information
1294
+ \`\`\`
1295
+ @misc{typerighter2026,
1296
+ title={TYPE/RIGHTER Synthetic Error Correction Dataset},
1297
+ author={TYPE/RIGHTER PWA},
1298
+ year={2026},
1299
+ url={https://github.com/typerighter}
1300
+ }
1301
+ \`\`\`
1302
+
1303
+ ### Contributions
1304
+ Thanks to the user who generated this dataset using TYPE/RIGHTER.
1305
+
1306
+ ## Error Distribution
1307
+ - Keyboard Adjacent Errors: ${parseInt(sliders.adjacent.value)}%
1308
+ - Case Corruption: ${parseInt(sliders.case.value)}%
1309
+ - Symbol Insertion: ${parseInt(sliders.symbol.value)}%
1310
+ - OCR Line Noise: ${parseInt(sliders.ocr.value)}%
1311
+
1312
+ ## Generated on
1313
+ ${new Date().toISOString()}
1314
+
1315
+ ---
1316
+ *Generated by TYPE/RIGHTER • Offline-First PWA • Privacy by Design • 2026*
1317
+ `;
1318
+
1319
+ // Create ZIP file
1320
+ const zip = new JSZip();
1321
+
1322
+ // Create data directory structure
1323
+ const dataFolder = zip.folder("data");
1324
+
1325
+ // Add train and test data as JSONL in data folder
1326
+ dataFolder.file("train-00000-of-00001.jsonl", trainData.map(JSON.stringify).join('\n'));
1327
+ dataFolder.file("test-00000-of-00001.jsonl", testData.map(JSON.stringify).join('\n'));
1328
+
1329
+ // Add metadata files at root
1330
+ zip.file("dataset_infos.json", JSON.stringify(datasetInfos, null, 2));
1331
+ zip.file("README.md", readme);
1332
+
1333
+ // Generate and download ZIP
1334
+ const content = await zip.generateAsync({ type: "blob" });
1335
+ const url = URL.createObjectURL(content);
1336
+ const a = document.createElement('a');
1337
+ a.href = url;
1338
+ a.download = `typerighter_dataset_${new Date().toISOString().split('T')[0]}.zip`;
1339
+ document.body.appendChild(a);
1340
+ a.click();
1341
+ document.body.removeChild(a);
1342
+ URL.revokeObjectURL(url);
1343
+
1344
+ showToast(`Dataset exported successfully! ${state.dataset.length} examples in ZIP file.`);
1345
+
1346
+ } catch (error) {
1347
+ console.error('Export error:', error);
1348
+ showToast('Error exporting dataset. Please try again.');
1349
+ } finally {
1350
+ exportBtn.innerHTML = '<i class="fas fa-file-export"></i> Export to Hugging Face Format';
1351
+ exportBtn.disabled = false;
1352
+ }
1353
+ }
1354
+
1355
+ // Utility Functions
1356
+ function formatFileSize(bytes) {
1357
+ if (bytes === 0) return '0 Bytes';
1358
+ const k = 1024;
1359
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
1360
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
1361
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i];
1362
+ }
1363
+
1364
+ function generateId() {
1365
+ return Date.now().toString(36) + Math.random().toString(36).substring(2);
1366
+ }
1367
+
1368
+ function sleep(ms) {
1369
+ return new Promise(resolve => setTimeout(resolve, ms));
1370
+ }
1371
+
1372
+ function showToast(message) {
1373
+ toast.textContent = message;
1374
+ toast.classList.add('show');
1375
+
1376
+ setTimeout(() => {
1377
+ toast.classList.remove('show');
1378
+ }, 3000);
1379
+ }
1380
+
1381
+ // Initialize
1382
+ updateProcessButton();
1383
+
1384
+ // Make functions available globally for inline event handlers
1385
+ window.removeFile = removeFile;
1386
+ </script>
1387
+ </body>
1388
+ </html>