/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Street-morphology emission bias — Layer 1 of the four-layer street-supplement architecture (see * `docs/articles/concepts/street-supplement-architecture.md`). * * This module composes with {@linkcode buildFSTEmissionPriors} (admin FST) and the QueryShape prior * via {@linkcode addEmissionMatrix} — same shape, same additive semantics. Where the admin FST * biases admin BIO labels (`B/I-locality`, `B/I-region`, ...), the morphology FST biases: * * - **Affix-token (the matched span):** toward `B/I-street_prefix` AND `B/I-street_suffix` (position * unknown — let the model + context disambiguate). * - **Adjacent token (one before AND one after each match):** toward `B/I-street`, AWAY from * `B/I-dependent_locality`. The negative bias on `dependent_locality` is the essential piece * — it closes the inference-time vacuum that caused v0.6.1's 1066 dep_locality hallucinations * (see [[project-v061-failure-mechanism]]). * * The morphology FST itself is built by `resolver-wof-sqlite/street-morphology-fst-builder.ts` and * ships as a separate binary (`fst-street-morphology.bin`) loaded into a second `FSTMatcher` * instance. */ import { type FSTMatcherLike } from "./fst-prior.ts"; import type { TokenLike } from "./query-shape-prior.ts"; export interface StreetMorphologyPriorOpts { /** * Multiplier on the base bias before {@linkcode maxBias} is applied. Default 1.0. */ biasScale?: number; /** * Maximum bias magnitude (logits) on the affix span itself. Default 3.0 — same as the admin FST. The morphology * signal is structurally less ambiguous than admin names (`Avenue` is almost never anything but street-typing), so * equal magnitude is justified. */ maxAffixBias?: number; /** * Maximum bias magnitude (logits) on the adjacent (neighbour) tokens for the `street` label. Default 2.0 — a touch * weaker than the affix bias because the neighbour is inferred from adjacency, not direct match. */ maxNeighbourStreetBias?: number; /** * Magnitude of the negative bias applied to `dependent_locality` BIO labels on the adjacent tokens. Default 2.0. This * is the essential piece. */ dependentLocalityPenalty?: number; } /** * Build a `[seqLen][numLabels]` bias matrix from street-morphology FST matches. * * The output composes with the admin FST bias matrix via {@linkcode addEmissionMatrix} — same * `addEmissionMatrix(emissions, fstBias) → biasedEmissions` pattern as the existing admin prior. */ export declare function buildStreetMorphologyEmissionPriors(fst: FSTMatcherLike, pieces: ReadonlyArray, labels: ReadonlyArray, opts?: StreetMorphologyPriorOpts): number[][]; //# sourceMappingURL=street-morphology-prior.d.ts.map