Module:number list/data/av

From Linguifex
Jump to navigation Jump to search


local export = {numbers = {}}

local numbers = export.numbers

-- Delete any number types that don't apply.
numbers[0] = {
	--cardinal = "cero",
	--ordinal = { "cero", "ceroésimo" },
}

numbers[1] = {
	cardinal = "uno",
	ordinal = "primo",
}

numbers[2] = {
	cardinal = "do",
	ordinal = "secondo",
	--multiplier = "doble",
	--fractional = "mitad",
}

numbers[3] = {
	cardinal = "tre",
	ordinal = "tertio",
	--multiplier = "triple",
	--fractional = "tercio",
}

numbers[4] = {
	cardinal = "cator",
	ordinal = "carto",
	---multiplier = "cuádruple",
	---fractional = "cuarto",
}

numbers[5] = {
	cardinal = "cince",
	ordinal = "cinto",
	--multiplier = "quíntuplo",
	--fractional = "quinto",
}

numbers[6] = {
	cardinal = "ses",
	ordinal = "sesto",
	--multiplier = "séxtuplo",
	--fractional = { "sexto", "seisavo" },
}

numbers[7] = {
	cardinal = "sete",
	ordinal = "setemo",
	--multiplier = "séptuplo",
	--fractional = "séptimo",
}

numbers[8] = {
	cardinal = "oto",
	ordinal = "otavo",
	--multiplier = "óctuple",
	--fractional = "octavo",
}

numbers[9] = {
	cardinal = "nove",
	ordinal = "nono",
	--fractional = "noveno",
}

numbers[10] = {
	cardinal = "dece",
	ordinal = "decemo",
	--multiplier = "décuplo",
	--fractional = "décimo",
}

local compose, decompose = mw.ustring.toNFC, mw.ustring.toNFD

local ten_ordinal = numbers[10].ordinal
for i, cardinal in ipairs {
	"undece", "dodece", "tredece", "catordece", "cindece", "sedece", "setdece", "dece e oto", "dece e nove"
} do
	local num = i + 11 - 1
	local ones = num - 10
	numbers[num] = {
		cardinal = cardinal,
		ordinal = ten_ordinal .. "mo"
		--fractional = remove_accent(cardinal) .. "avo",
	}
end

local function unpack_ipairs(t)
	local i = 0
	return function()
		i = i + 1
		if t[i] then
			return i, unpack(t[i])
		end
	end
end

for i, tens_cardinal, tens_ordinal in unpack_ipairs {
	{ "vigenti", "vigesmo" },
	{ "trigenta", "trigesmo" },
	{ "cadragenta", "cadragesmo" },
	{ "cincagenta", "cincagesmo" },
	{ "sesagenta", "sesagesmo" },
	{ "setagenta", "setagesmo" },
	{ "otagenta", "otogesmo" },
	{ "nonagenta", "nonagesmo" },
} do
	local tens = (i + 1) * 10
	numbers[tens] = {
		cardinal = tens_cardinal,
		ordinal = tens_ordinal,
		fractional = (tens_cardinal .. "avo"):gsub("aa", "a"),
	}
	local prefix = (tens_cardinal .. " y "):gsub("e y $", "i")
	local one_word_cardinal = prefix:sub(-1) ~= " "
	for ones = 1, 9 do
		local ones_cardinal = numbers[ones].cardinal
		local ones_ordinal = numbers[ones].ordinal
		local cardinal = prefix .. ones_cardinal
		local number = {}
		numbers[tens + ones] = number
		number.cardinal = cardinal
		if one_word_cardinal and number.cardinal:sub(-1) == "s" then
			number.cardinal = accent_finally(cardinal)
		end
		number.ordinal = tens_ordinal .. " " .. ones_ordinal
		number.fractional = cardinal:gsub("uno$", "un"):gsub("a y ", "ai") .. "avo"
	end
end

numbers[100] = {
	cardinal = "ciento",
	ordinal = "centésimo",
	fractional = {"centavo", "céntimo"},
}

numbers[200] = {
	cardinal = "doscientos",
	ordinal = "ducentésimo",
	fractional = "doscientosavo",
}

numbers[300] = {
	cardinal = "trescientos",
	ordinal = "tricentésimo",
	fractional = "trescientosavo",
}

numbers[400] = {
	cardinal = "cuatrocientos",
	ordinal = "cuadringentésimo",
	fractional = "cuatrocientosavo",
}

numbers[500] = {
	cardinal = "quinientos",
	ordinal = "quingentésimo",
	fractional = "quinientosavo",
}

numbers[600] = {
	cardinal = "seiscientos",
	ordinal = "sexcentésimo",
	fractional = "seiscientosavo",
}

numbers[700] = {
	cardinal = "setecientos",
	ordinal = "septingentésimo",
	fractional = "setecientosavo",
}

numbers[800] = {
	cardinal = "ochocientos",
	ordinal = "octingentésimo",
	fractional = "ochocientosavo",
}

numbers[900] = {
	cardinal = "novecientos",
	ordinal = "noningentésimo",
	fractional = "novecientosavo",
}

numbers[1000] = {
	cardinal = "mil",
	ordinal = "milésimo",
	fractional = "milavo",
}

--[[
numbers[] = {
	cardinal = "",
	ordinal = "",
	fractional = "",
}

numbers[] = {
	cardinal = "",
	ordinal = "",
	fractional = "",
}
--]]

return export