Module:xchc-noun: Difference between revisions

No edit summary
No edit summary
Line 26: Line 26:
end
end


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


function export.show(frame)
function export.show(frame)
Line 51: Line 59:
  or wordpron(word):match("[ɛa]$") and "н"
  or wordpron(word):match("[ɛa]$") and "н"
  or wordpron(word):match("[uoɔ]$") and "ӈ"
  or wordpron(word):match("[uoɔ]$") and "ӈ"
  or gsubh("Bӈ",{["o"]="о̆",["e"]="э̆"},"o")
  or gsubbh("Bӈ",{["o"]="о̆",["e"]="э̆"},"o")
data.pl = {
data.pl = {
["i"] = wordpron(word):match(voiceless .. "ː?$") and gsubh("фBд",{["o"]="ө",["e"]="э"},"e") or gsubh("вBд",{["o"]="ө",["e"]="э"},"e"),
["i"] = wordpron(word):match(voiceless .. "ː?$") and gsubbh("фBд",{["o"]="ө",["e"]="э"},"e") or gsubbh("вBд",{["o"]="ө",["e"]="э"},"e"),
["a"] = wordpron(word):match(voiceless .. "ː?$") and gsubh("шBд",{["o"]="о̆",["e"]="э̆"},"o") or gsubh("жBд",{["o"]="о̆",["e"]="э̆"},"o")
["a"] = wordpron(word):match(voiceless .. "ː?$") and gsubbh("шBд",{["o"]="о̆",["e"]="э̆"},"o") or gsbubh("жBд",{["o"]="о̆",["e"]="э̆"},"o")
}
}
Line 112: Line 120:
["dat"] = w_number[n_sh]:match(vowel .. "ː?$") and "ша" or w_number[n_sh]:match(voiced .. "ː?$") and "за" or "са",
["dat"] = w_number[n_sh]:match(vowel .. "ː?$") and "ша" or w_number[n_sh]:match(voiced .. "ː?$") and "за" or "са",
["gen"] = "ля",
["gen"] = "ля",
["ins"] = w_number[n_sh]:match(vowel .. "ː?$") and "лза" or gsubh("Bлз",{["o"]="ө",["e"]="э"},"o"),
["ins"] = w_number[n_sh]:match(vowel .. "ː?$") and "лза" or gsubbh("Bлз",{["o"]="ө",["e"]="э"},"o"),
["pro"] = gsubh("сBц","ө", "э", nil, nil, "ө"),
["pro"] = gsubbh("сBц","ө", "э", nil, nil, "ө"),
["ade"] = "ляц",
["ade"] = "ляц",
["abl"] = gsubh("сB",{["r"]="u",["u"]="i"},"r") .. gsubh("шR",{["o"]="о̄̆",["e"]="э̄̆"},"e"),
["abl"] = gsubbh("сB",{["r"]="u",["u"]="i"},"r") .. gsubrh("шR",{["o"]="о̄̆",["e"]="э̄̆"},"e"),
["ill"] = gsubh("кRб",{["r"]="ү",["u"]="ы"},"u"),
["ill"] = gsubrh("кRб",{["r"]="ү",["u"]="ы"},"u"),
}
}
table.insert(ret, "| " .. show_form(w_number[n_sh] .. decl[c_sh]) .. "\n")
table.insert(ret, "| " .. show_form(w_number[n_sh] .. decl[c_sh]) .. "\n")