thai-ocr-web 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,528 @@
1
+ !
2
+ "
3
+ #
4
+ $
5
+ %
6
+ &
7
+ '
8
+ (
9
+ )
10
+ *
11
+ +
12
+ ,
13
+ -
14
+ .
15
+ /
16
+ 0
17
+ 1
18
+ 2
19
+ 3
20
+ 4
21
+ 5
22
+ 6
23
+ 7
24
+ 8
25
+ 9
26
+ :
27
+ ;
28
+ <
29
+ =
30
+ >
31
+ ?
32
+ A
33
+ B
34
+ C
35
+ D
36
+ E
37
+ F
38
+ G
39
+ H
40
+ I
41
+ J
42
+ K
43
+ L
44
+ M
45
+ N
46
+ O
47
+ P
48
+ Q
49
+ R
50
+ S
51
+ T
52
+ U
53
+ V
54
+ W
55
+ X
56
+ Y
57
+ Z
58
+ [
59
+ ]
60
+ _
61
+ `
62
+ a
63
+ b
64
+ c
65
+ d
66
+ e
67
+ f
68
+ g
69
+ h
70
+ i
71
+ j
72
+ k
73
+ l
74
+ m
75
+ n
76
+ o
77
+ p
78
+ q
79
+ r
80
+ s
81
+ t
82
+ u
83
+ v
84
+ w
85
+ x
86
+ y
87
+ z
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
+ ∶
145
+ ∷
146
+ ∼
147
+ ®
148
+ ℉
149
+ Ω
150
+ ℧
151
+ Å
152
+ ⌀
153
+ ℏ
154
+ ⅀
155
+ ⍺
156
+ ⍵
157
+ ¢
158
+ €
159
+ £
160
+ ¥
161
+ ₿
162
+ Ⅰ
163
+ Ⅱ
164
+ Ⅲ
165
+ Ⅳ
166
+ Ⅴ
167
+ Ⅵ
168
+ Ⅶ
169
+ Ⅷ
170
+ Ⅸ
171
+ Ⅹ
172
+ Ⅺ
173
+ Ⅻ
174
+ ⅰ
175
+ ⅱ
176
+ ⅲ
177
+ ⅳ
178
+ ⅴ
179
+ ⅵ
180
+ ⅶ
181
+ ⅷ
182
+ ⅸ
183
+ ⅹ
184
+ ⅺ
185
+ ⅻ
186
+ ➀
187
+ ➁
188
+ ➂
189
+ ➃
190
+ ➄
191
+ ➅
192
+ ➆
193
+ ➇
194
+ ➈
195
+ ➉
196
+ ➊
197
+ ➋
198
+ ➌
199
+ ➍
200
+ ➎
201
+ ➏
202
+ ➐
203
+ ➑
204
+ ➒
205
+ ➓
206
+ ❶
207
+ ❷
208
+ ❸
209
+ ❹
210
+ ❺
211
+ ❻
212
+ ❼
213
+ ❽
214
+ ❾
215
+ ❿
216
+ ①
217
+ ②
218
+ ③
219
+ ④
220
+ ⑤
221
+ ⑥
222
+ ⑦
223
+ ⑧
224
+ ⑨
225
+ ⑩
226
+ ●
227
+ ▶
228
+ 𝑢
229
+ ︽
230
+ –
231
+ ﹥
232
+ 𝜓
233
+ •
234
+ ∋
235
+ ƒ
236
+ ०
237
+ ⬆
238
+ Ạ
239
+ ◀
240
+
241
+ ▫
242
+ ︾
243
+ À
244
+ Á
245
+ Â
246
+ Ã
247
+ Ä
248
+ Å
249
+ Æ
250
+ Ç
251
+ È
252
+ É
253
+ Ê
254
+ Ë
255
+ Ì
256
+ Í
257
+ Î
258
+ Ï
259
+ Ð
260
+ Ñ
261
+ Ò
262
+ Ó
263
+ Ô
264
+ Õ
265
+ Ö
266
+ Ø
267
+ Ù
268
+ Ú
269
+ Û
270
+ Ü
271
+ Ý
272
+ Þ
273
+ à
274
+ á
275
+ â
276
+ ã
277
+ ä
278
+ å
279
+ æ
280
+ ç
281
+ è
282
+ é
283
+ ê
284
+ ë
285
+ ì
286
+ í
287
+ î
288
+ ï
289
+ ð
290
+ ñ
291
+ ò
292
+ ó
293
+ ô
294
+ õ
295
+ ö
296
+ ø
297
+ ù
298
+ ú
299
+ û
300
+ ü
301
+ ý
302
+ þ
303
+ ÿ
304
+ ¡
305
+ ¤
306
+ ¦
307
+ §
308
+ ¨
309
+ ª
310
+ «
311
+ ¬
312
+ ¯
313
+ °
314
+ ²
315
+ ³
316
+ ´
317
+ µ
318
+
319
+ ¸
320
+ ¹
321
+ º
322
+ »
323
+ ¼
324
+ ½
325
+ ¾
326
+ ¿
327
+ ×
328
+ ‐
329
+ ‑
330
+ ‒
331
+ —
332
+ ―
333
+ ‖
334
+ ‗
335
+ ‘
336
+ ’
337
+ ‚
338
+ ‛
339
+ “
340
+ ”
341
+ „
342
+ ‟
343
+ †
344
+ ‡
345
+ ‣
346
+ ․
347
+ …
348
+ ‧
349
+ ‰
350
+ ‴
351
+ ‵
352
+ ‶
353
+ ‷
354
+ ‸
355
+ ‹
356
+ ›
357
+ ※
358
+ ‼
359
+ ‽
360
+ ‾
361
+ ₤
362
+ ₡
363
+ ₹
364
+ −
365
+ ∖
366
+ ∗
367
+ ≈
368
+ ≠
369
+ ≡
370
+ ≤
371
+ ≥
372
+ ⊂
373
+ ⊃
374
+ ↑
375
+ →
376
+ ↓
377
+ ↕
378
+ ™
379
+ Ω
380
+ ℮
381
+ ∆
382
+ ✓
383
+ ✗
384
+ ✘
385
+ ▪
386
+ ◼
387
+ ✔
388
+ ✕
389
+ ☑
390
+ ☒
391
+ №
392
+ ₽
393
+ ₴
394
+ Α
395
+ α
396
+ Β
397
+ β
398
+ Γ
399
+ γ
400
+ Δ
401
+ δ
402
+ Ε
403
+ ε
404
+ Ζ
405
+ ζ
406
+ Η
407
+ η
408
+ Θ
409
+ θ
410
+ Ι
411
+ ι
412
+ Κ
413
+ κ
414
+ Λ
415
+ λ
416
+ Μ
417
+ μ
418
+ Ν
419
+ ν
420
+ Ξ
421
+ ξ
422
+ Ο
423
+ ο
424
+ Π
425
+ π
426
+ Ρ
427
+ ρ
428
+ Σ
429
+ σ
430
+ ς
431
+ Τ
432
+ τ
433
+ Υ
434
+ υ
435
+ Φ
436
+ φ
437
+ Χ
438
+ χ
439
+ Ψ
440
+ ψ
441
+ ω
442
+ ก
443
+ ข
444
+ ค
445
+ ฅ
446
+ ฆ
447
+ ง
448
+ จ
449
+ ฉ
450
+ ช
451
+ ซ
452
+ ฌ
453
+ ญ
454
+ ฎ
455
+ ฏ
456
+ ฐ
457
+ ฑ
458
+ ฒ
459
+ ณ
460
+ ด
461
+ ต
462
+ ถ
463
+ ท
464
+ ธ
465
+ น
466
+ บ
467
+ ป
468
+ ผ
469
+ ฝ
470
+ พ
471
+ ฟ
472
+ ภ
473
+ ม
474
+ ย
475
+ ร
476
+ ฤ
477
+ ล
478
+ ฦ
479
+ ว
480
+ ศ
481
+ ษ
482
+ ส
483
+ ห
484
+ ฬ
485
+ อ
486
+ ฮ
487
+ ฯ
488
+ ะ
489
+ ั
490
+ า
491
+ ำ
492
+ ิ
493
+ ี
494
+ ึ
495
+ ื
496
+ ุ
497
+ ู
498
+ ฺ
499
+ ฿
500
+ เ
501
+ แ
502
+ โ
503
+ ใ
504
+ ไ
505
+ ๅ
506
+ ๆ
507
+ ็
508
+ ่
509
+ ้
510
+ ๊
511
+ ๋
512
+ ์
513
+ ํ
514
+ ๐
515
+ ๑
516
+ ๒
517
+ ๓
518
+ ๔
519
+ ๕
520
+ ๖
521
+ ๗
522
+ ๘
523
+ ๙
524
+ ๚
525
+ ฃ
526
+ ๎
527
+ ๏
528
+ ๛
package/package.json CHANGED
@@ -1,6 +1,86 @@
1
1
  {
2
2
  "name": "thai-ocr-web",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Thai + English printed-text OCR in the browser (WebGPU / WASM), images and PDFs: a JavaScript port of OpenThai 2.1 OCR Text with output identical to the reference runtime",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "author": "Awirut",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/RiwRiwara/thai-ocr-web.git"
11
+ },
12
+ "homepage": "https://thai-ocr-web.pages.dev/",
13
+ "bugs": {
14
+ "url": "https://github.com/RiwRiwara/thai-ocr-web/issues"
15
+ },
16
+ "keywords": [
17
+ "ocr",
18
+ "thai",
19
+ "thai-ocr",
20
+ "ocr-thai",
21
+ "browser",
22
+ "wasm",
23
+ "webgpu",
24
+ "onnxruntime-web",
25
+ "paddleocr",
26
+ "openthai",
27
+ "text-recognition",
28
+ "pdf",
29
+ "pdfjs"
30
+ ],
31
+ "exports": {
32
+ ".": {
33
+ "types": "./src/index.d.ts",
34
+ "default": "./src/index.js"
35
+ },
36
+ "./browser": {
37
+ "types": "./src/browser.d.ts",
38
+ "default": "./src/browser.js"
39
+ },
40
+ "./pdf": {
41
+ "types": "./src/pdf.d.ts",
42
+ "default": "./src/pdf.js"
43
+ },
44
+ "./models/*": "./models/*",
45
+ "./vendor/opencv/opencv-ocr.mjs": "./vendor/opencv/opencv-ocr.mjs",
46
+ "./package.json": "./package.json"
47
+ },
48
+ "types": "./src/index.d.ts",
49
+ "files": [
50
+ "src",
51
+ "vendor/opencv/opencv-ocr.mjs",
52
+ "models",
53
+ "NOTICE",
54
+ "CHANGELOG.md"
55
+ ],
56
+ "sideEffects": false,
57
+ "engines": {
58
+ "node": ">=20"
59
+ },
60
+ "scripts": {
61
+ "test": "node test/parity.mjs && node test/pdf.mjs",
62
+ "dev": "node scripts/prepare-demo.mjs && vite",
63
+ "build": "node scripts/prepare-demo.mjs && vite build && node scripts/split-large-assets.mjs",
64
+ "preview": "vite preview",
65
+ "build:opencv": "bash vendor/opencv/build/build.sh"
66
+ },
67
+ "dependencies": {
68
+ "clipper-lib": "^6.4.2"
69
+ },
70
+ "peerDependencies": {
71
+ "onnxruntime-web": "^1.31.1",
72
+ "pdfjs-dist": ">=5"
73
+ },
74
+ "peerDependenciesMeta": {
75
+ "pdfjs-dist": {
76
+ "optional": true
77
+ }
78
+ },
79
+ "devDependencies": {
80
+ "coi-serviceworker": "^0.1.7",
81
+ "onnxruntime-web": "^1.31.1",
82
+ "pdfjs-dist": "^6.5.438",
83
+ "pngjs": "^7.0.0",
84
+ "vite": "^8.3.8"
85
+ }
86
+ }
@@ -0,0 +1,27 @@
1
+ import type { ConfigOverrides, LineOCR } from "./index.js";
2
+ export * from "./index.js";
3
+
4
+ export declare const MODEL_FILES: string[];
5
+ /** True on iPhone / iPad, where createThaiOCR defaults to one WASM thread. */
6
+ export declare function isAppleMobile(): boolean;
7
+
8
+ export interface BrowserOptions {
9
+ /** URL of the folder that holds the model files. Default "models/". */
10
+ modelBaseUrl?: string;
11
+ /** "webgpu" falls back to WASM when the device has no WebGPU. Default "wasm". */
12
+ backend?: "webgpu" | "wasm";
13
+ /** WASM threads, used only when the page is cross-origin isolated. Default min(4, cores). */
14
+ threads?: number;
15
+ /** Cache API bucket for the model files; false to skip caching. */
16
+ cacheName?: string | false;
17
+ overrides?: ConfigOverrides;
18
+ /** JSON listing parts of onnxruntime-web's .wasm, for hosts with a per-file size limit (see scripts/split-large-assets.mjs). */
19
+ wasmManifestUrl?: string;
20
+ /** Cap on onnxruntime-web's WASM memory (MB). Default 512 on iPhone / iPad, where the 4 GB default fails. */
21
+ maxMemoryMB?: number;
22
+ }
23
+
24
+ /** Lower the maximum of shared WebAssembly.Memory created from now on (see maxMemoryMB). */
25
+ export declare function capWasmMemory(maxMB: number): void;
26
+
27
+ export declare function createThaiOCR(options?: BrowserOptions): Promise<LineOCR & { backend: "webgpu" | "wasm" }>;