vbarzokas / greek-utils

A JavaScript library for Greek language with utilities such as replacement of accented and other diacritics characters, conversion from Greek to phonetic, transliterated or greeklish Latin and more.
MIT License
92 stars 7 forks source link

Suggestion - ELOT 743 #8

Open aapostolou opened 3 years ago

aapostolou commented 3 years ago

Hello everyone,

I want to suggest a new function based on the Greek Standard, ELOT 743 which is recognised by the EU.

Current Function

var greeklish = greekUtils.toGreeklish('Εύηχο: αυτό που ακούγεται ωραία.');
console.log(greeklish); //Euhxo: auto pou akougetai wraia.

Suggested Function (to Add)

var greeklish = greekUtils.toGreeklishELOT743('Εύηχο: αυτό που ακούγεται ωραία.');
console.log(greeklish); // Evicho: afto pou akougetai oraia.

Goverment App for Translation

Standard Documentation (in greek)


If i understand correctly, the mapping is working based on find/replace objects. We also need to sanitize the string which is already a function.

I will do my best to provide a greek-to-greeklish-elot743-map.js.

Regards, Alex

aapostolou commented 3 years ago
const greekToGreeklishELOT743Map = [
    // αυ
    { find: "αυα", replace: "ava" },
    { find: "αυβ", replace: "avv" },
    { find: "αυγ", replace: "avg" },
    { find: "αυδ", replace: "avd" },
    { find: "αυε", replace: "ave" },
    { find: "αυζ", replace: "avz" },
    { find: "αυη", replace: "avi" },
    { find: "αυθ", replace: "afth" },
    { find: "αυι", replace: "avi" },
    { find: "αυκ", replace: "afk" },
    { find: "αυλ", replace: "avl" },
    { find: "αυμ", replace: "avm" },
    { find: "αυν", replace: "avn" },
    { find: "αυξ", replace: "afx" },
    { find: "αυο", replace: "avo" },
    { find: "αυπ", replace: "afp" },
    { find: "αυρ", replace: "avr" },
    { find: "αυσ", replace: "afs" },
    { find: "αυτ", replace: "aft" },
    { find: "αυυ", replace: "afy" },
    { find: "αυφ", replace: "aff" },
    { find: "αυχ", replace: "afch" },
    { find: "αυω", replace: "avo" },
    // ευ
    { find: "ευα", replace: "eva" },
    { find: "ευβ", replace: "evv" },
    { find: "ευγ", replace: "evg" },
    { find: "ευδ", replace: "evd" },
    { find: "ευε", replace: "eve" },
    { find: "ευζ", replace: "evz" },
    { find: "ευη", replace: "evi" },
    { find: "ευθ", replace: "efth" },
    { find: "ευι", replace: "evi" },
    { find: "ευκ", replace: "efk" },
    { find: "ευλ", replace: "evl" },
    { find: "ευμ", replace: "evm" },
    { find: "ευν", replace: "evn" },
    { find: "ευξ", replace: "efx" },
    { find: "ευο", replace: "evo" },
    { find: "ευπ", replace: "efp" },
    { find: "ευρ", replace: "evr" },
    { find: "ευσ", replace: "efs" },
    { find: "ευτ", replace: "eft" },
    { find: "ευυ", replace: "efy" },
    { find: "ευφ", replace: "eff" },
    { find: "ευχ", replace: "efch" },
    { find: "ευω", replace: "evo" },
    // ιυ
    { find: "ιυα", replace: "iya" },
    { find: "ιυβ", replace: "iyv" },
    { find: "ιυγ", replace: "iyg" },
    { find: "ιυδ", replace: "iyd" },
    { find: "ιυε", replace: "iye" },
    { find: "ιυζ", replace: "iyz" },
    { find: "ιυη", replace: "iyi" },
    { find: "ιυθ", replace: "iyth" },
    { find: "ιυι", replace: "iyi" },
    { find: "ιυκ", replace: "iyk" },
    { find: "ιυλ", replace: "iyl" },
    { find: "ιυμ", replace: "iym" },
    { find: "ιυν", replace: "iyn" },
    { find: "ιυξ", replace: "iyx" },
    { find: "ιυο", replace: "iyo" },
    { find: "ιυπ", replace: "iyp" },
    { find: "ιυρ", replace: "iyr" },
    { find: "ιυσ", replace: "iys" },
    { find: "ιυτ", replace: "iyt" },
    { find: "ιυυ", replace: "iyy" },
    { find: "ιυφ", replace: "iyf" },
    { find: "ιυχ", replace: "iych" },
    { find: "ιυω", replace: "iyo" },
    // γ#
    { find: "γγ", replace: "ng" },
    { find: "γκ", replace: "gk" },
    { find: "γξ", replace: "gx" },
    { find: "γχ", replace: "gch" },
    // μπ
    { find: "μπ", replace: "b" },
    // ου
    { find: "ου", replace: "ou" },
    // alphabet
    { find: "α", replace: "a" },
    { find: "β", replace: "v" },
    { find: "γ", replace: "g" },
    { find: "δ", replace: "d" },
    { find: "ε", replace: "e" },
    { find: "ζ", replace: "z" },
    { find: "η", replace: "i" },
    { find: "θ", replace: "th" },
    { find: "ι", replace: "i" },
    { find: "κ", replace: "k" },
    { find: "λ", replace: "l" },
    { find: "μ", replace: "m" },
    { find: "ν", replace: "n" },
    { find: "ξ", replace: "x" },
    { find: "ο", replace: "o" },
    { find: "π", replace: "p" },
    { find: "ρ", replace: "r" },
    { find: "σ", replace: "s" },
    { find: "ς", replace: "s" },
    { find: "τ", replace: "t" },
    { find: "υ", replace: "y" },
    { find: "φ", replace: "f" },
    { find: "χ", replace: "ch" },
    { find: "ψ", replace: "ps" },
    { find: "ω", replace: "o" }
  ];
vbarzokas commented 3 years ago

Hi @aapostolou, thanks for the suggestion!

That looks fine, can you please create a PR with the above changes?

petsoukos commented 9 months ago

Was this ever implemented?

aapostolou commented 9 months ago

Was this ever implemented?

Hello, I don't believe it was !

stathisiakovidis commented 8 months ago

Was this ever implemented?

Hello, I don't believe it was !

Hi, you can create a pull request for your change in order to be added. I don't know if the lib is still maintained but you can try.