local export = {numbers = {}}
local numbers = export.numbers
-- Delete any number types that don't apply.
numbers = {
cardinal = { "zero", "huts" },
ordinal = "zerogarren",
}
numbers = {
cardinal = "bat",
ordinal = "lehen",
}
numbers = {
cardinal = "bi",
ordinal = "bigarren",
multiplier = "bikoitz",
fractional = "erdi",
}
numbers = {
cardinal = "hiru",
ordinal = "hirugarren",
multiplier = "hirukoitz",
fractional = "heren",
}
numbers = {
cardinal = "lau",
ordinal = "laugarren",
multiplier = "laukoitz",
fractional = "laurden",
}
numbers = {
cardinal = "bost",
ordinal = "bosgarren",
multiplier = "boskoitz",
fractional = "bosten",
}
numbers = {
cardinal = "sei",
ordinal = "seigarren",
multiplier = "seikoitz",
fractional = { "seiren" },
}
numbers = {
cardinal = "zazpi",
ordinal = "zazpigarren",
multiplier = "zazpikoitz",
fractional = "zazpiren",
}
numbers = {
cardinal = "zortzi",
ordinal = "zortzigarren",
multiplier = "zortzikoitz",
fractional = "zortziren",
}
numbers = {
cardinal = "bederatzi",
ordinal = "bederatzigarren",
fractional = "bederatziren",
}
numbers = {
cardinal = "hamar",
ordinal = "hamargarren",
fractional = "hamarren",
}
numbers = {
cardinal = "hamaika",
ordinal = "hamaikagarren",
fractional = "hamaikaren",
}
numbers = {
cardinal = "hamabi",
ordinal = "hamabigarren",
fractional = "hamabiren",
}
numbers = {
cardinal = "hamairu",
ordinal = "hamairugarren",
fractional = "hamairuren",
}
numbers = {
cardinal = "hamalau",
ordinal = "hamalaugarren",
fractional = "hamalauren",
}
numbers = {
cardinal = "hamabost",
ordinal = "hamabosgarren",
fractional = "hamabosten",
}
numbers = {
cardinal = "hamasei",
ordinal = "hamaseigarren",
fractional = "hamaseiren",
}
numbers = {
cardinal = "hamazazpi",
ordinal = "hamazazpigarren",
fractional = "hamazazpiren",
}
numbers = {
cardinal = "hemezortzi",
ordinal = "hemezortzigarren",
fractional = "hemezortziren",
}
numbers = {
cardinal = "hemeretzi",
ordinal = "hemeretzigarren",
fractional = "hemeretziren",
}
numbers = {
cardinal = "hogei",
ordinal = "hogeigarren",
fractional = "hogeiren",
}
numbers = {
cardinal = "hogeita hamar",
ordinal = "hogeita hamargarren",
fractional = "hogeita hamarren",
}
numbers = {
cardinal = "berrogei",
ordinal = "berrogeigarren",
fractional = "berrogeiren",
}
numbers = {
cardinal = "berrogeita hamar",
ordinal = "berrogeita hamargarren",
fractional = "berrogeita hamarren",
}
numbers = {
cardinal = "hirurogei",
ordinal = "hirurogeigarren",
fractional = "hirurogeiren",
}
numbers = {
cardinal = "hirurogeita hamar",
ordinal = "hirurogeita hamargarren",
fractional = "hirurogeita hamarren",
}
numbers = {
cardinal = "laurogei",
ordinal = "laurogeigarren",
fractional = "laurogeiren",
}
numbers = {
cardinal = "laurogeita hamar",
ordinal = "laurogeita hamargarren",
fractional = "laurogeita hamarren",
}
local function first_element_if_table(t)
if type(t) == "table" then
return t
else
return t
end
end
local function add_subtable(t, key)
local subtable = t
if not subtable then
subtable = {}
t = subtable
end
return subtable
end
-- Insert val into subtable indexed by key, creating subtable if necessary.
local function insert_into_subtable(t, key, val)
local subtable = add_subtable(t, key)
table.insert(subtable, val)
end
-- Generate the vigesimal numerals for 31-39, 51-59, 71-79 and 91-99
-- by adding "teens" numerals for these "twenties".
local twenties_numerals = {
= "hogei",
= "berrogei",
= "hirurogei",
= "laurogei",
}
for twenties, twenties_cardinal in pairs(twenties_numerals) do
for teens = 11, 19 do
local teens_numeral = numbers
local number = add_subtable(numbers, twenties + teens)
insert_into_subtable(number, "cardinal", twenties_cardinal .. "ta " .. teens_numeral.cardinal)
insert_into_subtable(number, "ordinal", twenties_cardinal .. "ta " .. teens_numeral.ordinal)
insert_into_subtable(number, "fractional", twenties_cardinal .. "ta " .. teens_numeral.fractional)
end
end
local function tableify(val)
if type(val) ~= "table" then
return {val}
else
return val
end
end
-- Add the decimal numerals for 21-29, 41-49, 61-69 and 81-89,
-- inserting them after the vigesimal numerals if those are present.
for tens = 20, 90, 10 do
for _, tens_cardinal in ipairs(tableify(numbers.cardinal)) do
if not tens_cardinal:find "%hamar$" then
for ones = 1, 9 do
local number = add_subtable(numbers, tens + ones)
if ones == 5 then
insert_into_subtable(number, "cardinal", tens_cardinal .. "ta bost")
insert_into_subtable(number, "ordinal", tens_cardinal .. "ta bosgarren")
insert_into_subtable(number, "fractional", tens_cardinal .. "ta bosten")
elseif ones == 1 then
insert_into_subtable(number, "cardinal", tens_cardinal .. "ta bat")
insert_into_subtable(number, "ordinal", tens_cardinal .. "ta batgarren")
insert_into_subtable(number, "fractional", tens_cardinal .. "ta baten")
else
local ones_numerals = numbers
insert_into_subtable(number, "cardinal", tens_cardinal .. "ta " .. ones_numerals.cardinal)
insert_into_subtable(number, "ordinal", tens_cardinal .. "ta " .. ones_numerals.cardinal .. "garren")
insert_into_subtable(number, "fractional", tens_cardinal .. "ta " .. ones_numerals.cardinal .. "ren")
end
end
end
end
end
numbers = {
cardinal = "ehun",
ordinal = "ehungarren",
fractional = "ehunen",
}
numbers = {
cardinal = "berrehun",
ordinal = "berrehungarren",
fractional = "berrehunen",
}
numbers = {
cardinal = "hirurehun",
ordinal = "hirureungarren",
fractional = "hirureunen",
}
numbers = {
cardinal = "laurehun",
ordinal = "laurehungarren",
fractional = "laurehunen",
}
numbers = {
cardinal = "bostehun",
ordinal = "bostehungarren",
fractional = "bostehunen",
}
numbers = {
cardinal = "seiehun",
ordinal = "seiehungarren",
fractional = "seiehunen",
}
numbers = {
cardinal = "zazpiehun",
ordinal = "zazpiehungarren",
fractional = "zazpiehunen",
}
numbers = {
cardinal = "zortziehun",
ordinal = "zortziehungarren",
fractional = "zortziehunen",
}
numbers = {
cardinal = "bederatziehun",
ordinal = "bederatziehungarren",
fractional = "bederatziehunen",
}
numbers = {
cardinal = "mila",
ordinal = "milagarren",
fractional = "milaren",
}
return export