@gukhanmun/wasm 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
  *
@@ -609,4 +615,4 @@ declare class GukhanmunError extends Error {
609
615
  */
610
616
  declare function load(options?: GukhanmunOptions): Promise<Gukhanmun>;
611
617
  //#endregion
612
- 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 };
618
+ 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
@@ -202,6 +202,7 @@ function resolveOptions(opts = {}) {
202
202
  return {
203
203
  preset,
204
204
  rendering: opts.rendering ?? "hangul-only",
205
+ hanjaVariantSet: opts.hanjaVariantSet ?? "as-dictionary",
205
206
  segmentation: opts.segmentation ?? "lattice",
206
207
  numerals: opts.numerals ?? "hangul-phonetic",
207
208
  initialSoundLaw: opts.initialSoundLaw ?? (koKp ? false : true),
@@ -247,6 +248,7 @@ function buildRawOptions(opts, resolved) {
247
248
  const raw = {
248
249
  preset: resolved.preset,
249
250
  rendering: resolved.rendering,
251
+ hanjaVariantSet: resolved.hanjaVariantSet,
250
252
  segmentation: resolved.segmentation,
251
253
  numerals: resolved.numerals,
252
254
  initialSoundLaw: resolved.initialSoundLaw,
@@ -4,7 +4,7 @@
4
4
  "Hong Minhe (洪 民憙) <hong@minhee.org>"
5
5
  ],
6
6
  "description": "WebAssembly binding for Gukhanmun via wasm-bindgen.",
7
- "version": "0.2.0",
7
+ "version": "0.3.0",
8
8
  "license": "GPL-3.0-only",
9
9
  "repository": {
10
10
  "type": "git",
@@ -5,7 +5,7 @@
5
5
  "Hong Minhe (洪 民憙) <hong@minhee.org>"
6
6
  ],
7
7
  "description": "WebAssembly binding for Gukhanmun via wasm-bindgen.",
8
- "version": "0.2.0",
8
+ "version": "0.3.0",
9
9
  "license": "GPL-3.0-only",
10
10
  "repository": {
11
11
  "type": "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gukhanmun/wasm",
3
- "version": "0.2.0-dev.96",
3
+ "version": "0.3.0-dev.153",
4
4
  "description": "WebAssembly implementation of the Gukhanmun hanja-to-hangul converter.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -45,7 +45,7 @@
45
45
  "@gukhanmun/types": "*"
46
46
  },
47
47
  "devDependencies": {
48
- "@gukhanmun/types": "0.2.0-dev.96+e6fe5dd1ab693d47a8f459d0a6ee8ddd61dfd223"
48
+ "@gukhanmun/types": "0.3.0-dev.153+e988fed"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsdown && node -e \"const fs=require('node:fs'),p=require('node:path');fs.cpSync('wasm','dist/wasm',{recursive:true,force:true,filter:(s)=>p.basename(s)!=='.gitignore'})\""