48,407
edits
No edit summary |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 47: | Line 47: | ||
local export = {} | local export = {} | ||
function export.vowel_harmony(term) | |||
local polarity = { | |||
["au"] = "back", ["[ei]?u[oa]?"] = "back", ["o[ai]?"] = "back", ["[ủỏ]"] = "back", | |||
["a[iy]"] = "front", ["ey"] = "front", ["ů[aei]?"] = "front", ["[ei]ů"] = "front", ["[ủỷả]"] = "front" | |||
} | |||
for pat, harmony in pairs(polarity) do | |||
if find(term, pat) then return harmony end | |||
end | |||
return "neutral" | |||
end | |||
-- exportable to be used by [[Module:pine-noun]] | -- exportable to be used by [[Module:pine-noun]] | ||
function export.syllabify_from_spelling(term) | function export.syllabify_from_spelling(term, is_ipa) | ||
local vowels = "[" .. vowels_spelling .. "]" | local vowels = "[" .. vowels_spelling .. "]" | ||
local consonants = consonants_spelling --lazy_consonants | local consonants = consonants_spelling --lazy_consonants | ||
| Line 62: | Line 75: | ||
word = gsub(word, "(" .. consonants .. ")·%1", "·%1%1") | word = gsub(word, "(" .. consonants .. ")·%1", "·%1%1") | ||
word = gsub(word, "(" .. vowels .. ")(" .. consonants .. ")·v(" .. vowels .. ")", "%1·%2v%3") | word = gsub(word, "(" .. vowels .. ")(" .. consonants .. ")·v(" .. vowels .. ")", "%1·%2v%3") | ||
word = gsub(word, "(" .. vowels .. ")t·([ʦʧ])(" .. vowels .. ")", "%1·t%2%3") | |||
word = gsub(word, " | |||
words[i] = word | words[i] = word | ||
end | end | ||
term = table.concat(words, " ") | |||
if not is_ipa then | |||
term = gsub(term, "([ʦʧ])", {["ʦ"] = "ts", ["ʧ"] = "tṡ"}) | |||
end | |||
return term | |||
end | end | ||
function export.crux(term) | function export.crux(term) | ||
term = export.syllabify_from_spelling(term) | term = export.syllabify_from_spelling(term, true) | ||
-- default to short lax vowels | -- default to short lax vowels | ||
| Line 94: | Line 112: | ||
term = gsub(term, "(.)%1", "%1ː"); term = gsub(term, "ng", "ŋː") | term = gsub(term, "(.)%1", "%1ː"); term = gsub(term, "ng", "ŋː") | ||
local final_subs = { | local final_subs = { | ||
["ʧ"] = "t͡ʃ", | ["ʧ"] = "t͡ʃ", | ||
| Line 103: | Line 120: | ||
["ṇ"] = "n" .. c.ringbelow, | ["ṇ"] = "n" .. c.ringbelow, | ||
["ṛ"] = "r" .. c.ringbelow, | ["ṛ"] = "r" .. c.ringbelow, | ||
["·"] = ".", | |||
} | } | ||
term = gsub(term, "[ | term = gsub(term, "[ʧʦgƛṃṇṛ·]", final_subs) | ||
return term | return term | ||