local lang = require("Module:languages").getByCode("tr")
local export = {}
local vowels = {
= {high = "ı", low = "a"}, = {high = "ı", low = "a"},
= {high = "i", low = "e"},
= {high = "ı", low = "a"},
= {high = "i", low = "e"}, = {high = "i", low = "e"},
= {high = "u", low = "a"},
= {high = "ü", low = "e"},
= {high = "u", low = "a"}, = {high = "u", low = "a"},
= {high = "ü", low = "e"},
}
-- Inflection functions
function export.vowel(frame)
local params = {
= {required = true, default = "u"},
= {},
= {type = "boolean"},
= {type = "boolean"},
= {type = "boolean"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local stem = mw.title.getCurrentTitle().text
local data = {forms = {}, info = "Declension of ''" .. stem .. "''", categories = {}}
local vowel = vowels]
local plvowel = vowels
local plstem
if args == "p" then
plstem = stem
else
plstem = stem .. "l" .. vowel.low .. "r"
end
if mw.ustring.match(stem, "()$") ~= args then
require("Module:debug").track("tr-nouns/vowel")
end
data.forms = {stem}
data.forms = {stem .. "y" .. vowel.high}
data.forms = {stem .. "y" .. vowel.low}
data.forms = {stem .. "d" .. vowel.low}
data.forms = {stem .. "d" .. vowel.low .. "n"}
data.forms = {stem .. "n" .. vowel.high .. "n"}
data.forms = {plstem}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.low}
data.forms = {plstem .. "d" .. plvowel.low}
data.forms = {plstem .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n"}
if args then
data.forms = {stem .. "m"}
data.forms = {stem .. "n"}
data.forms = {stem .. "s" .. vowel.high}
data.forms = {stem .. "m" .. vowel.high .. "z"}
data.forms = {stem .. "n" .. vowel.high .. "z"}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m"}
data.forms = {plstem .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z"}
data.forms = {plstem .. plvowel.high}
data.forms = {stem .. "m" .. vowel.high}
data.forms = {stem .. "n" .. vowel.high}
data.forms = {stem .. "s" .. vowel.high .. "n" .. vowel.high}
data.forms = {stem .. "m" .. vowel.high .. "z" .. vowel.high}
data.forms = {stem .. "n" .. vowel.high .. "z" .. vowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {stem .. "m" .. vowel.low}
data.forms = {stem .. "n" .. vowel.low}
data.forms = {stem .. "s" .. vowel.high .. "n" .. vowel.low}
data.forms = {stem .. "m" .. vowel.high .. "z" .. vowel.low}
data.forms = {stem .. "n" .. vowel.high .. "z" .. vowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {stem .. "m" .. "d" .. vowel.low}
data.forms = {stem .. "n" .. "d" .. vowel.low}
data.forms = {stem .. "s" .. vowel.high .. "n" .. "d" .. vowel.low}
data.forms = {stem .. "m" .. vowel.high .. "z" .. "d" .. vowel.low}
data.forms = {stem .. "n" .. vowel.high .. "z" .. "d" .. vowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {stem .. "m" .. "d" .. vowel.low .. "n"}
data.forms = {stem .. "n" .. "d" .. vowel.low .. "n"}
data.forms = {stem .. "s" .. vowel.high .. "n" .. "d" .. vowel.low .. "n"}
data.forms = {stem .. "m" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
data.forms = {stem .. "n" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {stem .. "m" .. vowel.high .. "n"}
data.forms = {stem .. "n" .. vowel.high .. "n"}
data.forms = {stem .. "s" .. vowel.high .. "n" .. vowel.high .. "n"}
data.forms = {stem .. "m" .. vowel.high .. "z" .. vowel.high .. "n"}
data.forms = {stem .. "n" .. vowel.high .. "z" .. vowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
end
if args then
data.forms = {stem .. "y" .. vowel.high .. "m"}
data.forms = {stem .. "s" .. vowel.high .. "n"}
data.forms = {stem, stem .. "d" .. vowel.high .. "r"}
data.forms = {stem .. "y" .. vowel.high .. "z"}
data.forms = {stem .. "s" .. vowel.high .. "n" .. vowel.high .. "z"}
data.forms = {plstem}
data.forms = {plstem .. plvowel.high .. "m"}
data.forms = {plstem .. "s" .. plvowel.high .. "n"}
data.forms = {plstem, plstem .. "d" .. plvowel.high .. "r"}
data.forms = {plstem .. plvowel.high .. "z"}
data.forms = {plstem .. "s" .. plvowel.high .. "n" .. plvowel.high .. "z"}
data.forms = {plstem .. "d" .. plvowel.high .. "r"}
end
postprocess(args, data)
if args then
return mw.text.jsonEncode(data)
end
return make_table(data)
end
function export.cons(frame)
local params = {
= {required = true, default = "u"},
= {},
= {type = "boolean"},
= {type = "boolean"},
= {},
= {type = "boolean"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local stem = mw.title.getCurrentTitle().text
local data = {forms = {}, info = "Declension of ''" .. stem .. "''", categories = {}}
local stem2 = args or stem
local vowel = vowels]
local plvowel = vowels
local plstem
if args == "p" then
plstem = stem
else
plstem = stem .. "l" .. vowel.low .. "r"
end
if mw.ustring.match(stem, "()+$") ~= args then
require("Module:debug").track("tr-nouns/vowel")
end
local dt = "d"
if mw.ustring.find(stem, "$") then
dt = "t"
end
data.forms = {stem}
data.forms = {stem2 .. vowel.high}
data.forms = {stem2 .. vowel.low}
data.forms = {stem .. dt .. vowel.low}
data.forms = {stem .. dt .. vowel.low .. "n"}
data.forms = {stem2 .. vowel.high .. "n"}
data.forms = {plstem}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.low}
data.forms = {plstem .. "d" .. plvowel.low}
data.forms = {plstem .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n"}
if args then
data.forms = {stem2 .. vowel.high .. "m"}
data.forms = {stem2 .. vowel.high .. "n"}
data.forms = {stem2 .. vowel.high}
data.forms = {stem2 .. vowel.high .. "m" .. vowel.high .. "z"}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.high .. "z"}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m"}
data.forms = {plstem .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z"}
data.forms = {plstem .. plvowel.high}
data.forms = {stem2 .. vowel.high .. "m" .. vowel.high}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.high}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.high}
data.forms = {stem2 .. vowel.high .. "m" .. vowel.high .. "z" .. vowel.high}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.high .. "z" .. vowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {stem2 .. vowel.high .. "m" .. vowel.low}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.low}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.low}
data.forms = {stem2 .. vowel.high .. "m" .. vowel.high .. "z" .. vowel.low}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.high .. "z" .. vowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {stem2 .. vowel.high .. "m" .. "d" .. vowel.low}
data.forms = {stem2 .. vowel.high .. "n" .. "d" .. vowel.low}
data.forms = {stem2 .. vowel.high .. "n" .. "d" .. vowel.low}
data.forms = {stem2 .. vowel.high .. "m" .. vowel.high .. "z" .. "d" .. vowel.low}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.high .. "z" .. "d" .. vowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {stem2 .. vowel.high .. "m" .. "d" .. vowel.low .. "n"}
data.forms = {stem2 .. vowel.high .. "n" .. "d" .. vowel.low .. "n"}
data.forms = {stem2 .. vowel.high .. "n" .. "d" .. vowel.low .. "n"}
data.forms = {stem2 .. vowel.high .. "m" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {stem2 .. vowel.high .. "m" .. vowel.high .. "n"}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.high .. "n"}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.high .. "n"}
data.forms = {stem2 .. vowel.high .. "m" .. vowel.high .. "z" .. vowel.high .. "n"}
data.forms = {stem2 .. vowel.high .. "n" .. vowel.high .. "z" .. vowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
end
if args then
data.forms = {stem2 .. vowel.high .. "m"}
data.forms = {stem .. "s" .. vowel.high .. "n"}
data.forms = {stem, stem .. dt .. vowel.high .. "r"}
data.forms = {stem2 .. vowel.high .. "z"}
data.forms = {stem .. "s" .. vowel.high .. "n" .. vowel.high .. "z"}
data.forms = {plstem}
data.forms = {plstem .. plvowel.high .. "m"}
data.forms = {plstem .. "s" .. plvowel.high .. "n"}
data.forms = {plstem, plstem .. "d" .. plvowel.high .. "r"}
data.forms = {plstem .. plvowel.high .. "z"}
data.forms = {plstem .. "s" .. plvowel.high .. "n" .. plvowel.high .. "z"}
data.forms = {plstem .. "d" .. plvowel.high .. "r"}
end
postprocess(args, data)
if args then
return mw.text.jsonEncode(data)
end
return make_table(data)
end
function export.compound(frame)
local params = {
= {required = true, default = "u"},
= {},
= {},
= {type = "boolean"},
= {},
= {type = "boolean"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local stem = mw.title.getCurrentTitle().text
local data = {forms = {}, info = "Declension of ''" .. stem .. "''", categories = {}}
local stem2 = args or stem
local vowel = vowels]
local plvowel = vowels
local plstem
if args == "p" then
plstem = stem2
else
plstem = stem2 .. "l" .. vowel.low .. "r"
end
if mw.ustring.match(stem, "()$") ~= args then
require("Module:debug").track("tr-nouns/vowel")
end
local dt = "d"
if mw.ustring.find(stem2, "$") then
dt = "t"
end
data.forms = {stem}
data.forms = {stem .. "n" .. vowel.high}
data.forms = {stem .. "n" .. vowel.low}
data.forms = {stem .. "nd" .. vowel.low}
data.forms = {stem .. "nd" .. vowel.low .. "n"}
data.forms = {stem .. "n" .. vowel.high .. "n"}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "nd" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "nd" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
if args then
if args == "c" then
data.forms = {stem .. "m"}
data.forms = {stem .. "n"}
data.forms = {stem}
data.forms = {stem .. "m" .. vowel.high .. "z"}
data.forms = {stem .. "n" .. vowel.high .. "z"}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m"}
data.forms = {plstem .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z"}
data.forms = {plstem .. plvowel.high}
data.forms = {stem .. "m" .. vowel.high}
data.forms = {stem .. "n" .. vowel.high}
data.forms = {stem .. "n" .. vowel.high}
data.forms = {stem .. "m" .. vowel.high .. "z" .. vowel.high}
data.forms = {stem .. "n" .. vowel.high .. "z" .. vowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {stem .. "m" .. vowel.low}
data.forms = {stem .. "n" .. vowel.low}
data.forms = {stem .. "n" .. vowel.low}
data.forms = {stem .. "m" .. vowel.high .. "z" .. vowel.low}
data.forms = {stem .. "n" .. vowel.high .. "z" .. vowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {stem .. "m" .. "d" .. vowel.low}
data.forms = {stem .. "n" .. "d" .. vowel.low}
data.forms = {stem .. "n" .. "d" .. vowel.low}
data.forms = {stem .. "m" .. vowel.high .. "z" .. "d" .. vowel.low}
data.forms = {stem .. "n" .. vowel.high .. "z" .. "d" .. vowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {stem .. "m" .. "d" .. vowel.low .. "n"}
data.forms = {stem .. "n" .. "d" .. vowel.low .. "n"}
data.forms = {stem .. "n" .. "d" .. vowel.low .. "n"}
data.forms = {stem .. "m" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
data.forms = {stem .. "n" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {stem .. "m" .. vowel.high .. "n"}
data.forms = {stem .. "n" .. vowel.high .. "n"}
data.forms = {stem .. "n" .. vowel.high .. "n"}
data.forms = {stem .. "m" .. vowel.high .. "z" .. vowel.high .. "n"}
data.forms = {stem .. "n" .. vowel.high .. "z" .. vowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
elseif args == "v" then
data.forms = {stem2 .. "m"}
data.forms = {stem2 .. "n"}
data.forms = {stem2 .. "s" .. vowel.high}
data.forms = {stem2 .. "m" .. vowel.high .. "z"}
data.forms = {stem2 .. "n" .. vowel.high .. "z"}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m"}
data.forms = {plstem .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z"}
data.forms = {plstem .. plvowel.high}
data.forms = {stem2 .. "m" .. vowel.high}
data.forms = {stem2 .. "n" .. vowel.high}
data.forms = {stem2 .. "s" .. vowel.high .. "n" .. vowel.high}
data.forms = {stem2 .. "m" .. vowel.high .. "z" .. vowel.high}
data.forms = {stem2 .. "n" .. vowel.high .. "z" .. vowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high}
data.forms = {stem2 .. "m" .. vowel.low}
data.forms = {stem2 .. "n" .. vowel.low}
data.forms = {stem2 .. "s" .. vowel.high .. "n" .. vowel.low}
data.forms = {stem2 .. "m" .. vowel.high .. "z" .. vowel.low}
data.forms = {stem2 .. "n" .. vowel.high .. "z" .. vowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.low}
data.forms = {stem2 .. "m" .. "d" .. vowel.low}
data.forms = {stem2 .. "n" .. "d" .. vowel.low}
data.forms = {stem2 .. "s" .. vowel.high .. "n" .. "d" .. vowel.low}
data.forms = {stem2 .. "m" .. vowel.high .. "z" .. "d" .. vowel.low}
data.forms = {stem2 .. "n" .. vowel.high .. "z" .. "d" .. vowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low}
data.forms = {stem2 .. "m" .. "d" .. vowel.low .. "n"}
data.forms = {stem2 .. "n" .. "d" .. vowel.low .. "n"}
data.forms = {stem2 .. "s" .. vowel.high .. "n" .. "d" .. vowel.low .. "n"}
data.forms = {stem2 .. "m" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
data.forms = {stem2 .. "n" .. vowel.high .. "z" .. "d" .. vowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. "d" .. plvowel.low .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. "d" .. plvowel.low .. "n"}
data.forms = {stem2 .. "m" .. vowel.high .. "n"}
data.forms = {stem2 .. "n" .. vowel.high .. "n"}
data.forms = {stem2 .. "s" .. vowel.high .. "n" .. vowel.high .. "n"}
data.forms = {stem2 .. "m" .. vowel.high .. "z" .. vowel.high .. "n"}
data.forms = {stem2 .. "n" .. vowel.high .. "z" .. vowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "m" .. plvowel.high .. "z" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "z" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high .. "n" .. plvowel.high .. "n"}
else
--error("For compound nouns, please specify |poss=c if the possessor is a consonant stem and |poss=v if it is a vowel stem.")
table.insert(data.categories, "Turkish compound nouns with invalid poss parameter")
end
end
if args then
data.forms = {stem .. "y" .. vowel.high .. "m"}
data.forms = {stem .. "s" .. vowel.high .. "n"}
data.forms = {stem}
data.forms = {stem .. "y" .. vowel.high .. "z"}
data.forms = {stem .. "s" .. vowel.high .. "n" .. vowel.high .. "z"}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "y" .. plvowel.high .. "m"}
data.forms = {plstem .. plvowel.high .. "s" .. plvowel.high .. "n"}
data.forms = {plstem .. plvowel.high}
data.forms = {plstem .. plvowel.high .. "y" .. plvowel.high .. "z"}
data.forms = {plstem .. plvowel.high .. "s" .. plvowel.high .. "n" .. plvowel.high .. "z"}
data.forms = {plstem .. plvowel.high}
end
postprocess(args, data)
if args then
return mw.text.jsonEncode(data)
end
return make_table(data)
end
function postprocess(args, data)
data.has_poss = args
data.has_pred = args
data.n = args
if args == "p" then
table.insert(data.categories, lang:getCanonicalName() .. " pluralia tantum")
elseif args == "s" then
table.insert(data.categories, lang:getCanonicalName() .. " uncountable nouns")
elseif args then
error("args= must be \"s\" or \"p\".")
end
for key, form in pairs(data.forms) do
-- Do not show singular or plural forms for nominals that don't have them
if (args == "p" and key:find("|s$")) or (args == "s" and key:find("|p$")) then
form = nil
end
data.forms = form
end
data.lemma = (data.forms)
-- Check if the lemma form matches the page name
if (lang:makeEntryName(data.lemma)) ~= mw.title.getCurrentTitle().text then
table.insert(data.categories, lang:getCanonicalName() .. " entries with inflection not matching pagename")
end
end
-- Make the table
function make_table(data)
local function repl(param)
local accel = true
local no_store = false
if param == "info" then
return mw.getContentLanguage():ucfirst(data.info or "")
elseif string.sub(param, 1, 1) == "!" then
no_store = true
param = string.sub(param, 2)
elseif string.sub(param, 1, 1) == "#" then
accel = false
param = string.sub(param, 2)
end
local forms = data.forms
if not forms then
return "—"
end
local ret = {}
for key, subform in ipairs(forms) do
table.insert(ret, require("Module:links").full_link({lang = lang, term = subform, accel = accel and {form = param, lemma = data.lemma, no_store = no_store} or nil}))
end
return table.concat(ret, "<br/>")
end
local wikicode = {}
if data.has_poss or data.has_pred then
table.insert(wikicode, mw.getCurrentFrame():expandTemplate{
title = "inflection-box-top",
args = {
title = "{{{info}}}",
flow = "vertical",
}
})
table.insert(wikicode, mw.getCurrentFrame():expandTemplate{
title = "inflection-table-top",
args = {
title = "-",
palette = "red",
}
})
else
table.insert(wikicode, mw.getCurrentFrame():expandTemplate{
title = "inflection-table-top",
args = {
title = "{{{info}}}",
tall = "yes",
palette = "red",
}
})
end
table.insert(wikicode, [=[
!
! singular
! plural
|-
! nominative
| {{{nom|s}}}
| {{{nom|p}}}
|-
! definite accusative
| {{{def|acc|s}}}
| {{{def|acc|p}}}
|-
! dative
| {{{dat|s}}}
| {{{dat|p}}}
|-
! locative
| {{{loc|s}}}
| {{{loc|p}}}
|-
! ablative
| {{{abl|s}}}
| {{{abl|p}}}
|-
! genitive
| {{{gen|s}}}
| {{{gen|p}}}
]=])
table.insert(wikicode, mw.getCurrentFrame():expandTemplate{ title = "inflection-table-bottom" })
-- Possessive forms
if data.has_poss then
table.insert(wikicode, mw.getCurrentFrame():expandTemplate{
title = "inflection-table-top",
args = {
title = "Possessive forms",
palette = "red",
tall = "yes",
}
})
table.insert(wikicode, [=[
! colspan="3" class="outer" | nominative
|-
!
! singular
! plural
|-
! 1st singular
| {{{1|s|spos|poss}}}
| {{{1|s|mpos|poss}}}
|-
! 2nd singular
| {{{2|s|spos|poss}}}
| {{{2|s|mpos|poss}}}
|-
! 3rd singular
| {{{3|s|spos|poss}}}
| {{{3|s|mpos|poss}}}
|-
! 1st plural
| {{{1|p|spos|poss}}}
| {{{1|p|mpos|poss}}}
|-
! 2nd plural
| {{{2|p|spos|poss}}}
| {{{2|p|mpos|poss}}}
|-
! 3rd plural
| {{{3|p|spos|poss}}}
| {{{3|p|mpos|poss}}}
|-
! colspan="3" class="outer" | definite accusative
|-
!
! singular
! plural
|-
! 1st singular
| {{{1|s|spos|poss|def|acc}}}
| {{{1|s|mpos|poss|def|acc}}}
|-
! 2nd singular
| {{{2|s|spos|poss|def|acc}}}
| {{{2|s|mpos|poss|def|acc}}}
|-
! 3rd singular
| {{{3|s|spos|poss|def|acc}}}
| {{{3|s|mpos|poss|def|acc}}}
|-
! 1st plural
| {{{1|p|spos|poss|def|acc}}}
| {{{1|p|mpos|poss|def|acc}}}
|-
! 2nd plural
| {{{2|p|spos|poss|def|acc}}}
| {{{2|p|mpos|poss|def|acc}}}
|-
! 3rd plural
| {{{3|p|spos|poss|def|acc}}}
| {{{3|p|mpos|poss|def|acc}}}
|-
! colspan="3" class="outer" | dative
|-
!
! singular
! plural
|-
! 1st singular
| {{{1|s|spos|poss|dat}}}
| {{{1|s|mpos|poss|dat}}}
|-
! 2nd singular
| {{{2|s|spos|poss|dat}}}
| {{{2|s|mpos|poss|dat}}}
|-
! 3rd singular
| {{{3|s|spos|poss|dat}}}
| {{{3|s|mpos|poss|dat}}}
|-
! 1st plural
| {{{1|p|spos|poss|dat}}}
| {{{1|p|mpos|poss|dat}}}
|-
! 2nd plural
| {{{2|p|spos|poss|dat}}}
| {{{2|p|mpos|poss|dat}}}
|-
! 3rd plural
| {{{3|p|spos|poss|dat}}}
| {{{3|p|mpos|poss|dat}}}
|-
! colspan="3" class="outer" | locative
|-
!
! singular
! plural
|-
! 1st singular
| {{{1|s|spos|poss|loc}}}
| {{{1|s|mpos|poss|loc}}}
|-
! 2nd singular
| {{{2|s|spos|poss|loc}}}
| {{{2|s|mpos|poss|loc}}}
|-
! 3rd singular
| {{{3|s|spos|poss|loc}}}
| {{{3|s|mpos|poss|loc}}}
|-
! 1st plural
| {{{1|p|spos|poss|loc}}}
| {{{1|p|mpos|poss|loc}}}
|-
! 2nd plural
| {{{2|p|spos|poss|loc}}}
| {{{2|p|mpos|poss|loc}}}
|-
! 3rd plural
| {{{3|p|spos|poss|loc}}}
| {{{3|p|mpos|poss|loc}}}
|-
! colspan="3" class="outer" | ablative
|-
!
! singular
! plural
|-
! 1st singular
| {{{1|s|spos|poss|abl}}}
| {{{1|s|mpos|poss|abl}}}
|-
! 2nd singular
| {{{2|s|spos|poss|abl}}}
| {{{2|s|mpos|poss|abl}}}
|-
! 3rd singular
| {{{3|s|spos|poss|abl}}}
| {{{3|s|mpos|poss|abl}}}
|-
! 1st plural
| {{{1|p|spos|poss|abl}}}
| {{{1|p|mpos|poss|abl}}}
|-
! 2nd plural
| {{{2|p|spos|poss|abl}}}
| {{{2|p|mpos|poss|abl}}}
|-
! 3rd plural
| {{{3|p|spos|poss|abl}}}
| {{{3|p|mpos|poss|abl}}}
|-
! colspan="3" class="outer" | genitive
|-
!
! singular
! plural
|-
! 1st singular
| {{{1|s|spos|poss|gen}}}
| {{{1|s|mpos|poss|gen}}}
|-
! 2nd singular
| {{{2|s|spos|poss|gen}}}
| {{{2|s|mpos|poss|gen}}}
|-
! 3rd singular
| {{{3|s|spos|poss|gen}}}
| {{{3|s|mpos|poss|gen}}}
|-
! 1st plural
| {{{1|p|spos|poss|gen}}}
| {{{1|p|mpos|poss|gen}}}
|-
! 2nd plural
| {{{2|p|spos|poss|gen}}}
| {{{2|p|mpos|poss|gen}}}
|-
! 3rd plural
| {{{3|p|spos|poss|gen}}}
| {{{3|p|mpos|poss|gen}}}
]=])
table.insert(wikicode, mw.getCurrentFrame():expandTemplate{ title = "inflection-table-bottom" })
end
-- Predicative forms
if data.has_pred then
table.insert(wikicode, mw.getCurrentFrame():expandTemplate{
title = "inflection-table-top",
args = {
title = "Predicative forms",
palette = "red",
tall = "yes",
}
})
table.insert(wikicode, [=[
!
! singular
! plural
|-
! 1st singular
| {{{1|s|pred|of the|s}}}
| {{{1|s|pred|of the|p}}}
|-
! 2nd singular
| {{{2|s|pred|of the|s}}}
| {{{2|s|pred|of the|p}}}
|-
! 3rd singular
| {{{3|s|pred|of the|s}}}
| {{{3|s|pred|of the|p}}}
|-
! 1st plural
| {{{1|p|pred|of the|s}}}
| {{{1|p|pred|of the|p}}}
|-
! 2nd plural
| {{{2|p|pred|of the|s}}}
| {{{2|p|pred|of the|p}}}
|-
! 3rd plural
| {{{3|p|pred|of the|s}}}
| {{{3|p|pred|of the|p}}}
]=])
table.insert(wikicode, mw.getCurrentFrame():expandTemplate{ title = "inflection-table-bottom" })
end
if data.has_poss or data.has_pred then
table.insert(wikicode, '\n')
table.insert(wikicode, mw.getCurrentFrame():expandTemplate{ title = "inflection-box-bottom" })
end
return mw.ustring.gsub(table.concat(wikicode), "{{{(?+)}}}", repl) .. require("Module:utilities").format_categories(data.categories, lang)
end
return export