UNPKG

cmu-syllable-counter

Version:

Fast and accurate syllable counter for English words using CMU Dictionary

56 lines 2.06 kB
export { cmuDictionary } from "./dictionary"; export { syllableCounter, SyllableCounter } from "./syllable-counter"; export type { WordDetail, Analysis, SyllableCountResult, SyllableCountOptions, CoreHyphenationOptions, HyphenationResult }; export type { WordAnalysis, WordSearchOptions } from "./dictionary"; import type { HyphenationOptions } from "./syllable-counter"; interface WordDetail { word: string; hyp: string; sc: number; source: "cmu" | "fallback"; pron?: string; } interface Analysis { totalWords: number; avgSyllablesPerWord: number; lines: number; } interface SyllableCountResult { totalSyllableCount: number; wordDetails?: WordDetail[]; analysis?: Analysis; } interface SyllableCountOptions { includeHyp?: boolean; delimiter?: string; includePron?: boolean; includeAnalysis?: boolean; } interface CoreHyphenationOptions extends HyphenationOptions { includeAnalysis?: boolean; } interface HyphenationResult { hyp: string; words: WordDetail[]; analysis?: Analysis; } /** * Unified syllable counting function for words or sentences * @param wordsOrSentences - A single word, sentence, or an array of words/sentences * @param options - Configuration options * @returns Promise with total syllable count and optional hyphenation/pronunciation data */ export declare function getSyllableCount(wordsOrSentences: string | string[], options?: SyllableCountOptions): Promise<SyllableCountResult>; /** * Get hyphenated string with word details * @param wordsOrSentences - A single word, sentence, or an array of words/sentences * @param options - Configuration options * @returns Promise with hyphenated string and word details */ export declare function getHyphenatedString(wordsOrSentences: string | string[], options?: CoreHyphenationOptions): Promise<HyphenationResult>; declare const _default: { getSyllableCount: typeof getSyllableCount; getHyphenatedString: typeof getHyphenatedString; }; export default _default; //# sourceMappingURL=core.d.ts.map