UNPKG

greek-text-utils

Version:

A collection of greek text utils, including conversion to ISO 843/ELOT 743, Greeklish, Phonetic Latin, and Transliterated Latin

55 lines (54 loc) 2.55 kB
/** * A collection of utilities for the Greek language such as replacement of accented and other diacritics characters, * conversion from Greek to phonetic, transliterated or greeklish Latin and more. */ declare const greekUtils: { /** * Convert a Latin/greeklish characters text to its modern Greek equivalent. */ toGreek: (text: string, ignoreCharacters?: string) => string; /** * Convert a modern Greek characters text to its greeklish equivalent. */ toGreeklish: (text: string, ignoreCharacters?: string) => string; /** * Convert a modern Greek characters text to its phonetically equivalent Latin (sound mapping). */ toPhoneticLatin: (text: string, ignoreCharacters?: string) => string; /** * Convert a modern Greek characters text to its transliterated equivalent Latin (letter mapping). */ toTransliteratedLatin: (text: string, ignoreCharacters?: string) => string; /** * Convert a modern Greek characters text to its ISO 843/ELOT 743 Type 1 equivalent Latin. * Type 1 (Transliteration/μεταγραμματισμός): Simple, consistent, reversible character mapping. * Used for bibliographic references, catalogs, databases. */ toISO843Type1: (text: string) => string; /** * Convert ISO 843/ELOT 743 Type 1 Latin text back to Greek (retransliteration per spec). * Applies final sigma (ς) at word ends as defined by the standard. */ fromISO843Type1: (text: string) => string; /** * Convert a modern Greek characters text to its ISO 843/ELOT 743 Type 2 equivalent Latin. * Type 2 (Transcription/μεταγραφή): Context-sensitive, pronunciation-based conversion. * Used for passports, ID cards, road signs, maps. */ toISO843Type2: (text: string) => string; /** * Convert a modern Greek characters text to its ISO 843/ELOT 743 equivalent Latin. * This uses Type 2 (Transcription) for compatibility with government implementations. * @deprecated Use toISO843Type2() for explicit Type 2 or toISO843Type1() for Type 1 */ toISO843: (text: string) => string; /** * Convert a modern/ancient Greek characters text containing diacritics to its simple equivalent without diacritics. */ sanitizeDiacritics: (text: string, ignoreCharacters?: string) => string; /** * Removes all Greek stop words from a text. */ removeStopWords: (text: string, shouldRemoveMultipleWhiteSpaces?: boolean) => string; }; export default greekUtils;