phonemize
Version:
Fast phonemizer with rule-based G2P prediction. Pure JavaScript implementation.
35 lines (34 loc) • 1.1 kB
TypeScript
/**
* Union of all closed-class / function-word categories: determiners,
* pronouns, prepositions, auxiliaries, modals, conjunctions, wh-words.
*
* Used by EnglishG2P to drop primary stress in connected speech — these
* words typically reduce when not in citation form.
*/
export declare const FUNCTION_WORDS: Set<string>;
export declare function isFunctionWord(word: string, pos?: string): boolean;
export declare function reduceToWeakForm(ipa: string): string;
export interface POSResult {
word: string;
pos: string;
confidence: number;
}
export declare class SimplePOSTagger {
/**
* Check if a word is likely a noun based on its endings
*/
private isLikelyNoun;
/**
* Tag a single word with its most likely POS
*/
tagWord(word: string, context?: string[]): POSResult;
/**
* Tag multiple words in sequence with context
*/
tagWords(words: string[]): POSResult[];
/**
* Simple sentence-level POS tagging
*/
tagSentence(text: string): POSResult[];
}
export declare const simplePOSTagger: SimplePOSTagger;