greek-text-utils
Version:
A collection of greek text utils, including conversion to ISO 843/ELOT 743, Greeklish, Phonetic Latin, and Transliterated Latin
248 lines • 5.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.greekCharacters = exports.voicedCharacters = exports.greekToISO843Type2Map = void 0;
/**
* Type 2 - Transcription (μεταγραφή) according to ELOT 743/ISO 843
* Basic character mappings for pronunciation-based conversion
* Context-sensitive rules (αυ/ευ/ηυ, μπ) are handled separately in the conversion function
* Used for passports, ID cards, road signs, maps
*/
exports.greekToISO843Type2Map = [
// Fixed digraphs and trigraphs
{ find: 'αι', replace: 'ai' },
{ find: 'αί', replace: 'ai' },
{ find: 'οι', replace: 'oi' },
{ find: 'οί', replace: 'oi' },
{ find: 'ου', replace: 'ou' },
{ find: 'ού', replace: 'ou' },
{ find: 'ει', replace: 'ei' },
{ find: 'εί', replace: 'ei' },
{ find: 'ντ', replace: 'nt' },
{ find: 'τσ', replace: 'ts' },
{ find: 'τς', replace: 'ts' },
{ find: 'τζ', replace: 'tz' },
{ find: 'γγ', replace: 'ng' },
{ find: 'γκ', replace: 'gk' },
{ find: 'γχ', replace: 'nch' },
{ find: 'γξ', replace: 'nx' },
// Fixed digraphs and trigraphs - uppercase
{ find: 'ΑΙ', replace: 'AI' },
{ find: 'ΑΊ', replace: 'AI' },
{ find: 'ΟΙ', replace: 'OI' },
{ find: 'ΟΊ', replace: 'OI' },
{ find: 'ΟΥ', replace: 'OU' },
{ find: 'ΟΎ', replace: 'OU' },
{ find: 'Ου', replace: 'Ou' },
{ find: 'Ού', replace: 'Ou' },
{ find: 'ΕΙ', replace: 'EI' },
{ find: 'ΕΊ', replace: 'EI' },
{ find: 'ΝΤ', replace: 'NT' },
{ find: 'ΤΣ', replace: 'TS' },
{ find: 'ΤΖ', replace: 'TZ' },
{ find: 'ΓΓ', replace: 'NG' },
{ find: 'ΓΚ', replace: 'GK' },
{ find: 'ΓΧ', replace: 'Nch' },
{ find: 'ΓΞ', replace: 'Nx' },
// Basic alphabet - lowercase
{ find: 'α', replace: 'a' },
{ find: 'ά', replace: 'a' },
{ find: 'β', replace: 'v' },
{ find: 'γ', replace: 'g' },
{ find: 'δ', replace: 'd' },
{ find: 'ε', replace: 'e' },
{ find: 'έ', replace: 'e' },
{ find: 'ζ', replace: 'z' },
{ find: 'η', replace: 'i' },
{ find: 'ή', replace: 'i' },
{ find: 'θ', replace: 'th' },
{ find: 'ι', replace: 'i' },
{ find: 'ί', replace: 'i' },
{ find: 'ϊ', replace: 'i' },
{ find: 'ΐ', replace: 'i' },
{ find: 'κ', replace: 'k' },
{ find: 'λ', replace: 'l' },
{ find: 'μ', replace: 'm' },
{ find: 'ν', replace: 'n' },
{ find: 'ξ', replace: 'x' },
{ find: 'ο', replace: 'o' },
{ find: 'ό', replace: 'o' },
{ find: 'π', replace: 'p' },
{ find: 'ρ', replace: 'r' },
{ find: 'σ', replace: 's' },
{ find: 'ς', replace: 's' },
{ find: 'τ', replace: 't' },
{ find: 'υ', replace: 'y' },
{ find: 'ύ', replace: 'y' },
{ find: 'ϋ', replace: 'y' },
{ find: 'ΰ', replace: 'y' },
{ find: 'φ', replace: 'f' },
{ find: 'χ', replace: 'ch' },
{ find: 'ψ', replace: 'ps' },
{ find: 'ω', replace: 'o' },
{ find: 'ώ', replace: 'o' },
// Basic alphabet - uppercase
{ find: 'Α', replace: 'A' },
{ find: 'Ά', replace: 'A' },
{ find: 'Β', replace: 'V' },
{ find: 'Γ', replace: 'G' },
{ find: 'Δ', replace: 'D' },
{ find: 'Ε', replace: 'E' },
{ find: 'Έ', replace: 'E' },
{ find: 'Ζ', replace: 'Z' },
{ find: 'Η', replace: 'I' },
{ find: 'Ή', replace: 'I' },
{ find: 'Θ', replace: 'Th' },
{ find: 'Ι', replace: 'I' },
{ find: 'Ί', replace: 'I' },
{ find: 'Ϊ', replace: 'I' },
{ find: 'Κ', replace: 'K' },
{ find: 'Λ', replace: 'L' },
{ find: 'Μ', replace: 'M' },
{ find: 'Ν', replace: 'N' },
{ find: 'Ξ', replace: 'X' },
{ find: 'Ο', replace: 'O' },
{ find: 'Ό', replace: 'O' },
{ find: 'Π', replace: 'P' },
{ find: 'Ρ', replace: 'R' },
{ find: 'Σ', replace: 'S' },
{ find: 'Τ', replace: 'T' },
{ find: 'Υ', replace: 'Y' },
{ find: 'Ύ', replace: 'Y' },
{ find: 'Ϋ', replace: 'Y' },
{ find: 'Φ', replace: 'F' },
{ find: 'Χ', replace: 'Ch' },
{ find: 'Ψ', replace: 'Ps' },
{ find: 'Ω', replace: 'O' },
{ find: 'Ώ', replace: 'O' },
];
/**
* Characters that are considered vowels or voiced consonants for context-sensitive rules
*/
exports.voicedCharacters = new Set([
'α',
'ά',
'β',
'γ',
'δ',
'ε',
'έ',
'ζ',
'η',
'ή',
'ι',
'ί',
'ϊ',
'ΐ',
'λ',
'μ',
'ν',
'ο',
'ό',
'ρ',
'υ',
'ύ',
'ϋ',
'ΰ',
'ω',
'ώ',
'Α',
'Ά',
'Β',
'Γ',
'Δ',
'Ε',
'Έ',
'Ζ',
'Η',
'Ή',
'Ι',
'Ί',
'Ϊ',
'Λ',
'Μ',
'Ν',
'Ο',
'Ό',
'Ρ',
'Υ',
'Ύ',
'Ϋ',
'Ω',
'Ώ',
]);
/**
* Greek characters set for checking if a character is Greek
*/
exports.greekCharacters = new Set([
'α',
'ά',
'β',
'γ',
'δ',
'ε',
'έ',
'ζ',
'η',
'ή',
'θ',
'ι',
'ί',
'ϊ',
'ΐ',
'κ',
'λ',
'μ',
'ν',
'ξ',
'ο',
'ό',
'π',
'ρ',
'σ',
'ς',
'τ',
'υ',
'ύ',
'ϋ',
'ΰ',
'φ',
'χ',
'ψ',
'ω',
'ώ',
'Α',
'Ά',
'Β',
'Γ',
'Δ',
'Ε',
'Έ',
'Ζ',
'Η',
'Ή',
'Θ',
'Ι',
'Ί',
'Ϊ',
'Κ',
'Λ',
'Μ',
'Ν',
'Ξ',
'Ο',
'Ό',
'Π',
'Ρ',
'Σ',
'Τ',
'Υ',
'Ύ',
'Ϋ',
'Φ',
'Χ',
'Ψ',
'Ω',
'Ώ',
]);
exports.default = exports.greekToISO843Type2Map;
//# sourceMappingURL=greek-to-iso843-type2-map.js.map