De Muysc cubun - Lengua Muisca

m
m
Línea 3: Línea 3:
 
-- Módulo de conjugación para verbos muysca en mediawiki
 
-- Módulo de conjugación para verbos muysca en mediawiki
 
-- ============================================================
 
-- ============================================================
 
  
 
local p = {}
 
local p = {}
Línea 26: Línea 25:
 
             title = "Serie de Nominalización",
 
             title = "Serie de Nominalización",
 
             headers = {"Resultativa", "Factual", "Irrealis"}
 
             headers = {"Resultativa", "Factual", "Irrealis"}
 +
        },
 +
        s3 = {
 +
            title = "Modo Imperativo",
 +
            headers = {"Forma Única"}
 
         }
 
         }
 
     },
 
     },
 
     persons = {
 
     persons = {
 
         sg1 = "1.ª sg.", sg2 = "2.ª sg.", sg3 = "3.ª",
 
         sg1 = "1.ª sg.", sg2 = "2.ª sg.", sg3 = "3.ª",
         pl1 = "1.ª pl.", pl2 = "2.ª pl."
+
         pl1 = "1.ª pl.", pl2 = "2.ª pl.",
 +
        imp_sg = "2.ª sg. (Imp.)",
 +
        imp_pl = "2.ª pl. (Imp.)"
 
     }
 
     }
 
}
 
}
Línea 92: Línea 97:
 
function p.getConjugations(pageName, claseRaw, manualRoot)
 
function p.getConjugations(pageName, claseRaw, manualRoot)
 
     local classInfo = parseVerbClass(claseRaw)
 
     local classInfo = parseVerbClass(claseRaw)
     local root = getRoot(pageName, classInfo, manualRoot)
+
     local root = getRoot(pageName, classInfo.type, manualRoot)
 
      
 
      
 
     local results = { root = root, classInfo = classInfo, series = {} }
 
     local results = { root = root, classInfo = classInfo, series = {} }
Línea 105: Línea 110:
 
             suffixes = {perf = "", imperf = (classInfo.type == "su." and "-suca" or "-squa"), irreal = "-nga"},
 
             suffixes = {perf = "", imperf = (classInfo.type == "su." and "-suca" or "-squa"), irreal = "-nga"},
 
             applyRule = true,
 
             applyRule = true,
             allowInfix = true -- <--- Habilitar infijo -b-
+
             allowInfix = true
 
         },
 
         },
 
         {
 
         {
Línea 114: Línea 119:
 
             suffixes = {perf = "-ia", imperf = "-sca", irreal = "-nga"},
 
             suffixes = {perf = "-ia", imperf = "-sca", irreal = "-nga"},
 
             applyRule = false,
 
             applyRule = false,
             allowInfix = false -- <--- Prohibir infijo -b- en esta serie
+
             allowInfix = false
 +
        },
 +
        {
 +
            id = "S3", -- Imperativos
 +
            title = TEXTS.series.s3.title,
 +
            headers = TEXTS.series.s3.headers,
 +
            persons = {
 +
                {TEXTS.persons.imp_sg, "", "-u"},
 +
                {TEXTS.persons.imp_pl, "", "-ua"}
 +
            },
 +
            applyRule = false,
 +
            allowInfix = false
 
         }
 
         }
 
     }
 
     }
Línea 122: Línea 138:
  
 
     for _, s in ipairs(config) do
 
     for _, s in ipairs(config) do
         local serieData = { title = s.title, headers = s.headers, rows = {} }
+
         local serieData = { id = s.id, title = s.title, headers = s.headers, rows = {} }
 
          
 
          
 
         for _, pData in ipairs(s.persons) do
 
         for _, pData in ipairs(s.persons) do
             local label, prefix = pData[1], pData[2]
+
            -- CORRECCIÓN AQUÍ: Capturamos el tercer valor (sufijo personal)
 +
             local label, prefix, personalSuffix = pData[1], pData[2], pData[3]
 
              
 
              
 
             -- 1. Regla Especial de Prefijo (z- -> i-)
 
             -- 1. Regla Especial de Prefijo (z- -> i-)
