Mô đun:number list/data/cs
Giao diện
local export = {numbers = {}}
local m_numutils = require("Module:number list/utils")
local map = m_numutils.map
local power_of = m_numutils.power_of
local rmatch = mw.ustring.match
local usub = mw.ustring.sub
local numbers = export.numbers
export.additional_number_types = {
{key = "neuter_collective", after = "collective"},
{key = "repetition_adjective", after = "adverbial"},
}
local function add_ordinal_suffix(num, term)
local et_stem = rmatch(term, "^(.*)[eě]t$")
if et_stem then
return et_stem .. "átý"
else
return term .. "ý"
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)
-- FIXME
-- props.ordinal_abbr = map(function(ord) return numstr .. "-" .. usub(ord, #ord - 1) end, props.ordinal)
if props.wplink == true then
props.wplink = ("%s (číslo)"):format(numstr)
end
if props.adverbial == true then
props.adverbial = map(function(card) return card .. "krát" end, card_base)
end
if props.repetition_adjective == true then
props.repetition_adjective = map(function(card) return card .. "inásobný" end, card_base)
end
if props.fractional == true then
props.fractional = map(function(card) return card .. "ina" end, card_base)
end
numbers[num] = props
end
make_number(0, {
cardinal = "nula",
ordinal = {"nultý", "nulový"},
wplink = "nula",
adverbial = {"nulakrát", "nulkrát"},
repetition_adjective = "nulanásobný",
})
make_number(1, {
cardinal = "jeden",
ordinal = "první",
wplink = true,
adverbial = {"jedenkrát", "jednikrát", "jednou"},
repetition_adjective = "jednonásobný",
collective = "jedny",
})
make_number(2, {
cardinal = "dva",
ordinal = "druhý",
wplink = true,
adverbial = true,
repetition_adjective = "dvojnásobný",
collective = "dvoje",
fractional = {"půl", "polovina", "polovice"},
multiplier = "dvojitý",
})
make_number(3, {
cardinal = "tři",
ordinal = "třetí",
wplink = true,
adverbial = true,
repetition_adjective = "trojnásobný",
collective = "troje",
fractional = "třetina",
multiplier = "trojitý",
})
make_number(4, {
cardinal = "čtyři",
ordinal = "čtvrtý",
wplink = true,
adverbial = true,
repetition_adjective = "čtyřnásobný",
collective = "čtvery",
fractional = "čtvrtina",
})
-- Do numbers 5 through 10.
for i, cardinal in ipairs { "pět", "šest", "sedm", "osm", "devět", "deset" } do
local num = i + 4
local et_stem = rmatch(cardinal, "^(.*)[eě]t$")
local collective, neuter_collective
if et_stem then
collective = et_stem .. "atery"
neuter_collective = et_stem .. "atero"
else
collective = cardinal .. "ery"
neuter_collective = cardinal .. "ero"
end
local fractional, repetition_adjective
if num == 9 then
fractional = "devítina"
repetition_adjective = "devítinásobný"
elseif num == 10 then
fractional = {"desetina", "desítina"}
-- desítinásobný seems to be extremely rare, if it exists at all
repetition_adjective = true
else
fractional = true
repetition_adjective = true
end
make_number(num, {
cardinal = cardinal,
wplink = true,
adverbial = true,
repetition_adjective = repetition_adjective,
collective = collective,
neuter_collective = neuter_collective,
fractional = fractional,
})
end
-- Do numbers 11 through 19.
for i, teen in ipairs {
"jede", "dva", "tři", "čtr", "pat", "šest", "sedm", "osm", "devate"
} do
local num = i + 10
make_number(num, {
cardinal = teen .. "náct",
wplink = true,
adverbial = true,
repetition_adjective = true,
fractional = true,
})
end
-- Do numbers 20 through 90 by 10.
for i, tens_cardinal in ipairs {
"dvacet", "třicet", "čtyřicet", "padesát",
"šedesát", "sedmdesát", "osmdesát", "devadesát",
} do
local num = (i + 1) * 10
local tens_ordinal = add_ordinal_suffix(num, tens_cardinal)
make_number(num, {
cardinal = tens_cardinal,
ordinal = tens_ordinal,
wplink = true,
adverbial = true,
repetition_adjective = true,
fractional = true,
})
end
-- Do numbers 21 through 29, 31 through 39, ..., 91 through 99.
for tens = 20, 90, 10 do
for ones = 1, 9 do
local num = tens + ones
local ones_prefix, ones_suffix
if ones == 1 then
ones_prefix = "jedna"
ones_suffix = " jedna"
else
ones_prefix = numbers[ones].cardinal .. "a"
ones_suffix = " " .. numbers[ones].cardinal
end
local inverted_cardinal = ones_prefix .. numbers[tens].cardinal
local inverted_ordinal = add_ordinal_suffix(num, inverted_cardinal)
local inverted_tag = "<tag:inverted>"
local separate_cardinal = numbers[tens].cardinal .. ones_suffix
local separate_ordinal = numbers[tens].ordinal .. " " .. numbers[ones].ordinal
local separate_tag = "<tag:separate>"
make_number(num, {
cardinal = {inverted_cardinal .. inverted_tag, separate_cardinal .. separate_tag},
ordinal = {inverted_ordinal .. inverted_tag, separate_ordinal .. separate_tag},
wplink = true,
adverbial = inverted_cardinal .. "krát",
repetition_adjective = inverted_cardinal .. "inásobný",
fractional = inverted_cardinal .. "ina",
})
end
end
export.numbers[100] = {
cardinal = "sto",
ordinal = "stý",
fractional = "setina",
}
export.numbers[101] = {
cardinal = "sto jeden",
ordinal = "stý první",
}
export.numbers[200] = {
cardinal = "dvě stě",
ordinal = "dvoustý",
}
export.numbers[300] = {
cardinal = "tři sta",
ordinal = "třístý",
}
export.numbers[400] = {
cardinal = "čtyři sta",
ordinal = "čtyřstý",
}
export.numbers[500] = {
cardinal = "pět set",
ordinal = "pětistý",
}
export.numbers[600] = {
cardinal = "šest set",
ordinal = "šestistý",
}
export.numbers[700] = {
cardinal = "sedm set",
ordinal = "sedmistý",
}
export.numbers[800] = {
cardinal = "osm set",
ordinal = "osmistý",
}
export.numbers[900] = {
cardinal = "devět set",
ordinal = "devítistý",
}
export.numbers[1000] = {
cardinal = "tisíc",
ordinal = "tisící",
}
export.numbers[2000] = {
cardinal = "dva tisíce",
ordinal = "dvoutisící",
}
export.numbers[5000] = {
cardinal = "pět tisíc",
ordinal = "pětitisící",
}
export.numbers[1000000] = {
cardinal = {"milion", "milión"},
ordinal = {"miliontý", "milióntý"},
fractional = {"miliontina", "milióntina"},
}
export.numbers[1000000000] = {
cardinal = "miliarda",
ordinal = "miliardtý",
fractional = "miliardtina",
}
export.numbers[1000000000000] = {
cardinal = {"bilion", "bilión"},
ordinal = {"biliontý", "bilióntý"},
fractional = {"biliontina", "bilióntina"},
}
export.numbers["1000000000000000"] = {
cardinal = "biliarda",
ordinal = "biliardtý",
fractional = "biliardtina",
}
return export