Jump to content

Module:Gaillean: Difference between revisions

From Yezur Wiki
Thiorosan (talk | contribs)
Add irregular stems for randei, tonhwith and velna-ollu; reject a regular-class lemma that lacks the class ending instead of silently building a wrong paradigm
Thiorosan (talk | contribs)
Add class NP for Thaemo (declines as a neuter in -u but with -o, and has no plural) and a |nopl= flag so any unique referent can suppress its plural
 
Line 7: Line 7:


-- class letter (as given in the lexicon) -> paradigm
-- class letter (as given in the lexicon) -> paradigm
local CLASS = { F = "a", M1 = "e", M2 = "at", N1 = "uz", N2 = "u",
local CLASS = { F = "a", M1 = "e", M2 = "at", N1 = "uz", N2 = "u", NP = "o",
                 MX = "irr", FX = "irr", NX = "irr" }
                 MX = "irr", FX = "irr", NX = "irr" }


Line 33: Line 33:
           {"DAT", "i",  "ibhi"}, {"ACC", "uz",  "ia"},
           {"DAT", "i",  "ibhi"}, {"ACC", "uz",  "ia"},
           {"VOC", "u",  "i"} } },
           {"VOC", "u",  "i"} } },
  -- Thaemo: a unique proper noun. It declines as a neuter in -u but with -o
  -- throughout, and being unique it has no plural.
  o  = { cut = "o",  nopl = true, rows = {
          {"NOM", "o",  ""},    {"GEN", "on",  ""},
          {"DAT", "i",  ""},    {"ACC", "o",  ""},
          {"VOC", "o",  ""} } },
   -- irregular nouns decline from a stem in -r, supplied with |stem=
   -- irregular nouns decline from a stem in -r, supplied with |stem=
   irr = { cut = "r", rows = {
   irr = { cut = "r", rows = {
Line 100: Line 106:
   end
   end
   local par = P[key]
   local par = P[key]
  -- a unique referent (a proper noun) has no plural; either the paradigm
  -- says so, or the entry passes |nopl=
  local nopl = par.nopl or (mw.text.trim(a.nopl or "") ~= "")
   local stem
   local stem
   if key == "irr" then
   if key == "irr" then
Line 131: Line 140:
           or (r[1] == "VOC") and (short .. "ia")
           or (r[1] == "VOC") and (short .. "ia")
           or (U.gsub(stem, "r$", "") .. r[3])
           or (U.gsub(stem, "r$", "") .. r[3])
    elseif nopl then
      pl = "—"
     else
     else
       pl = stem .. r[3]
       pl = stem .. r[3]

Latest revision as of 11:00, 27 August 2026

This is the documentation for Module:Gaillean, the noun-declension module for Gaillean (YAQ-GA) on the Yezur wiki. It is not called directly: Template:YAQ-GA-decl is a bare {{#invoke:Gaillean|decl}} and the module reads the template's own parameters from the parent frame, so a Dictionary entry writes {{YAQ-GA-decl|class=F}} under its declension heading. The module returns a wikitable of five cases — nominative, genitive, dative, accusative and vocative — in columns headed SG and PL.

Forms are built by concatenation from the citation form. The module does not call Module:Auphen; the Gaillean sound data at Module:Auphen/YAQ-GA serves the entry's pronunciation line instead.

Parameters

Parameter Purpose
word (or 1) The citation form to decline. Defaults to the page name when omitted, which is how entries use it.
class (or 2) The noun class, in the letters recorded on the entry's {{head}} line. Required; an unrecognised value returns an error message in place of the table.
stem The stem of an irregular noun, the form in -r its other forms are built on. Read only for classes MX, FX and NX, where it takes precedence over the module's own table of stems.
nopl Any non-empty value suppresses the plural, whose cells are then filled with a dash. For nouns with a unique referent.

Regular classes

The classes below decline by rule, each tied to the ending of the citation form. The module removes that ending and adds the endings given here; a lemma that does not carry its class's ending returns an error rather than a table. Singular and plural are given in that order.

Class Lemma in NOM GEN DAT ACC VOC
F -a -a / -ar -an / -aori -ae / -uz -as / -ax -a / -a
M1 -e -e / -o -in / -ori -i / -uz -ez / -orz bare stem / -or
M2 -at -at / -o -ant / -ori -i / -on -ats / -ae -a / -o
N1 -uz -uz / -ia -uzn / -iari -i / -ibhi -uz / -ia -u / -i
N2 -u -u / -ur -un / -uri -i / -uri -u / -ur -u / -ur
NP -o -o -on -i -o -o

Class NP is a one-off: it follows N2 with -o wherever that class has -u, and has no plural at all, the plural cells being dashed without nopl. It is carried at present only by Thaemo.

Irregular classes

Classes MX, FX and NX do not decline from the citation form, and differ from one another only in the gender they record: the module declines all three alike. They decline from a stem in -r, taken from stem or, failing that, from the module's own table of 44 stems keyed by lemma; where neither supplies one the module returns an error. No entry passes stem at present, so every irregular relies on the table. Several of its stems belong to transparent compounds and repeat the stem of the head noun, so velna-aevr takes velna-aetover beside aevraetover.

The nominative singular is the citation form itself and the nominative plural the bare stem. The other singulars are built on a shortened stem — the stem less its final -r and the vowel before it — and take -un, -i, -as and -i for genitive, dative, accusative and vocative. The genitive, dative and accusative plurals are built on the stem less its final -r and take -tri, -z and -ter; the vocative plural takes -ia on the shortened stem. Thus aevr, stem aetover: gen. sg. aetovun, dat. sg. aetovi, acc. sg. aetovas, voc. sg. aetovi; nom. pl. aetover, gen. pl. aetovetri, dat. pl. aetovez, acc. pl. aetoveter, voc. pl. aetovia.

nopl is honoured by the regular classes only; the irregular classes build their plural on a separate branch and ignore it. All three failure cases — an unknown class, a lemma without its class's ending, and an irregular noun with no stem on record — are returned as a class="error" span in place of the table.


-- Module:Gaillean — noun declension for Gaillean (YAQ-GA). Backs
-- Template:YAQ-GA-decl. Five regular paradigms, named for the shape of the
-- nominative singular, plus an irregular class that declines from a separate
-- stem. Cases: NOM GEN DAT ACC VOC, singular and plural.
local p = {}
local U = mw.ustring

-- class letter (as given in the lexicon) -> paradigm
local CLASS = { F = "a", M1 = "e", M2 = "at", N1 = "uz", N2 = "u", NP = "o",
                MX = "irr", FX = "irr", NX = "irr" }

-- paradigm = { cut = <what is removed from the citation form>,
--              rows = { {case, sg, pl}, ... } }
local P = {
  a  = { cut = "a",  rows = {
           {"NOM", "a",   "ar"},   {"GEN", "an",  "aori"},
           {"DAT", "ae",  "uz"},   {"ACC", "as",  "ax"},
           {"VOC", "a",   "a"} } },
  e  = { cut = "e",  rows = {
           {"NOM", "e",   "o"},    {"GEN", "in",  "ori"},
           {"DAT", "i",   "uz"},   {"ACC", "ez",  "orz"},
           {"VOC", "",    "or"} } },
  at = { cut = "at", rows = {
           {"NOM", "at",  "o"},    {"GEN", "ant", "ori"},
           {"DAT", "i",   "on"},   {"ACC", "ats", "ae"},
           {"VOC", "a",   "o"} } },
  u  = { cut = "u",  rows = {
           {"NOM", "u",   "ur"},   {"GEN", "un",  "uri"},
           {"DAT", "i",   "uri"},  {"ACC", "u",   "ur"},
           {"VOC", "u",   "ur"} } },
  uz = { cut = "uz", rows = {
           {"NOM", "uz",  "ia"},   {"GEN", "uzn", "iari"},
           {"DAT", "i",   "ibhi"}, {"ACC", "uz",  "ia"},
           {"VOC", "u",   "i"} } },
  -- Thaemo: a unique proper noun. It declines as a neuter in -u but with -o
  -- throughout, and being unique it has no plural.
  o  = { cut = "o",  nopl = true, rows = {
           {"NOM", "o",   ""},    {"GEN", "on",  ""},
           {"DAT", "i",   ""},    {"ACC", "o",   ""},
           {"VOC", "o",   ""} } },
  -- irregular nouns decline from a stem in -r, supplied with |stem=
  irr = { cut = "r", rows = {
           {"NOM", "LEMMA", ""},    {"GEN", "un",  "tri"},
           {"DAT", "i",     "z"},   {"ACC", "as",  "ter"},
           {"VOC", "i",     "ia"} } },
}


-- Irregular stems, supplied by the operator. The last four are transparent
-- compounds and take the stem of their head noun.
local STEMS = {
  ['aevr'] = 'aetover',
  ['antef'] = 'antepher',
  ['canno'] = 'cannour',
  ['canton'] = 'cantner',
  ['dwalia'] = 'dwalter',
  ['haebri'] = 'haeper',
  ['iat'] = 'iekher',
  ['los'] = 'lonser',
  ['ollu'] = 'oller',
  ['perinio'] = 'periniour',
  ['petros'] = 'peter',
  ['qanitzh'] = 'qantizher',
  ['qolluth'] = 'qolluter',
  ['son'] = 'sonter',
  ['sondel'] = 'sonther',
  ['water'] = 'watrer',
  ['tonaevr'] = 'tonaetover',
  ['velna-aevr'] = 'velna-aetover',
  ['ithlinexi-aevr'] = 'ithlinexi-aetover',
  ['ithlinexi-ollu'] = 'ithlinexi-oller',
  ['aezhizel'] = 'aezhiller',
  ['carrix'] = 'carricter',
  ['elfitis'] = 'elfitwir',
  ['ennerd'] = 'enxer',
  ['gwani'] = 'gwater',
  ['hwith'] = 'hwinther',
  ['munu'] = 'munwer',
  ['nanti'] = 'nattiker',
  ['qoethae'] = 'qoethaner',
  ['rian'] = 'rianter',
  ['sona'] = 'sonater',
  ['wuerit'] = 'wuetter',
  ['zwathor'] = 'zwather',
  ['allan'] = 'alloner',
  ['awiter'] = 'awiter',
  ['hipilas'] = 'hipintar',
  ['ip'] = 'iper',
  ['khest'] = 'khetter',
  ['mpes'] = 'mpester',
  ['randei'] = 'ranther',
  ['tonhwith'] = 'tonhwinther',
  ['velna-ollu'] = 'velna-oller',
  ['ithlinexi-hwith'] = 'ithlinexi-hwinther',
  ['velna-hwith'] = 'velna-hwinther',
}

function p.decl(frame)
  local a = frame:getParent().args
  local word = mw.text.trim(a.word or a[1] or "")
  if word == "" then word = mw.title.getCurrentTitle().text end
  local cls = mw.text.trim(a.class or a[2] or "")
  local key = CLASS[cls]
  if not key then
    return "<span class=\"error\">Gaillean: unknown noun class \"" .. cls .. "\"</span>"
  end
  local par = P[key]
  -- a unique referent (a proper noun) has no plural; either the paradigm
  -- says so, or the entry passes |nopl=
  local nopl = par.nopl or (mw.text.trim(a.nopl or "") ~= "")
  local stem
  if key == "irr" then
    local s = mw.text.trim(a.stem or "")
    if s == "" then s = STEMS[word] or "" end
    if s == "" then
      return "<span class=\"error\">Gaillean irregular noun: no stem recorded</span>"
    end
    stem = s
  else
    -- a regular class implies its ending: reject a lemma that does not carry it,
    -- rather than silently no-opping the gsub and inventing a paradigm
    if not U.find(word, par.cut .. "$") then
      return '<span class="error">Gaillean: a class-' .. cls ..
             ' noun must end in -' .. par.cut .. '</span>'
    end
    stem = U.gsub(word, par.cut .. "$", "")
  end
  local out = { '{| class="wikitable" style="text-align:center"',
                '! !! SG !! PL' }
  -- irregular singulars drop the vowel before the stem's final r
  local short = stem
  if key == "irr" then
    short = U.gsub(U.gsub(stem, "r$", ""), "[aeiou]$", "")
  end
  for _, r in ipairs(par.rows) do
    local sg = (r[2] == "LEMMA") and word or ((key == "irr" and short or stem) .. r[2])
    local pl
    if key == "irr" then
      pl = (r[1] == "NOM") and stem
           or (r[1] == "VOC") and (short .. "ia")
           or (U.gsub(stem, "r$", "") .. r[3])
    elseif nopl then
      pl = "&mdash;"
    else
      pl = stem .. r[3]
    end
    table.insert(out, "|-")
    table.insert(out, "! " .. r[1])
    table.insert(out, "| '''" .. sg .. "''' || '''" .. pl .. "'''")
  end
  table.insert(out, "|}")
  return table.concat(out, "\n")
end

return p