UNPKG

@lunarisapp/language

Version:

A utility library for core linguistic breakdown: vowels, consonants, words, and sentences.

30 lines (23 loc) 1.21 kB
declare const languages: readonly ["af", "as", "be", "bg", "ca", "da", "de", "de_DE", "de_CH", "de_AT", "en", "en_US", "en_GB", "eo", "es", "et", "fr", "gl", "hr", "hu", "id", "is", "it", "kn", "lt", "lv", "mn", "mr", "nb", "nl", "nn", "pa", "pl", "pt", "pt_PT", "pt_BR", "ro", "ru", "sa", "sk", "sl", "sq", "sr", "sr_Latn", "sv", "te", "th", "uk", "zu"]; type Language = (typeof languages)[number]; declare const vowels: Readonly<Record<Language, readonly string[]>>; declare const consonants: Readonly<Record<Language, readonly string[]>>; declare const contractionsRegexSeq: Readonly<Partial<Record<Language, string>>>; /** * Remove punctuation from text. * @param text * @param ignoreContractions */ declare function removePunctuation(text: string, ignoreContractions?: boolean): string; /** * Get the words from text. * @param text * @param isRemovePunctuation */ declare function getWords(text: string, isRemovePunctuation?: boolean): string[]; /** * Get the sentences from text. * @param text */ declare function getSentences(text: string): RegExpMatchArray | []; export { type Language, consonants, contractionsRegexSeq, getSentences, getWords, languages, removePunctuation, vowels };