phonemize
Version:
Fast phonemizer with rule-based G2P prediction. Pure JavaScript implementation.
19 lines (18 loc) • 813 B
TypeScript
/**
* P3.1: Runtime letter-to-sound lookup using the compiled LTS table.
*
* predictByLTS(word) walks the word left-to-right, at each position trying
* the longest grapheme cluster known to the table and backing off through
* context levels (full L+R → L-only → R-only → no-context) until a phoneme
* mapping is found. If nothing matches even with single-letter no-context
* lookup, that letter is dropped from the output (alignments allow silent
* letters, so this is rare).
*
* Output IPA has no stress marks — stress comes from the principled
* pipeline (en-principled).
*/
/**
* Predict an IPA realization of `word` using the LTS table. Returns null
* only if the word contains a character the table has never seen.
*/
export declare function predictByLTS(word: string): string | null;