Línea 136: Línea 153:
 
             -- 2. LÓGICA DEL INFIJO -b- Y CAMBIOS EN LA RAÍZ
 
             -- 2. LÓGICA DEL INFIJO -b- Y CAMBIOS EN LA RAÍZ
 
             local currentInfix = ""
 
             local currentInfix = ""
             local currentRoot = root -- Por defecto, la raíz no cambia
+
             local currentRoot = root  
 
              
 
              
 
             if s.allowInfix and classInfo.isTransitive and not classInfo.isIntransitive then
 
             if s.allowInfix and classInfo.isTransitive and not classInfo.isIntransitive then
 
                 if prefix ~= "" then
 
                 if prefix ~= "" then
 
                     local r1 = firstChar
 
                     local r1 = firstChar
                    local r2 = firstTwo
 
                   
 
                    -- Regla: b + u = g + u (Ej: b-u-squa -> g-u-squa ; g-uity-suca -> g-uity-suca)
 
 
                     if r1 == "u" then
 
                     if r1 == "u" then
 
                         currentInfix = "g-"
 
                         currentInfix = "g-"
 
                    --NO BORRAR: Falta aquí una regla relacionada con la existencia de raices con vocales altas u, i, ɨ.
 
                   
 
                    -- Regla: b + n = m + n
 
 
                     elseif r1 == "n" then
 
                     elseif r1 == "n" then
 
                         currentInfix = "m-"
 
                         currentInfix = "m-"
                       
 
                    -- Regla: b + hV = mV + h (Ej: b-hize-suca -> mi-hize-suca)
 
 
                     elseif r1 == "h" then
 
                     elseif r1 == "h" then
 
                         local vocal = root:sub(2,2)
 
                         local vocal = root:sub(2,2)
 
                         currentInfix = "m" .. vocal .. "-"
 
                         currentInfix = "m" .. vocal .. "-"
 
                         currentRoot = "h" .. root:sub(3)
 
                         currentRoot = "h" .. root:sub(3)
                       
 
                    -- Regla: b + b = m + m (Ej: b-bahasy-suca -> m-mahasy-suca)
 
 
                     elseif r1 == "b" then
 
                     elseif r1 == "b" then
 
                         currentInfix = "m-"
 
                         currentInfix = "m-"
 
                         currentRoot = "m" .. root:sub(2)
 
                         currentRoot = "m" .. root:sub(2)
 
                    -- Reglas por defecto y asimilación por prefijo m-
 
 
                     else
 
                     else
 
                         if prefix == "m-" then
 
                         if prefix == "m-" then
Línea 175: Línea 179:
 
             end
 
             end
  
             -- 3. LÓGICA DE VERBOS CON RAÍZ HISTÓRICA EN IQUY (-quy / -z / -i)
+
             -- 3. LÓGICA DE SUFIJOS
             local perfSuffix = s.suffixes.perf
+
            -- Priorizamos personalSuffix (S3) sobre los sufijos generales de serie
             local imperfSuffix = s.suffixes.imperf
+
             local perfSuffix = personalSuffix or (s.suffixes and s.suffixes.perf) or ""
             local irrealSuffix = s.suffixes.irreal
+
             local imperfSuffix = (s.suffixes and s.suffixes.imperf) or ""
 +
             local irrealSuffix = (s.suffixes and s.suffixes.irreal) or ""
 
              
 
              
 
             local rootPerf = currentRoot
 
             local rootPerf = currentRoot
Línea 184: Línea 189:
 
             local rootIrreal = currentRoot
 
             local rootIrreal = currentRoot
  
 +
            -- 4. LÓGICA DE VERBOS CON RAÍZ HISTÓRICA EN IQUY (-quy / -z / -i)
 
             if classInfo.isQuy then
 
             if classInfo.isQuy then
 
                 if s.id == "S1" then
 
                 if s.id == "S1" then
