phonemize
Version:
Fast phonemizer with rule-based G2P prediction. Pure JavaScript implementation.
29 lines (28 loc) • 1.35 kB
TypeScript
/**
* Post-lexical corrections for the rule path.
*
* Applied by predictInternal() to the joined syllable IPA right after
* syllableToIPA, before the stress mark is inserted — rule-path ONLY.
* This is deliberately separate from en-phonotactics.ts, which holds
* the small universal rule set applied to dict output as well; nothing
* here may move there without changing dict-word behavior.
*
* Two tables, applied in order:
* POST_PROC_RULES — unconditional IPA cleanup (degemination, rhotic
* merges, suffix vowel fixes).
* POST_LEX_RULES — orthography/etymology-conditioned corrections,
* each gated by a cheap guard on the spelling (and syllable count).
* Order is load-bearing: later rules see earlier rules' output.
*/
export declare const POST_PROC_RULES: Array<[RegExp, string]>;
/**
* Stress-mark convention repair for the rule path, applied after
* predictInternal inserts the primary mark: onset-maximize the mark
* position, add suffix secondary stress, shift primary onto -ation.
*/
export declare function applyPostStress(ipa: string, word: string): string;
/**
* Apply the unconditional cleanup then the guarded corrections, in
* table order, to the joined syllable IPA of the rule path.
*/
export declare function applyPostLexical(ipa: string, word: string, sylCount: number): string;