Module:et-nominaux

Bonjour, vous êtes venu ici pour chercher la signification du mot Module:et-nominaux. Dans DICTIOUS, vous trouverez non seulement toutes les significations du dictionnaire pour le mot Module:et-nominaux, mais vous apprendrez également son étymologie, ses caractéristiques et comment dire Module:et-nominaux au singulier et au pluriel. Tout ce que vous devez savoir sur le mot Module:et-nominaux est ici. La définition du mot Module:et-nominaux vous aidera à être plus précis et correct lorsque vous parlerez ou écrirez vos textes. Connaître la définition deModule:et-nominaux, ainsi que celles d'autres mots, enrichit votre vocabulaire et vous fournit des ressources linguistiques plus nombreuses et de meilleure qualité.

La documentation pour ce module peut être créée à Module:et-nominaux/Documentation

local m_bases = require("Module:bases")

local p = {}

-- Functions that do the actual inflecting by creating the forms of a basic term.
local inflections = {}

-- The main entry point.
-- This is the only function that can be invoked from a template.
function p.show(frame)
  local infl_type = frame.args or error("Inflection type has not been specified. Please pass parameter 1 to the module invocation")
  local args = frame:getParent().args

  if not inflections then
    error("Unknown inflection type '" .. infl_type .. "'")
  end

  local data = { forms = {}, title = nil, categories = {} }

  -- Generate the forms
  inflections(args, data)

  -- Postprocess
  postprocess(args, data)

  if args then
    table.insert(data.categories, "et-decl with nosg")
  end

  if args then
    table.insert(data.categories, "Noms indénombrables en estonien")
  end

  if args then
    table.insert(data.categories, "et-decl with type")
  end

  local categories = ""

  for _, category in ipairs(data.categories) do
    categories = categories .. m_bases.fait_categorie_contenu(category)
  end

  return make_table(data) .. categories
end

function get_params(args, num, gradation)
  local params = {}

  params.base = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{1}}}");
  if not params.base or params.base == "" then
    error("Parameter 1 (base stem) may not be empty.")
  end

  if gradation then
    if num == 5 then
      params.strong = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{2}}}") or ""
      params.weak = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{3}}}") or ""
      params.final = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{4}}}");
      if not params.final or params.final == "" then
        error("Parameter 4 (final letter(s)) may not be empty.")
      end
      params.final_nom_sg = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{5}}}") or ""
    elseif num == 4 then
      params.strong = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{2}}}") or ""
      params.weak = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{3}}}") or ""
      params.final = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{4}}}");
      if not params.final or params.final == "" then
        error("Parameter 4 (final letter(s)) may not be empty.")
      end
    elseif num == 3 then
      params.strong = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{2}}}") or ""
      params.weak = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{3}}}") or ""
    end
  else
    if num == 3 then
      params.final = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{2}}}");
      if not params.final or params.final == "" then
        error("Parameter 2 (final letter(s)) may not be empty.")
      end
      params.final_nom_sg = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{3}}}") or ""
    elseif num == 2 then
      params.final = args or (mw.title.getCurrentTitle().nsText == "Template" and "{{{2}}}") or ""
    end
  end

  return params
end


--[=[
    Inflection functions
]=]--

local stem_endings = {}

stem_endings = {
   = "",
}

stem_endings = {
   = "",
   = "sse",
   = "s",
   = "st",
   = "le",
   = "l",
   = "lt",
   = "ks",
   = "ni",
   = "na",
   = "ta",
   = "ga",
   = "d",
}

stem_endings = {
   = "",
}

stem_endings = {
   = "",
}

stem_endings = {
   = "",
   = "sse",
   = "s",
   = "st",
   = "le",
   = "l",
   = "lt",
   = "ks",
   = "ni",
   = "na",
   = "ta",
   = "ga",
}

stem_endings = {
   = "sse",
   = "s",
   = "st",
   = "le",
   = "l",
   = "lt",
   = "ks",
}

stem_endings = {
   = "",
}


