Module:xchc-noun: Difference between revisions

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


local function gsubh(word, o, e, r, u, def)
local function gsubh(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 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 = {["ɛ"] = e, ["ɔ"] = o, ["r"] = r, ["u"] = u}
local repl = {["ɛ"] = data.e, ["ɔ"] = data.o, ["r"] = data.r, ["u"] = data.u}
return not r and word:gsub("B", repl[backh] or def) or word:gsub("R", repl[roundh] or def)
return word:gsub("B", repl[backh or def]):gsub("R", repl[roundh or def])
end
end


Line 51: Line 51:
  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ӈ","о̆","э̆",nil,nil,"о̆")
  or gsubh("Bӈ",{["o"]="о̆",["e"]="э̆"},"o")
data.pl = {
data.pl = {
["i"] = wordpron(word):match(voiceless .. "ː?$") and gsubh("фBд","ө","э",nil,nil,"э") or gsubh("вBд","ө","э",nil,nil,"э"),
["i"] = wordpron(word):match(voiceless .. "ː?$") and gsubh("фBд",{["o"]="ө",["e"]="э"},"e") or gsubh("вBд",{["o"]="ө",["e"]="э"},"e"),
["a"] = wordpron(word):match(voiceless .. "ː?$") and gsubh("шBд","о̆","э̆",nil,nil,"о̆") or gsubh("жBд","о̆","э̆",nil,nil,"о̆"),
["a"] = wordpron(word):match(voiceless .. "ː?$") and gsubh("шBд",{["o"]="о̆",["e"]="э̆"},"o") or gsubh("жBд",{["o"]="о̆",["e"]="э̆"},"o")
}
}
Line 112: Line 112:
["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лз","ө", "э", nil, nil, "ө"),
["ins"] = w_number[n_sh]:match(vowel .. "ː?$") and "лза" or gsubh("Bлз",{["o"]="ө",["e"]="э"},"o"),
["pro"] = gsubh("сBц","ө", "э", nil, nil, "ө"),
["pro"] = gsubh("сBц","ө", "э", nil, nil, "ө"),
["ade"] = "ляц",
["ade"] = "ляц",
["abl"] = gsubh("сB",nil,nil,"u","i","u") .. gsubh("шR","о̄̆","э̄̆",nil,nil,"э̄̆"),
["abl"] = gsubh("сB",{["r"]="u",["u"]="i"},"r") .. gsubh("шR",{["o"]="о̄̆",["e"]="э̄̆"},"e"),
["ill"] = gsubh("кRб","ү","ы",nil,nil,"ы"),
["ill"] = gsubh("к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")