IPA to Auxlang Glyph Conversion Rules

Hi auxlangers,

For those interested, here is the IPA to Glyph Conversion code. As a reminder this converts the IPA from many languages, into glyphs which are used by the algorithmic auxlang for the purposes of root word generation.
If you have any qualms with it please express them.

There is ipaTo16Glyph, ipaTo24Glyph and ipaTo32Glyph. Thanks to a little encoding compression algorithm now can fit all valid syllables (~10,000) up to 32glyphs within 16bits.

Each code segment starts with the list of alphabet glyphs, followed by their IPA equivalents if different from their apparent selves.  /h/ is only used for grammar because if you look at it on a spectrogram it’s really more of an unvoiced vowel than a real consonant like /x/.

Thanks to Dana Nutter’s suggestion to put the IPA and replacements into an array I’ve improved the code making it easier to maintain and review.

the arrays are of the form [“match”, “replacement”],
I’ve grouped phonemes that translate to the same glyph

function ipaTo16Glyph(word) {
/*
var Bit4Alphabet =     [“m”,”k”,”i”,”a”,”y”,”u”,”p”,”w”,
“n”,”s”,”t”,”l”,”h”,”f”,”.”,”c”];
// c = /ʃ/
// y = /j/
// . = /ʔ/
//  note su glyph . ob only used for grammar ya
// h = /h/
//  note su glyph h ob only used for grammar ya
*/
var matchReplaceArray = [
/* punctuation */
[“\\(..\\)”, “”], [“\\(…\\)”, “”], [“ˈ”, “”],
[“ˌ”, “”], [“\\.”, “”], [“\\^”, “”], [“\-“, “”],
[“_”, “”], [‘”‘, “”], [“ː”, “”], [” “, “”],
/* vowels */
[“y”, “i”], [“Y”, “i”], [“ɪ”, “i”], [“ĩ”, “i”],
[“ɨ”, “i”], [“e”, “i”],
[“ɛ”, “a”], [“ɜ”, “a”], [“æ”, “a”], [“ɑ̃”, “a”],
[“ã”, “a”], [“ʌ”, “a”], [“ɑ”, “a”], [“ɐ̃”, “a”],
[“ɐ”, “a”],
[“o”, “u”], [“ɵ”, “u”], [“ɔ”, “u”], [“ʉ”, “u”],
[“ø”, “u”], [“œ̃”, “u”], [“œ”, “u”], [“ũ”, “u”],
[“ɯ”, “u”], [“õ”, “u”],
/** consonants **/
/* plosives */
[“b”, “p”],
[“ð”, “t”], [“ʈ”, “t”], [“ɗ”, “t”], [“ɖ”, “t”],
[“t̪”, “t”], [“ʈ”, “t”], [“d”, “t”],
[“c”, “k”], [“ɟ”, “k”], [“ʔ”, “k”], [“q”, “k”],
[“ɡ”, “k”], [“ˀ”, “k”],
/* approximants */
[“ʊ”, “w”],/* w like vowel */
[“v”, “w”], [“β”, “w”], [“w̃”, “w”], [“ʋ”, “w”],
[“l̩”, “l”], [“ɫ”, “l”], [“ɬ”, “l”], [“ɭ”, “l”],
[“ʎ”, “l”],
[“j”, “y”], [“ʲ”, “y”], [“ʁ”, “y”], [“ɾ”, “y”],
[“ɹ”, “y”], [“ɻ”, “y”], [“ɚ”, “y”]
/* fricatives */
[“θ”, “f”],
[“z”, “s”],
[“ʃ”, “c”], [“ʃ”, “c”], [“ʒ”, “c”], [“ʂ”, “c”],
[“ʐ”, “c”], [“ç”, “c”], [“ʝ”, “c”], [“ɕ”, “c”],
[“ʑ”, “c”], [“ɣ”, “c”], [“x”, “c”], [“ħ”, “c”],
[“ʰ”, “c”], [“h”, “c”], [“ʕ”, “c”], [“ʕ”, “c”],
[“؟”, “c”], [“ˤ”, “c”],
/* nasals */
[“m̩”, “m”],
[“ŋ”, “n”], [“ɳ”, “n”], [“ɲ”, “n”],
];
matchReplaceArray.forEach(function(tuple) {
var match = new RegExp(tuple[0], “g”),
replace = tuple[1];
word = word.replace(match, replace);
});
return word;
}
function ipaTo24Glyph(word) {
/*
var Glyph24Alphabet =     [“m”,”k”,”i”,”a”,”y”,”u”,”p”,”w”,
“n”,”s”,”t”,”l”,”h”,”f”,”.”,”c”,
“e”,”o”,”r”,”b”,”g”,”d”,”z”,”j”];
// c = /ʃ/
// j = /ʒ/
// y = /j/
// . = /ʔ/
//  note su glyph . ob only used for grammar ya
// h = /h/
//  note su glyph h ob only used for grammar ya
*/
var matchReplaceArray = [
/* punctuation */
[“\\(..\\)”, “”], [“\\(…\\)”, “”], [“ˈ”, “”],
[“ˌ”, “”], [“\\.”, “”], [“\\^”, “”], [“\\-“, “”],
[“_”, “”], [‘”‘, “”], [“ː”, “”], [” “, “”],
/* vowels */
[“y”, “i”], [“Y”, “i”], [“ɪ”, “i”], [“ĩ”, “i”],
[“ɨ”, “i”],
[“e”, “e”], [“ɛ”, “e”], [“ɜ”, “e”], [“ø”, “e”],
[“œ̃”, “e”], [“œ”, “e”],
[“æ”, “a”], [“ɑ̃”, “a”], [“ã”, “a”], [“ɑ”, “a”],
[“ɐ̃”, “a”], [“ɐ”, “a”],
[“ʌ”, “o”], [“o”, “o”], [“ɔ”, “o”], [“ɵ”, “o”],
[“õ”, “o”],
[“ʊ”, “u”], [“ʉ”, “u”], [“ũ”, “u”], [“ɯ”, “u”],
/** consonants **/
/* plosives */
[“ʈ”, “t”], [“t̪”, “t”], [“ʈ”, “t”],
[“ð”, “d”], [“ɗ”, “d”], [“ɖ”, “d”], [“d”, “d”],
[“b”, “b”],
[“c”, “k”], [“q”, “k”], [“ʔ”, “k”], [“ˀ”, “k”],
[“ɟ”, “g”], [“g”, “g”], [“ɡ”, “g”],
/* approximants */
[“v”, “w”], [“β”, “w”], [“w̃”, “w”], [“ʋ”, “w”],
[“l̩”, “l”], [“ɫ”, “l”], [“ɬ”, “l”], [“ɭ”, “l”],
[“ʎ”, “l”],
[“j”, “y”], [“ʲ”, “y”],
[“ɾ”, “r”], [“ɹ”, “r”], [“ɻ”, “r”], [“ɚ”, “r”],
[“ʁ”, “r”],/* espeak for ʀ */
/* fricatives */
[“θ”, “f”],
[“ʰ”, “c”], [“ʃ”, “c”], [“ʃ”, “c”], [“ʂ”, “c”],
[“ç”, “c”], [“ɕ”, “c”], [“x”, “c”], [“ħ”, “c”],
[“h”, “c”],
[“ʒ”, “j”], [“ʐ”, “j”], [“ʑ”, “j”], [“ʝ”, “j”],
[“ɣ”, “j”], [“ʕ”, “j”], [“ʕ”, “j”], [“؟”, “j”],
[“ˤ”, “j”],
/* nasals */
[“m̩”, “m”],
[“ŋ”, “n”], [“ɳ”, “n”], [“ɲ”, “n”],
];
matchReplaceArray.forEach(function(tuple) {
var match = new RegExp(tuple[0], “g”),
replace = tuple[1];
word = word.replace(match, replace);
});
return word;
}

