phonemize
Version:
Fast phonemizer with rule-based G2P prediction. Pure JavaScript implementation.
26 lines (25 loc) • 1.17 kB
TypeScript
/**
* RP (Received Pronunciation) post-processing for English G2P output.
*
* The base English G2P returns General American IPA. This module turns
* that output into a reasonable RP / Southern Standard British rendering
* via rule-based transformation — no separate dictionary file is loaded
* (which would roughly double the package size).
*
* Coverage is intentionally conservative:
* - non-rhoticity (drop coda /ɹ/, lengthen the preceding vowel)
* - NURSE split: stressed /ɝ/ → /ɜː/, unstressed → /ə/
* - SQUARE / NEAR / CURE diphthongs from /Vɹ/ pairs
* - FIRE / POWER from diphthong + /ɹ/
* - French -age borrowings: lengthen final stressed vowel + drop /d/
* - yod retention after word-initial /s/ (sue, suit, super, …)
*
* Words whose RP form genuinely can't be derived by rule (schedule,
* tomato, herb, …) live in `src-data/en-gb/lexical.json`, not in this
* source file.
*/
/**
* Convert American-English IPA to RP IPA for the given word. Looks up
* lexical shibboleths first; falls back to rule-based transformation.
*/
export declare function transformAmericanToRP(word: string, ipaUS: string): string;