-- Create forms based on each stem, by adding endings to it
local function process_stems(data, stems)
  -- Go through each of the stems given
  for stem_key, substems in pairs(stems) do
    for _, stem in ipairs(substems) do
      -- Attach the endings to the stem
      for form_key, ending in pairs(stem_endings) do
        if not data.forms then
          data.forms = {}
        end

        table.insert(data.forms, stem .. ending)
      end
    end
  end
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type ohutu")

  local params = get_params(args, 1)
  local i_stem = mw.ustring.gsub(params.base, "i$", "e")

  local stems = {}
  stems = { params.base }
  stems = { params.base }
  stems = { params.base .. "t" }
  stems = nil
  stems = { params.base .. "te" }
  stems = { i_stem .. "i" }
  stems = { i_stem .. "id" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type õpik")

  local params = get_params(args, 3)
  local i_stem = mw.ustring.gsub(params.base .. params.final, "i$", "e")

  local stems = {}
  stems = { params.base .. params.final_nom_sg }
  stems = { params.base .. params.final }
  stems = { params.base .. params.final .. "t" }
  stems = nil
  stems = { params.base .. params.final .. "te" }
  stems = { i_stem .. "i" }
  stems = { i_stem .. "id" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ]"
  table.insert(data.categories, "Formes nominales en estonien de type vaher")

  local params = get_params(args, 5, true)
  local i_stem = mw.ustring.gsub(params.base .. params.strong .. params.final, "i$", "e")

  if params.strong == params.weak then
    data.title = data.title .. ", length gradation"
  else
    data.title = data.title .. ", ''" .. params.strong .. "-" .. (params.weak == "" and "ø" or params.weak) .. "'' gradation"
  end

  local stems = {}
  stems = { params.base .. params.weak .. params.final_nom_sg }
  stems = { params.base .. params.strong .. params.final }
  stems = { params.base .. params.strong .. params.final .. "t" }
  stems = nil
  stems = { params.base .. params.strong .. params.final .. "te" }
  stems = { i_stem .. "i" }
  stems = { i_stem .. "id" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type ase")

  local params = get_params(args, 2)

  local stems = {}
  stems = { params.base }
  stems = { params.base .. "me" }
  stems = { params.base .. params.final }
  stems = nil
  stems = { params.base .. "mete" }
  stems = { params.base .. "mei" }
  stems = { params.base .. "meid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ]"
  table.insert(data.categories, "Formes nominales en estonien de type liige")

  local params = get_params(args, 5, true)
  local i_stem = mw.ustring.gsub(params.base .. params.strong .. params.final, "i$", "e")

  if params.strong == params.weak then
    data.title = data.title .. ", length gradation"
  else
    data.title = data.title .. ", ''" .. params.strong .. "-" .. (params.weak == "" and "ø" or params.weak) .. "'' gradation"
  end

  local stems = {}
  stems = { params.base .. params.weak .. params.final_nom_sg }
  stems = { params.base .. params.strong .. params.final }
  stems = { params.base .. params.weak .. params.final_nom_sg .. "t" }
  stems = nil
  stems = { params.base .. params.strong .. params.final .. "te" }
  stems = { i_stem .. "i" }
  stems = { i_stem .. "id" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ]"
  table.insert(data.categories, "Formes nominales en estonien de type mõte")

  local params = get_params(args, 4, true)

  if params.strong == params.weak then
    data.title = data.title .. ", length gradation"
  else
    data.title = data.title .. ", ''" .. params.strong .. "-" .. (params.weak == "" and "ø" or params.weak) .. "'' gradation"
  end

  local stems = {}
  stems = { params.base .. params.weak .. params.final }
  stems = { params.base .. params.strong .. params.final }
  stems = { params.base .. params.weak .. params.final .. "t" }
  stems = nil
  stems = { params.base .. params.weak .. params.final .. "te" }
  stems = { params.base .. params.strong .. params.final .. "i" }
  stems = { params.base .. params.strong .. params.final .. "id" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ]"
  table.insert(data.categories, "Formes nominales en estonien de type kallas")

  local params = get_params(args, 5, true)
  local i_stem = mw.ustring.gsub(params.base .. params.strong .. params.final, "i$", "e")

  if params.strong == params.weak then
    data.title = data.title .. ", length gradation"
  else
    data.title = data.title .. ", ''" .. params.strong .. "-" .. (params.weak == "" and "ø" or params.weak) .. "'' gradation"
  end

  local stems = {}
  stems = { params.base .. params.weak .. params.final_nom_sg }
  stems = { params.base .. params.strong .. params.final }
  stems = { params.base .. params.weak .. params.final_nom_sg .. "t" }
  stems = nil
  stems = { params.base .. params.weak .. params.final_nom_sg .. "te" }
  stems = { i_stem .. "i" }
  stems = { i_stem .. "id" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ]"
  table.insert(data.categories, "Formes nominales en estonien de type küünal")

  local params = get_params(args, 5, true)

  if params.strong == params.weak then
    data.title = data.title .. ", length gradation"
  else
    data.title = data.title .. ", ''" .. params.strong .. "-" .. (params.weak == "" and "ø" or params.weak) .. "'' gradation"
  end

  local stems = {}
  stems = { params.base .. params.weak .. params.final_nom_sg }
  stems = { params.base .. params.strong .. params.final }
  stems = { params.base .. params.weak .. params.final_nom_sg .. "t" }
  stems = nil
  stems = { params.base .. params.weak .. params.final_nom_sg .. "de" }
  stems = { params.base .. params.strong .. params.final .. "i" }
  stems = { params.base .. params.strong .. params.final .. "id" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type katus")

  local params = get_params(args, 1)

  local stems = {}
  stems = { params.base .. "s" }
  stems = { params.base .. "se" }
  stems = { params.base .. "st" }
  stems = nil
  stems = { params.base .. "ste" }
  stems = { params.base .. "sei" }
  stems = { params.base .. "seid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type soolane")

  local params = get_params(args, 2)

  local stems = {}
  stems = { params.base .. params.final }
  stems = { params.base .. "se" }
  stems = { params.base .. "st" }
  stems = nil
  stems = { params.base .. "ste" }
  stems = { params.base .. "sei" }
  stems = { params.base .. "seid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type harjutus")

  local params = get_params(args, 1)

  local stems = {}
  stems = { params.base .. "s" }
  stems = { params.base .. "se" }
  stems = { params.base .. "st" }
  stems = { params.base .. "sse" }
  stems = { params.base .. "ste" }
  stems = { params.base .. "si" }
  stems = { params.base .. "si" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type oluline")

  local params = get_params(args, 2)

  local stems = {}
  stems = { params.base .. params.final }
  stems = { params.base .. "se" }
  stems = { params.base .. "st" }
  stems = { params.base .. "sse" }
  stems = { params.base .. "ste" }
  stems = { params.base .. "si" }
  stems = { params.base .. "si" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], gradation en lingueur"
  table.insert(data.categories, "Formes nominales en estonien de type suur")

  local params = get_params(args, 1)

  local stems = {}
  stems = { params.base }
  stems = { params.base .. "e" }
  stems = { params.base .. "t" }
  stems = { params.base .. "de" }
  stems = { params.base .. "te" }
  stems = { params.base .. "i" }
  stems = { params.base .. "i" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ]"
  table.insert(data.categories, "Formes nominales en estonien de type uus")

  local params = get_params(args, 2)
  local s_stem = mw.ustring.gsub(params.base .. params.final, "n$", "")

  if params.final ~= "" then
    data.title = data.title .. ", ''" .. params.final .. "d/" .. params.final .. "t-" .. params.final .. params.final .. "-" .. params.final .. "s'' gradation"
  else
    data.title = data.title .. ", ''d/t-ø-s'' gradation"
  end

  local stems = {}
  stems = { s_stem .. "s" }
  stems = { params.base .. params.final .. params.final .. "e" }
  stems = { params.base .. params.final .. "t" }
  stems = { params.base .. params.final .. "de" }
  stems = { params.base .. params.final .. "te" }
  stems = { s_stem .. "si" }
  stems = { s_stem .. "si" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], ''d/t-ø-s'' gradation"
  table.insert(data.categories, "Formes nominales en estonien de type käsi")

  local params = get_params(args, 1)
  local weak_stem = params.base

  if mw.ustring.find(params.base, "u$") then
    -- susi
    weak_stem = mw.ustring.gsub(params.base, "u$", "o")
  end

  local stems = {}
  stems = { params.base .. "si" }
  stems = { weak_stem .. "e" }
  stems = { params.base .. "tt" }
  stems = { params.base .. "tte" }
  stems = { params.base .. "te" }
  stems = { params.base .. "si" }
  stems = { params.base .. "si" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type pere")

  local params = get_params(args, 1)
  local ill_sg_stem = params.base

  if mw.ustring.find(ill_sg_stem, "$") or mw.ustring.find(ill_sg_stem, "^$") then
    ill_sg_stem = mw.ustring.gsub(ill_sg_stem, "(.)(.)$", "%1%1%2")
  end

  local stems = {}
  stems = { params.base }
  stems = { params.base }
  stems = { params.base .. "t" }
  stems = { ill_sg_stem }
  stems = { params.base .. "de" }
  stems = {}
  stems = { params.base .. "sid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type elu")

  local params = get_params(args, 1)
  local ill_sg_stem = params.base

  if mw.ustring.find(ill_sg_stem, "$") or mw.ustring.find(ill_sg_stem, "^$") then
    local base, cons, vowel = mw.ustring.match(ill_sg_stem, "^(.-)(.)(.)$")

    if cons == "b" then
      ill_sg_stem = base .. "pp" .. vowel
    elseif cons == "d" then
      ill_sg_stem = base .. "tt" .. vowel
    elseif cons == "g" then
      ill_sg_stem = base .. "kk" .. vowel
    else
      ill_sg_stem = base .. cons .. cons .. vowel
    end
  end

  local stems = {}
  stems = { params.base }
  stems = { params.base }
  stems = { params.base }
  stems = { ill_sg_stem }
  stems = { params.base .. "de" }
  stems = {}
  stems = { params.base .. "sid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type kivi")

  local params = get_params(args, 1)
  local pl_stem = mw.ustring.gsub(params.base, "$", "e")
  local ill_sg_stem = params.base

  if mw.ustring.find(ill_sg_stem, "$") or mw.ustring.find(ill_sg_stem, "^$") then
    ill_sg_stem = mw.ustring.gsub(ill_sg_stem, "(.)(.)$", "%1%1%2")
  end

  local stems = {}
  stems = { params.base }
  stems = { params.base }
  stems = { params.base }
  stems = { ill_sg_stem }
  stems = { params.base .. "de" }
  stems = { pl_stem }
  stems = { pl_stem, params.base .. "sid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type pesa")

  local params = get_params(args, 1)
  local pl_stem = mw.ustring.gsub(params.base, "$", "i")
  local ill_sg_stem = params.base

  if mw.ustring.find(ill_sg_stem, "$") or mw.ustring.find(ill_sg_stem, "^$") then
    ill_sg_stem = mw.ustring.gsub(ill_sg_stem, "(.)(.)$", "%1%1%2")
  end

  local stems = {}
  stems = { params.base }
  stems = { params.base }
  stems = { params.base }
  stems = { ill_sg_stem }
  stems = { params.base .. "de" }
  stems = { pl_stem }
  stems = { pl_stem, params.base .. "sid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type sõna")

  local params = get_params(args, 1)
  local pl_stem = mw.ustring.gsub(params.base, "$", "u")
  local ill_sg_stem = params.base

  if mw.ustring.find(ill_sg_stem, "$") or mw.ustring.find(ill_sg_stem, "^$") then
    local base, cons, vowel = mw.ustring.match(ill_sg_stem, "^(.-)(.)(.)$")

    if cons == "b" then
      ill_sg_stem = base .. "pp" .. vowel
    else
      ill_sg_stem = base .. cons .. cons .. vowel
    end
  end

  local stems = {}
  stems = { params.base }
  stems = { params.base }
  stems = { params.base }
  stems = { ill_sg_stem }
  stems = { params.base .. "de" }
  stems = { pl_stem }
  stems = { pl_stem, params.base .. "sid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ]"
  table.insert(data.categories, "Formes nominales en estonien de type nägu")

  local params = get_params(args, 4, true)

  if params.strong == params.weak then
    data.title = data.title .. ", sans gradation"
  else
    data.title = data.title .. ", ''" .. params.strong .. "-" .. (params.weak == "" and "ø" or params.weak) .. "'' gradation"
  end

  local extra_strong = params.strong
  local weak_stem = params.base .. params.weak .. params.final

  if params.strong == "b" then
    extra_strong = "pp"
  elseif params.strong == "d" then
    extra_strong = "tt"
  elseif params.strong == "g" then
    extra_strong = "kk"
  end

  if params.weak == "" then
    if mw.ustring.find(params.base, "ä$") and params.final == "u" then
      -- nägu
      weak_stem = params.base .. "o"
    end
  end

  local stems = {}
  stems = { params.base .. params.strong .. params.final }
  stems = { weak_stem }
  stems = { params.base .. params.strong .. params.final }
  stems = { params.base .. extra_strong .. params.final }
  stems = { params.base .. params.strong .. params.final .. "de" }
  stems = {}
  stems = { params.base .. params.strong .. params.final .. "sid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ]"
  table.insert(data.categories, "Formes nominales en estonien de type tuba")

  local params = get_params(args, 4, true)

  if params.strong == params.weak then
    data.title = data.title .. ", sans gradation"
  else
    data.title = data.title .. ", ''" .. params.strong .. "-" .. (params.weak == "" and "ø" or params.weak) .. "'' gradation"
  end

  local extra_strong = params.strong
  local weak_stem = params.base .. params.weak .. params.final

  if params.strong == "b" then
    extra_strong = "pp"
  elseif params.strong == "d" then
    extra_strong = "tt"
  elseif params.strong == "g" then
    extra_strong = "kk"
  end

  if params.weak == "" then
    if mw.ustring.find(params.base, "u$") then
      -- tuba
      if params.final == "a" then
        weak_stem = mw.ustring.gsub(params.base, "u$", "o") .. params.final
      end
    end
  end

  local stems = {}
  stems = { params.base .. params.strong .. params.final }
  stems = { weak_stem }
  stems = { params.base .. params.strong .. params.final }
  stems = { params.base .. extra_strong .. params.final }
  stems = { params.base .. params.strong .. params.final .. "de" }
  stems = {}
  stems = { params.base .. params.strong .. "e", params.base .. params.strong .. params.final .. "sid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ]"
  table.insert(data.categories, "Formes nominales en estonien de type sõda")

  local params = get_params(args, 4, true)

  if params.strong == params.weak then
    data.title = data.title .. ", sans gradation"
  else
    data.title = data.title .. ", ''" .. params.strong .. "-" .. (params.weak == "" and "ø" or params.weak) .. "'' gradation"
  end

  local extra_strong = params.strong
  local weak_stem = params.base .. params.weak .. params.final
  local weak_pl_stem = params.base .. params.weak .. "u"

  if params.strong == "b" then
    extra_strong = "pp"
  elseif params.strong == "d" then
    extra_strong = "tt"
  elseif params.strong == "g" then
    extra_strong = "kk"
  end

  if params.weak == "" then
    if mw.ustring.find(params.base, "i$") then
      -- rida
      if params.final == "a" then
        weak_stem = mw.ustring.gsub(params.base, "i$", "e") .. params.final
      end

      weak_pl_stem = nil
    end
  end

  local stems = {}
  stems = { params.base .. params.strong .. params.final }
  stems = { weak_stem }
  stems = { params.base .. params.strong .. params.final }
  stems = { params.base .. extra_strong .. params.final }
  stems = { params.base .. params.strong .. params.final .. "de" }
  stems = { weak_pl_stem }
  stems = { params.base .. params.strong .. "u", params.base .. params.strong .. params.final .. "sid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type seminar")

  local params = get_params(args, 1)

  local stems = {}
  stems = { params.base }
  stems = { params.base .. "i" }
  stems = { params.base .. "i" }
  stems = { params.base .. "i" }
  stems = { params.base .. "ide" }
  stems = { params.base .. "e" }
  stems = { params.base .. "e", params.base .. "isid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type süli")

  local params = get_params(args, 1)
  local ill_sg_stem = params.base

  if mw.ustring.find(ill_sg_stem, "$") or mw.ustring.find(ill_sg_stem, "^$") then
    local base, cons = mw.ustring.match(ill_sg_stem, "^(.-)(.)$")
    ill_sg_stem = base .. cons .. cons
  end

  local stems = {}
  stems = { params.base .. "i" }
  stems = { params.base .. "e" }
  stems = { params.base .. "e" }
  stems = { ill_sg_stem .. "e" }
  stems = { params.base .. "ede" }
  stems = {}
  stems = { params.base .. "esid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ]"
  table.insert(data.categories, "Formes nominales en estonien de type jõgi")

  local params = get_params(args, 3, true)
  local extra_strong = params.strong

  if params.strong == "g" then
    extra_strong = "kk"
  end

  if params.strong == params.weak then
    data.title = data.title .. ", length gradation"
  else
    data.title = data.title .. ", ''" .. params.strong .. "-" .. (params.weak == "" and "ø" or params.weak) .. "'' gradation"
  end

  local stems = {}
  stems = { params.base .. params.strong .. "i" }
  stems = { params.base .. params.weak .. "e" }
  stems = { params.base .. params.strong .. "e" }
  stems = { params.base .. extra_strong .. "e" }
  stems = { params.base .. params.strong .. "ede" }
  stems = {}
  stems = { params.base .. params.strong .. "esid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], ''kk-k'' gradation"
  table.insert(data.categories, "Formes nominales en estonien de type õnnelik")

  local params = get_params(args, 1)

  local stems = {}
  stems = { params.base .. "k" }
  stems = { params.base .. "ku" }
  stems = { params.base .. "kku" }
  stems = { params.base .. "kku" }
  stems = { params.base .. "ke", params.base .. "kkude" }
  stems = {}
  stems = { params.base .. "kke", params.base .. "kkusid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type koi")

  local params = get_params(args, 1)
  local par_sg = args;
  if par_sg == "" then
    par_sg = nil
  end  -- For nõu

  local stems = {}
  stems = { params.base }
  stems = { params.base }
  stems = { par_sg or params.base .. "d" }
  stems = {}
  stems = { params.base .. "de" }
  stems = {}
  stems = { params.base .. "sid" }

  process_stems(data, stems)
end

inflections = function(args, data)
  data.title = "Type ÕS ], sans gradation"
  table.insert(data.categories, "Formes nominales en estonien de type idee")

  local params = get_params(args, 1)
  local ill_sg2 = args;
  if ill_sg2 == "" then
    ill_sg2 = nil
  end
  local shortened_stem, vowel = mw.ustring.match(params.base, "^(.-)(?)$")

  local stems = {}
  stems = { params.base }
  stems = { params.base }
  stems = { params.base .. "d" }
  stems = {}
  stems = { params.base .. "de" }
  stems = { shortened_stem .. "i" }
  stems = { shortened_stem .. "id", params.base .. "sid" }

  process_stems(data, stems)

  if ill_sg2 then
    table.insert(data.forms, shortened_stem .. "h" .. vowel)
  end
end


-- Helper functions

local function combine(forms1, forms2)
  if forms1 and forms2 then
    local ret = mw.clone(forms1)

    for _, form in ipairs(forms2) do
      table.insert(ret, form)
    end

    return ret
  elseif forms1 then
    return mw.clone(forms1)
  elseif forms2 then
    return mw.clone(forms2)
  else
    return nil
  end
end

function postprocess(args, data)
  local n = args;
  if n == "" then
    n = nil
  end

  data.forms = combine(data.forms, data.forms)

  for _, case in ipairs({ "ill", "ine", "ela", "all", "ade", "abl", "tra" }) do
    data.forms = combine(data.forms, data.forms)
  end

  if n == "pl" then
    table.insert(data.categories, "Mots au pluriel uniquement en estonien")
  end

  -- TODO: This says "nouns", but this module is also used for adjectives!
  if n == "sg" then
    table.insert(data.categories, "Mots au singulier uniquement en estonien")
  end

  for key, form in pairs(data.forms) do
    -- Do not show singular or plural forms for nominals that don't have them
    if (n == "pl" and key:find("_sg$")) or (n == "sg" and key:find("_pl$")) then
      form = nil
    end

    data.forms = form
  end

  -- Check if the lemma form matches the page name
  if data.forms ~= mw.title.getCurrentTitle().text then
    table.insert(data.categories, "Mots en estonien dont la déclinaison ne correspond pas au titre de la page")
  end
end

-- Make the table
function make_table(data)
  local function show_form(form)
    if not form then
      return "—"
    elseif type(form) ~= "table" then
      error("a non-table value was given in the list of inflected forms.")
    end

    local ret = {}

    for _, subform in ipairs(form) do
      table.insert(ret, mw.ustring.format("]", subform))
    end

    return table.concat(ret, "<br/>")
  end

  local function repl(param)
    if param == "lemma" then
      return mw.ustring.format("]", mw.title.getCurrentTitle().text)
    elseif param == "info" then
      return data.title and " (" .. data.title .. ")" or ""
    else
      return show_form(data.forms)
    end
  end

  local wikicode = [=[<div class="inflection-table {{#if:{{{appendix|}}}{{{nonav|}}}||mw-collapsible}}" style="float: right; max-width: 50%; min-width: 20%; overflow-x: auto; border: 1px solid #aaa; background: white;">
<div style="background:#DDF; text-align: center; font-weight: bold;">Déclinaison</div>
<div class="mw-collapsible-content">
{| class="flextable" style="margin: 0 auto; float: none;"
|+ Déclinaison de {{{lemma}}}{{{info}}}
! Cas
! Singulier
! Pluriel
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Nominatif
| {{{nom_sg}}}
| {{{nom_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Accusatif<sup>1</sup>
| {{{gen_sg}}}
| {{{nom_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Génitif
| {{{gen_sg}}}
| {{{gen_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Partitif
| {{{par_sg}}}
| {{{par_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Illatif
| {{{ill_sg}}}
| {{{ill_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Inessif
| {{{ine_sg}}}
| {{{ine_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Élatif
| {{{ela_sg}}}
| {{{ela_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Allatif
| {{{all_sg}}}
| {{{all_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Adessif
| {{{ade_sg}}}
| {{{ade_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Ablatif
| {{{abl_sg}}}
| {{{abl_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Translatif
| {{{tra_sg}}}
| {{{tra_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Terminatif
| {{{ter_sg}}}
| {{{ter_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Essif
| {{{ess_sg}}}
| {{{ess_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Abessif
| {{{abe_sg}}}
| {{{abe_pl}}}
|- style="background:rgb(95%,95%,100%);vertical-align:top;"
! style="background:rgb(80%,80%,100%);" | Comitatif
| {{{com_sg}}}
| {{{com_pl}}}
|-
| colspan="3" bgcolor="#EEEEF7" |
<div class="mw-collapsible mw-collapsed" style="text-align: left;">Notes n° 1
<div class="mw-collapsible-content">
* 1 : L'accusatif n'est pas officiellement reconnu<br/>comme l'un des 14 cas de l'estonien.<br/>Son existence est toutefois proposée par<br/>certains linguistes.
</div>
</div>
|}
</div>
</div>]=]

  return mw.ustring.gsub(wikicode, "{{{(+)}}}", repl)
end

return p