function ipaTo32Glyph(word) {
/*
var Bit5Alphabet =     [“m”,”k”,”i”,”a”,”y”,”u”,”p”,”w”,
“n”,”s”,”t”,”l”,”h”,”f”,”.”,”c”,
“e”,”o”,”r”,”b”,”g”,”d”,”z”,”j”,
“v”,”q”,”7″,”_”,”6″,”x”,”1″,”8″];
// c = /ʃ/
// j = /ʒ/
// y = /j/
// q = /ŋ/
// 6 = /ə/
// 7 = /˦/ // high tone for rare words
// _ = /˨/ // low tone for rare words
// 1 = /ǀ/ // dental click for temporary words
// 8 = /ǁ/ // lateral click for temporary words
// . = /ʔ/ // glotal stop only used for grammar ya
// h = /h/ // glotal fricative only used for grammar ya
*/
var matchReplaceArray = [
/* punctuation */
[“\\(..\\)”, “”], [“\\(…\\)”, “”], [“ˈ”, “”],
[“ˌ”, “”], [“\\.”, “”], [“\\^”, “”], [“\\-“, “”],
[“_”, “”], [‘”‘, “”], [“ː”, “”], [” “, “”],
/* vowels */
[“y”, “i”], [“Y”, “i”], [“ɪ”, “i”], [“ĩ”, “i”],
[“ɨ”, “i”],
[“e”, “e”], [“ɛ”, “e”], [“ɜ”, “e”], [“ø”, “e”],
[“œ̃”, “e”], [“œ”, “e”],
[“æ”, “a”], [“ɑ̃”, “a”], [“ã”, “a”], [“ɑ”, “a”],
[“ɐ̃”, “a”], [“ɐ”, “a”],
[“ʌ”, “o”], [“o”, “o”], [“ɔ”, “o”], [“ɵ”, “o”],
[“õ”, “o”],
[“ʊ”, “u”], [“ʉ”, “u”], [“ũ”, “u”], [“ɯ”, “u”],
[“ə”, “6”],
/* tones */
[“˨”, “_”], [“˩”, “_”],
[“˥”, “7”], [“˦”, “7”],
[“˧”, “”],
/** consonants **/
/* plosives */
[“ʈ”, “t”], [“t̪”, “t”], [“ʈ”, “t”],
[“ð”, “d”], [“ɗ”, “d”], [“ɖ”, “d”], [“d”, “d”],
[“b”, “b”],
[“c”, “k”], [“q”, “k”], [“ʔ”, “k”], [“ˀ”, “k”],
[“ɟ”, “g”], [“g”, “g”], [“ɡ”, “g”],
/* approximants */
[“w̃”, “w”], [“ʋ”, “w”],
[“l̩”, “l”], [“ɫ”, “l”], [“ɬ”, “l”], [“ɭ”, “l”],
[“ʎ”, “l”],
[“j”, “y”], [“ʲ”, “y”],
[“ɾ”, “r”], [“ɹ”, “r”], [“ɻ”, “r”], [“ɚ”, “r”],
[“ʁ”, “r”],/* espeak for ʀ */
/* fricatives */
[“v”, “v”], [“β”, “v”],
[“θ”, “f”],
[“ʃ”, “c”], [“ʃ”, “c”], [“ʂ”, “c”], [“ç”, “c”],
[“ɕ”, “c”],
[“ʒ”, “j”], [“ʐ”, “j”], [“ʑ”, “j”], [“ʝ”, “j”],
[“x”, “x”], [“ħ”, “x”], [“h”, “x”], [“ʰ”, “x”],
[“ɣ”, “x”], [“ʕ”, “x”], [“ʕ”, “x”], [“؟”, “x”],
[“ˤ”, “x”],
/* nasals */
[“m̩”, “m”],
[“ɳ”, “n”],
[“ŋ”, “q”], [“ɲ”, “q”],
];
matchReplaceArray.forEach(function(tuple) {
var match = new RegExp(tuple[0], “g”),
replace = tuple[1];
word = word.replace(match, replace);
});
return word;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s