Last active
October 22, 2018 20:36
-
-
Save Romern/e4d522a1023483a344d9dc6e06af8857 to your computer and use it in GitHub Desktop.
Small js script using https://github.com/evanshortiss/ogham to convert ogham phrases back to latin (with no changes to the database because I'm lazy)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//const ogham = require('ogham'); | |
let test = { | |
individual: { | |
' ': { | |
char: ' ', | |
code: 5760 | |
}, | |
b: { | |
char: 'ᚁ', | |
code: 5761 | |
}, | |
l: { | |
char: 'ᚂ', | |
code: 5762 | |
}, | |
f: { | |
char: 'ᚃ', | |
code: 5763 | |
}, | |
s: { | |
char: 'ᚄ', | |
code: 5764 | |
}, | |
n: { | |
char: 'ᚅ', | |
code: 5765 | |
}, | |
h: { | |
char: 'ᚆ', | |
code: 5766 | |
}, | |
d: { | |
char: 'ᚇ', | |
code: 5767 | |
}, | |
t: { | |
char: 'ᚈ', | |
code: 5768 | |
}, | |
c: { | |
char: 'ᚉ', | |
code: 5769 | |
}, | |
q: { | |
char: 'ᚊ', | |
code: 5770 | |
}, | |
m: { | |
char: 'ᚋ', | |
code: 5771 | |
}, | |
g: { | |
char: 'ᚌ', | |
code: 5772 | |
}, | |
z: { | |
char: 'ᚎ', | |
code: 5774 | |
}, | |
r: { | |
char: 'ᚏ', | |
code: 5775 | |
}, | |
a: { | |
char: 'ᚐ', | |
code: 5776 | |
}, | |
o: { | |
char: 'ᚑ', | |
code: 5777 | |
}, | |
u: { | |
char: 'ᚒ', | |
code: 5778 | |
}, | |
e: { | |
char: 'ᚓ', | |
code: 5779 | |
}, | |
i: { | |
char: 'ᚔ', | |
code: 5780 | |
}, | |
p: { | |
char: 'ᚚ', | |
code: 5786 | |
} | |
}, | |
// These are part of the aicme forfeda and are treated as opt-in by the module | |
// https://en.wikipedia.org/wiki/Forfeda#The_aicme_forfeda | |
combination: { | |
ea: { | |
char: 'ᚕ', | |
code: 5781 | |
}, | |
oi: { | |
char: 'ᚖ', | |
code: 5782 | |
}, | |
ui: { | |
char: 'ᚗ', | |
code: 5783 | |
}, | |
// ng: { | |
// char: "ᚍ", | |
// code: 5773 | |
// }, | |
ia: { | |
char: 'ᚘ', | |
code: 5784 | |
}, | |
ae: { | |
char: 'ᚙ', | |
code: 5785 | |
} | |
}, | |
head: { | |
char: '᚛', | |
code: 5787 | |
}, | |
tail: { | |
char: '᚜', | |
code: 5788 | |
} | |
}; | |
function convertBack(input) { | |
let out = ""; | |
for (var char of input) { | |
//console.log(char); | |
for (let latinletter in test.individual) { | |
let oghamsymbol = test.individual[latinletter]['char']; | |
if (oghamsymbol == char) { | |
out = out.concat(latinletter); | |
} | |
} | |
for (let latinletter in test.combination) { | |
let oghamsymbol = test.combination[latinletter]['char']; | |
if (oghamsymbol == char) { | |
out = out.concat(latinletter); | |
} | |
} | |
} | |
return out; | |
} | |
//console.log(ogham.convert('Was zum Teufel hast du grade ueber mich gesagt du kleine Schlampe Du solltest wissen dass ich meine Ausbildung beim GSG neun als Jahrgangsbester abgeschlossen habe in mehrere Kommandounternehmen gegen Al Kaida involviert war und ueber dreihundert bestaetigte Toetungen habe',{usePhonetics: true})) | |
console.log(convertBack("᚛ᚒᚒᚐᚄ ᚎᚒᚋ ᚈᚓᚒᚃᚓᚂ ᚆᚐᚄᚈ ᚇᚒ ᚌᚏᚐᚇᚓ ᚒᚓᚁᚓᚏ ᚋᚔᚉᚆ ᚌᚓᚄᚐᚌᚈ ᚇᚒ ᚊᚂᚓᚔᚅᚓ ᚄᚉᚆᚂᚐᚋᚚᚓ ᚇᚒ ᚄᚑᚂᚂᚈᚓᚄᚈ ᚒᚒᚔᚄᚄᚓᚅ ᚇᚐᚄᚄ ᚔᚉᚆ ᚋᚓᚔᚅᚓ ᚐᚒᚄᚁᚔᚂᚇᚒᚅᚌ ᚁᚓᚔᚋ ᚌᚄᚌ ᚅᚓᚒᚅ ᚐᚂᚄ ᚌᚐᚆᚏᚌᚐᚅᚌᚄᚁᚓᚄᚈᚓᚏ ᚐᚁᚌᚓᚄᚉᚆᚂᚑᚄᚄᚓᚅ ᚆᚐᚁᚓ ᚔᚅ ᚋᚓᚆᚏᚓᚏᚓ ᚊᚑᚋᚋᚐᚅᚇᚑᚒᚅᚈᚓᚏᚅᚓᚆᚋᚓᚅ ᚌᚓᚌᚓᚅ ᚐᚂ ᚊᚐᚔᚇᚐ ᚔᚅᚃᚑᚂᚃᚔᚓᚏᚈ ᚒᚒᚐᚏ ᚒᚅᚇ ᚒᚓᚁᚓᚏ ᚇᚏᚓᚔᚆᚒᚅᚇᚓᚏᚈ ᚁᚓᚄᚈᚐᚓᚈᚔᚌᚈᚓ ᚈᚑᚓᚈᚒᚅᚌᚓᚅ ᚆᚐᚁᚓ᚜")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment