@gukhanmun/opendict-cdb 0.4.0-dev.236 → 0.4.0-dev.248
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/dist/general.cdb.gz +0 -0
- package/dist/index.d.ts +19 -91
- package/dist/index.js +13 -10
- package/dist/north-korean.cdb.gz +0 -0
- package/package.json +2 -2
package/dist/general.cdb.gz
CHANGED
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -1,75 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Specifies a dictionary loaded from a binary file or URL.
|
|
5
|
-
*
|
|
6
|
-
* The `data` field accepts:
|
|
7
|
-
* - A `BufferSource` (`ArrayBuffer` or `ArrayBufferView`) — supported in all
|
|
8
|
-
* environments.
|
|
9
|
-
* - A `URL` — resolved via `fetch` in browsers; via `node:fs/promises`
|
|
10
|
-
* in Node.js, Deno 2.0+, and Bun.
|
|
11
|
-
* - A `string` — treated as a filesystem path; supported in Node.js,
|
|
12
|
-
* Deno 2.0+, and Bun only. Throws in browser environments.
|
|
13
|
-
*
|
|
14
|
-
* At runtime, a `FileDictionarySource` is distinguished from other values by
|
|
15
|
-
* the absence of an `entries` property (`"entries" in source` selects a
|
|
16
|
-
* {@link MapDictionarySource}).
|
|
17
|
-
*/
|
|
18
|
-
interface FileDictionarySource {
|
|
19
|
-
/**
|
|
20
|
-
* The binary dictionary data or a reference to where it can be loaded.
|
|
21
|
-
*
|
|
22
|
-
* Pass a `BufferSource` for data already in memory, a `URL` for a remote
|
|
23
|
-
* or local URL (resolved via `fetch` or `readFile`), or a path `string`
|
|
24
|
-
* for filesystem paths (Node.js / Deno 2.0+ / Bun only).
|
|
25
|
-
*/
|
|
26
|
-
readonly data: ArrayBuffer | ArrayBufferView | URL | string;
|
|
27
|
-
/**
|
|
28
|
-
* The on-disk format of the dictionary file.
|
|
29
|
-
*
|
|
30
|
-
* - `"fst"` — Gukhanmun FST file (`*.gukfst`); preferred for small
|
|
31
|
-
* WebAssembly bundles. Supported in all runtimes.
|
|
32
|
-
* - `"cdb"` — Gukhanmun CDB-trie file (`*.gukcdb`); preferred when code
|
|
33
|
-
* auditability or trivial mmap support matters. Requires a filesystem
|
|
34
|
-
* or in-memory bytes; supported in Node-API and (with `from_bytes`) in
|
|
35
|
-
* WASM builds that include the `cdb` feature.
|
|
36
|
-
*
|
|
37
|
-
* The `"tsv"` format is reserved and never accepted. Pass entries in memory
|
|
38
|
-
* through {@link MapDictionarySource} instead of compiling a table.
|
|
39
|
-
*/
|
|
40
|
-
readonly format: "fst" | "cdb";
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* A dictionary built from entries computed at runtime, such as per-document
|
|
44
|
-
* reading overrides.
|
|
45
|
-
*
|
|
46
|
-
* Use this instead of compiling a TSV file with `gukhanmun-mkdict` when the
|
|
47
|
-
* entries do not exist on disk, for example in a browser, an edge runtime, or a
|
|
48
|
-
* site generator that derives entries per document.
|
|
49
|
-
*
|
|
50
|
-
* A source is distinguished from a {@link FileDictionarySource} by the presence
|
|
51
|
-
* of an `entries` property.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```ts
|
|
55
|
-
* import { stdictFst } from "@gukhanmun/stdict-fst";
|
|
56
|
-
* const g = await load({
|
|
57
|
-
* dictionaries: [
|
|
58
|
-
* {
|
|
59
|
-
* entries: [
|
|
60
|
-
* { hanja: "高橋", reading: "다카하시" },
|
|
61
|
-
* { hanja: "東京", reading: "도쿄", preference: 10 },
|
|
62
|
-
* { hanja: "年代", reading: "연대", suffixReading: "년대" },
|
|
63
|
-
* ],
|
|
64
|
-
* },
|
|
65
|
-
* await stdictFst(),
|
|
66
|
-
* ],
|
|
67
|
-
* });
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region index.d.ts
|
|
72
|
-
|
|
1
|
+
import { FileDictionarySource, FileDictionarySource as FileDictionarySource$1, SourceRole } from "@gukhanmun/types";
|
|
73
2
|
/**
|
|
74
3
|
* URL of the bundled Open Korean Dictionary 一般語 CDB binary.
|
|
75
4
|
*
|
|
@@ -77,25 +6,25 @@ interface FileDictionarySource {
|
|
|
77
6
|
* extension) to stay within registry per-file size limits;
|
|
78
7
|
* {@link opendictCdbBytes} inflates it transparently.
|
|
79
8
|
*/
|
|
80
|
-
declare const opendictGeneralCdbUrl: URL;
|
|
9
|
+
export declare const opendictGeneralCdbUrl: URL;
|
|
81
10
|
/**
|
|
82
11
|
* URL of the bundled Open Korean Dictionary 北韓語 CDB binary.
|
|
83
12
|
*
|
|
84
13
|
* Stored gzip-compressed; {@link opendictCdbBytes} inflates it transparently.
|
|
85
14
|
*/
|
|
86
|
-
declare const opendictNorthKoreanCdbUrl: URL;
|
|
15
|
+
export declare const opendictNorthKoreanCdbUrl: URL;
|
|
87
16
|
/**
|
|
88
17
|
* URL of the bundled Open Korean Dictionary 方言 CDB binary.
|
|
89
18
|
*
|
|
90
19
|
* Stored gzip-compressed; {@link opendictCdbBytes} inflates it transparently.
|
|
91
20
|
*/
|
|
92
|
-
declare const opendictDialectCdbUrl: URL;
|
|
21
|
+
export declare const opendictDialectCdbUrl: URL;
|
|
93
22
|
/**
|
|
94
23
|
* URL of the bundled Open Korean Dictionary 옛말 CDB binary.
|
|
95
24
|
*
|
|
96
25
|
* Stored gzip-compressed; {@link opendictCdbBytes} inflates it transparently.
|
|
97
26
|
*/
|
|
98
|
-
declare const opendictArchaicCdbUrl: URL;
|
|
27
|
+
export declare const opendictArchaicCdbUrl: URL;
|
|
99
28
|
/**
|
|
100
29
|
* Loads an Open Korean Dictionary CDB binary as raw bytes.
|
|
101
30
|
*
|
|
@@ -112,7 +41,7 @@ declare const opendictArchaicCdbUrl: URL;
|
|
|
112
41
|
* @param url Location of the CDB binary to read.
|
|
113
42
|
* @returns The CDB binary as a `Uint8Array`.
|
|
114
43
|
*/
|
|
115
|
-
declare function opendictCdbBytes(url: URL): Promise<Uint8Array>;
|
|
44
|
+
export declare function opendictCdbBytes(url: URL): Promise<Uint8Array>;
|
|
116
45
|
/**
|
|
117
46
|
* Loads the bundled Open Korean Dictionary 일반어 CDB binary as raw bytes.
|
|
118
47
|
*
|
|
@@ -120,7 +49,7 @@ declare function opendictCdbBytes(url: URL): Promise<Uint8Array>;
|
|
|
120
49
|
* {@link opendictGeneralCdbUrl}.
|
|
121
50
|
* @returns The CDB binary as a `Uint8Array`.
|
|
122
51
|
*/
|
|
123
|
-
declare function opendictGeneralCdbBytes(url?: URL): Promise<Uint8Array>;
|
|
52
|
+
export declare function opendictGeneralCdbBytes(url?: URL): Promise<Uint8Array>;
|
|
124
53
|
/**
|
|
125
54
|
* Loads the bundled Open Korean Dictionary 북한어 CDB binary as raw bytes.
|
|
126
55
|
*
|
|
@@ -128,7 +57,7 @@ declare function opendictGeneralCdbBytes(url?: URL): Promise<Uint8Array>;
|
|
|
128
57
|
* {@link opendictNorthKoreanCdbUrl}.
|
|
129
58
|
* @returns The CDB binary as a `Uint8Array`.
|
|
130
59
|
*/
|
|
131
|
-
declare function opendictNorthKoreanCdbBytes(url?: URL): Promise<Uint8Array>;
|
|
60
|
+
export declare function opendictNorthKoreanCdbBytes(url?: URL): Promise<Uint8Array>;
|
|
132
61
|
/**
|
|
133
62
|
* Loads the bundled Open Korean Dictionary 방언 CDB binary as raw bytes.
|
|
134
63
|
*
|
|
@@ -136,7 +65,7 @@ declare function opendictNorthKoreanCdbBytes(url?: URL): Promise<Uint8Array>;
|
|
|
136
65
|
* {@link opendictDialectCdbUrl}.
|
|
137
66
|
* @returns The CDB binary as a `Uint8Array`.
|
|
138
67
|
*/
|
|
139
|
-
declare function opendictDialectCdbBytes(url?: URL): Promise<Uint8Array>;
|
|
68
|
+
export declare function opendictDialectCdbBytes(url?: URL): Promise<Uint8Array>;
|
|
140
69
|
/**
|
|
141
70
|
* Loads the bundled Open Korean Dictionary 옛말 CDB binary as raw bytes.
|
|
142
71
|
*
|
|
@@ -144,30 +73,29 @@ declare function opendictDialectCdbBytes(url?: URL): Promise<Uint8Array>;
|
|
|
144
73
|
* {@link opendictArchaicCdbUrl}.
|
|
145
74
|
* @returns The CDB binary as a `Uint8Array`.
|
|
146
75
|
*/
|
|
147
|
-
declare function opendictArchaicCdbBytes(url?: URL): Promise<Uint8Array>;
|
|
76
|
+
export declare function opendictArchaicCdbBytes(url?: URL): Promise<Uint8Array>;
|
|
148
77
|
/**
|
|
149
78
|
* Loads the bundled Open Korean Dictionary 일반어 dictionary.
|
|
150
79
|
*
|
|
151
|
-
* @returns A `FileDictionarySource` with `format: "cdb"`.
|
|
80
|
+
* @returns A `FileDictionarySource` with `format: "cdb"` and `role: "reference"`.
|
|
152
81
|
*/
|
|
153
|
-
declare function opendictGeneralCdb(): Promise<FileDictionarySource>;
|
|
82
|
+
export declare function opendictGeneralCdb(): Promise<FileDictionarySource$1>;
|
|
154
83
|
/**
|
|
155
84
|
* Loads the bundled Open Korean Dictionary 북한어 dictionary.
|
|
156
85
|
*
|
|
157
|
-
* @returns A `FileDictionarySource` with `format: "cdb"`.
|
|
86
|
+
* @returns A `FileDictionarySource` with `format: "cdb"` and `role: "reference"`.
|
|
158
87
|
*/
|
|
159
|
-
declare function opendictNorthKoreanCdb(): Promise<FileDictionarySource>;
|
|
88
|
+
export declare function opendictNorthKoreanCdb(): Promise<FileDictionarySource$1>;
|
|
160
89
|
/**
|
|
161
90
|
* Loads the bundled Open Korean Dictionary 방언 dictionary.
|
|
162
91
|
*
|
|
163
|
-
* @returns A `FileDictionarySource` with `format: "cdb"`.
|
|
92
|
+
* @returns A `FileDictionarySource` with `format: "cdb"` and `role: "reference"`.
|
|
164
93
|
*/
|
|
165
|
-
declare function opendictDialectCdb(): Promise<FileDictionarySource>;
|
|
94
|
+
export declare function opendictDialectCdb(): Promise<FileDictionarySource$1>;
|
|
166
95
|
/**
|
|
167
96
|
* Loads the bundled Open Korean Dictionary 옛말 dictionary.
|
|
168
97
|
*
|
|
169
|
-
* @returns A `FileDictionarySource` with `format: "cdb"`.
|
|
98
|
+
* @returns A `FileDictionarySource` with `format: "cdb"` and `role: "reference"`.
|
|
170
99
|
*/
|
|
171
|
-
declare function opendictArchaicCdb(): Promise<FileDictionarySource>;
|
|
172
|
-
|
|
173
|
-
export { type FileDictionarySource, opendictArchaicCdb, opendictArchaicCdbBytes, opendictArchaicCdbUrl, opendictCdbBytes, opendictDialectCdb, opendictDialectCdbBytes, opendictDialectCdbUrl, opendictGeneralCdb, opendictGeneralCdbBytes, opendictGeneralCdbUrl, opendictNorthKoreanCdb, opendictNorthKoreanCdbBytes, opendictNorthKoreanCdbUrl };
|
|
100
|
+
export declare function opendictArchaicCdb(): Promise<FileDictionarySource$1>;
|
|
101
|
+
export type { FileDictionarySource, SourceRole };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// index.ts
|
|
2
2
|
/**
|
|
3
3
|
* URL of the bundled Open Korean Dictionary 一般語 CDB binary.
|
|
4
4
|
*
|
|
@@ -115,46 +115,49 @@ function opendictArchaicCdbBytes(url = opendictArchaicCdbUrl) {
|
|
|
115
115
|
/**
|
|
116
116
|
* Loads the bundled Open Korean Dictionary 일반어 dictionary.
|
|
117
117
|
*
|
|
118
|
-
* @returns A `FileDictionarySource` with `format: "cdb"`.
|
|
118
|
+
* @returns A `FileDictionarySource` with `format: "cdb"` and `role: "reference"`.
|
|
119
119
|
*/
|
|
120
120
|
async function opendictGeneralCdb() {
|
|
121
121
|
return {
|
|
122
122
|
data: await opendictGeneralCdbBytes(),
|
|
123
|
-
format: "cdb"
|
|
123
|
+
format: "cdb",
|
|
124
|
+
role: "reference"
|
|
124
125
|
};
|
|
125
126
|
}
|
|
126
127
|
/**
|
|
127
128
|
* Loads the bundled Open Korean Dictionary 북한어 dictionary.
|
|
128
129
|
*
|
|
129
|
-
* @returns A `FileDictionarySource` with `format: "cdb"`.
|
|
130
|
+
* @returns A `FileDictionarySource` with `format: "cdb"` and `role: "reference"`.
|
|
130
131
|
*/
|
|
131
132
|
async function opendictNorthKoreanCdb() {
|
|
132
133
|
return {
|
|
133
134
|
data: await opendictNorthKoreanCdbBytes(),
|
|
134
|
-
format: "cdb"
|
|
135
|
+
format: "cdb",
|
|
136
|
+
role: "reference"
|
|
135
137
|
};
|
|
136
138
|
}
|
|
137
139
|
/**
|
|
138
140
|
* Loads the bundled Open Korean Dictionary 방언 dictionary.
|
|
139
141
|
*
|
|
140
|
-
* @returns A `FileDictionarySource` with `format: "cdb"`.
|
|
142
|
+
* @returns A `FileDictionarySource` with `format: "cdb"` and `role: "reference"`.
|
|
141
143
|
*/
|
|
142
144
|
async function opendictDialectCdb() {
|
|
143
145
|
return {
|
|
144
146
|
data: await opendictDialectCdbBytes(),
|
|
145
|
-
format: "cdb"
|
|
147
|
+
format: "cdb",
|
|
148
|
+
role: "reference"
|
|
146
149
|
};
|
|
147
150
|
}
|
|
148
151
|
/**
|
|
149
152
|
* Loads the bundled Open Korean Dictionary 옛말 dictionary.
|
|
150
153
|
*
|
|
151
|
-
* @returns A `FileDictionarySource` with `format: "cdb"`.
|
|
154
|
+
* @returns A `FileDictionarySource` with `format: "cdb"` and `role: "reference"`.
|
|
152
155
|
*/
|
|
153
156
|
async function opendictArchaicCdb() {
|
|
154
157
|
return {
|
|
155
158
|
data: await opendictArchaicCdbBytes(),
|
|
156
|
-
format: "cdb"
|
|
159
|
+
format: "cdb",
|
|
160
|
+
role: "reference"
|
|
157
161
|
};
|
|
158
162
|
}
|
|
159
|
-
//#endregion
|
|
160
163
|
export { opendictArchaicCdb, opendictArchaicCdbBytes, opendictArchaicCdbUrl, opendictCdbBytes, opendictDialectCdb, opendictDialectCdbBytes, opendictDialectCdbUrl, opendictGeneralCdb, opendictGeneralCdbBytes, opendictGeneralCdbUrl, opendictNorthKoreanCdb, opendictNorthKoreanCdbBytes, opendictNorthKoreanCdbUrl };
|
package/dist/north-korean.cdb.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gukhanmun/opendict-cdb",
|
|
3
|
-
"version": "0.4.0-dev.
|
|
3
|
+
"version": "0.4.0-dev.248",
|
|
4
4
|
"description": "Open Korean Dictionary categories bundled as CDB binaries for @gukhanmun/wasm and @gukhanmun/napi.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@gukhanmun/types": "*"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@gukhanmun/types": "0.4.0-dev.
|
|
64
|
+
"@gukhanmun/types": "0.4.0-dev.248+36997e7"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"prebuild": "mise run -C ../.. opendict-cdb-data",
|