@gukhanmun/opendict-fst 0.2.0-dev.0 → 0.2.0-dev.115
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 +56 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
[![npm][npm badge]][npm]
|
|
6
6
|
[![License: GPL-3.0-or-later AND CC BY-SA 2.0 KR][license badge]][GPL]
|
|
7
7
|
|
|
8
|
-
Open Korean Dictionary (우리말샘) categories
|
|
9
|
-
`@gukhanmun/wasm`
|
|
8
|
+
*Open Korean Dictionary* (우리말샘) categories compiled into FST binaries for
|
|
9
|
+
use with `@gukhanmun/wasm` or `@gukhanmun/napi`.
|
|
10
10
|
|
|
11
11
|
[JSR badge]: https://jsr.io/badges/@gukhanmun/opendict-fst
|
|
12
12
|
[JSR]: https://jsr.io/@gukhanmun/opendict-fst
|
|
@@ -16,6 +16,18 @@ Open Korean Dictionary (우리말샘) categories bundled as FST binaries for
|
|
|
16
16
|
[GPL]: https://www.gnu.org/licenses/gpl-3.0.html
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
Installation
|
|
20
|
+
------------
|
|
21
|
+
|
|
22
|
+
~~~~ bash
|
|
23
|
+
npm add @gukhanmun/opendict-fst
|
|
24
|
+
pnpm add @gukhanmun/opendict-fst
|
|
25
|
+
yarn add @gukhanmun/opendict-fst
|
|
26
|
+
bun add @gukhanmun/opendict-fst
|
|
27
|
+
deno add jsr:@gukhanmun/opendict-fst
|
|
28
|
+
~~~~
|
|
29
|
+
|
|
30
|
+
|
|
19
31
|
Usage
|
|
20
32
|
-----
|
|
21
33
|
|
|
@@ -27,18 +39,55 @@ const g = await load({
|
|
|
27
39
|
preset: "ko-kp",
|
|
28
40
|
dictionaries: [await opendictNorthKoreanFst()],
|
|
29
41
|
});
|
|
30
|
-
console.log(g.convert("歷史와 來日"));
|
|
42
|
+
console.log(g.convert("歷史와 來日")); // "력사와 래일"
|
|
31
43
|
~~~~
|
|
32
44
|
|
|
33
|
-
The package exports separate
|
|
34
|
-
categories so
|
|
45
|
+
The package exports separate helper functions for the 一般語, 北韓語, 方言,
|
|
46
|
+
and 옛말 categories, so you can select and load only the categories you need:
|
|
47
|
+
|
|
48
|
+
- `opendictGeneralFst()`
|
|
49
|
+
- `opendictNorthKoreanFst()`
|
|
50
|
+
- `opendictDialectFst()`
|
|
51
|
+
- `opendictArchaicFst()`
|
|
52
|
+
|
|
53
|
+
Each function returns a `DictionarySource` record (a `{ format: "fst", bytes: Uint8Array }`
|
|
54
|
+
object).
|
|
55
|
+
|
|
56
|
+
### Raw bytes and URLs
|
|
57
|
+
|
|
58
|
+
If you only need raw `Uint8Array` bytes, use the `*Bytes()` helpers:
|
|
59
|
+
|
|
60
|
+
- `opendictGeneralFstBytes()`
|
|
61
|
+
- `opendictNorthKoreanFstBytes()`
|
|
62
|
+
- `opendictDialectFstBytes()`
|
|
63
|
+
- `opendictArchaicFstBytes()`
|
|
64
|
+
|
|
65
|
+
To get the package URL of an FST binary, use the `*Url` constants:
|
|
66
|
+
|
|
67
|
+
- `opendictGeneralFstUrl`
|
|
68
|
+
- `opendictNorthKoreanFstUrl`
|
|
69
|
+
- `opendictDialectFstUrl`
|
|
70
|
+
- `opendictArchaicFstUrl`
|
|
71
|
+
|
|
72
|
+
The `*Bytes()` helpers read the binary from disk using `node:fs/promises` if loaded from
|
|
73
|
+
a `file:` URL (default for npm installations), and fall back to `fetch` for other protocols.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
Relation to `@gukhanmun/opendict-cdb`
|
|
77
|
+
-------------------------------------
|
|
78
|
+
|
|
79
|
+
Both packages contain the same dictionary data in different binary formats. The
|
|
80
|
+
FST format supports prefix streaming and is the better choice for
|
|
81
|
+
`@gukhanmun/wasm` workloads with the lattice segmenter. The CDB format has O(1)
|
|
82
|
+
lookup and a simpler layout. Either works; choose based on your performance
|
|
83
|
+
profile or integration constraints.
|
|
35
84
|
|
|
36
85
|
|
|
37
86
|
Data attribution
|
|
38
87
|
----------------
|
|
39
88
|
|
|
40
|
-
The bundled dictionary data is
|
|
41
|
-
Language's Open Korean Dictionary (우리말샘) JSON dump dated 2026-05-03. See
|
|
89
|
+
The bundled dictionary data is derived from the National Institute of Korean
|
|
90
|
+
Language's *Open Korean Dictionary* (우리말샘) JSON dump dated 2026-05-03. See
|
|
42
91
|
*ATTRIBUTION.md* for source and license details.
|
|
43
92
|
|
|
44
93
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gukhanmun/opendict-fst",
|
|
3
|
-
"version": "0.2.0-dev.
|
|
3
|
+
"version": "0.2.0-dev.115",
|
|
4
4
|
"description": "Open Korean Dictionary categories bundled as FST binaries for @gukhanmun/wasm and @gukhanmun/napi.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@gukhanmun/types": "*"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@gukhanmun/types": "0.2.0-dev.
|
|
55
|
+
"@gukhanmun/types": "0.2.0-dev.115+7e9dc967239aee2ac70b52d2149d745fa2a18545"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"prebuild": "mise run -C ../.. opendict-fst-data",
|