Module:xchc-noun: Difference between revisions

No edit summary
Tag: Manual revert
No edit summary
 
(17 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 56: Line 54:
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 116: 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"]="ө"}),