Module:number list/data/gmh
Jump to navigation
Jump to search
- The following documentation is generated by Module:documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
This module contains data on various types of numbers in Middle High German.
(edit)
local export = {numbers = {}}
local m_numutils = require("Module:number list/utils")
local map = m_numutils.map
local power_of = m_numutils.power_of
local numbers = export.numbers
local lcfirst = function(text) return mw.getContentLanguage():lcfirst(text) end
local ucfirst = function(text) return mw.getContentLanguage():ucfirst(text) end
local function add_ordinal_suffix(num, term)
term = lcfirst(term):gsub("c$", "ge")
if type(num) == "number" and num < 20 then
return term .. "de"
else
return term .. "ste"
end
end
local function make_number(num, props, card_base)
local numstr = m_numutils.format_fixed(num)
card_base = card_base or props.cardinal
props.ordinal = props.ordinal or map(function(card) return add_ordinal_suffix(num, card) end, card_base)
props.ordinal_abbr = ordinal_abbr
if props.fractional == true then
props.fractional = map(function(ord) return ucfirst(ord) .. "l" end, props.ordinal)
end
if props.sequence_adverb == true then
props.sequence_adverb = map(function(ord) return ord .. "ns" end, props.ordinal)
end
numbers[num] = props
end
make_number(1, {
cardinal = "ein",
ordinal = "ērste",
}, "ein")
make_number(2, {
cardinal = "zwēne",
ordinal = "ander",
})
-- Do numbers 3 through 12.
for i, cardinal in ipairs { "drī", "vier", "fünf", "sëhs", "siben", "ahte", "niun", "zëhen", "einlif", "zwelf" } do
local num = i + 2
local ordinal
if num == 3 then
ordinal = "dritte"
elseif num == 5 then
ordinal = "fünfte"
elseif num == 6 then
ordinal = "sëhste"
elseif num == 7 then
ordinal = {"sibende", "sibte"}
elseif num == 8 then
ordinal = {"ahtede", "ahte"}
else
ordinal = cardinal .. "de"
end
make_number(num, {
cardinal = cardinal,
ordinal = ordinal,
})
end
-- Do numbers 13 through 19.
for i, teen in ipairs {
"drīzëhen", "vierzëhen", "fünfzëhen", "sëhszëhen", "sibenzëhen", "ahtzëhen", "niunzëhen"
} do
local num = i + 12
make_number(num, {
cardinal = teen,
})
end
-- Do numbers 20 through 99.
for i, tens_cardinal in ipairs {
"zweinzic", "drīȥic", "vierzic", "fünfzic",
"sëhszic", "sibenzic", "ahtzic", "niunzic",
} do
local tens = (i + 1) * 10
for ones = 0, 9 do
local num = tens + ones
local ones_prefix
if ones == 0 then
ones_prefix = ""
else
ones_prefix = numbers[ones].cardinal .. " und "
end
local cardinal = map(function(tens_card) return ones_prefix .. tens_card end, tens_cardinal)
make_number(num, {
cardinal = cardinal,
})
end
end
make_number(100, {
cardinal = {"hundert", "zëhenzic"},
ordinal = {"hundertste", "zëhenzigeste"},
}, "hundert")
make_number(200, {
cardinal = {"zwei hundert", "zwei hunt"},
})
make_number(300, {
cardinal = {"driu hundert", "driu hunt"},
})
-- Do numbers 200 through 900 by 100.
for i=400, 900, 100 do
make_number(i, {
cardinal = {numbers[i / 100].cardinal .. " hundert", numbers[i / 100].cardinal .. " hunt"},
})
end
make_number(1000, {
cardinal = "tūsent",
}, "tūsent")
make_number(2000, {
cardinal = "zwei tūsent",
})
make_number(3000, {
cardinal = "driu tūsent",
})
local function make_large_number(num, cardinal, card_base)
make_number(num, {
cardinal = cardinal,
}, card_base)
end
-- Do numbers 2000 through 9000 by 1000.
for i=4000, 9000, 1000 do
make_large_number(i, numbers[i / 1000].cardinal .. " tūsent")
end
return export