UNPKG

phonemize

Version:

Fast phonemizer with rule-based G2P prediction. Pure JavaScript implementation.

26 lines (25 loc) 803 B
export interface HomographEntry { pronunciation: string; pos: string; } export interface HomographDict { [word: string]: HomographEntry[]; } export declare class G2PModel { private dictionary; private homographs; constructor(); private matchPos; private wellKnown; private tryMorphologicalAnalysis; private tryDecomposition; private syllabify; private assignStress; private isSyllableHeavy; private isLikelyCompound; private syllableToIPA; predict(word: string, pos?: string, detectedLanguage?: string, disableDict?: boolean): string; addPronunciation(word: string, pronunciation: string): void; } export declare const g2pModel: G2PModel; export declare function predict(word: string, pos?: string, detectedLanguage?: string): string;