Module:osx-decl-noun
Appearance
- The following documentation is located at Module:osx-decl-noun/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local export = {}
local m_links = require("Module:links")
local m_utils = require("Module:utilities")
local lang = require("Module:languages").getByCode("osx")
local decl_data = {}
decl_data["a-f"] = {
params = {
[1] = {},
},
}
setmetatable(decl_data["a-f"], {__call = function(self, args, data)
data.decl_type = "feminine a-stem"
data.forms["nom_sg"] = {args[1] .. "a"}
data.forms["acc_sg"] = {args[1] .. "a"}
data.forms["gen_sg"] = {args[1] .. "ō"}
data.forms["dat_sg"] = {args[1] .. "u"}
data.forms["nom_pl"] = {args[1] .. "a"}
data.forms["acc_pl"] = {args[1] .. "a"}
data.forms["gen_pl"] = {args[1] .. "anō"}
data.forms["dat_pl"] = {args[1] .. "um"}
table.insert(data.categories, "Old Saxon a-stem nouns")
end
})
decl_data["a-f-v"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["a-f-v"], {__call = function(self, args, data)
data.decl_type = "feminine a-stem"
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1]}
data.forms["gen_sg"] = {args[2] .. "ō"}
data.forms["dat_sg"] = {args[2] .. "u"}
data.forms["nom_pl"] = {args[2] .. "a"}
data.forms["acc_pl"] = {args[2] .. "a"}
data.forms["gen_pl"] = {args[2] .. "anō"}
data.forms["dat_pl"] = {args[2] .. "um"}
table.insert(data.categories, "Old Saxon a-stem nouns")
end
})
decl_data["a-m"] = {
params = {
[1] = {},
},
}
setmetatable(decl_data["a-m"], {__call = function(self, args, data)
data.decl_type = "masculine a-stem"
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1]}
data.forms["gen_sg"] = {args[1] .. "es"}
data.forms["dat_sg"] = {args[1] .. "e"}
data.forms["nom_pl"] = {args[1] .. "os"}
data.forms["acc_pl"] = {args[1] .. "os"}
data.forms["gen_pl"] = {args[1] .. "ō"}
data.forms["dat_pl"] = {args[1] .. "um"}
table.insert(data.categories, "Old Saxon a-stem nouns")
end
})
decl_data["a-m-v"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["a-m-v"], {__call = function(self, args, data)
data.decl_type = "masculine a-stem"
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1]}
data.forms["gen_sg"] = {args[2] .. "es"}
data.forms["dat_sg"] = {args[2] .. "e"}
data.forms["nom_pl"] = {args[2] .. "os"}
data.forms["acc_pl"] = {args[2] .. "os"}
data.forms["gen_pl"] = {args[2] .. "ō"}
data.forms["dat_pl"] = {args[2] .. "um"}
table.insert(data.categories, "Old Saxon a-stem nouns")
end
})
decl_data["a-n"] = {
params = {
[1] = {},
},
}
setmetatable(decl_data["a-n"], {__call = function(self, args, data)
decl_data["a-m"](args, data)
data.decl_type = "neuter a-stem"
data.forms["nom_pl"] = {args[1]}
data.forms["acc_pl"] = {args[1]}
data.forms["dat_pl"] = {args[1] .. "un"}
end
})
decl_data["a-n1"] = {
params = {
[1] = {},
},
}
setmetatable(decl_data["a-n1"], {__call = function(self, args, data)
decl_data["a-m"](args, data)
data.decl_type = "neuter a-stem"
data.forms["nom_pl"] = {args[1] .. "u"}
data.forms["acc_pl"] = {args[1] .. "u"}
end
})
decl_data["a-n1-1"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["a-n1-1"], {__call = function(self, args, data)
decl_data["a-m-v"](args, data)
data.decl_type = "neuter a-stem"
data.forms["nom_pl"] = {args[2] .. "u"}
data.forms["acc_pl"] = {args[2] .. "u"}
end
})
decl_data["a-n2"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["a-n2"], {__call = function(self, args, data)
decl_data["a-m-v"](args, data)
data.decl_type = "neuter a-stem"
data.forms["nom_pl"] = {args[1]}
data.forms["acc_pl"] = {args[1]}
end
})
decl_data["i-f"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["i-f"], {__call = function(self, args, data)
data.decl_type = "feminine i-stem"
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1]}
data.forms["gen_sg"] = {args[2] .. "i"}
data.forms["dat_sg"] = {args[2] .. "i"}
data.forms["nom_pl"] = {args[2] .. "i"}
data.forms["acc_pl"] = {args[2] .. "i"}
data.forms["gen_pl"] = {args[2] .. "iō"}
data.forms["dat_pl"] = {args[2] .. "ium"}
table.insert(data.categories, "Old Saxon i-stem nouns")
end
})
decl_data["i-f2"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["i-f2"], {__call = function(self, args, data)
decl_data["i-f"](args, data)
data.forms["gen_pl"] = {args[1] .. "iō"}
data.forms["dat_pl"] = {args[1] .. "ium"}
end
})
decl_data["i-m"] = {
params = {
[1] = {},
[2] = {},
["mutstem"] = {},
},
}
setmetatable(decl_data["i-m"], {__call = function(self, args, data)
data.decl_type = "masculine i-stem"
data.forms["nom_sg"] = {args.mutstem or args[1]}
data.forms["acc_sg"] = {args.mutstem or args[1]}
data.forms["gen_sg"] = {args[1] .. "ies"}
data.forms["dat_sg"] = {args[1] .. "ie"}
data.forms["nom_pl"] = {args[2]}
data.forms["acc_pl"] = {args[2]}
data.forms["gen_pl"] = {args[1] .. "iō"}
data.forms["dat_pl"] = {args[1] .. "ium"}
table.insert(data.categories, "Old Saxon i-stem nouns")
end
})
decl_data["i-m1"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["i-m1"], {__call = function(self, args, data)
data.decl_type = "masculine i-stem"
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1]}
data.forms["gen_sg"] = {args[1] .. "es"}
data.forms["dat_sg"] = {args[1] .. "e"}
data.forms["nom_pl"] = {args[2] .. "i"}
data.forms["acc_pl"] = {args[2] .. "i"}
data.forms["gen_pl"] = {args[1] .. "iō"}
data.forms["dat_pl"] = {args[1] .. "ium"}
table.insert(data.categories, "Old Saxon i-stem nouns")
end
})
decl_data["ja-m"] = {
params = {
[1] = {},
["nopl"] = {},
},
}
setmetatable(decl_data["ja-m"], {__call = function(self, args, data)
data.decl_type = "masculine ja-stem"
data.forms["nom_sg"] = {args[1] .. "i"}
data.forms["acc_sg"] = {args[1] .. "i"}
data.forms["gen_sg"] = {args[1] .. "ies"}
data.forms["dat_sg"] = {args[1] .. "ie"}
if not args.nopl then
data.forms["nom_pl"] = {args[1] .. "ios"}
data.forms["acc_pl"] = {args[1] .. "ios"}
data.forms["gen_pl"] = {args[1] .. "iō"}
data.forms["dat_pl"] = {args[1] .. "ium"}
end
table.insert(data.categories, "Old Saxon ja-stem nouns")
end
})
decl_data["ja-n"] = {
params = {
[1] = {},
},
}
setmetatable(decl_data["ja-n"], {__call = function(self, args, data)
decl_data["ja-m"](args, data)
data.decl_type = "neuter ja-stem"
if not args.nopl then
data.forms["nom_pl"] = {args[1] .. "i"}
data.forms["acc_pl"] = {args[1] .. "i"}
end
end
})
decl_data["ja-n2"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["ja-n2"], {__call = function(self, args, data)
data.decl_type = "neuter ja-stem"
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1]}
data.forms["gen_sg"] = {args[2] .. "ies"}
data.forms["dat_sg"] = {args[2] .. "ie"}
data.forms["nom_pl"] = {args[1]}
data.forms["acc_pl"] = {args[1]}
data.forms["gen_pl"] = {args[2] .. "iō"}
data.forms["dat_pl"] = {args[2] .. "ium"}
table.insert(data.categories, "Old Saxon ja-stem nouns")
end
})
decl_data["n-m"] = {
params = {
[1] = {},
["nopl"] = {},
},
}
setmetatable(decl_data["n-m"], {__call = function(self, args, data)
data.decl_type = "masculine n-stem"
data.forms["nom_sg"] = {args[1] .. "o"}
data.forms["acc_sg"] = {args[1] .. "on", args[1] .. "an"}
data.forms["gen_sg"] = {args[1] .. "en", args[1] .. "an", args[1] .. "on" }
data.forms["dat_sg"] = {args[1] .. "en", args[1] .. "an", args[1] .. "on" }
if not args.nopl then
data.forms["nom_pl"] = {args[1] .. "on", args[1] .. "un", args[1] .. "an"}
data.forms["acc_pl"] = {args[1] .. "on", args[1] .. "un", args[1] .. "an"}
data.forms["gen_pl"] = {args[1] .. "ono"}
data.forms["dat_pl"] = {args[1] .. "un", args[1] .. "on"}
end
table.insert(data.categories, "Old Saxon n-stem nouns")
end
})
decl_data["n-n"] = {
params = {
[1] = {},
["nopl"] = {},
},
}
setmetatable(decl_data["n-n"], {__call = function(self, args, data)
decl_data["n-m"](args, data)
data.decl_type = "neuter n-stem"
data.forms["nom_sg"] = {args[1] .. "a"}
data.forms["acc_sg"] = {args[1] .. "a"}
end
})
decl_data["n-f"] = {
params = {
[1] = {},
["nopl"] = {},
},
}
setmetatable(decl_data["n-f"], {__call = function(self, args, data)
decl_data["n-m"](args, data)
data.decl_type = "feminine n-stem"
data.forms["nom_sg"] = {args[1] .. "a"}
data.forms["acc_sg"] = {args[1] .. "un", args[1] .. "an", args[1] .. "on" }
data.forms["gen_sg"] = {args[1] .. "un", args[1] .. "an", args[1] .. "on" }
data.forms["dat_sg"] = {args[1] .. "un", args[1] .. "an", args[1] .. "on" }
data.forms["nom_pl"] = {args[1] .. "un", args[1] .. "an", args[1] .. "on" }
data.forms["acc_pl"] = {args[1] .. "un", args[1] .. "an", args[1] .. "on" }
data.forms["dat_pl"] = {args[1] .. "un", args[1] .. "an", args[1] .. "on" }
end
})
decl_data["nd"] = {
params = {
[1] = {},
},
}
setmetatable(decl_data["nd"], {__call = function(self, args, data)
data.decl_type = "nd-stem"
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1]}
data.forms["gen_sg"] = {args[1] .. "es"}
data.forms["dat_sg"] = {args[1] .. "e"}
data.forms["nom_pl"] = {args[1]}
data.forms["acc_pl"] = {args[1]}
data.forms["gen_pl"] = {args[1] .. "ō"}
data.forms["dat_pl"] = {args[1] .. "um"}
table.insert(data.categories, "Old Saxon nd-stem nouns")
end
})
decl_data["o-f"] = {
params = {
[1] = {},
[2] = {},
["nopl"] = {},
},
}
setmetatable(decl_data["o-f"], {__call = function(self, args, data)
data.decl_type = "feminine ō-stem"
data.forms["nom_sg"] = {args[2] or (args[1] .. "a")}
data.forms["acc_sg"] = {args[2] or (args[1] .. "a")}
data.forms["gen_sg"] = {args[1] .. "a", args[1] .. "u", args[1] .. "o"}
data.forms["dat_sg"] = {args[1] .. "u", args[1] .. "o", args[1] .. "a"}
if not args.nopl then
data.forms["nom_pl"] = {args[1] .. "a"}
data.forms["acc_pl"] = {args[1] .. "a"}
data.forms["gen_pl"] = {args[1] .. "ono"}
data.forms["dat_pl"] = {args[1] .. "on", args[1] .. "um", args[1] .. "un"}
end
table.insert(data.categories, "Old Saxon ō-stem nouns")
end
})
decl_data["r-n"] = {
params = {
[1] = {},
},
}
setmetatable(decl_data["r-n"], {__call = function(self, args, data)
data.decl_type = "r-stem"
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1]}
data.forms["gen_sg"] = {args[1]}
data.forms["dat_sg"] = {args[1]}
data.forms["nom_pl"] = {args.mutstem or args[1]}
data.forms["acc_pl"] = {args.mutstem or args[1]}
data.forms["gen_pl"] = {(args.mutstem2 or args[1]) .. "ō"}
data.forms["dat_pl"] = {(args.mutstem2 or args[1]) .. "um"}
table.insert(data.categories, "Old Saxon r-stem nouns")
end
})
decl_data["u-f"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["u-f"], {__call = function(self, args, data)
data.decl_type = "feminine u-stem"
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1]}
data.forms["gen_sg"] = {args[2] .. "i"}
data.forms["dat_sg"] = {args[2] .. "i"}
data.forms["nom_pl"] = {args[2] .. "i"}
data.forms["acc_pl"] = {args[2] .. "i"}
data.forms["gen_pl"] = {args[1] .. "o"}
data.forms["dat_pl"] = {args[1] .. "um"}
table.insert(data.categories, "Old Saxon u-stem nouns")
end
})
decl_data["u-m"] = {
params = {
[1] = {},
},
}
setmetatable(decl_data["u-m"], {__call = function(self, args, data)
data.decl_type = "masculine u-stem"
data.forms["nom_sg"] = {args[1] .. "u"}
data.forms["acc_sg"] = {args[1] .. "u"}
data.forms["gen_sg"] = {args[1] .. "ies", args[1] .. "eas"}
data.forms["dat_sg"] = {args[1] .. "o", args[1] .. "ie", args[1] .. "i", args[1] .. "e"}
data.forms["nom_pl"] = {args[1] .. "i"}
data.forms["acc_pl"] = {args[1] .. "i"}
data.forms["gen_pl"] = {args[1] .. "io", args[1] .. "o" }
data.forms["dat_pl"] = {args[1] .. "un", args[1] .. "iun"}
table.insert(data.categories, "Old Saxon u-stem nouns")
end
})
decl_data["u-n"] = {
params = {
[1] = {},
},
}
setmetatable(decl_data["u-n"], {__call = function(self, args, data)
data.decl_type = "neuter u-stem"
data.forms["nom_sg"] = {args[1] .. "u", args[1] .. "o"}
data.forms["acc_sg"] = {args[1] .. "u", args[1] .. "o"}
data.forms["gen_sg"] = {args[1] .. "es", args[1] .. "as"}
data.forms["dat_sg"] = {args[1] .. "e"}
data.forms["ins_sg"] = {args[1] .. "o"}
table.insert(data.categories, "Old Saxon u-stem nouns")
end
})
decl_data["wa-m"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["wa-m"], {__call = function(self, args, data)
data.decl_type = "masculine wa-stem"
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1]}
data.forms["gen_sg"] = {args[2] .. "wes"}
data.forms["dat_sg"] = {args[2] .. "we"}
data.forms["nom_pl"] = {args[2] .. "wos"}
data.forms["acc_pl"] = {args[2] .. "wos"}
data.forms["gen_pl"] = {args[2] .. "wō"}
data.forms["dat_pl"] = {args[2] .. "wum"}
table.insert(data.categories, "Old Saxon wa-stem nouns")
end
})
decl_data["wa-n"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["wa-n"], {__call = function(self, args, data)
decl_data["wa-m"](args, data)
data.decl_type = "neuter wa-stem"
data.forms["nom_pl"] = {args[1]}
data.forms["acc_pl"] = {args[1]}
end
})
decl_data["z-n"] = {
params = {
[1] = {},
[2] = {},
},
}
setmetatable(decl_data["z-n"], {__call = function(self, args, data)
local a2 = args[2] or args[1]
data.decl_type = "z-stem"
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1]}
data.forms["gen_sg"] = {a2 .. "es"}
data.forms["dat_sg"] = {a2 .. "e"}
data.forms["nom_pl"] = {a2 .. "iru"}
data.forms["acc_pl"] = {a2 .. "iru"}
data.forms["gen_pl"] = {a2 .. "irō"}
data.forms["dat_pl"] = {a2 .. "irum"}
table.insert(data.categories, "Old Saxon z-stem nouns")
end
})
-- The main entry point for automatic declension.
function export.show(frame)
local parent_args = frame:getParent().args
local decl_type = (frame.args["decl"] or parent_args["decl"]) or "a-m"
if not decl_data[decl_type] then
error("Unknown declension '" .. decl_type .. "'")
end
local data = {forms = {}, categories = {}}
data.head = parent_args["head"] or nil
local args = require("Module:parameters").process(parent_args, decl_data[decl_type].params, true)
-- Override for templates
if not args[1] then
setmetatable(args, {__index = function(self, key)
return "{{{" .. key .. "}}}"
end
})
end
-- Generate the forms
if parent_args.irr then
table.insert(data.categories, "Old Saxon irregular nouns")
if decl_data.irregular[parent_args.irr] then
decl_data.irregular[parent_args.irr](data)
else
decl_data[decl_type](args, data)
end
else
decl_data[decl_type](args, data)
end
-- Make the table
return make_table(data)
end
-- The main entry point for manual declension.
function export.show_manual(frame)
local parent_args = frame:getParent().args
local params = {
[1] = {},
[2] = {},
[3] = {},
[4] = {},
[5] = {},
[6] = {},
[7] = {},
[8] = {},
[9] = {},
["head"] = {}, -- currently ignored
}
local data = {forms = {}, categories = {}}
local args = require("Module:parameters").process(parent_args, params)
local function split(arg)
return arg and mw.text.split(arg, "%s*,%s*") or nil
end
data.forms.nom_sg = split(args[1])
data.forms.nom_pl = split(args[2])
data.forms.acc_sg = split(args[3])
data.forms.acc_pl = split(args[4])
data.forms.gen_sg = split(args[5])
data.forms.gen_pl = split(args[6])
data.forms.dat_sg = split(args[7])
data.forms.dat_pl = split(args[8])
data.forms.ins_sg = split(args[9])
data.decl_type = "irregular"
-- Make the table
return make_table(data)
end
function make_table(data)
local function show_form(form)
if not form then
return "—"
end
local ret = {}
for key, subform in ipairs(form) do
if mw.title.getCurrentTitle().nsText == "Reconstruction" and subform ~= "—" then
subform = "*" .. subform
end
table.insert(ret, m_links.full_link({lang = lang, term = subform}))
end
return table.concat(ret, ", ")
end
local function repl(param)
if param == "decl_type" then
return data.decl_type
else
return show_form(data.forms[param])
end
end
local wikicode = [=[
<div class="NavFrame" style="float: left; width: 45%;">
<div class="NavHead">Declension of {{{nom_sg}}} ({{{decl_type}}})</div>
<div class="NavContent">
{| style="width: 100%; line-height: 125%; background-color:#F9F9F9; text-align:center; border: 1px solid #CCCCFF;" cellpadding="3" cellspacing="1" class="inflection-table"
|- style="background-color:#EFEFEF; "
|-
|
! style="width: 50%; background-color:#F3E5AB" | singular
! style="width: 50%; background-color:#F3E5AB" | plural
|-
! style="background: #FAEBD7" | [[Appendix:Glossary#nominative case|nominative]]
| {{{nom_sg}}}
| {{{nom_pl}}}
|-
! style="background: #FAEBD7" | [[Appendix:Glossary#accusative case|accusative]]
| {{{acc_sg}}}
| {{{acc_pl}}}
|-
! style="background: #FAEBD7" | [[Appendix:Glossary#genitive case|genitive]]
| {{{gen_sg}}}
| {{{gen_pl}}}
|-
! style="background: #FAEBD7" | [[Appendix:Glossary#dative case|dative]]
| {{{dat_sg}}}
| {{{dat_pl}}}
|-
! style="background: #FAEBD7" | [[Appendix:Glossary#instrumental case|instrumental]]
| {{{ins_sg}}}
| {{{ins_pl}}}
|}</div></div>
<br clear="all" />]=]
return (mw.ustring.gsub(wikicode, "{{{([a-z0-9_]+)}}}", repl)) .. m_utils.format_categories(data.categories, lang)
end
return export