Línea 190: Línea 196:
 
                 elseif s.id == "S2" then
 
                 elseif s.id == "S2" then
 
                     -- Serie de Nominalización: Preserva rasgos históricos
 
                     -- Serie de Nominalización: Preserva rasgos históricos
                   
 
                    -- A. Resultativa: Palatalización histórica (u -> uz) + alomorfo -a
 
 
                     rootPerf = currentRoot .. "z"
 
                     rootPerf = currentRoot .. "z"
 
                     perfSuffix = "-a"
 
                     perfSuffix = "-a"
                   
 
                    -- B. Factual e Irrealis: Preserva la -i histórica (u -> ui)
 
 
                     rootImperf = currentRoot .. "i"
 
                     rootImperf = currentRoot .. "i"
 
                     rootIrreal = currentRoot .. "i"
 
                     rootIrreal = currentRoot .. "i"
 +
                elseif s.id == "S3" then
 +
                    -- NUEVO: El Imperativo de verbos iquy también palataliza (u -> uz)
 +
                    rootPerf = currentRoot .. "z"
 +
                    -- perfSuffix ya trae "-u" o "-ua" del personalSuffix definido arriba
 
                 end
 
                 end
 
             end
 
             end
Línea 207: Línea 213:
 
                 irreal = prefix .. currentInfix .. rootIrreal .. irrealSuffix
 
                 irreal = prefix .. currentInfix .. rootIrreal .. irrealSuffix
 
             })
 
             })
 
 
         end
 
         end
 
         table.insert(results.series, serieData)
 
         table.insert(results.series, serieData)
 
     end
 
     end
 
 
     return results
 
     return results
 
end
 
end
 
  
 
-- ============================================================
 
-- ============================================================
-- LA VISTA: Usado por la Wiki
+
-- LA VISTA: Usado por la Wiki (drawTable y render se mantienen igual)
 
-- ============================================================
 
-- ============================================================
 
 
local function drawTable(serie)
 
local function drawTable(serie)
 
     local wrapper = mw.html.create("div"):css("margin-bottom", "1.5em"):css("font-size", "14px")
 
     local wrapper = mw.html.create("div"):css("margin-bottom", "1.5em"):css("font-size", "14px")
 
+
     wrapper:tag("div"):css("font-weight", "bold"):css("font-size", "1.1em")
     wrapper:tag("div")
+
         :css("margin-bottom", "0.4em"):css("color", "#202122"):wikitext(serie.title)
        :css("font-weight", "bold"):css("font-size", "1.1em")
 
         :css("margin-bottom", "0.4em"):css("color", "#202122")
 
        :wikitext(serie.title)
 
  
 
     local tableHtml = wrapper:tag("table"):addClass("wikitable")
 
     local tableHtml = wrapper:tag("table"):addClass("wikitable")
Línea 233: Línea 232:
 
     local headerRow = tableHtml:tag("tr")
 
     local headerRow = tableHtml:tag("tr")
 
     headerRow:tag("th"):wikitext(TEXTS.ui.col_person)
 
     headerRow:tag("th"):wikitext(TEXTS.ui.col_person)
     for _, hName in ipairs(serie.headers) do
+
      
        headerRow:tag("th"):wikitext(hName)
+
    if serie.id == "S3" then
 +
        headerRow:tag("th"):wikitext(serie.headers[1])
 +
    else
 +
        for _, hName in ipairs(serie.headers) do
 +
            headerRow:tag("th"):wikitext(hName)
 +
        end
 
     end
 
     end
  
Línea 241: Línea 245:
 
         tr:tag("td"):css("font-weight", "bold"):wikitext(row.label)
 
         tr:tag("td"):css("font-weight", "bold"):wikitext(row.label)
 
         tr:tag("td"):wikitext(row.perf)
 
         tr:tag("td"):wikitext(row.perf)
         tr:tag("td"):wikitext(row.imperf)
+
         if serie.id ~= "S3" then
        tr:tag("td"):wikitext(row.irreal)
+
            tr:tag("td"):wikitext(row.imperf)
 +
            tr:tag("td"):wikitext(row.irreal)
 +
        end
 
     end
 
     end
 
 
     return wrapper
 
     return wrapper
 
end
 
end
Línea 257: Línea 262:
 
     end
 
     end
  
     local mainDiv = mw.html.create("div")
+
     local mainDiv = mw.html.create("div"):addClass("mw-collapsible"):addClass("mw-collapsed")
        :addClass("mw-collapsible"):addClass("mw-collapsed")
+
         :css("border", "1px solid #a2a9b1"):css("padding", "15px"):css("background-color", "#fcfcfc")
         :css("border", "1px solid #a2a9b1"):css("padding", "15px")
