@gukhanmun/napi 0.2.0-dev.96 → 0.3.0-dev.153

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/index.d.ts CHANGED
@@ -51,6 +51,8 @@ type Preset = "ko-kr" | "ko-kp";
51
51
  * `RenderMode::Original`.
52
52
  */
53
53
  type RenderMode = "hangul-only" | "hangul-hanja-parens" | "hanja-hangul-parens" | "ruby-on-hangul" | "ruby-on-hanja" | "original";
54
+ /** The hanja variant set applied after dictionary recognition. */
55
+ type HanjaVariantSet = "as-dictionary" | "shinjitai" | "kanxi" | "simplified" | "asahimoji";
54
56
  /**
55
57
  * Selects how glosses are rendered when {@link RenderMode} is `"original"`.
56
58
  *
@@ -100,11 +102,13 @@ type Segmentation = "lattice" | "eager";
100
102
  * (`十百千萬億兆京`) using stack-based accumulation and produce Arabic,
101
103
  * respecting the Korean convention that bare `十` means 10 not `一十`.
102
104
  * Corresponds to Rust `NumeralStrategy::AdditiveArabic`.
103
- * - `"smart"` — Uses `"additive-arabic"` when a unit hanja follows the
104
- * numeral (`年月日時分秒號世紀` and others); uses `"positional-arabic"`
105
- * for pure-digit runs of four or more characters (year convention);
106
- * otherwise falls back to `"hangul-phonetic"`. Corresponds to Rust
107
- * `NumeralStrategy::Smart`.
105
+ * - `"smart"` — Uses `"additive-arabic"` for additive numerals that
106
+ * begin with a digit, and for small-place-marker starts (`十`, `百`,
107
+ * `千`) unless the next character is an ambiguous non-unit hanja word
108
+ * character; uses `"positional-arabic"` for pure-digit runs of four or
109
+ * more characters (year convention) or when a unit hanja follows the
110
+ * digit run (`年月日時分秒號世紀` and others); otherwise falls back to
111
+ * `"hangul-phonetic"`. Corresponds to Rust `NumeralStrategy::Smart`.
108
112
  */
109
113
  type NumeralStrategy = "hangul-phonetic" | "positional-arabic" | "additive-arabic" | "smart";
110
114
  /**
@@ -313,6 +317,8 @@ interface GukhanmunOptions {
313
317
  * @see {@link OriginalGloss}
314
318
  */
315
319
  readonly originalGloss?: OriginalGloss;
320
+ /** The hanja variant set. Defaults to `"as-dictionary"`. */
321
+ readonly hanjaVariantSet?: HanjaVariantSet;
316
322
  /**
317
323
  * Hanja-span segmentation algorithm. Defaults to `"lattice"`.
318
324
  *
@@ -608,4 +614,4 @@ declare class GukhanmunError extends Error {
608
614
  */
609
615
  declare function load(options?: GukhanmunOptions): Promise<Gukhanmun>;
610
616
  //#endregion
611
- export { type ContextWindow, type DictionaryEntry, type DictionarySource, type Directives, type ErrorCode, type FileDictionarySource, type Format, type Gukhanmun, GukhanmunError, type GukhanmunFactory, type GukhanmunOptions, type HomophoneDetection, type HtmlOptions, type NumeralStrategy, type OriginalGloss, type Preset, type Recovery, type RenderMode, type Segmentation, load };
617
+ export { type ContextWindow, type DictionaryEntry, type DictionarySource, type Directives, type ErrorCode, type FileDictionarySource, type Format, type Gukhanmun, GukhanmunError, type GukhanmunFactory, type GukhanmunOptions, type HanjaVariantSet, type HomophoneDetection, type HtmlOptions, type NumeralStrategy, type OriginalGloss, type Preset, type Recovery, type RenderMode, type Segmentation, load };
package/dist/index.js CHANGED
@@ -153,6 +153,7 @@ function resolveOptions(opts = {}) {
153
153
  return {
154
154
  preset,
155
155
  rendering: opts.rendering ?? "hangul-only",
156
+ hanjaVariantSet: opts.hanjaVariantSet ?? "as-dictionary",
156
157
  segmentation: opts.segmentation ?? "lattice",
157
158
  numerals: opts.numerals ?? "hangul-phonetic",
158
159
  initialSoundLaw: opts.initialSoundLaw ?? (koKp ? false : true),
@@ -167,6 +168,7 @@ function buildRawOptions(opts, resolved) {
167
168
  const raw = {
168
169
  preset: resolved.preset,
169
170
  rendering: resolved.rendering,
171
+ hanjaVariantSet: resolved.hanjaVariantSet,
170
172
  segmentation: resolved.segmentation,
171
173
  numerals: resolved.numerals,
172
174
  initialSoundLaw: resolved.initialSoundLaw,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gukhanmun/napi",
3
- "version": "0.2.0-dev.96",
3
+ "version": "0.3.0-dev.153",
4
4
  "description": "Node.js native addon (napi-rs) for the Gukhanmun hanja-to-hangul converter.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -14,12 +14,12 @@
14
14
  "dist"
15
15
  ],
16
16
  "optionalDependencies": {
17
- "@gukhanmun/napi-x86_64-apple-darwin": "0.2.0-dev.96+e6fe5dd1ab693d47a8f459d0a6ee8ddd61dfd223",
18
- "@gukhanmun/napi-aarch64-apple-darwin": "0.2.0-dev.96+e6fe5dd1ab693d47a8f459d0a6ee8ddd61dfd223",
19
- "@gukhanmun/napi-x86_64-pc-windows-msvc": "0.2.0-dev.96+e6fe5dd1ab693d47a8f459d0a6ee8ddd61dfd223",
20
- "@gukhanmun/napi-aarch64-pc-windows-msvc": "0.2.0-dev.96+e6fe5dd1ab693d47a8f459d0a6ee8ddd61dfd223",
21
- "@gukhanmun/napi-aarch64-unknown-linux-gnu": "0.2.0-dev.96+e6fe5dd1ab693d47a8f459d0a6ee8ddd61dfd223",
22
- "@gukhanmun/napi-x86_64-unknown-linux-gnu": "0.2.0-dev.96+e6fe5dd1ab693d47a8f459d0a6ee8ddd61dfd223"
17
+ "@gukhanmun/napi-aarch64-apple-darwin": "0.3.0-dev.153+e988fed",
18
+ "@gukhanmun/napi-x86_64-apple-darwin": "0.3.0-dev.153+e988fed",
19
+ "@gukhanmun/napi-x86_64-pc-windows-msvc": "0.3.0-dev.153+e988fed",
20
+ "@gukhanmun/napi-aarch64-unknown-linux-gnu": "0.3.0-dev.153+e988fed",
21
+ "@gukhanmun/napi-x86_64-unknown-linux-gnu": "0.3.0-dev.153+e988fed",
22
+ "@gukhanmun/napi-aarch64-pc-windows-msvc": "0.3.0-dev.153+e988fed"
23
23
  },
24
24
  "homepage": "https://github.com/dahlia/gukhanmun",
25
25
  "bugs": "https://github.com/dahlia/gukhanmun/issues",
@@ -52,7 +52,7 @@
52
52
  "@gukhanmun/types": "*"
53
53
  },
54
54
  "devDependencies": {
55
- "@gukhanmun/types": "0.2.0-dev.96+e6fe5dd1ab693d47a8f459d0a6ee8ddd61dfd223"
55
+ "@gukhanmun/types": "0.3.0-dev.153+e988fed"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsdown"