Module:number list/data/ka/sandbox

Hello, you have come here looking for the meaning of the word Module:number list/data/ka/sandbox. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:number list/data/ka/sandbox, but we will also tell you about its etymology, its characteristics and you will know how to say Module:number list/data/ka/sandbox in singular and plural. Everything you need to know about the word Module:number list/data/ka/sandbox you have here. The definition of the word Module:number list/data/ka/sandbox will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:number list/data/ka/sandbox, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


local export = {numbers = {}}

-- Automatically create new subtables of export.numbers through __index,
-- automatically add new fields of export.numbers
-- without overwriting old ones through __newindex.
local actual_numbers = export.numbers

local namespace = mw.title.getCurrentTitle().nsText
local function log(...)
	if namespace == "Module" then
		mw.log(...)
	end
end

local Georgian = require "Module:languages".getByCode "ka"
local proxy_number_metatable = {
	__newindex = function (self, k, v)
		local old = rawget(self.__actual, k)
		if old and old ~= v then
			local old, v = Georgian:transliterate(old), Georgian:transliterate(v)
			log("k: " .. k .. "; old " .. old .. "; new " .. v .. "; old == new: " .. tostring(old == v))
		end
		
		if type(old) == "table" then
			table.insert(old, v)
		elseif type(old) == "string" then
			if old ~= v then
				rawset(self.__actual, k, { old, v })
			end
		else
			rawset(self.__actual, k, v)
		end
	end,
	__index = function (self, k)
		return rawget(self.__actual, k)
	end,
}

local proxy_subtables = {}
local function get_proxy_number_table(k, actual_table)
	local t = proxy_subtables
	if not t then
		t = setmetatable({ __actual = actual_table }, proxy_number_metatable)
		proxy_subtables = t
	end
	return t
end

local function get_actual_number_table(k)
	local t = actual_numbers
	if not t then
		t = {}
		actual_numbers = t
	end
	return t
end

local proxy_numbers = setmetatable({}, {
	__newindex = function (self, k1, fields)
		local subtable = get_actual_number_table(k1)
		local proxy_subtable = get_proxy_number_table(k1, subtable)
		if not proxy_subtable then
			proxy_subtable = new_proxy_number_table(subtable)
			mw.log("new proxy_subtable for " .. k1)
			rawset(proxy_subtables, k1, proxy_subtable)
		end
		for k, v in pairs(fields) do
			proxy_subtable = v
		end
	end,
	__index = function (self, k)
		local actual_table = get_actual_number_table(k)
		local proxy_table = get_proxy_number_table(k, actual_table)
		return proxy_table
	end,
})
local numbers = proxy_numbers

local adverbial_suffix = "ჯერ"
local multiplier_suffix = "მაგი"
local distributive_suffix = "მაგად"
local collective_suffix = "ვე"
local fractional_suffix = "დი"

numbers.cardinal = "ნული"

numbers = {
	cardinal = "ერთი",
	ordinal = "პირველი",
	multiplier = "ერთმაგი",
	distributive = "ერთმაგად",
	adverbial = {"ერთხელ", "ერთჯერ" },
	collective = "ერთივე",
	fractional = { "მთლიანი", "სრული", "ერთიანი" },
}

numbers = {
	cardinal = "ორი",
	fractional = "ნახევარი", -- regular fractional added below
}

numbers.cardinal = "სამი"
numbers.cardinal = "ოთხი"
numbers.cardinal = "ხუთი"
numbers.cardinal = "ექვსი"
numbers.cardinal = "შვიდი"
numbers.cardinal = "რვა"
numbers.cardinal = "ცხრა"
numbers.cardinal = "ათი"
numbers.cardinal = "თერთმეტი"
numbers.cardinal = "თორმეტი"
numbers.cardinal = "ცამეტი"
numbers.cardinal = "თოთხმეტი"
numbers.cardinal = "თხუთმეტი"
numbers.cardinal = "თექვსმეტი"
numbers.cardinal = "ჩვიდმეტი"
numbers.cardinal = "თვრამეტი"
numbers.cardinal = "ცხრამეტი"

local function remove_final_vowel(word)
	return (mw.ustring.gsub(word, "$", ""))
end

local function remove_final_i(word)
	return word:gsub("ი$", "")
end

local function get_cardinal(number)
	return numbers.cardinal
end

local function get(number, type)
	return numbers
end

local function circumfix_ordinal(cardinal)
	return "მე" .. remove_final_vowel(cardinal) .. "ე"
end

for number = 2, 19 do
	numbers.ordinal = circumfix_ordinal(get_cardinal(number))
end

local twenty = "ოცი"
-- Add cardinals and ordinals for 20-99.
for i = 1, 4 do
	local twenties = i * 20
	local twenties_cardinal
	if i ~= 1 then
		twenties_cardinal = (remove_final_vowel(get_cardinal(i)) .. "მ" .. twenty)
			:gsub("მმ", "მ")
	else
		twenties_cardinal = twenty
	end
	numbers = {
		cardinal = twenties_cardinal,
		ordinal = circumfix_ordinal(twenties_cardinal),
	}
	
	local twenties_and = remove_final_vowel(twenties_cardinal) .. "და"
	
	for ones = 1, 19 do
		numbers = {
			cardinal = twenties_and .. get_cardinal(ones),
			ordinal = twenties_and .. circumfix_ordinal(get_cardinal(ones)),
		}
	end
end

local function make_numerals(number, cardinal, ordinal)
	numbers.cardinal = cardinal
	
	ordinal = ordinal or circumfix_ordinal(cardinal)
	numbers.ordinal = ordinal
	
	numbers.adverbial = remove_final_i(cardinal) .. adverbial_suffix
	
	if number <= 1000 then
		numbers.multiplier = remove_final_i(cardinal) .. multiplier_suffix
	
		numbers.distributive = remove_final_i(cardinal) .. distributive_suffix
	end
	
	numbers.collective = cardinal .. collective_suffix
	
	numbers.fractional = remove_final_i(ordinal) .. fractional_suffix
end

for number = 2, 99 do
	make_numerals(number, get_cardinal(number), get(number, "ordinal"))
end

local hundred_cardinal = "ასი"
make_numerals(100, hundred_cardinal)

for i = 2, 10 do
	local cardinal = remove_final_vowel(get_cardinal(i)) .. hundred_cardinal
	make_numerals(i * 100, cardinal)
end

make_numerals(1000000, "მილიონი")

return export