@qrcommunication/gigapdf-lib 0.53.0 → 0.54.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.
- package/CHANGELOG.md +29 -0
- package/dist/index.cjs +17 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,35 @@ All notable changes to `@qrcommunication/gigapdf-lib` are documented here.
|
|
|
4
4
|
The format follows [Keep a Changelog](https://keepachangelog.com/) and the
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.54.0] - 2026-06-20
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **OCR front-end restoration (no API change — automatic in `ocr`).** Before recognition the
|
|
12
|
+
engine now (1) **auto-crops a photographed page** — detects the document's four corners on a
|
|
13
|
+
contrasting background and perspective-warps it head-on (8×8 DLT homography + bilinear warp,
|
|
14
|
+
pure `std`), and (2) **flattens uneven illumination** (flat-field divide by a local background:
|
|
15
|
+
shadows/glare → uniform page). Both are **gated to no-op on already-clean scans**, so they only
|
|
16
|
+
help phone photos / creased paper. Rescues real-world captures with zero caller changes.
|
|
17
|
+
- **Chinese OCR — new `cjk` script.** `loadBundledOcrModel("cjk")` / `ALL_OCR_SCRIPTS` now load
|
|
18
|
+
`ocr_cjk.gpocr` (data-driven **2401-class** charset, 32/64/128 backbone) — **CER 0.206 on CASIA
|
|
19
|
+
handwritten Chinese**, the first CJK model shipped.
|
|
20
|
+
- **Japanese & Korean scripts declared** (`"japanese"`, `"korean"` → `ocr_jpn.gpocr` /
|
|
21
|
+
`ocr_kor.gpocr`). Their charsets include kana+kanji / Hangul **plus full ASCII** (mixed
|
|
22
|
+
alphanumerics). Models train upstream and land in a follow-up release — `loadBundledOcrModel`
|
|
23
|
+
now **returns `false` for an absent blob instead of throwing**, so `ALL_OCR_SCRIPTS` stays safe.
|
|
24
|
+
- **Handwriting & degraded variants** bundled: `ocr_alpha_hw.gpocr` (real-cursive, **beats
|
|
25
|
+
Tesseract on IAM — CER 0.309 vs 0.353**) and `ocr_alpha_photo.gpocr` (degradation-augmented,
|
|
26
|
+
beats the plain HW model on degraded input). Host-load via `loadOcrModel`.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- **Non-Latin models rebuilt at the 32/64/128 backbone** — Devanagari, Bengali, Tamil and
|
|
31
|
+
Arabic validation CER roughly **halved** (deva 0.039, beng 0.042, taml 0.011, arabic 0.030);
|
|
32
|
+
the bundled `.gpocr` blobs are updated. Capacity, not data, was the bound.
|
|
33
|
+
- **Faster real-dataset training downloads** (dev tooling): `hw_datasets.py` fetches line images
|
|
34
|
+
**concurrently** (`GIGA_OCR_DL_WORKERS`), ~16× quicker — pairs with an HF Pro token.
|
|
35
|
+
|
|
7
36
|
## [0.52.5] - 2026-06-19
|
|
8
37
|
|
|
9
38
|
### Added
|
package/dist/index.cjs
CHANGED
|
@@ -33,14 +33,20 @@ var OCR_MODEL_FILES = {
|
|
|
33
33
|
arabic: "ocr_arabic.gpocr",
|
|
34
34
|
devanagari: "ocr_deva.gpocr",
|
|
35
35
|
bengali: "ocr_beng.gpocr",
|
|
36
|
-
tamil: "ocr_taml.gpocr"
|
|
36
|
+
tamil: "ocr_taml.gpocr",
|
|
37
|
+
cjk: "ocr_cjk.gpocr",
|
|
38
|
+
japanese: "ocr_jpn.gpocr",
|
|
39
|
+
korean: "ocr_kor.gpocr"
|
|
37
40
|
};
|
|
38
41
|
var ALL_OCR_SCRIPTS = [
|
|
39
42
|
"alpha",
|
|
40
43
|
"arabic",
|
|
41
44
|
"devanagari",
|
|
42
45
|
"bengali",
|
|
43
|
-
"tamil"
|
|
46
|
+
"tamil",
|
|
47
|
+
"cjk",
|
|
48
|
+
"japanese",
|
|
49
|
+
"korean"
|
|
44
50
|
];
|
|
45
51
|
var GigaPdfEngine = class _GigaPdfEngine {
|
|
46
52
|
constructor(ex) {
|
|
@@ -411,10 +417,17 @@ var GigaPdfEngine = class _GigaPdfEngine {
|
|
|
411
417
|
* the engine via {@link loadOcrModel}. **Node hosts only** — it reads the blob
|
|
412
418
|
* from disk the same way {@link loadDefault} resolves the wasm. Returns `true`
|
|
413
419
|
* on success. Use this to recognize non-Latin scripts (Arabic, Devanagari,
|
|
414
|
-
* Bengali, Tamil) or to upgrade
|
|
420
|
+
* Bengali, Tamil, Chinese `cjk`, Japanese, Korean) or to upgrade
|
|
421
|
+
* Latin/Cyrillic/Greek to the CRNN (`alpha`). Returns `false` (rather than
|
|
422
|
+
* throwing) when the blob isn't bundled in this release — e.g. a script still
|
|
423
|
+
* training upstream — so loading a set stays resilient.
|
|
415
424
|
*/
|
|
416
425
|
async loadBundledOcrModel(script) {
|
|
417
|
-
|
|
426
|
+
try {
|
|
427
|
+
return this.loadOcrModel(await (0, import_node_fs.readModelFile)(OCR_MODEL_FILES[script]));
|
|
428
|
+
} catch {
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
418
431
|
}
|
|
419
432
|
/**
|
|
420
433
|
* Load several bundled OCR models (idempotent per call). Returns the scripts
|