/** * Tokenizer interface for alignment. * * Each token comes back with its (start, end) character offsets so BIO labels can be assigned * by span overlap with component spans, independent of how the tokenizer chose its splits. * The interface is deliberately minimal — only what alignment needs. */ import type { TextFragment } from "@mailwoman/core/tokenization/Span"; /** * A tokenizer that maps a string to a sequence of `TextFragment`s. */ export interface Tokenizer { tokenize(text: string): readonly TextFragment[]; } /** * Whitespace + punctuation tokenizer (pure JS). * * Tokens are maximal runs of unicode word characters (`\p{L}`, `\p{N}`, `\p{M}`, plus `'`, `-`, `_`); * everything else is a separator and isn't emitted, so the spans cover only token regions. * The lossiness at the edges is intentional, because alignment can still label every meaningful span. */ export declare function whitespaceTokenizer(): Tokenizer; /** * Whitespace tokenizer for Latin runs, one token per character for Han runs. * * The CJK sibling model is character-level (CharCNN), so a per-character token is the * unit it labels, while the Latin tail of a mixed row (`赵光三分场二十九队, Heilongjiang, China`) * keeps the word tokens the Latin aligner has always used. * Spans still come back as `[start, end)` offsets over the source string, * so the aligner's span-overlap rule needs no change. */ export declare function cjkAwareTokenizer(): Tokenizer; //# sourceMappingURL=tokenize.d.ts.map