Module:tln-conj: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| (11 intermediate revisions by the same user not shown) | |||
| Line 96: | Line 96: | ||
fut_3p = "ᠢᠷᠡᠨ" | fut_3p = "ᠢᠷᠡᠨ" | ||
} | } | ||
} | |||
---------------------------------------------------------------- | |||
-- IRREGULAR VERBS | |||
---------------------------------------------------------------- | |||
local irregulars = { | |||
["ᠢᠷᠡ"] = { | |||
pres_1s = "ᠸᠣ", | |||
pres_2s = "ᠸᠠᠢᠰ", | |||
pres_3s = "ᠸᠠᠢᠲ", | |||
pres_1p = "ᠸᠠᠢᠨᠤᠰ", | |||
pres_2p = "ᠸᠠᠢᠰ", | |||
pres_3p = "ᠸᠣᠨ", | |||
past_1s = "ᠣᠯᠠᠢ", | |||
past_2s = "ᠣᠯᠠᠢᠰᠲᠢ", | |||
past_3s = "ᠣᠯᠠᠢᠲ", | |||
past_1p = "ᠣᠯᠠᠢᠨᠤᠰ", | |||
past_2p = "ᠣᠯᠠᠢᠰᠲᠢᠰ", | |||
past_3p = "ᠣᠯᠡᠷᠤᠨ" | |||
} | |||
} | } | ||
| Line 142: | Line 167: | ||
["ᠴ"] = "č", | ["ᠴ"] = "č", | ||
["ᠶ"] = "y", | ["ᠶ"] = "y", | ||
["ᠳ"] = "d" | ["ᠳ"] = "d", | ||
["ᠯ"] = "l" | |||
} | } | ||
| Line 194: | Line 220: | ||
local forms = {} | local forms = {} | ||
local function get_slot_stem(slot) | local function get_slot_stem(args, slot) | ||
local parts = mw.text.split(slot, "_") | |||
local | local mood = nil | ||
local tense = nil | |||
local person_number = nil | |||
if | -- Detect capital prefix = mood (your convention) | ||
if mw.ustring.match(parts[1], "^[A-Z]") then | |||
mood = parts[1] | |||
tense = parts[2] | |||
person_number = parts[3] | |||
else | |||
tense = parts[1] | |||
person_number = parts[2] | |||
end | |||
local person = person_number:sub(1,1) | |||
local number = person_number:sub(2,2) | |||
-- priority list (MOST specific → LEAST specific) | |||
local candidates = {} | |||
if mood then | |||
table.insert(candidates, mood .. "_" .. tense .. "_" .. person_number .. "_stem") | |||
table.insert(candidates, mood .. "_" .. tense .. "_" .. person .. "_stem") | |||
table.insert(candidates, mood .. "_" .. tense .. "_" .. number .. "_stem") | |||
table.insert(candidates, mood .. "_" .. tense .. "_stem") | |||
table.insert(candidates, mood .. "_stem") | |||
end | |||
table.insert(candidates, tense .. "_" .. person_number .. "_stem") | |||
table.insert(candidates, tense .. "_" .. person .. "_stem") | |||
table.insert(candidates, tense .. "_" .. number .. "_stem") | |||
table.insert(candidates, tense .. "_stem") | |||
table.insert(candidates, "stem") | |||
for _, key in ipairs(candidates) do | |||
if args[key] and args[key] ~= "" then | |||
return args[key] | |||
end | |||
end | end | ||
| Line 208: | Line 271: | ||
if args[slot] and args[slot] ~= "" then | if args[slot] and args[slot] ~= "" then | ||
forms[slot] = args[slot] | forms[slot] = args[slot] | ||
elseif irregulars[title] | |||
and irregulars[title][slot] then | |||
forms[slot] = irregulars[title][slot] | |||
else | else | ||
forms[slot] = combine( | forms[slot] = combine(stem, ending) | ||
end | end | ||