Jump to content

Module:Airananwe: Difference between revisions

From Yezur Wiki
Thiorosan (talk | contribs)
Add p.decl: the four noun forms, plural and genitive generated from the rulesets
Thiorosan (talk | contribs)
Fix the conjugation header (cells need !! separators, not !) and add the passive Future column
 
(One intermediate revision by the same user not shown)
Line 16: Line 16:
{ 'Near present', 'nearpresent' }, { 'Near future', 'nearfuture' }, { 'Future', 'future' },
{ 'Near present', 'nearpresent' }, { 'Near future', 'nearfuture' }, { 'Future', 'future' },
}
}
local PASSIVE = { { 'Past', 'passive-past' }, { 'Present', 'passive-present' } }
local PASSIVE = { { 'Past', 'passive-past' }, { 'Present', 'passive-present' },
{ 'Future', 'passive-future' } }


local function build()
local function build()
Line 42: Line 43:
local out = { '{| class="wikitable" style="text-align:center"' }
local out = { '{| class="wikitable" style="text-align:center"' }
out[#out + 1] = '|+ ' .. caption
out[#out + 1] = '|+ ' .. caption
local head = { '!' }
local names = {}
for _, t in ipairs(tenses) do head[#head + 1] = '! ' .. t[1] end
for _, t in ipairs(tenses) do names[#names + 1] = t[1] end
out[#out + 1] = table.concat(head, ' ')
out[#out + 1] = '! !! ' .. table.concat(names, ' !! ')
for _, per in ipairs(PERSONS) do
for _, per in ipairs(PERSONS) do
out[#out + 1] = '|-'
out[#out + 1] = '|-'
Line 78: Line 79:
local gen = eng:run(data.sets['genitive'], w, false)
local gen = eng:run(data.sets['genitive'], w, false)
local plg = eng:run(data.sets['genitive'], pl, false)
local plg = eng:run(data.sets['genitive'], pl, false)
local function b(s) return "'''" .. s .. "'''" end
local out = {
local out = {
'{| class="wikitable" style="text-align:center"',
'{| class="wikitable" style="text-align:center"',
'! !! SG !! PL',
'! !! SG !! PL',
'|-', '! plain',
'|-', '! plain',
"| .. w .. || .. pl .. ",
'| ' .. b(w) .. ' || ' .. b(pl),
'|-', '! genitive',
'|-', '! genitive',
"| .. gen .. || .. plg .. ",
'| ' .. b(gen) .. ' || ' .. b(plg),
'|}',
'|}',
}
}

Latest revision as of 09:10, 27 August 2026

This is the documentation for Module:Airananwe, the inflection-table builder for Airananwe (registry code YAS-AI) on the Yezur wiki. It is not called directly: Template:YAS-AI-conj invokes {{#invoke:Airananwe|conj}} and Template:YAS-AI-decl invokes {{#invoke:Airananwe|decl}}, and Dictionary entries transclude those templates under a ====Conjugation==== or ====Declension==== heading.

The module holds no rules of its own: what it hard-codes is the inventory of tenses and persons and the layout of the tables, while every form is derived by running one named ruleset from Module:Auphen/YAS-AI over the citation form. It requires that data page directly rather than through Module:Auphen/frame, and builds an Module:Auphen engine from its orthography-scope categories (cats) alone. The engine is created without ipa_rules and each form is asked for in spelling rather than sound, so pronounce is never run and the tables come out in ordinary Airananwe orthography; pronunciation stays with {{auphen}}. A change to the rules on the data page is therefore picked up here without an edit to this module, which is wired to YAS-AI and serves no other language.

Parameters

Both functions take the same parameters and read them from the parent frame, so they are given to the wrapper template rather than to the invocation.

Parameter Purpose
word The form to inflect: the citation form of the verb for conj, the singular of the noun for decl. Defaults to the page name when omitted.
1 A positional alternative to word, consulted only when word is absent; a word that is present but empty falls through to the page name instead.

Rulesets

Ruleset Derives
tense-person One finite form. tense is past, nearpast, present, nearpresent, nearfuture, future, passive-past, passive-present or passive-future; person is 1sg, 2sg, 3sg, 3sg-f, 1p, 2p or 3p.
tense-person-neg The negative counterpart of the same form.
plural The plural of a noun, from the shape of the singular.
genitive The genitive of a noun. Run over the headword for the singular and over the generated plural for the plural.

The data page carries two further rulesets, special and passive, which this module never calls: each finite ruleset repeats inline the stem derivation it needs — bare stem, special stem or passive stem — before the personal ending, so it can be run over the citation form on its own. The two remain reachable as {{auphen|word|YAS-AI|special}}.

conj emits two tables, the seven persons down the side, captioned "Active — negative beneath each form" and "Passive". The first covers the six active tenses, the affirmative in bold with the negative in grey beneath it; the second covers the passive past, present and future in the same layout. A tense and person for which no affirmative ruleset exists is shown as an em dash, and a missing negative leaves the lower line of the cell empty; with the data page as it stands neither case arises.

decl emits a single table, SG and PL against plain and genitive, all four forms in bold. Airananwe has no case in the old sense — the plural is formed by rule from the shape of the singular, and the genitive is the suffixed postposition -enne (-nne after a vowel), which attaches to both numbers. Running the genitive over the plural is the one place where the output of one ruleset is fed to another.

For the rule notation itself, and for the engine's behaviour and divergence log, see Module talk:Auphen.


-- Module:Airananwe — verb conjugation for Airananwe (YAS-AI).
-- Backs Template:YAS-AI-conj. Every form is generated by running one of the
-- named rulesets in [[Module:Auphen/YAS-AI]] over the citation form, so a
-- change to the sound rules is picked up here with no edit to this module.
-- The rulesets are self-contained: each prepends its own stem derivation
-- (bare stem, special stem or passive stem) before the personal endings.
local p = {}
local Auphen = require('Module:Auphen')

local PERSONS = {
	{ '1SG', '1sg' }, { '2SG', '2sg' }, { '3SG', '3sg' }, { '3SG.F', '3sg-f' },
	{ '1P', '1p' }, { '2P', '2p' }, { '3P', '3p' },
}
local ACTIVE = {
	{ 'Past', 'past' }, { 'Near past', 'nearpast' }, { 'Present', 'present' },
	{ 'Near present', 'nearpresent' }, { 'Near future', 'nearfuture' }, { 'Future', 'future' },
}
local PASSIVE = { { 'Past', 'passive-past' }, { 'Present', 'passive-present' },
	{ 'Future', 'passive-future' } }

local function build()
	local data = require('Module:Auphen/YAS-AI')
	local cats = {}
	for name, members in pairs(data.cats or {}) do
		local m = {}
		for i = 1, #members do m[i] = members[i] end
		cats[name] = m
	end
	return Auphen.new(cats), data
end

-- one cell: affirmative over negative
local function cell(eng, data, word, key)
	local aff = data.sets[key]
	local neg = data.sets[key .. '-neg']
	if not aff then return '| —' end
	local a = eng:run(aff, word, false)
	local n = neg and eng:run(neg, word, false) or ''
	return "| '''" .. a .. "'''<br /><span style=\"color:#767676\">" .. n .. '</span>'
end

local function grid(eng, data, word, tenses, caption)
	local out = { '{| class="wikitable" style="text-align:center"' }
	out[#out + 1] = '|+ ' .. caption
	local names = {}
	for _, t in ipairs(tenses) do names[#names + 1] = t[1] end
	out[#out + 1] = '! !! ' .. table.concat(names, ' !! ')
	for _, per in ipairs(PERSONS) do
		out[#out + 1] = '|-'
		out[#out + 1] = '! ' .. per[1]
		for _, t in ipairs(tenses) do
			out[#out + 1] = cell(eng, data, word, t[2] .. '-' .. per[2])
		end
	end
	out[#out + 1] = '|}'
	return table.concat(out, '\n')
end

-- {{#invoke:Airananwe|conj|word=…}} — the citation form, or the page name.
function p.conj(frame)
	local a = frame:getParent().args
	local w = mw.text.trim(a.word or a[1] or '')
	if w == '' then w = mw.title.getCurrentTitle().text end
	local eng, data = build()
	return grid(eng, data, w, ACTIVE, 'Active — negative beneath each form')
		.. '\n' .. grid(eng, data, w, PASSIVE, 'Passive')
end

-- {{#invoke:Airananwe|decl|word=…}} — the four noun forms. There is no case in
-- the old sense: the plural is formed by rule from the shape of the singular,
-- and the genitive is the suffixed postposition -enne (-nne after a vowel),
-- which attaches to both numbers.
function p.decl(frame)
	local a = frame:getParent().args
	local w = mw.text.trim(a.word or a[1] or '')
	if w == '' then w = mw.title.getCurrentTitle().text end
	local eng, data = build()
	local pl  = eng:run(data.sets['plural'], w, false)
	local gen = eng:run(data.sets['genitive'], w, false)
	local plg = eng:run(data.sets['genitive'], pl, false)
	local function b(s) return "'''" .. s .. "'''" end
	local out = {
		'{| class="wikitable" style="text-align:center"',
		'! !! SG !! PL',
		'|-', '! plain',
		'| ' .. b(w) .. ' || ' .. b(pl),
		'|-', '! genitive',
		'| ' .. b(gen) .. ' || ' .. b(plg),
		'|}',
	}
	return table.concat(out, '\n')
end

return p