/** * Hyphenation Engine * * Implements Liang's hyphenation algorithm (as used in TeX) for automatic * word hyphenation without external dependencies. * * Features: * - Pattern-based hyphenation (Liang algorithm) * - Built-in patterns for English (US) * - Pluggable pattern sets for other languages * - Min-prefix / min-suffix constraints * - Exception dictionary support * * @stability experimental */ /** Hyphenation options. */ export interface HyphenationOptions { /** Minimum characters before the first hyphenation point. Default: 2. */ readonly minLeft?: number; /** Minimum characters after the last hyphenation point. Default: 2. */ readonly minRight?: number; /** Custom hyphen character. Default: "\u00AD" (soft hyphen). */ readonly hyphenChar?: string; } /** Hyphenation pattern set for a language. */ export interface HyphenationPatterns { /** Language identifier (e.g., "en-us"). */ readonly language: string; /** Patterns in Liang format (e.g., ".ach4" means level 4 between 'c' and 'h' at word start). */ readonly patterns: readonly string[]; /** Exception words with explicit hyphenation (e.g., "as-so-ciate"). */ readonly exceptions?: readonly string[]; } /** * Create a hyphenator function for a given language/pattern set. * * @param patterns - The hyphenation patterns to use. * @param options - Hyphenation constraints. * @returns A function that takes a word and returns an array of hyphenation points (indices). */ export declare function createHyphenator(patterns: HyphenationPatterns, options?: HyphenationOptions): (word: string) => number[]; /** * Hyphenate a word by inserting soft hyphens at valid break points. * * @param word - The word to hyphenate. * @param hyphenator - A hyphenator function (from createHyphenator). * @param hyphenChar - The hyphen character to insert. Default: "\u00AD". * @returns The word with soft hyphens inserted. */ export declare function hyphenateWord(word: string, hyphenator: (w: string) => number[], hyphenChar?: string): string; /** * Hyphenate all words in a text string. * * @param text - The text to hyphenate. * @param hyphenator - A hyphenator function. * @param hyphenChar - The hyphen character to insert. * @returns The text with soft hyphens inserted. */ export declare function hyphenateText(text: string, hyphenator: (w: string) => number[], hyphenChar?: string): string; /** * English (US) hyphenation patterns — comprehensive TeX US English patterns. * Based on Liang's dissertation patterns (hyph-en-us) providing full coverage * for standard English word hyphenation. */ export declare const ENGLISH_US_PATTERNS: HyphenationPatterns;