+
         :attr("data-expandtext", TEXTS.ui.expand):attr("data-collapsetext", TEXTS.ui.collapse)
        :css("background-color", "#fcfcfc")
 
         :attr("data-expandtext", TEXTS.ui.expand)
 
        :attr("data-collapsetext", TEXTS.ui.collapse)
 
  
     mainDiv:tag("div")
+
     mainDiv:tag("div"):css("font-weight", "bold"):css("border-bottom", "1px solid #a2a9b1")
        :css("font-weight", "bold"):css("border-bottom", "1px solid #a2a9b1")
 
 
         :css("margin-bottom", "15px"):css("padding-bottom", "5px")
 
         :css("margin-bottom", "15px"):css("padding-bottom", "5px")
         :wikitext(TEXTS.ui.main_title .. data.root .. " (" .. data.clase .. ")")
+
         :wikitext(TEXTS.ui.main_title .. data.root .. " (" .. data.classInfo.raw .. ")")
  
 
     local contentDiv = mainDiv:tag("div"):addClass("mw-collapsible-content")
 
     local contentDiv = mainDiv:tag("div"):addClass("mw-collapsible-content")
 
 
     for _, serie in ipairs(data.series) do
 
     for _, serie in ipairs(data.series) do
 
         contentDiv:node(drawTable(serie))
 
         contentDiv:node(drawTable(serie))
 
     end
 
     end
 
 
     return tostring(mainDiv)
 
     return tostring(mainDiv)
 
end
 
end
  
 
return p
 
return p

Revisión del 17:30 29 mar 2026

La documentación para este módulo puede ser creada en Módulo:Conjugador/doc

-- ============================================================
-- Diego F. Gómez -- 2024-2026
-- Módulo de conjugación para verbos muysca en mediawiki
-- ============================================================

local p = {}

-- ============================================================
-- DICCIONARIO DE TEXTOS 
-- ============================================================
local TEXTS = {
    ui = {
        expand = "Conjugar",
        collapse = "Ocultar",
        error_root = "Error: No se pudo extraer la raíz de ",
        main_title = "Paradigma verbal: ",
        col_person = "Persona"
    },
    series = {
        s1 = {
            title = "Serie de Flexión Verbal (Independiente)",
            headers = {"Perfectivo", "Imperfectivo", "Irrealis"}
        },
        s2 = {
            title = "Serie de Nominalización",
            headers = {"Resultativa", "Factual", "Irrealis"}
        },
        s3 = {
            title = "Modo Imperativo",
            headers = {"Forma Única"}
        }
    },
    persons = {
        sg1 = "1.ª sg.", sg2 = "2.ª sg.", sg3 = "3.ª",
        pl1 = "1.ª pl.", pl2 = "2.ª pl.",
        imp_sg = "2.ª sg. (Imp.)", 
        imp_pl = "2.ª pl. (Imp.)"
    }
}

-- ============================================================
-- LÓGICA PRIVADA
-- ============================================================

local function cleanPageName(pageName)
    if not mw then return pageName:gsub("%s*%b()", ""):gsub("%d+", ""):trim() end
    pageName = mw.text.trim(pageName or "")
    pageName = mw.ustring.gsub(pageName, "%s*%b()", "")
    pageName = mw.ustring.gsub(pageName, "%d+", "")
    return mw.text.trim(pageName)
end

local function normalizeClass(rawClass)
    rawClass = (rawClass or ""):lower()
    if rawClass:find("sq") then return "sq."
    elseif rawClass:find("su") then return "su." end
    return ""
end

local function getRoot(pageName, clase, manualRoot)
    if manualRoot and manualRoot ~= "" then return manualRoot end
    local fullVerb = cleanPageName(pageName)
    local root = fullVerb
    if clase == "sq." then root = fullVerb:gsub("squa$", "")
    elseif clase == "su." then root = fullVerb:gsub("suca$", "") end
    if root == fullVerb then root = fullVerb:gsub("s[uq]ua$", "") end
    return root
end

-- ============================================================
-- NUEVA LÓGICA DE CLASE (Parsing)
-- ============================================================

