Modul:ka-headword
Penampilan
- Laman modul ini kekurangan sublaman pendokumenan. Sila cipta laman pendokumenan tersebut.
- Pautan berguna: senarai sublaman • pautan • transklusi • kes ujian • kotak pasir
local export = {}
local lang = require("Module:languages").getByCode("ka")
local m_headword = require("Module:headword")
pos_functions = {}
local forms = {}
function export.show(frame)
local args = frame:getParent().args
local poscat = frame.args[1]
local data = {lang = lang, pos_category = poscat, categories = {}, heads = {args["term"] or args["head"]}, inflections = {}}
return pos_functions[poscat](args, data)
end
pos_functions["kata sifat"] = function(args, data)
local term = args["term"] or mw.title.getCurrentTitle().text
local last = mw.ustring.sub(term, -1, -1)
local beforeLast = mw.ustring.sub(term, -2, -2)
local indeclinable = mw.ustring.match(last, "[აეოუ]") or mw.ustring.match(beforeLast, "[აეიოუ]")
if indeclinable then
table.insert(data.inflections, {label = "[[Appendix:Glossary#indeclinable|indeclinable]]"})
end
if args[1] == "-" then --then hope there is no diminutive
table.insert(data.inflections, {label = "not [[Appendix:Glossary#comparable|comparable]]"})
table.insert(data.categories, "Georgian uncomparable adjectives")
else
local diminutive = args[1]
local comparative = args["comp"] or "[[უფრო]] " .. term
local superlative = args["sup"] or "[[ყველაზე]] " .. term
table.insert(data.inflections, {label = "[[Appendix:Glossary#comparative|comparative]]", comparative})
table.insert(data.inflections, {label = "[[Appendix:Glossary#superlative|superlative]]", superlative})
if diminutive then
table.insert(data.inflections, {label = "[[Appendix:Glossary#diminutive|diminutive]]", diminutive})
end
end
return m_headword.full_headword(data)
end
function getModernPlural(term) --detect ჟოკეი too
local lastLetter = mw.ustring.sub(term, -1)
if lastLetter == "ი" or lastLetter == "ა" then
return mw.ustring.sub(term, 0, -2) .. "ები"
elseif lastLetter == "ე" or lastLetter == "ო" or lastLetter == "უ" then
return term .. "ები"
end
end
function getArchaicPlural(term)
local lastLetter = mw.ustring.sub(term, -1)
if lastLetter == "ი" then
return mw.ustring.sub(term, 0, -2) .. "ნი"
else
return term .. "ნი"
end
end
pos_functions["proper nouns"] = function(args, data)
if args[1] ~= nil then
if args[1] == "-" then --არც გაატრაკო ტო
table.insert(data.inflections, {label = "[[Lampiran:Glosari#tidak berbilang|tidak berbilang]]"})
else
table.insert(data.inflections, {label = "plural", args[1]})
table.insert(data.categories, "Georgian countable proper nouns")
end
end
return m_headword.full_headword(data)
end
pos_functions["kata nama"] = function(args, data)
local a, b, c = args[1], args[2], args[3]
local wordArg = nil
local isUncountAndCount = a == "~" or b == "~" or c == "~"
local hasDash = a == "-" or b == "-" or c == "-"
local hasQuestion = a == "?" or b == "?" or c == "?"
if hasQuestion then
return m_headword.full_headword(data)
end
if a and mw.ustring.match(a, "[ა-ჰ]") then wordArg = a end
if b and mw.ustring.match(b, "[ა-ჰ]") then wordArg = b end
if c and mw.ustring.match(c, "[ა-ჰ]") then wordArg = c end
local hasArchaic = a == "+" or b == "+" or c == "+"
local hasPlural = a == "0" or b == "0" or c == "0" or not hasDash or wordArg
local archaic = hasArchaic and getArchaicPlural(args["term"] or mw.title.getCurrentTitle().text) or nil
local plural = hasPlural and (wordArg or getModernPlural(args["term"] or mw.title.getCurrentTitle().text)) or nil
if hasDash then
if plural or archaic then
table.insert(data.inflections, {label = "usually [[Appendix:Glossary#uncountable|uncountable]]"})
else
table.insert(data.inflections, {label = "[[Appendix:Glossary#uncountable|uncountable]]"})
end
else
table.insert(data.categories, "Georgian countable nouns")
if isUncountAndCount then
table.insert(data.inflections, {label = "[[Appendix:Glossary#uncountable|uncountable]] and [[Appendix:Glossary#countable|countable]]"})
end
end
if hasDash or isUncountAndCount then
table.insert(data.categories, "Georgian uncountable nouns")
end
if plural then
table.insert(data.inflections, {label = "jamak", plural, accel = {form = "nom|p"}})
end
if archaic then
table.insert(data.inflections, {label = "jamak usang", archaic})
end
return m_headword.full_headword(data)
end
return export