@gukhanmun/stdict-cdb 0.1.0-dev.0 → 0.1.0-dev.11
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/README.md +50 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@gukhanmun/stdict-cdb
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
Standard Korean Language Dictionary (표준국어대사전, 標準國語大辭典) compiled
|
|
5
|
+
into a Gukhanmun CDB binary and distributed as an npm package. Use this with
|
|
6
|
+
`@gukhanmun/wasm` or `@gukhanmun/napi` when `ko-KR` readings are needed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Installation
|
|
10
|
+
------------
|
|
11
|
+
|
|
12
|
+
~~~~ sh
|
|
13
|
+
npm install @gukhanmun/stdict-cdb
|
|
14
|
+
~~~~
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
Usage
|
|
18
|
+
-----
|
|
19
|
+
|
|
20
|
+
~~~~ ts
|
|
21
|
+
import { load } from "@gukhanmun/wasm";
|
|
22
|
+
import { stdictCdb } from "@gukhanmun/stdict-cdb";
|
|
23
|
+
|
|
24
|
+
const g = await load({ dictionaries: [await stdictCdb()] });
|
|
25
|
+
console.log(g.convert("漢字를 한글로")); // "한자를 한글로"
|
|
26
|
+
~~~~
|
|
27
|
+
|
|
28
|
+
`stdictCdb()` returns a `DictionarySource` record (a
|
|
29
|
+
`{ format: "cdb", bytes: Uint8Array }` object). `stdictCdbBytes()` returns only
|
|
30
|
+
the `Uint8Array` when you need the raw bytes. `stdictCdbUrl` is the URL of the
|
|
31
|
+
binary inside the package, useful for preloading or caching.
|
|
32
|
+
|
|
33
|
+
On Node.js the bytes are read with `node:fs/promises`. On all other runtimes
|
|
34
|
+
they are fetched with `fetch`.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Relation to `@gukhanmun/stdict-fst`
|
|
38
|
+
-----------------------------------
|
|
39
|
+
|
|
40
|
+
Both packages contain the same dictionary data in different binary formats. The
|
|
41
|
+
CDB format has O(1) lookup and a layout that is straightforward to inspect
|
|
42
|
+
manually. The FST format supports prefix streaming and is generally preferred
|
|
43
|
+
for the lattice segmenter. Either works; choose based on your performance
|
|
44
|
+
profile or integration constraints.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
License
|
|
48
|
+
-------
|
|
49
|
+
|
|
50
|
+
GPL-3.0-only.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gukhanmun/stdict-cdb",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.11",
|
|
4
4
|
"description": "Standard Korean Language Dictionary bundled as a CDB binary for @gukhanmun/wasm and @gukhanmun/napi.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@gukhanmun/types": "*"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@gukhanmun/types": "0.1.0-dev.
|
|
49
|
+
"@gukhanmun/types": "0.1.0-dev.11+a4f62826f422ceaa9ade163304ea2f756b1dfe54"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsdown && node -e \"require('node:fs').copyFileSync('stdict.cdb','dist/stdict.cdb')\""
|