Module:taln-conj: Difference between revisions

Nehster9 (talk | contribs)
mNo edit summary
m Sware moved page Module:tln-conj to Module:taln-conj without leaving a redirect
 
(13 intermediate revisions by one other 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 = {}


     for slot, ending in pairs(endings[class]) do
local function get_slot_stem(args, slot)
        if args[slot] and args[slot] ~= "" then
 
            forms[slot] = args[slot]
     local parts = mw.text.split(slot, "_")
         else
 
            forms[slot] = combine(stem, ending)
    local mood = nil
    local tense = nil
    local person_number = nil
 
    -- 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
     end
    return stem
end
for slot, ending in pairs(endings[class]) do
    if args[slot] and args[slot] ~= "" then
        forms[slot] = args[slot]
    elseif irregulars[title]
      and irregulars[title][slot] then
        forms[slot] = irregulars[title][slot]
    else
        forms[slot] = combine(stem, ending)
    end
end


     local text =
     local text =