For AI agents: the complete documentation index is available at https://canary.gukhanmun.org/ko-Kore/llms.txt, the full documentation bundle is available at https://canary.gukhanmun.org/ko-Kore/llms-full.txt, and this page is available as Markdown at https://canary.gukhanmun.org/ko-Kore/guide/javascript/dictionary.md.
  • 韓國語 (國漢文)
  • 辭典

    dictionaries 옵션에 DictionarySource 客體의 配列을 넘깁니다. 辭典 出處는 컴파일된 產出物(FileDictionarySource)이거나 實行 時點에 計算한 項目 目錄 (MapDictionarySource)입니다. 基本 reference-authorized 政策은 出處 役割과 明示的 辭典 關係에 따라 候補 順位를 定합니다. sourcePolicy: "ordered"를 選擇하면 從來의 配列 優先順位를 使用합니다.

    《標準國語大辭典》 패키지

    @gukhanmun/stdict-fst와 @gukhanmun/stdict-cdb는 둘 다 內藏 《標準國語大辭典》을 各各 다른 바이너리 形式으로 提供합니다.

    import { 
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    } from "@gukhanmun/wasm";
    import {
    function stdictFst(): Promise<FileDictionarySource>

    Loads the bundled Standard Korean Language Dictionary as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    stdictFst
    } from "@gukhanmun/stdict-fst";
    import {
    function stdictCdb(): Promise<FileDictionarySource>

    Loads the bundled Standard Korean Language Dictionary as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "cdb" and role: "reference".
    stdictCdb
    } from "@gukhanmun/stdict-cdb";
    // FST: 勸奬; 디스크에서 더 작고, 래티스(lattice) 分割에 더 適合 const
    const g: Gukhanmun
    g
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [await
    function stdictFst(): Promise<FileDictionarySource>

    Loads the bundled Standard Korean Language Dictionary as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    stdictFst
    ()] });
    // CDB: 索引을 使用한 찾기; 더 單純한 파일 配置 const
    const g: Gukhanmun
    g
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [await
    function stdictCdb(): Promise<FileDictionarySource>

    Loads the bundled Standard Korean Language Dictionary as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "cdb" and role: "reference".
    stdictCdb
    ()] });

    stdictFst()와 stdictCdb()는 모두 Promise<FileDictionarySource>를 返還합니다.

    같은 辭典을 여러 變換器에서 使用하려면 loadDictionary()로 한 번만 불러옵니다. load()와 같은 패키지에서 가져온 函數를 使用합니다.

    import { 
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ,
    function loadDictionary(source: DictionarySource): Promise<LoadedDictionary>

    Loads one immutable dictionary snapshot for reuse by this backend.

    loadDictionary
    } from "@gukhanmun/wasm";
    import {
    function stdictFst(): Promise<FileDictionarySource>

    Loads the bundled Standard Korean Language Dictionary as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    stdictFst
    } from "@gukhanmun/stdict-fst";
    const
    const reference: LoadedDictionary
    reference
    = await
    function loadDictionary(source: DictionarySource): Promise<LoadedDictionary>

    Loads one immutable dictionary snapshot for reuse by this backend.

    loadDictionary
    (await
    function stdictFst(): Promise<FileDictionarySource>

    Loads the bundled Standard Korean Language Dictionary as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    stdictFst
    ());
    const
    const overrides: {
        entries: {
            hanja: string;
            reading: string;
        }[];
    }
    overrides
    = {
    entries: {
        hanja: string;
        reading: string;
    }[]
    entries
    : [{
    hanja: string
    hanja
    : "東京",
    reading: string
    reading
    : "도쿄" }] };
    const
    const plain: Gukhanmun
    plain
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [
    const overrides: {
        entries: {
            hanja: string;
            reading: string;
        }[];
    }
    overrides
    ,
    const reference: LoadedDictionary
    reference
    ] });
    const
    const ruby: Gukhanmun
    ruby
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [
    const overrides: {
        entries: {
            hanja: string;
            reading: string;
        }[];
    }
    overrides
    ,
    const reference: LoadedDictionary
    reference
    ],
    rendering?: RenderMode | undefined

    How annotations are rendered into output text or markup. Defaults to "hangul-only".

    @seeRenderMode
    rendering
    : "ruby-on-hangul",
    });

    LoadedDictionary는 불러온 時點의 內容과 出處 役割을 保持합니다. 辭典 데이터는 共有하지만, 出處 順序와 變換 옵션은 變換器마다 따로 適用합니다. 다른 백엔드에서 使用하거나 바뀐 內容을 反映하려면 다시 불러옵니다. 핸들이 든 옵션의 타입은 GukhanmunLoadOptions입니다.

    《우리말샘》 패키지

    @gukhanmun/opendict-fst와 @gukhanmun/opendict-cdb는 《우리말샘》을 一般語, 北韓語, 方言, 옛말 分類別 辭典으로 나누어 提供합니다. JavaScript 프리셋은 이 패키지들을 自動으로 불러오지 않으므로, 必要한 分類를 明示的으로 넘겨야 합니다:

    import { 
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    } from "@gukhanmun/wasm";
    import {
    function opendictDialectFst(): Promise<FileDictionarySource>

    Loads the bundled Open Korean Dictionary 방언 dictionary.

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    opendictDialectFst
    ,
    function opendictNorthKoreanFst(): Promise<FileDictionarySource>

    Loads the bundled Open Korean Dictionary 북한어 dictionary.

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    opendictNorthKoreanFst
    ,
    } from "@gukhanmun/opendict-fst"; const
    const g: Gukhanmun
    g
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    preset?: Preset | undefined

    Named configuration preset. Defaults to "ko-kr".

    @seePreset
    preset
    : "ko-kp",
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [
    await
    function opendictNorthKoreanFst(): Promise<FileDictionarySource>

    Loads the bundled Open Korean Dictionary 북한어 dictionary.

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    opendictNorthKoreanFst
    (),
    await
    function opendictDialectFst(): Promise<FileDictionarySource>

    Loads the bundled Open Korean Dictionary 방언 dictionary.

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    opendictDialectFst
    (),
    ], });

    같은 分類를 CDB 形式으로 쓰려면 CDB 패키지를 使用합니다:

    import { 
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    The native addon is synchronously ready; compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched or read from disk, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    } from "@gukhanmun/napi";
    import {
    function opendictNorthKoreanCdb(): Promise<FileDictionarySource>

    Loads the bundled Open Korean Dictionary 북한어 dictionary.

    @returnsA FileDictionarySource with format: "cdb" and role: "reference".
    opendictNorthKoreanCdb
    } from "@gukhanmun/opendict-cdb";
    const
    const g: Gukhanmun
    g
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    The native addon is synchronously ready; compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched or read from disk, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    preset?: Preset | undefined

    Named configuration preset. Defaults to "ko-kr".

    @seePreset
    preset
    : "ko-kp",
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [await
    function opendictNorthKoreanCdb(): Promise<FileDictionarySource>

    Loads the bundled Open Korean Dictionary 북한어 dictionary.

    @returnsA FileDictionarySource with format: "cdb" and role: "reference".
    opendictNorthKoreanCdb
    ()],
    });

    《外來語 表記 用例》 패키지

    @gukhanmun/loanwords-fst와 @gukhanmun/loanwords-cdb는 國立國語院 《外來語 表記 用例》 辭典을 提供합니다. "ko-kr"과 "ko-kp" 모두 明示的으로 불러와야 하며, 프리셋은 이 辭典을 自動으로 追加하지 않습니다. 使用者 定義 辭典은 override, stdict·opendict는 reference, 外來語 用例는 loanword 役割로 區別합니다. 公式 로더(loader)는 役割을 明示하므로 基本 政策에서는 外來語 用例와 參照 辭典의 相對的인 配列 順序에 依存하지 않습니다:

    import { 
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    } from "@gukhanmun/wasm";
    import {
    function loanwordsFst(): Promise<FileDictionarySource>

    Loads the bundled NIKL loanword examples as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "fst" and role: "loanword".
    loanwordsFst
    } from "@gukhanmun/loanwords-fst";
    import {
    function stdictFst(): Promise<FileDictionarySource>

    Loads the bundled Standard Korean Language Dictionary as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    stdictFst
    } from "@gukhanmun/stdict-fst";
    const
    const g: Gukhanmun
    g
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    preset?: Preset | undefined

    Named configuration preset. Defaults to "ko-kr".

    @seePreset
    preset
    : "ko-kr",
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [await
    function loanwordsFst(): Promise<FileDictionarySource>

    Loads the bundled NIKL loanword examples as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "fst" and role: "loanword".
    loanwordsFst
    (), await
    function stdictFst(): Promise<FileDictionarySource>

    Loads the bundled Standard Korean Language Dictionary as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    stdictFst
    ()],
    });
    const g: Gukhanmun
    g
    .
    Gukhanmun.convert(source: string, format?: MediaType): string (+2 overloads)

    Converts source to hangul in one shot. Buffers the entire input before returning.

    @paramsource - The text to convert.@paramformat - Input/output media type. Defaults to "text/plain".@returnsThe converted text.@throws{@linkGukhanmunError } on conversion failure.
    convert
    ("香港"); // "홍콩"

    CDB 形式을 쓰려면 @gukhanmun/loanwords-cdb에서 loanwordsCdb를 가져옵니다. 두 로더 모두 Promise<FileDictionarySource>를 返還하고 @gukhanmun/wasm과 @gukhanmun/napi에서 쓸 수 있습니다. 패키지를 設置하는 것만으로는 變換이 달라지지 않으며, 로더의 結果를 dictionaries에 넣어야 합니다.

    使用者 定義 辭典

    FileDictionarySource는 바이너리 形式과 불러올 데이터를 指定합니다:

    interface FileDictionarySource {
      
    FileDictionarySource.format: "fst" | "cdb"
    format
    : "fst" | "cdb";
    FileDictionarySource.data: string | ArrayBuffer | ArrayBufferView<ArrayBufferLike> | URL
    data
    : ArrayBuffer |
    interface ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>
    ArrayBufferView
    | URL | string;
    }

    data 필드는 다음을 받습니다:

    種類位置備考
    ArrayBuffer/ArrayBufferView모든 環境이미 메모리에 있는 바이트
    URL모든 環境遠隔 또는 로컬 URL; fetch()로 불러옴
    stringNode.js, Deno, Bun파일시스템 經路

    URL에서 불러오기

    const 
    const g: Gukhanmun
    g
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [{
    FileDictionarySource.format: "fst" | "cdb"

    The on-disk format of the dictionary file.

    • "fst" — Gukhanmun FST file (*.gukfst); preferred for small WebAssembly bundles. Supported in all runtimes.
    • "cdb" — Gukhanmun CDB-trie file (*.gukcdb); preferred when code auditability or trivial mmap support matters. Requires a filesystem or in-memory bytes; supported in Node-API and (with from_bytes) in WASM builds that include the cdb feature.

    The "tsv" format is reserved and never accepted. Pass entries in memory through MapDictionarySource instead of compiling a table.

    format
    : "fst",
    FileDictionarySource.data: string | ArrayBuffer | ArrayBufferView<ArrayBufferLike> | URL

    The binary dictionary data or a reference to where it can be loaded.

    Pass a BufferSource for data already in memory, a URL for a remote or local URL (resolved via fetch or readFile), or a path string for filesystem paths (Node.js / Deno 2.0+ / Bun only).

    data
    : new
    var URL: new (url: string | URL, base?: string | URL) => URL

    The URL interface is used to parse, construct, normalize, and encode URLs. It works by providing properties which allow you to easily read and modify the components of a URL.

    MDN Reference

    URL class is a global reference for import { URL } from 'url' https://nodejs.org/api/url.html#the-whatwg-url-api

    @sincev10 .0.0
    URL
    ("./legal.gukfst", import.meta.
    ImportMeta.url: string

    The absolute file: URL of the module.

    This is defined exactly the same as it is in browsers providing the URL of the current module file.

    This enables useful patterns such as relative file loading:

    import { readFileSync } from 'node:fs';
    const buffer = readFileSync(new URL('./data.proto', import.meta.url));
    url
    ),
    }], });

    브라우저에서는 URL이 fetch()로 가져와집니다. Node.js·Deno·Bun에서는 file:// URL이 디스크에서 읽힙니다.

    바이트에서 불러오기

    const 
    const response: Response
    response
    = await
    function fetch(input: string | URL | Request, init?: RequestInit): Promise<Response> (+1 overload)
    fetch
    ("/custom.gukcdb");
    const
    const buf: ArrayBuffer
    buf
    = await
    const response: Response
    response
    .
    Body.arrayBuffer(): Promise<ArrayBuffer>
    arrayBuffer
    ();
    const
    const g: Gukhanmun
    g
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [{
    FileDictionarySource.format: "fst" | "cdb"

    The on-disk format of the dictionary file.

    • "fst" — Gukhanmun FST file (*.gukfst); preferred for small WebAssembly bundles. Supported in all runtimes.
    • "cdb" — Gukhanmun CDB-trie file (*.gukcdb); preferred when code auditability or trivial mmap support matters. Requires a filesystem or in-memory bytes; supported in Node-API and (with from_bytes) in WASM builds that include the cdb feature.

    The "tsv" format is reserved and never accepted. Pass entries in memory through MapDictionarySource instead of compiling a table.

    format
    : "cdb",
    FileDictionarySource.data: string | URL | ArrayBuffer | ArrayBufferView<ArrayBufferLike>

    The binary dictionary data or a reference to where it can be loaded.

    Pass a BufferSource for data already in memory, a URL for a remote or local URL (resolved via fetch or readFile), or a path string for filesystem paths (Node.js / Deno 2.0+ / Bun only).

    data
    :
    const buf: ArrayBuffer
    buf
    }],
    });

    파일 經路에서 불러오기(Node.js/Deno/Bun)

    const 
    const g: Gukhanmun
    g
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    The native addon is synchronously ready; compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched or read from disk, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [{
    FileDictionarySource.format: "fst" | "cdb"

    The on-disk format of the dictionary file.

    • "fst" — Gukhanmun FST file (*.gukfst); preferred for small WebAssembly bundles. Supported in all runtimes.
    • "cdb" — Gukhanmun CDB-trie file (*.gukcdb); preferred when code auditability or trivial mmap support matters. Requires a filesystem or in-memory bytes; supported in Node-API and (with from_bytes) in WASM builds that include the cdb feature.

    The "tsv" format is reserved and never accepted. Pass entries in memory through MapDictionarySource instead of compiling a table.

    format
    : "fst",
    FileDictionarySource.data: string | ArrayBuffer | ArrayBufferView<ArrayBufferLike> | URL

    The binary dictionary data or a reference to where it can be loaded.

    Pass a BufferSource for data already in memory, a URL for a remote or local URL (resolved via fetch or readFile), or a path string for filesystem paths (Node.js / Deno 2.0+ / Bun only).

    data
    : "/data/domain.gukfst" }],
    });

    브라우저에서 純粹 文字列 經路를 넘기면 "io" 코드와 함께 GukhanmunError를 던집니다.

    여러 辭典 結合

    const 
    const g: Gukhanmun
    g
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    The native addon is synchronously ready; compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched or read from disk, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [
    {
    FileDictionarySource.format: "fst" | "cdb"

    The on-disk format of the dictionary file.

    • "fst" — Gukhanmun FST file (*.gukfst); preferred for small WebAssembly bundles. Supported in all runtimes.
    • "cdb" — Gukhanmun CDB-trie file (*.gukcdb); preferred when code auditability or trivial mmap support matters. Requires a filesystem or in-memory bytes; supported in Node-API and (with from_bytes) in WASM builds that include the cdb feature.

    The "tsv" format is reserved and never accepted. Pass entries in memory through MapDictionarySource instead of compiling a table.

    format
    : "fst",
    FileDictionarySource.data: string | ArrayBuffer | ArrayBufferView<ArrayBufferLike> | URL

    The binary dictionary data or a reference to where it can be loaded.

    Pass a BufferSource for data already in memory, a URL for a remote or local URL (resolved via fetch or readFile), or a path string for filesystem paths (Node.js / Deno 2.0+ / Bun only).

    data
    : "/data/legal.gukfst" }, // 먼저 檢査
    await
    function stdictFst(): Promise<FileDictionarySource>

    Loads the bundled Standard Korean Language Dictionary as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    stdictFst
    (), // fallback
    ], });

    使用者 定義 辭典 構築

    위에서 불러온 .gukfst와 .gukcdb 파일은 컴파일된 產出物이며, gukhanmun-mkdict 道具로 平文 텍스트 表에서 빌드됩니다. 辭典 出處를 作成하고 컴파일하는 方法은 CLI 案內書의 〈使用者 定義 辭典 構築〉을 參照하십시오. 項目을 디스크에 두지 않고 實行 中에 計算한다면, 다음 節처럼 直接 넘기면 됩니다.

    實行 時點에 計算한 項目

    MapDictionarySource는 項目을 메모리에 담습니다. 文書를 만드는 途中에 讀音을 計算하거나, TSV 파일도 gukhanmun-mkdict도 쓸 수 없는 브라우저·에지 런타임에서 使用합니다:

    const 
    const converter: Gukhanmun
    converter
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [
    {
    MapDictionarySource.entries: readonly DictionaryEntry[]

    The entries of this dictionary.

    Repeated hanja keys append competing readings instead of replacing each other, and DictionaryEntry.preference decides which reading is the context-free default. Several readings for one key also let the engine pick a reading from a following particle (東京을 versus 東京를).

    An empty list contributes nothing, which is a convenient way to express "this document has no overrides".

    entries
    : [
    {
    DictionaryEntry.hanja: string

    The hanja form (dictionary key), e.g. "漢字".

    hanja
    : "高橋",
    DictionaryEntry.reading: string

    The word-initial hangul reading, e.g. "한자".

    reading
    : "다카하시" },
    {
    DictionaryEntry.hanja: string

    The hanja form (dictionary key), e.g. "漢字".

    hanja
    : "東京",
    DictionaryEntry.reading: string

    The word-initial hangul reading, e.g. "한자".

    reading
    : "도쿄",
    DictionaryEntry.preference?: number | undefined

    Relative default preference for this reading within its hanja key, a non-negative integer. Larger values win, so an entry listed twice with different preferences keeps competing readings and uses the higher one by default. Absent means 0.

    List order never selects the default: when two readings share a preference the tie is broken by reading spelling. Set distinct preferences to choose a default deliberately.

    Corresponds to Rust ReadingCandidate::preference.

    preference
    : 10 },
    {
    DictionaryEntry.hanja: string

    The hanja form (dictionary key), e.g. "漢字".

    hanja
    : "年代",
    DictionaryEntry.reading: string

    The word-initial hangul reading, e.g. "한자".

    reading
    : "연대",
    DictionaryEntry.suffixReading?: string | undefined

    The reading used when the match is not word-initial, when it differs from

    reading . For example a 年代 entry with reading: "연대" and suffixReading: "년대" reads 1990年代 as 1990년대 but 年代 alone as 연대.

    Corresponds to Rust ReadingCandidate::suffix_reading.

    suffixReading
    : "년대" },
    ], }, await
    function stdictFst(): Promise<FileDictionarySource>

    Loads the bundled Standard Korean Language Dictionary as a

    FileDictionarySource ready to pass to load({ dictionaries: [...] }).

    @returnsA FileDictionarySource with format: "fst" and role: "reference".
    stdictFst
    (),
    ], });

    各 필드는 漢字 키를 除外하면 Rust의 ReadingCandidate 타입과 같습니다:

    필드意味
    hanja辭典 키
    reading語頭 讀音
    suffixReading語頭가 아닐 때 쓰는 讀音 (다를 때만)
    preference같은 키 안에서의 相對 優先 順位; 클수록 優先, 없으면 0
    requireHanja讀音과 함께 原本 漢字를 恒常 보임
    requireHangul原本 漢字와 함께 한글 註를 恒常 보임

    項目 目錄의 基本 役割은 "override"입니다. 辭典 協力 政策에서는 같은 表記와 消費 길이에 對해 參照·外來語 出處보다 먼저 適用하며, 여러 덮어쓰기(override)가 있으면 먼저 登錄한 것이 優先합니다. sourcePolicy: "ordered"에서는 모든 出處가 配列 順序를 따르므로, 이 모드에서 컴파일된 辭典의 키를 덮어쓰려면 項目 目錄을 그 辭典보다 앞에 둡니다.

    같은 hanja 키를 되풀이하면 앞의 讀音을 代替하지 않고 讀音을 하나 더 追加합니다. 엔진은 한 標題語의 여러 讀音을 모두 지니고 있다가, 뒤따르는 助詞가 決定的이면 그 助詞에 맞는 讀音을 고릅니다:

    const 
    const g: Gukhanmun
    g
    = await
    function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>

    Creates a Gukhanmun converter with the given options.

    Initialises the WASM module on the first call (subsequent calls reuse the cached module). Compiled dictionaries supplied via GukhanmunOptions.dictionaries are fetched, while MapDictionarySource entry lists are serialised and built in memory as Rust MapDictionary values.

    Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

    @paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
    load
    ({
    dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined
    dictionaries
    : [
    {
    MapDictionarySource.entries: readonly DictionaryEntry[]

    The entries of this dictionary.

    Repeated hanja keys append competing readings instead of replacing each other, and DictionaryEntry.preference decides which reading is the context-free default. Several readings for one key also let the engine pick a reading from a following particle (東京을 versus 東京를).

    An empty list contributes nothing, which is a convenient way to express "this document has no overrides".

    entries
    : [
    {
    DictionaryEntry.hanja: string

    The hanja form (dictionary key), e.g. "漢字".

    hanja
    : "東京",
    DictionaryEntry.reading: string

    The word-initial hangul reading, e.g. "한자".

    reading
    : "동경" },
    {
    DictionaryEntry.hanja: string

    The hanja form (dictionary key), e.g. "漢字".

    hanja
    : "東京",
    DictionaryEntry.reading: string

    The word-initial hangul reading, e.g. "한자".

    reading
    : "도쿄",
    DictionaryEntry.preference?: number | undefined

    Relative default preference for this reading within its hanja key, a non-negative integer. Larger values win, so an entry listed twice with different preferences keeps competing readings and uses the higher one by default. Absent means 0.

    List order never selects the default: when two readings share a preference the tie is broken by reading spelling. Set distinct preferences to choose a default deliberately.

    Corresponds to Rust ReadingCandidate::preference.

    preference
    : 10 },
    ], }, ], });
    const g: Gukhanmun
    g
    .
    Gukhanmun.convert(source: string, format?: MediaType): string (+2 overloads)

    Converts source to hangul in one shot. Buffers the entire input before returning.

    @paramsource - The text to convert.@paramformat - Input/output media type. Defaults to "text/plain".@returnsThe converted text.@throws{@linkGukhanmunError } on conversion failure.
    convert
    ("東京"); // "도쿄": 優先 順位가 높은 讀音
    const g: Gukhanmun
    g
    .
    Gukhanmun.convert(source: string, format?: MediaType): string (+2 overloads)

    Converts source to hangul in one shot. Buffers the entire input before returning.

    @paramsource - The text to convert.@paramformat - Input/output media type. Defaults to "text/plain".@returnsThe converted text.@throws{@linkGukhanmunError } on conversion failure.
    convert
    ("東京을"); // "동경을": 助詞가 다른 讀音을 고름
    const g: Gukhanmun
    g
    .
    Gukhanmun.convert(source: string, format?: MediaType): string (+2 overloads)

    Converts source to hangul in one shot. Buffers the entire input before returning.

    @paramsource - The text to convert.@paramformat - Input/output media type. Defaults to "text/plain".@returnsThe converted text.@throws{@linkGukhanmunError } on conversion failure.
    convert
    ("東京를"); // "도쿄를"

    文脈 없이 쓰는 基本 讀音은 preference가 決定합니다. 目錄 順序는 決코 基本 讀音을 고르지 않습니다. 두 讀音의 優先 順位가 같으면 讀音 綴字 順序로 決定되므로, 選擇이 重要하다면 preference를 서로 다르게 指定하십시오.

    빈 entries 目錄은 아무것도 寄與하지 않으므로, 덮어쓸 項目이 없는 文書에는 { entries: [] }를 그대로 둘 수 있습니다.

    出處에 따른 候補 選擇

    基本 reference-authorized 政策은 參照 辭典과 外來語 辭典의 候補를 別途로 保存합니다. 參照 辭典이 同義語나 形式的 轉送 關係로 許容한 表記만 優先하며, 같은 候補에 寄與한 모든 語義의 許容 範圍를 交集合으로 計算합니다. 同一한 漢字 表記나 讀音만으로 關係를 推測하지 않습니다. 根據가 없으면 參照 辭典의 讀音을 維持하므로 東扶餘는 동부여, 香港은 홍콩이 됩니다.

    最終 候補 풀 全體에 助詞 檢査를 한 番 適用합니다. 따라서 基本 讀音이 아닌 獨立 外來語 候補도 助詞에 맞으면 選擇할 수 있습니다. 平은 평이지만 平를은 다이라를이 될 수 있습니다. 數値 優先度는 各 辭典 內部에서만 比較하며, 格子(lattice)의 目的 函數는 變更하지 않습니다.

    政策動作
    reference-authorized許容된 外來語 表記, 參照 辭典의 轉送/原讀音, 獨立 外來語 順
    reference-first參照 辭典의 原讀音을 獨立 外來語보다 優先
    loanword-first獨立 外來語를 參照 辭典의 原讀音보다 優先
    ordered役割과 許容 關係를 無視하고 從來의 辭典 順序를 使用

    協力 政策에서 使用者의 override는 같은 表記와 消費 길이의 다른 候補를 代替하며, 더 긴 一致를 除去하지 않습니다. 參照 專用 設定은 獨立 外來語를 除外하지만, 參照 辭典이 許容한 外來語 實現은 維持합니다.

    選擇한 候補의 識別子·別名·位置形·註解(annotation) 標識을 함께 傳達합니다. 出處를 保存하는 辭典 一致는 隣接한 폴백 漢字와 別途의 註解로 남으므로, ordered와 比較하여 括弧로 묶이는 範圍가 달라질 수 있습니다.

    load({ sourcePolicy: "reference-authorized", referenceOnly: true, dictionaries })로 政策과 參照 專用을 設定합니다. 파일·項目 記述子 모두 role: "override" | "reference" | "loanword"를 받을 수 있습니다. 項目의 基本값은 override이며, 파일은 바이너리의 役割 메타데이터가 있으면 使用하고 없으면 override입니다. 明示的 role은 메타데이터보다 優先합니다. 公式 로더는 役割을 明示합니다. 協力 政策에서 덮어쓰기는 配列 位置와 無關하게 協力 辭典보다 優先하고, 덮어쓰기끼리는 앞의 項目이 優先합니다. sourcePolicy: "ordered"는 모든 記述子의 從來 配列 順序를 復元합니다.

    《標準國語大辭典》 CDB 로더는 stdict.cdb.gz를 내려받아 解凍합니다. 使用者 URL에는 gzip이나 壓縮하지 않은 CDB를 提供할 수 있으며, npm의 壓縮하지 않은 stdict.cdb 내보내기는 維持합니다.

    辭典 役割은 格子의 點數 目的 函數를 變更하지 않습니다. JavaScript 바인딩은 變換 前에 文書 全體를 버퍼링합니다. 〈스트리밍 API〉를 參照하십시오.