มอดูล:number list/data/hrx
หน้าตา
- 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 ฮุนสริก.
(edit)
local export = {numbers = {}}
local m_numutils = require("Module:number list/utils")
local map = m_numutils.map
local power_of = m_numutils.power_of
export.additional_number_types = {
{key = "fractional_prefix", after = "fractional"},
}
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("e$", "")
if type(num) == "number" and num < 20 then
return term .. "t"
else
return term .. "st"
end
end
local function add_suffix(numstr, term, suffix)
term = lcfirst(term):gsub("e$", "")
if #numstr >= 7 and not term:find("en$") then
-- Million -> millionenmal, Milliarde -> milliardenmal
term = term .. "en"
end
return term .. suffix
end
local function has_polygon(num)
if type(num) == "string" then
return false
end
return num >= 3 and num <= 22 or num == 24 or num == 27 or num == 28 or num == 30 or num == 31 or num == 32 or
num == 34 or num == 36 or num == 40 or num == 48 or num == 50 or num == 51 or num == 60 or num == 70 or
num == 80
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.adverbial == true then
props.adverbial = map(function(card) return add_suffix(numstr, card, "mol") end, card_base)
end
if props.adverbial and type(num) == "number" and num <= 100 then
props.adverbial_abbreviation = num .. "-mol"
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(0, {
cardinal = "null",
adverbial = "nie",
})
make_number(1, {
cardinal = {"een", "enns"},
ordinal = "eerst",
adverbial = "eenmol",
fractional = "ganz",
}, "ein")
make_number(2, {
cardinal = "zweu",
ordinal = "zwett",
collective = "Doppel",
fractional = "halleb",
fractional_prefix = "halleb-",
})
-- Do numbers 3 through 12.
for i, cardinal in ipairs { "drei", "fier", "finnef", "sechs", "sieve", "acht", "nein", "zehn", "ellef", "zwellef" } do
local num = i + 2
local ordinal
if num == 3 then
ordinal = "dritt"
elseif num == 7 then
ordinal = "sibt"
elseif num == 8 then
fractional = "Achtel"
ordinal = "acht"
elseif num == 9 then
fractional = nil
elseif num == 10 then
fractional = nil
elseif num == 11 then
fractional = nil
elseif num == 12 then
fractional = nil
collective = "Dutzend"
else
ordinal = cardinal .. "t"
end
make_number(num, {
cardinal = cardinal,
fractional = fractional,
ordinal = ordinal,
collective = collective,
})
end
-- Do numbers 13 through 19.
for i, teen in ipairs {
"dreizen", "ferzen", "fufzen", "sechzen", "sibzen", "achtzen", "neinzen"
} do
local num = i + 12
make_number(num, {
cardinal = teen,
})
end
-- Do numbers 20 through 99.
for i, tens_cardinal in ipairs {
"zwanzich", "dreisich", "ferzich", "fufzich",
"sechzich", "sibzich", "achtzich", "neinzich",
} do
local tens = (i + 1) * 10
for ones = 0, 9 do
local num = tens + ones
local ones_prefix
if ones == 0 then
ones_prefix = ""
elseif ones == 1 then
ones_prefix = "enn-un-"
else
ones_prefix = numbers[ones].cardinal .. "-un-"
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 = {"hunnerd", "een-hunnerd"},
}, "hunnerd")
make_number(101, {
cardinal = {"hunnerd-enn", "een-hunnerd-een"},
ordinal = {"hunnerd-erst", "een-hunnerd-erst"},
})
-- Do numbers 200 through 900 by 100.
for i=200, 900, 100 do
make_number(i, {
cardinal = numbers[i / 100].cardinal .. "-hunnerd",
})
end
make_number(1000, {
cardinal = {"tausend", "een-tausend", "mil"},
}, "tausend")
local function make_large_number(num, cardinal)
make_number(num, {
cardinal = cardinal,
})
end
-- Do numbers 2000 through 9000 by 1000.
for i=2000, 9000, 1000 do
make_large_number(i, numbers[i / 1000].cardinal .. "-tausend")
end
-- Do numbers 10,000 through 90,000 by 10,000.
for i=10000, 90000, 10000 do
make_large_number(i,
-- Need to use map() because of 30.
map(function(base_card) return base_card .. "-tausend" end, numbers[i / 1000].cardinal)
)
end
-- Do numbers 100,000 through 900,000 by 100,000.
for i=100000, 900000, 100000 do
make_large_number(i,
-- Need to use map() because of 100.
map(function(base_card) return base_card .. "-tausend" end, numbers[i / 1000].cardinal)
)
end
make_large_number(1000000, "Million")
make_large_number(2000000, "[[zweu]]-[[Million]]e")
make_large_number(power_of(7), "[[zehn]]-[[Million]]e")
make_large_number(power_of(8), "[[hunnerd]]-[[Million]]e")
make_large_number(power_of(9), "Billion")
make_large_number(power_of(9, 2), "[[zweu]]-[[Billion]]e")
make_large_number(power_of(10), "[[zehn]]-[[Billion]]e")
make_large_number(power_of(11), "[[hunnerd]]-[[Billion]]e")
return export