Module:xchc-noun: Difference between revisions
No edit summary |
No edit summary |
||
| Line 15: | Line 15: | ||
local export = {} | local export = {} | ||
local voiced = "mnɲŋbdɡvzʒɣlr" | |||
local voiceless = "ptkfsʃxh" | |||
return | local consonant = "[" .. voiced .. voiceless .. "]" | ||
local vowel = "[aeɛioɔuyø]" | |||
local function matchEnd(foo, pat) | |||
return foo:match(pat .. "ː?$") | |||
end | end | ||
local | local function gsubh(word, o, e, def) | ||
local repl = {["ɛ"] = e, ["ɔ"] = o} | |||
return word:gsub("V", repl[backh] or def) | |||
end | |||
function export.show(frame) | function export.show(frame) | ||
| Line 36: | Line 41: | ||
if g ~= "i" and g ~= "a" then error("Unknown gender: it must be either ‘i’ or ‘a’") end | if g ~= "i" and g ~= "a" then error("Unknown gender: it must be either ‘i’ or ‘a’") end | ||
local wordpron = m_ipa.crux(word) | |||
backh = word:match("ɛ") and "ɛ" or word:match("ɔ") and "ɔ" or nil | |||
local singular = word | |||
local paucal = wordpron:matchEnd("[eiøy]") and "ч" or wordpron:matchEnd("[ɛa]") and "н" or wordpron:matchEnd("[uoɔ]") and "ӈ" or gsubh("Vӈ", "о̆", "э̆", "о̆") | |||
local plural = { | |||
["i"] = wordpron:matchEnd(voiceless) and gsubh("фVд","ө","э","э") or gsubh("вVд","ө","э","э"), | |||
["a"] = wordpron:matchEnd(voiceless) and gsubh("шVд","о̆","э̆","о̆") or gsubh("жVд","о̆","э̆","о̆"), | |||
} | |||
end | end | ||