local function parseVerbClass(raw)
    raw = (raw or ""):lower()
    local info = {
        type = "",             -- "sq." o "su."
        isTransitive = false,
        isIntransitive = false,
        isQuy = false,
        raw = raw
    }
    
    if raw:find("sq") then info.type = "sq." end
    if raw:find("su") then info.type = "su." end
    if raw:find("tr%.") then info.isTransitive = true end
    if raw:find("intr%.") then info.isIntransitive = true end
    if raw:find("quy%.") then info.isQuy = true end
    
    return info
end

-- ============================================================
-- EL CEREBRO: Lógica Pura
-- ============================================================

function p.getConjugations(pageName, claseRaw, manualRoot)
    local classInfo = parseVerbClass(claseRaw)
    local root = getRoot(pageName, classInfo.type, manualRoot)
    
    local results = { root = root, classInfo = classInfo, series = {} }

    -- Configuración de Series
    local config = {
        {
            id = "S1", -- Flexión Verbal
            title = TEXTS.series.s1.title, 
            headers = TEXTS.series.s1.headers,
            persons = {{TEXTS.persons.sg1, "z-"}, {TEXTS.persons.sg2, "m-"}, {TEXTS.persons.sg3, "a-"}, {TEXTS.persons.pl1, "chi-"}, {TEXTS.persons.pl2, "mi-"}},
            suffixes = {perf = "", imperf = (classInfo.type == "su." and "-suca" or "-squa"), irreal = "-nga"},
            applyRule = true,
            allowInfix = true
        },
        {
            id = "S2", -- Nominalización
            title = TEXTS.series.s2.title, 
            headers = TEXTS.series.s2.headers,
            persons = {{TEXTS.persons.sg1, "cha-"}, {TEXTS.persons.sg2, "ma-"}, {TEXTS.persons.sg3, ""}, {TEXTS.persons.pl1, "chi-"}, {TEXTS.persons.pl2, "mi-"}},
            suffixes = {perf = "-ia", imperf = "-sca", irreal = "-nga"},
            applyRule = false,
            allowInfix = false
        },
        {
            id = "S3", -- Imperativos
            title = TEXTS.series.s3.title, 
            headers = TEXTS.series.s3.headers,
            persons = {
                {TEXTS.persons.imp_sg, "", "-u"}, 
                {TEXTS.persons.imp_pl, "", "-ua"}
            },
            applyRule = false,
            allowInfix = false
        }
    }

    local firstChar = root:sub(1,1):lower()
    local firstTwo = root:sub(1,2):lower()

    for _, s in ipairs(config) do
        local serieData = { id = s.id, title = s.title, headers = s.headers, rows = {} }
        
        for _, pData in ipairs(s.persons) do
            -- CORRECCIÓN AQUÍ: Capturamos el tercer valor (sufijo personal)
            local label, prefix, personalSuffix = pData[1], pData[2], pData[3]
            
            -- 1. Regla Especial de Prefijo (z- -> i-)
            if s.applyRule and label == TEXTS.persons.sg1 then
                if firstChar == "n" or firstChar == "z" or firstChar == "t" or firstTwo == "ch" then
                    prefix = "i-"
                end
            end

            -- 2. LÓGICA DEL INFIJO -b- Y CAMBIOS EN LA RAÍZ
            local currentInfix = ""
            local currentRoot = root 
            
            if s.allowInfix and classInfo.isTransitive and not classInfo.isIntransitive then
                if prefix ~= "" then
                    local r1 = firstChar
                    if r1 == "u" then
                        currentInfix = "g-"
                    elseif r1 == "n" then
                        currentInfix = "m-"
                    elseif r1 == "h" then
                        local vocal = root:sub(2,2)
                        currentInfix = "m" .. vocal .. "-"
                        currentRoot = "h" .. root:sub(3)
                    elseif r1 == "b" then
                        currentInfix = "m-"
                        currentRoot = "m" .. root:sub(2)
                    else
                        if prefix == "m-" then
                            currentInfix = "m-"
                        else
                            currentInfix = "b-"
                        end
                    end
                end
            end

            -- 3. LÓGICA DE SUFIJOS
            -- Priorizamos personalSuffix (S3) sobre los sufijos generales de serie
            local perfSuffix = personalSuffix or (s.suffixes and s.suffixes.perf) or ""
            local imperfSuffix = (s.suffixes and s.suffixes.imperf) or ""
            local irrealSuffix = (s.suffixes and s.suffixes.irreal) or ""
            
            local rootPerf = currentRoot
            local rootImperf = currentRoot
            local rootIrreal = currentRoot

            -- 4. LÓGICA DE VERBOS CON RAÍZ HISTÓRICA EN IQUY (-quy / -z / -i)
            if classInfo.isQuy then
                if s.id == "S1" then
                    -- Serie de Flexión: Mantiene raíz u + sufijo quy
                    perfSuffix = "quy"
                elseif s.id == "S2" then
                    -- Serie de Nominalización: Preserva rasgos históricos
                    rootPerf = currentRoot .. "z"
                    perfSuffix = "-a"
                    rootImperf = currentRoot .. "i"
                    rootIrreal = currentRoot .. "i"
                elseif s.id == "S3" then
                    -- NUEVO: El Imperativo de verbos iquy también palataliza (u -> uz)
                    rootPerf = currentRoot .. "z"
                    -- perfSuffix ya trae "-u" o "-ua" del personalSuffix definido arriba
                end
            end

            table.insert(serieData.rows, {
                label = label,
                perf = prefix .. currentInfix .. rootPerf .. perfSuffix,
                imperf = prefix .. currentInfix .. rootImperf .. imperfSuffix,
                irreal = prefix .. currentInfix .. rootIrreal .. irrealSuffix
            })
        end
        table.insert(results.series, serieData)
    end
    return results
