Module:xchc-noun: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 27: Line 27:
end
end


local function gsubbh(word, data, def)
local function gsubh(pat, repl, def)
local ipa = wordpron(word)
local word = data.word
local backh = ipa:match("ɛ") and "ɛ" or ipa:match("ɔ") and "ɔ" or nil
local harmony = m_ipa.harmony(word)
local repl = {["ɛ"] = data.e, ["ɔ"] = data.o, ["e"] = data.e, ["o"] = data.o}
local function todef(feat) return repl[harmony[feat]] or (type(def) == table and def[harmony[feat]] or repl[def]) end
return word:gsub("B", repl[backh or def])
end
if pat:match("B") and pat:match("R") then
pat = pat:gsub("B", todef("backness")):gsub("R", todef("roundness"))
else
pat = pat:gsub(pat:match("[BR]"),todef(pat:match("[BR]") == "B" and "backness" or "roundness"))
end


local function gsubrh(word, data, def)
return pat
local ipa = wordpron(word)
local roundh = ipa:match("[yuøo]") and "r" or ipa:match("[ie]") and "u" or nil
local repl = {["r"] = data.r, ["u"] = data.u}
return word:gsub("R", repl[roundh or def])
end
end


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