@gukhanmun/types 0.1.0-dev.16 → 0.1.0-dev.18

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +26 -4
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -122,6 +122,19 @@ type NumeralStrategy = "hangul-phonetic" | "positional-arabic" | "additive-arabi
122
122
  * accuracy matters more than latency.
123
123
  */
124
124
  type ContextWindow = "off" | "per-block" | "per-section" | "per-document";
125
+ /**
126
+ * Selects how the homophone marker decides that a reading needs its hanja shown
127
+ * in `rendering: "hangul-only"`. Corresponds to Rust `HomophoneDetection`.
128
+ *
129
+ * - `"context-local"` — Gloss a reading only when a different-meaning homophone
130
+ * actually appears within the {@link ContextWindow}. This keeps hangul-only
131
+ * output clean and is the default.
132
+ * - `"dictionary-wide"` — Also gloss readings shared by other hanja forms
133
+ * anywhere in the dictionary, even when no homophone appears in the text.
134
+ * With a large reference dictionary this glosses most Sino-Korean words; words
135
+ * that should always be glossed are better expressed with `requireHanja`.
136
+ */
137
+ type HomophoneDetection = "context-local" | "dictionary-wide";
125
138
  /**
126
139
  * Controls how the pipeline handles reader errors encountered during HTML
127
140
  * scanning. Corresponds to Rust `Recovery`.
@@ -323,13 +336,22 @@ interface GukhanmunOptions {
323
336
  readonly initialSoundLaw?: boolean;
324
337
  /**
325
338
  * Context window for homophone disambiguation. The `HomophoneMarker`
326
- * middleware sets `homophone = true` on annotations whose hangul reading is
327
- * shared by another hanja form within this window. Defaults to
328
- * `"per-block"`.
339
+ * middleware sets `homophone = true` on annotations whose hangul reading
340
+ * collides within this window. Defaults to `"per-block"`.
329
341
  *
330
342
  * @see {@link ContextWindow}
331
343
  */
332
344
  readonly homophoneWindow?: ContextWindow;
345
+ /**
346
+ * Strategy that decides which readings count as homophones needing a hanja
347
+ * gloss. Defaults to `"context-local"`, which glosses a reading only when a
348
+ * different-meaning homophone appears within {@link homophoneWindow}. Use
349
+ * `"dictionary-wide"` to also gloss readings shared by other dictionary
350
+ * entries.
351
+ *
352
+ * @see {@link HomophoneDetection}
353
+ */
354
+ readonly homophoneDetection?: HomophoneDetection;
333
355
  /**
334
356
  * Context window for first-occurrence filtering. The
335
357
  * `FirstOccurrenceFilter` middleware clears `requireHanja` /
@@ -533,4 +555,4 @@ declare class GukhanmunError extends Error {
533
555
  }[];
534
556
  }
535
557
  //#endregion
536
- export { ContextWindow, DictionaryEntry, DictionarySource, Directives, ErrorCode, FileDictionarySource, Format, Gukhanmun, GukhanmunError, GukhanmunFactory, GukhanmunOptions, HtmlOptions, NumeralStrategy, OriginalGloss, Preset, Recovery, RenderMode, Segmentation, load };
558
+ export { ContextWindow, DictionaryEntry, DictionarySource, Directives, ErrorCode, FileDictionarySource, Format, Gukhanmun, GukhanmunError, GukhanmunFactory, GukhanmunOptions, HomophoneDetection, HtmlOptions, NumeralStrategy, OriginalGloss, Preset, Recovery, RenderMode, Segmentation, load };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gukhanmun/types",
3
- "version": "0.1.0-dev.16",
3
+ "version": "0.1.0-dev.18",
4
4
  "description": "TypeScript API contract for Gukhanmun (type declarations only, no runtime code).",
5
5
  "type": "module",
6
6
  "exports": {