end

-- ============================================================
-- LA VISTA: Usado por la Wiki (drawTable y render se mantienen igual)
-- ============================================================
local function drawTable(serie)
    local wrapper = mw.html.create("div"):css("margin-bottom", "1.5em"):css("font-size", "14px")
    wrapper:tag("div"):css("font-weight", "bold"):css("font-size", "1.1em")
        :css("margin-bottom", "0.4em"):css("color", "#202122"):wikitext(serie.title)

    local tableHtml = wrapper:tag("table"):addClass("wikitable")
        :css("width", "100%"):css("max-width", "600px"):css("margin", "0")

    local headerRow = tableHtml:tag("tr")
    headerRow:tag("th"):wikitext(TEXTS.ui.col_person)
    
    if serie.id == "S3" then
        headerRow:tag("th"):wikitext(serie.headers[1])
    else
        for _, hName in ipairs(serie.headers) do
            headerRow:tag("th"):wikitext(hName)
        end
    end

    for _, row in ipairs(serie.rows) do
        local tr = tableHtml:tag("tr")
        tr:tag("td"):css("font-weight", "bold"):wikitext(row.label)
        tr:tag("td"):wikitext(row.perf)
        if serie.id ~= "S3" then
            tr:tag("td"):wikitext(row.imperf)
            tr:tag("td"):wikitext(row.irreal)
        end
    end
    return wrapper
end

function p.render(frame)
    local args = frame:getParent().args
    local pageName = mw.title.getCurrentTitle().text
    local data = p.getConjugations(pageName, args.clase or args.tipo, args.raiz)

    if data.root == "" or data.root == pageName then
        return "<span style='color:red;'>" .. TEXTS.ui.error_root .. pageName .. ".</span>"
    end

    local mainDiv = mw.html.create("div"):addClass("mw-collapsible"):addClass("mw-collapsed")
        :css("border", "1px solid #a2a9b1"):css("padding", "15px"):css("background-color", "#fcfcfc")
        :attr("data-expandtext", TEXTS.ui.expand):attr("data-collapsetext", TEXTS.ui.collapse)

    mainDiv:tag("div"):css("font-weight", "bold"):css("border-bottom", "1px solid #a2a9b1")
        :css("margin-bottom", "15px"):css("padding-bottom", "5px")
        :wikitext(TEXTS.ui.main_title .. data.root .. " (" .. data.classInfo.raw .. ")")

    local contentDiv = mainDiv:tag("div"):addClass("mw-collapsible-content")
    for _, serie in ipairs(data.series) do
        contentDiv:node(drawTable(serie))
    end
    return tostring(mainDiv)
end

return p