/** * @file Renders a Korean address in one of seven registers and decides which registers a row supports. * * A register is one way to write an address: the ministry form, typed, delivery, the spoken short region, search * without spaces, or the lot-number form. `short_region` needs a known short form, `official` and `building` need * the parenthetical, and `jibun` needs a lot with its 동. * * Ported from the Python builders' `countries/kr/corpora/rows.py`. */ import type { SeededRandom } from "@mailwoman/core/math/random"; import { type CJKRecord } from "#cjk/builder"; import { type JusoLabelRow } from "#kr/adapters/juso/label-rows"; import { type Aligned } from "#kr/adapters/localdata/align"; import type { KeyIndex } from "#kr/adapters/localdata/key-index"; import { type PermitRow } from "#kr/adapters/localdata/permit-rows"; /** * The label set Korean rows are tagged against. */ export declare const KR_LABEL_SET_NAME = "stage3-cjk"; /** * The corpus source of the register rows. */ export declare const KR_CORPUS_SOURCE = "juso-kr"; /** * The corpus source of the aligned permit rows. */ export declare const KR_REGISTRY_SOURCE = "localdata-kr"; /** * Each register's weight. * * The sampler renormalizes them over the registers a row can render. */ export declare const KR_REGISTER_WEIGHTS: Map; /** * Options for {@linkcode renderKRRow}. */ export interface KRRenderOptions { register: string; country?: boolean; shortRegion?: string | null; } /** * One register row rendered in one register as a span-labeled corpus record. * * A compound 시군구 (`수원시 장안구`) is two adjacent subregion spans. 세종특별자치시 has no 시군구, * so its rows go from the region to the 읍/면 or the road. * * @throws When the `short_region` register has no short form. */ export declare function renderKRRow(row: JusoLabelRow, options: KRRenderOptions): CJKRecord; /** * The registers a row can render. */ export declare function availableKRRegisters(row: JusoLabelRow): string[]; /** * One of `options`, drawn by {@linkcode KR_REGISTER_WEIGHTS}. * A single option is returned without a draw. */ export declare function chooseKRRegister(rng: SeededRandom, options: readonly string[]): string; /** * One of a region's short forms, or `null` without a draw when it has none. */ export declare function chooseShortRegion(rng: SeededRandom, region: string): string | null; /** * Why a register row is dropped, or `null` when it renders. * * 시군구 isn't required, because 세종특별자치시 has none. */ export declare function krIneligibility(row: JusoLabelRow, maxFieldChars: number): string | null; /** * The centroid and hold-out key: the register's current region name, * so a pre-merger permit row keys the same unit. */ export declare function krHoldoutKey(region: string, sigungu: string): string; /** * An aligned permit string as a registry corpus record. */ export declare function krRegistryRecord(aligned: Aligned): CJKRecord; /** * Every form of one permit that aligns and fits the model's window. * * A clerk's 99-character unit list would be truncated by the loader, so it is a board row instead. */ export declare function krPermitAlignment(row: PermitRow, index: KeyIndex): Aligned[]; //# sourceMappingURL=rows.d.ts.map