Module:xchc-noun: Difference between revisions

No edit summary
No edit summary
Line 24: Line 24:
end
end


local function gsubh(word, o, e, def)
local function gsubh(word, o, e, r, u, def)
local backh = word:match("ɛ") and "ɛ" or word:match("ɔ") and "ɔ" or nil
local ipa = m_ipa.crux(word)
local repl = {["ɛ"] = e, ["ɔ"] = o}
local backh = ipa:match("ɛ") and "ɛ" or ipa:match("ɔ") and "ɔ" or nil
return word:gsub("V", repl[backh] or def)
local roundh = ipa:match("[yuɔo]") and "r" or ipa:match("[ie]") and "u" or nil
local repl = {["ɛ"] = e, ["ɔ"] = o, ["r"] = r, ["u"] = u}
return not r and word:gsub("B", repl[backh] or def) or word:gsub("R", repl[roundh] or def)
end
end


Line 53: Line 55:
  or wordpron(word):me("[ɛa]") and "н"
  or wordpron(word):me("[ɛa]") and "н"
  or wordpron(word):me("[uoɔ]") and "ӈ"
  or wordpron(word):me("[uoɔ]") and "ӈ"
  or gsubh("", "о̆", "э̆", "о̆")
  or gsubh("","о̆","э̆",nil,nil,"о̆")
data.pl = {
data.pl = {
["i"] = wordpron(word):me(voiceless) and gsubh("фVд","ө","э","э") or gsubh("вVд","ө","э","э"),
["i"] = wordpron(word):me(voiceless) and gsubh("фBд","ө","э",nil,nil,"э") or gsubh("вBд","ө","э",nil,nil,"э"),
["a"] = wordpron(word):me(voiceless) and gsubh("шVд","о̆","э̆","о̆") or gsubh("жVд","о̆","э̆","о̆"),
["a"] = wordpron(word):me(voiceless) and gsubh("шBд","о̆","э̆",nil,nil,"о̆") or gsubh("жBд","о̆","э̆",nil,nil,"о̆"),
}
}


Line 106: Line 108:
local cases = {"nominative", "accusative", "dative", "genitive", "instrumental", "prosecutive", "adessive<br/>comitative", "ablative<br/>elative", "illative<br/>allative"}
local cases = {"nominative", "accusative", "dative", "genitive", "instrumental", "prosecutive", "adessive<br/>comitative", "ablative<br/>elative", "illative<br/>allative"}
local cases_sh = {"nom", "acc", "dat", "gen", "ins", "pro", "ade", "abl", "ill"}
local numbers = {"singular", "paucal", "plural"}
local numbers = {"singular", "paucal", "plural"}
local numbers_sh = {"si", "pa", "pl"}
local ret = {}
local ret = {}
Line 115: Line 116:
end
end
for _, n in ipairs(numbers) do
for _, number in ipairs(numbers) do
table.insert(ret, "! " .. n .. "\n")
table.insert(ret, "! " .. number .. "\n")
end
end
table.insert(ret, "|-\n")
table.insert(ret, "|-\n")
Line 124: Line 125:
table.insert(ret, "|-\n")
table.insert(ret, "|-\n")
for _, case in ipairs(cases) do
for _, case in ipairs(cases) do
table.insert(ret, "| " .. show_form(case .. data.sg) .. show_form(case .. data.pau) .. show_form(case .. data.pl[data.g]) .. "\n")
local c_sh = case:sub(1,3)
for _, number in ipairs(numbers) do
local n_sh = number:sub(1,3)
local decl = {
["nom"] = "",
["acc"] = w_number[n_sh]:me(vowel) and "дза" or w_number[n_sh]:me(voiced) and "да" or "та",
["dat"] = w_number[n_sh]:me(vowel) and "ша" or w_number[n_sh]:me(voiced) and "за" or "са",
["gen"] = "ля",
["ins"] = w_number[n_sh]:me(vowel) and "лза" or gsubh("Bлз","ө", "э", nil, nil, "ө"),
["pro"] = gsubh("сBц","ө", "э", nil, nil, "ө"),
["ade"] = "ляц",
["abl"] = gsubh("сB",nil,nil,"u","i","u") .. gsubh("шR","о̄̆","э̄̆",nil,nil,"э̄̆"),
["pro"] = gsubh("кFб","ү","ы",nil,nil,"ы"),
}
table.insert(ret, "| " .. show_form(w_number[n_sh] .. decl[c_sh]))
end
table.insert(ret, "\n")
end
end