/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * `NeuralProposalClassifier` — adapter that exposes a `NeuralAddressClassifier` as a * `ProposalClassifier` (the `@mailwoman/core/types` contract that the policy registry consumes). * * Implementation: for each section, run the neural classifier on `section.body`, walk the resulting * `AddressTree`, and emit one `ClassificationProposal` per node whose tag is in the `emits` list. * Spans are rebased to the original input via `section.start + node.start` so downstream * consumers see character offsets in the caller's coordinate space — same convention as * `wrapLegacyClassifier`. * * Per-section calls trade a small amount of context for the uniform `ProposalClassifier` shape. * Addresses inside a section are typically short and the model handles them well; whole-input * inference is a future optimization once the policy layer has a way to invoke a classifier "once * per parse" instead of per section. */ import type { ComponentTag, ProposalClassifier } from "@mailwoman/core/types"; import type { NeuralAddressClassifier } from "./classifier.ts"; export interface NeuralProposalClassifierConfig { /** * Stable id surfaced as `source_id` on every proposal (e.g. `neural-v0.2.0-en-us`). */ id: string; /** * The underlying neural classifier. Typed by the one method the adapter calls, so a caller may supply anything that * parses — a real classifier, a remote one, a test double — without asserting it is the whole class. */ classifier: Pick; /** * Component tags this classifier may emit. Defaults to the Stage 2 tag set (coarse + venue/street/house_number). * v0.2.0 Stage 1 models never decode to the fine tags anyway, so the broader default is forwards-compat without * back-compat risk. */ emits?: readonly ComponentTag[]; /** * Locales this classifier is active for. `["*"]` (locale-agnostic) by default. */ locales?: readonly (string | "*")[]; /** * Default penalty applied to emitted proposals. Default 0. */ penalty?: number; } /** * Build a `ProposalClassifier` backed by a `NeuralAddressClassifier`. */ export declare function createNeuralProposalClassifier(cfg: NeuralProposalClassifierConfig): ProposalClassifier; //# sourceMappingURL=proposal-classifier.d.ts.map