Module:xchc-noun: Difference between revisions

No edit summary
No edit summary
 
(23 intermediate revisions by the same user not shown)
Line 10: Line 10:
local m_tr = require('Module:xchc-translit')
local m_tr = require('Module:xchc-translit')
local m_ipa = require('Module:xchc-pron')
local m_ipa = require('Module:xchc-pron')
local c = require("Module:languages/data").chars


local lang = require('Module:languages').getByCode("xchc")
local lang = require('Module:languages').getByCode("xchc")
Line 17: Line 19:
local export = {}
local export = {}


local voiced = "mnɲŋbdɡvzʒɣlr"
local voiced = "мньӈбдгвзжғлрй" --"mnɲŋbdɡvzʒɣlr"
local voiceless = "ptkfsʃxh"
local voiceless = "пткфсшӀчц" --"ptkfsʃxh"
local consonant = "[" .. voiced .. voiceless .. "]"
local consonant = "[" .. voiced .. voiceless .. "]"
local vowel = "[aeɛioɔuyø]"
local vowel = "[ыиэеаяүөуюоёӯӣɜɔ]" --"[aeɛioɔuyø]"
local genders = {["a"] = "animate", ["i"] = "inanimate"}
local genders = {["a"] = "animate", ["i"] = "inanimate"}
local function pron(w)
return m_ipa.crux(w)
end


local function gsubh(word, pat, repl, def)
local function gsubh(word, pat, repl, def)
Line 46: Line 44:
local word = NAMESPACE == "Template" and "өра̄" or parent_args["word"] or PAGENAME
local word = NAMESPACE == "Template" and "өра̄" or parent_args["word"] or PAGENAME
local unc = parent_args["unc"] or false
local unc = parent_args["unc"] or false
local args = {}
local args = {}
Line 52: Line 51:
data = {}
data = {}
data.word = word
data.word = word
data.nocat = parent_args["nocat"] or false
data.g = g
data.g = g
data.sg = ""
data.sg = ""
local lastipa = match(pron(word), "(.)ː?$")
local pautable = {["a"] = "н", ["e"] = "ч", ["ɛ"] = "н", ["i"] = "ч", ["o"] = "ӈ", ["ɔ"] = "ӈ", ["ø"] = "ч", ["u"] = "ӈ", ["y"] = "ч"}
local pautable = {
data.pau = pautable[lastipa] or gsubh(word, "Bӈ",{["b"]="о̆",["f"]="э̆", ["ab"]="о̆"})
["[эеыиӣөү]"] = "ч",
["[ɛая]"] = "н",
["[уӯоɔ]"] = "ӈ",
}
local simplified_word = m_ipa.simplify(word)
--data.pau = nil
if simplified_word:match(vowel .. "$") then
for pat, pau in pairs(pautable) do
if simplified_word:match(pat .. "$") then
data.pau = pau
break
end
end
else
data.pau = gsubh(word, "Bӈ",{["b"]="о̆",["f"]="э̆", ["ab"]="о̆"})
end
data.pl = {
data.pl = {
["i"] = (match(pron(word), voiceless .. "ː?$") and "ш" or "ж") .. gsubh(word, "Bд",{["b"]="о̆",["e"]="э̆", ["ab"]="о̆"}),
["i"] = (match(simplified_word, "[" .. voiceless .. "]$") and "ш" or "ж") .. gsubh(word, "Bд",{["b"]="о̆",["e"]="э̆", ["ab"]="о̆"}),
["a"] = (match(pron(word), voiceless .. "ː?$") and "ф" or "в") .. gsubh(word, "Rд",{["r"]="ө",["u"]="э", ["ar"]="э"}),
["a"] = (match(simplified_word, "[" .. voiceless .. "]$") and "ф" or "в") .. gsubh(word, "Rд",{["r"]="ө",["u"]="э", ["ar"]="э"}),
}
}
Line 93: Line 110:


function make_cases(data)
function make_cases(data)
local cases = {"nominative", "accusative", "dative", "genitive"}
local cases = {"nominative", "accusative", "dative", "genitive", "instrumental", "prosecutive", "adessive<br/>comitative", "ablative<br/>elative", "illative<br/>allative"}
-- "instrumental", "prosecutive", "adessive<br/>comitative", "ablative<br/>elative", "illative<br/>allative"
local numbers = {"singular", "paucal", "plural"}
local numbers = {"singular", "paucal", "plural"}
Line 115: Line 131:
local decl = {
local decl = {
["nom"] = "",
["nom"] = "",
["acc"] = match(pron(w_number[n_sh]), vowel .. "ː?$") and "дза"
["acc"] = match(w_number[n_sh], vowel .. "$") and "дза"
      or match(pron(w_number[n_sh]), voiced .. "ː?$") and "да"
      or match(w_number[n_sh], voiced .. "$") and "да"
      or "та",
      or "та",
["dat"] = match(pron(w_number[n_sh]), vowel .. "ː?$") and "ша"
["dat"] = match(w_number[n_sh], vowel .. "$") and "ша"
  or match(pron(w_number[n_sh]), voiced .. "ː?$") and "за"
  or match(w_number[n_sh], voiced .. "$") and "за"
  or "са",
  or "са",
["gen"] = "ля",
["gen"] = "ля",
--["ins"] = match(pron(w_number[n_sh]), vowel .. "ː?$") and "лза"
["ins"] = match(w_number[n_sh], vowel .. "$") and "лз"
--   or gsubh(w_number[n_sh], "Rлз",{["r"]="ө",["u"]="э",["ar"]="ө"}),
  or gsubh(w_number[n_sh], "Rлз",{["r"]="ө",["u"]="э",["ar"]="ө"}),
--["pro"] = gsubh(w_number[n_sh], "сRц",{["r"]="ө",["u"]="э", ["ar"]="ө"}),
["pro"] = gsubh(w_number[n_sh], "сRц",{["r"]="ө",["u"]="э", ["ar"]="ө"}),
--["ade"] = "ляц",
["ade"] = "ляц",
--["abl"] = gsubh(w_number[n_sh], "сRшB",{["r"]="у",["u"]="ы",["b"]="о̄̆",["f"]="э̄̆",["ar"]="у",["ab"]="э̄̆"}),
["abl"] = gsubh(w_number[n_sh], "сRшB",{["r"]="у",["u"]="ы",["b"]="о̄̆",["f"]="э̄̆",["ar"]="у",["ab"]="э̄̆"}),
--["ill"] = gsubh(w_number[n_sh], "кRб",{["r"]="ү",["u"]="ы",["ar"]="ы"}),
["ill"] = gsubh(w_number[n_sh], "кRб",{["r"]="ү",["u"]="ы",["ar"]="ы"}),
}
}
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")
Line 152: Line 168:
after_title="[[:Category:Chiingimec " .. genders[data.g] .. " nouns|" .. genders[data.g] .. "]]",
after_title="[[:Category:Chiingimec " .. genders[data.g] .. " nouns|" .. genders[data.g] .. "]]",
all_cases=make_cases(data)
all_cases=make_cases(data)
}) .. "[[Category:Chiingimec " .. genders[data.g] .. " nouns|" .. genders[data.g] .. "]]"
}) .. (data.nocat and "" or "[[Category:Chiingimec " .. genders[data.g] .. " nouns|" .. genders[data.g] .. "]]")
end
end


return export
return export