Module:User:Sahib1609/az-headword

local export = {}

local export = {} local pos_functions = {} local rfind = mw.ustring.find local rmatch = mw.ustring.match local rsubn = mw.ustring.gsub local rsplit = mw.text.split

local lang = require("Module:languages").getByCode("az")

local suffix_categories = { ["adjectives"] = true, ["adverbs"] = true, ["nouns"] = true, ["verbs"] = true, ["prepositional phrases"] = true, }

-- version of rsubn that discards all but the first return value local function rsub(term, foo, bar) local retval = rsubn(term, foo, bar) return retval end

local function track(page) require("Module:debug").track("az-headword/" .. page) return true end

local function glossary_link(entry, text) text = text or entry return "" .. text .. "" end

local no_split_words = { ["bə's"] = true, }

local function add_space_word_links(space_word, split_dash) local space_word_no_punct, punct = rmatch(space_word, "^(.*)([,;:?!])$") space_word_no_punct = space_word_no_punct or space_word punct = punct or "" local words -- don’t split prefixes and suffixes if not split_dash or rfind(space_word_no_punct, "^%-") or rfind(space_word_no_punct, "%-$") then words = {space_word_no_punct} else words = rsplit(space_word_no_punct, "%-") end local linked_words = {} for _, word in ipairs(words) do		if not no_split_words[word] and rfind(word, "'") then word = rsub(word, "([^']+')", "%1") word = rsub(word, "%]([^%[%]]*)$", "]%1") else word = "" .. word .. "" end table.insert(linked_words, word) end return table.concat(linked_words, "-") .. punct end

local function add_lemma_links(lemma, split_dash) if not rfind(lemma, " ") then split_dash = true end local words = rsplit(lemma, " ") local linked_words = {} for _, word in ipairs(words) do		table.insert(linked_words, add_space_word_links(word, split_dash)) end local retval = table.concat(linked_words, " ") -- If we ended up with a single link consisting of the entire lemma, -- remove the link. local unlinked_retval = rmatch(retval, "^%[%[([^%[%]]*)%]%]$") return unlinked_retval or retval end

-- The main entry point. -- This is the only function that can be invoked from a template. function export.show(frame) local PAGENAME = mw.title.getCurrentTitle.text local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.") local params = { ["head"] = {list = true}, ["suff"] = {type = "boolean"}, ["splitdash"] = {alias_of = "splithyph", type = "boolean"}, ["splithyph"] = {type = "boolean"}, ["nolinkhead"] = {type = "boolean"}, }

if rfind(PAGENAME, " ") then track("space") end

if pos_functions[poscat] then for key, val in pairs(pos_functions[poscat].params) do			params[key] = val end end

local parargs = frame:getParent.args if parargs.splitdash then track("splitdash") end local args = require("Module:parameters").process(parargs, params)

local heads = args["head"] if pos_functions[poscat] and pos_functions[poscat].param1_is_head and args[1] then table.insert(heads, 1, args[1]) end if args.nolinkhead then if #heads == 0 then heads = {PAGENAME} end else local auto_linked_head = add_lemma_links(PAGENAME, args["splithyph"]) if #heads == 0 then heads = {auto_linked_head} else for _, head in ipairs(heads) do				if head == auto_linked_head then track("redundant-head") end end end end local data = {lang = lang, pos_category = poscat, categories = {}, heads = heads, genders = {}, inflections = {}, categories = {}} if args["suff"] then data.pos_category = "suffixes" if suffix_categories[poscat] then local singular_poscat = poscat:gsub("s$", "") table.insert(data.categories, lang:getCanonicalName .. " " .. singular_poscat .. "-forming suffixes") else error("No category exists for suffixes forming " .. poscat .. ".") end end if pos_functions[poscat] then pos_functions[poscat].func(args, data) end return require("Module:headword").full_headword(data) end

local function do_adjective(pos) return { params = { [1] = {}, -- hyphen (-) if incomparable, intensive form otherwise },		func = function(args, data) local PAGENAME = mw.title.getCurrentTitle.text local function comp if rfind(PAGENAME, 'b') or rfind(PAGENAME, 'c') or rfind(PAGENAME, 'd') or rfind(PAGENAME, 'f') or rfind(PAGENAME, 'g') or rfind(PAGENAME, 'h') or rfind(PAGENAME, 'j') or rfind(PAGENAME, 'k') or rfind(PAGENAME, 'l') or rfind(PAGENAME, 'm') or rfind(PAGENAME, 'n') or rfind(PAGENAME, 'p') or rfind(PAGENAME, 'q') or rfind(PAGENAME, 'r') or rfind(PAGENAME, 's') or rfind(PAGENAME, 't') or rfind(PAGENAME, 'v') or rfind(PAGENAME, 'x') or rfind(PAGENAME, 'y') or rfind(PAGENAME, 'z') or rfind(PAGENAME, 'ğ') or rfind(PAGENAME, 'ç') or rfind(PAGENAME, 'ş') then return "daha " elseif rfind(PAGENAME, 'б') or rfind(PAGENAME, 'ҹ') or rfind(PAGENAME, 'д') or rfind(PAGENAME, 'ф') or rfind(PAGENAME, 'ҝ') or rfind(PAGENAME, 'һ') or rfind(PAGENAME, 'ж') or rfind(PAGENAME, 'к') or rfind(PAGENAME, 'л') or rfind(PAGENAME, 'м') or rfind(PAGENAME, 'н') or rfind(PAGENAME, 'п') or rfind(PAGENAME, 'г') or rfind(PAGENAME, 'р') or rfind(PAGENAME, 'с') or rfind(PAGENAME, 'т') or rfind(PAGENAME, 'в') or rfind(PAGENAME, 'х') or rfind(PAGENAME, 'ј') or rfind(PAGENAME, 'з') or rfind(PAGENAME, 'ғ') or rfind(PAGENAME, 'ч') or rfind(PAGENAME, 'ш') then return "даһа " end end local function sup if rfind(PAGENAME, 'b') or rfind(PAGENAME, 'c') or rfind(PAGENAME, 'd') or rfind(PAGENAME, 'f') or rfind(PAGENAME, 'g') or rfind(PAGENAME, 'h') or rfind(PAGENAME, 'j') or rfind(PAGENAME, 'k') or rfind(PAGENAME, 'l') or rfind(PAGENAME, 'm') or rfind(PAGENAME, 'n') or rfind(PAGENAME, 'p') or rfind(PAGENAME, 'q') or rfind(PAGENAME, 'r') or rfind(PAGENAME, 's') or rfind(PAGENAME, 't') or rfind(PAGENAME, 'v') or rfind(PAGENAME, 'x') or rfind(PAGENAME, 'y') or rfind(PAGENAME, 'z') or rfind(PAGENAME, 'ğ') or rfind(PAGENAME, 'ç') or rfind(PAGENAME, 'ş') then return "ən " elseif rfind(PAGENAME, 'б') or rfind(PAGENAME, 'ҹ') or rfind(PAGENAME, 'д') or rfind(PAGENAME, 'ф') or rfind(PAGENAME, 'ҝ') or rfind(PAGENAME, 'һ') or rfind(PAGENAME, 'ж') or rfind(PAGENAME, 'к') or rfind(PAGENAME, 'л') or rfind(PAGENAME, 'м') or rfind(PAGENAME, 'н') or rfind(PAGENAME, 'п') or rfind(PAGENAME, 'г') or rfind(PAGENAME, 'р') or rfind(PAGENAME, 'с') or rfind(PAGENAME, 'т') or rfind(PAGENAME, 'в') or rfind(PAGENAME, 'х') or rfind(PAGENAME, 'ј') or rfind(PAGENAME, 'з') or rfind(PAGENAME, 'ғ') or rfind(PAGENAME, 'ч') or rfind(PAGENAME, 'ш') then return "ән " end end if args[1] == "-" then table.insert(data.inflections, { label = "not comparable" }) else table.insert(data.inflections, { label = "comparative", comp .. PAGENAME }) table.insert(data.inflections, { label = "superlative", sup .. PAGENAME }) if args[1] then table.insert(data.inflections, { label = "intensive", args[1] }) end end end } end

local function get_noun_pos(is_proper) return { params = { [1] = {},			[2] = {},			["stem"] = {}, ["broken"] = {}, ["broken-v"] = {}, ["nb"] = {}, ["sing"] = {}, },		func = function(args, data) local PAGENAME = mw.title.getCurrentTitle.text local function stemforacc if rfind(PAGENAME, 'b') or rfind(PAGENAME, 'c') or rfind(PAGENAME, 'd') or rfind(PAGENAME, 'f') or rfind(PAGENAME, 'g') or rfind(PAGENAME, 'h') or rfind(PAGENAME, 'j') or rfind(PAGENAME, 'k') or rfind(PAGENAME, 'l') or rfind(PAGENAME, 'm') or rfind(PAGENAME, 'n') or rfind(PAGENAME, 'p') or rfind(PAGENAME, 'q') or rfind(PAGENAME, 'r') or rfind(PAGENAME, 's') or rfind(PAGENAME, 't') or rfind(PAGENAME, 'v') or rfind(PAGENAME, 'x') or rfind(PAGENAME, 'y') or rfind(PAGENAME, 'z') or rfind(PAGENAME, 'ğ') or rfind(PAGENAME, 'ç') or rfind(PAGENAME, 'ş') then if args[2] == "q" then if rfind(PAGENAME, 'q$') then return mw.ustring.sub(PAGENAME, 1, -2) .. 'ğ' end elseif args[2] == "k" then if rfind(PAGENAME, 'k$') then return mw.ustring.sub(PAGENAME, 1, -2) .. 'y'						end else return PAGENAME end elseif rfind(PAGENAME, 'б') or rfind(PAGENAME, 'ҹ') or rfind(PAGENAME, 'д') or rfind(PAGENAME, 'ф') or rfind(PAGENAME, 'ҝ') or rfind(PAGENAME, 'һ') or rfind(PAGENAME, 'ж') or rfind(PAGENAME, 'к') or rfind(PAGENAME, 'л') or rfind(PAGENAME, 'м') or rfind(PAGENAME, 'н') or rfind(PAGENAME, 'п') or rfind(PAGENAME, 'г') or rfind(PAGENAME, 'р') or rfind(PAGENAME, 'с') or rfind(PAGENAME, 'т') or rfind(PAGENAME, 'в') or rfind(PAGENAME, 'х') or rfind(PAGENAME, 'ј') or rfind(PAGENAME, 'з') or rfind(PAGENAME, 'ғ') or rfind(PAGENAME, 'ч') or rfind(PAGENAME, 'ш') then if args[2] == "q" then if rfind(PAGENAME, 'г$') then return mw.ustring.sub(PAGENAME, 1, -2) .. 'ғ' end elseif args[2] == "k" then if rfind(PAGENAME, 'к$') then return mw.ustring.sub(PAGENAME, 1, -2) .. 'ј' end else return PAGENAME end end end local function stemforpl if rfind(PAGENAME, 'b') or rfind(PAGENAME, 'c') or rfind(PAGENAME, 'd') or rfind(PAGENAME, 'f') or rfind(PAGENAME, 'g') or rfind(PAGENAME, 'h') or rfind(PAGENAME, 'j') or rfind(PAGENAME, 'k') or rfind(PAGENAME, 'l') or rfind(PAGENAME, 'm') or rfind(PAGENAME, 'n') or rfind(PAGENAME, 'p') or rfind(PAGENAME, 'q') or rfind(PAGENAME, 'r') or rfind(PAGENAME, 's') or rfind(PAGENAME, 't') or rfind(PAGENAME, 'v') or rfind(PAGENAME, 'x') or rfind(PAGENAME, 'y') or rfind(PAGENAME, 'z') or rfind(PAGENAME, 'ğ') or rfind(PAGENAME, 'ç') or rfind(PAGENAME, 'ş') then if args[2] == "cc" then if rfind(PAGENAME, 'b$') or rfind(PAGENAME, 'c$') or rfind(PAGENAME, 'd$') or rfind(PAGENAME, 'f$') or rfind(PAGENAME, 'g$') or rfind(PAGENAME, 'h') or rfind(PAGENAME, 'j') or rfind(PAGENAME, 'k$') or rfind(PAGENAME, 'l$') or rfind(PAGENAME, 'm$') or rfind(PAGENAME, 'n$') or rfind(PAGENAME, 'p$') or rfind(PAGENAME, 'q$') or rfind(PAGENAME, 'r$') or rfind(PAGENAME, 's$') or rfind(PAGENAME, 't$') or rfind(PAGENAME, 'v$') or rfind(PAGENAME, 'x$') or rfind(PAGENAME, 'y$') or rfind(PAGENAME, 'z$') or rfind(PAGENAME, 'ğ$') or rfind(PAGENAME, 'ç$') or rfind(PAGENAME, 'ş$') then return mw.ustring.sub(PAGENAME, 1, -2) end else return PAGENAME end elseif rfind(PAGENAME, 'б') or rfind(PAGENAME, 'ҹ') or rfind(PAGENAME, 'д') or rfind(PAGENAME, 'ф') or rfind(PAGENAME, 'ҝ') or rfind(PAGENAME, 'һ') or rfind(PAGENAME, 'ж') or rfind(PAGENAME, 'к') or rfind(PAGENAME, 'л') or rfind(PAGENAME, 'м') or rfind(PAGENAME, 'н') or rfind(PAGENAME, 'п') or rfind(PAGENAME, 'г') or rfind(PAGENAME, 'р') or rfind(PAGENAME, 'с') or rfind(PAGENAME, 'т') or rfind(PAGENAME, 'в') or rfind(PAGENAME, 'х') or rfind(PAGENAME, 'ј') or rfind(PAGENAME, 'з') or rfind(PAGENAME, 'ғ') or rfind(PAGENAME, 'ч') or rfind(PAGENAME, 'ш') then if args[2] == "cc" then if rfind(PAGENAME, 'б$') or rfind(PAGENAME, 'ҹ$') or rfind(PAGENAME, 'д$') or rfind(PAGENAME, 'ф$') or rfind(PAGENAME, 'ҝ$') or rfind(PAGENAME, 'һ') or rfind(PAGENAME, 'ж') or rfind(PAGENAME, 'к$') or rfind(PAGENAME, 'л$') or rfind(PAGENAME, 'м$') or rfind(PAGENAME, 'н$') or rfind(PAGENAME, 'п$') or rfind(PAGENAME, 'г$') or rfind(PAGENAME, 'р$') or rfind(PAGENAME, 'с$') or rfind(PAGENAME, 'т$') or rfind(PAGENAME, 'в$') or rfind(PAGENAME, 'х$') or rfind(PAGENAME, 'ј$') or rfind(PAGENAME, 'з$') or rfind(PAGENAME, 'ғ$') or rfind(PAGENAME, 'ч$') or rfind(PAGENAME, 'ш$') then return mw.ustring.sub(PAGENAME, 1, -2) end else return PAGENAME end end end local function azv1 if rfind(PAGENAME, 'b') or rfind(PAGENAME, 'c') or rfind(PAGENAME, 'd') or rfind(PAGENAME, 'f') or rfind(PAGENAME, 'g') or rfind(PAGENAME, 'h') or rfind(PAGENAME, 'j') or rfind(PAGENAME, 'k') or rfind(PAGENAME, 'l') or rfind(PAGENAME, 'm') or rfind(PAGENAME, 'n') or rfind(PAGENAME, 'p') or rfind(PAGENAME, 'q') or rfind(PAGENAME, 'r') or rfind(PAGENAME, 's') or rfind(PAGENAME, 't') or rfind(PAGENAME, 'v') or rfind(PAGENAME, 'x') or rfind(PAGENAME, 'y') or rfind(PAGENAME, 'z') or rfind(PAGENAME, 'ğ') or rfind(PAGENAME, 'ç') or rfind(PAGENAME, 'ş') then if args[1] == "ə" or args[1] == "e" or args[1] == "i" or args[1] == "ö" or args[1] == "ü" then return "i" else return "ı" end elseif rfind(PAGENAME, 'б') or rfind(PAGENAME, 'ҹ') or rfind(PAGENAME, 'д') or rfind(PAGENAME, 'ф') or rfind(PAGENAME, 'ҝ') or rfind(PAGENAME, 'һ') or rfind(PAGENAME, 'ж') or rfind(PAGENAME, 'к') or rfind(PAGENAME, 'л') or rfind(PAGENAME, 'м') or rfind(PAGENAME, 'н') or rfind(PAGENAME, 'п') or rfind(PAGENAME, 'г') or rfind(PAGENAME, 'р') or rfind(PAGENAME, 'с') or rfind(PAGENAME, 'т') or rfind(PAGENAME, 'в') or rfind(PAGENAME, 'х') or rfind(PAGENAME, 'ј') or rfind(PAGENAME, 'з') or rfind(PAGENAME, 'ғ') or rfind(PAGENAME, 'ч') or rfind(PAGENAME, 'ш') then if args[1] == "ə" or args[1] == "e" or args[1] == "i" or args[1] == "ö" or args[1] == "ü" then return "и" else return "ы" end end end local function azv2 if rfind(PAGENAME, 'b') or rfind(PAGENAME, 'c') or rfind(PAGENAME, 'd') or rfind(PAGENAME, 'f') or rfind(PAGENAME, 'g') or rfind(PAGENAME, 'h') or rfind(PAGENAME, 'j') or rfind(PAGENAME, 'k') or rfind(PAGENAME, 'l') or rfind(PAGENAME, 'm') or rfind(PAGENAME, 'n') or rfind(PAGENAME, 'p') or rfind(PAGENAME, 'q') or rfind(PAGENAME, 'r') or rfind(PAGENAME, 's') or rfind(PAGENAME, 't') or rfind(PAGENAME, 'v') or rfind(PAGENAME, 'x') or rfind(PAGENAME, 'y') or rfind(PAGENAME, 'z') or rfind(PAGENAME, 'ğ') or rfind(PAGENAME, 'ç') or rfind(PAGENAME, 'ş') then if args[1] == "ə" or args[1] == "e" or args[1] == "i" or args[1] == "ö" or args[1] == "ü" then return "ə" else return "a" end elseif rfind(PAGENAME, 'б') or rfind(PAGENAME, 'ҹ') or rfind(PAGENAME, 'д') or rfind(PAGENAME, 'ф') or rfind(PAGENAME, 'ҝ') or rfind(PAGENAME, 'һ') or rfind(PAGENAME, 'ж') or rfind(PAGENAME, 'к') or rfind(PAGENAME, 'л') or rfind(PAGENAME, 'м') or rfind(PAGENAME, 'н') or rfind(PAGENAME, 'п') or rfind(PAGENAME, 'г') or rfind(PAGENAME, 'р') or rfind(PAGENAME, 'с') or rfind(PAGENAME, 'т') or rfind(PAGENAME, 'в') or rfind(PAGENAME, 'х') or rfind(PAGENAME, 'ј') or rfind(PAGENAME, 'з') or rfind(PAGENAME, 'ғ') or rfind(PAGENAME, 'ч') or rfind(PAGENAME, 'ш') then if args[1] == "ə" or args[1] == "e" or args[1] == "i" or args[1] == "ö" or args[1] == "ü" then return "ә" else return "а" end end end local function azv3 if rfind(PAGENAME, 'b') or rfind(PAGENAME, 'c') or rfind(PAGENAME, 'd') or rfind(PAGENAME, 'f') or rfind(PAGENAME, 'g') or rfind(PAGENAME, 'h') or rfind(PAGENAME, 'j') or rfind(PAGENAME, 'k') or rfind(PAGENAME, 'l') or rfind(PAGENAME, 'm') or rfind(PAGENAME, 'n') or rfind(PAGENAME, 'p') or rfind(PAGENAME, 'q') or rfind(PAGENAME, 'r') or rfind(PAGENAME, 's') or rfind(PAGENAME, 't') or rfind(PAGENAME, 'v') or rfind(PAGENAME, 'x') or rfind(PAGENAME, 'y') or rfind(PAGENAME, 'z') or rfind(PAGENAME, 'ğ') or rfind(PAGENAME, 'ç') or rfind(PAGENAME, 'ş') then if args[1] == "ə" or args[1] == "e" or args[1] == "i" then return "ə" elseif args[1] == "ö" or args[1] == "ü" then return "ü" elseif args[1] == "a" or args[1] == "ı" then return "ı" else return "u" end elseif rfind(PAGENAME, 'б') or rfind(PAGENAME, 'ҹ') or rfind(PAGENAME, 'д') or rfind(PAGENAME, 'ф') or rfind(PAGENAME, 'ҝ') or rfind(PAGENAME, 'һ') or rfind(PAGENAME, 'ж') or rfind(PAGENAME, 'к') or rfind(PAGENAME, 'л') or rfind(PAGENAME, 'м') or rfind(PAGENAME, 'н') or rfind(PAGENAME, 'п') or rfind(PAGENAME, 'г') or rfind(PAGENAME, 'р') or rfind(PAGENAME, 'с') or rfind(PAGENAME, 'т') or rfind(PAGENAME, 'в') or rfind(PAGENAME, 'х') or rfind(PAGENAME, 'ј') or rfind(PAGENAME, 'з') or rfind(PAGENAME, 'ғ') or rfind(PAGENAME, 'ч') or rfind(PAGENAME, 'ш') then if args[1] == "ə" or args[1] == "e" or args[1] == "i" then return "ә" elseif args[1] == "ö" or args[1] == "ü" then return "ү" elseif args[1] == "a" or args[1] == "ı" then return "ы" else return "у" end end end local function n if rfind(PAGENAME, 'b') or rfind(PAGENAME, 'c') or rfind(PAGENAME, 'd') or rfind(PAGENAME, 'f') or rfind(PAGENAME, 'g') or rfind(PAGENAME, 'h') or rfind(PAGENAME, 'j') or rfind(PAGENAME, 'k') or rfind(PAGENAME, 'l') or rfind(PAGENAME, 'm') or rfind(PAGENAME, 'n') or rfind(PAGENAME, 'p') or rfind(PAGENAME, 'q') or rfind(PAGENAME, 'r') or rfind(PAGENAME, 's') or rfind(PAGENAME, 't') or rfind(PAGENAME, 'v') or rfind(PAGENAME, 'x') or rfind(PAGENAME, 'y') or rfind(PAGENAME, 'z') or rfind(PAGENAME, 'ğ') or rfind(PAGENAME, 'ç') or rfind(PAGENAME, 'ş') then return "n" elseif rfind(PAGENAME, 'б') or rfind(PAGENAME, 'ҹ') or rfind(PAGENAME, 'д') or rfind(PAGENAME, 'ф') or rfind(PAGENAME, 'ҝ') or rfind(PAGENAME, 'һ') or rfind(PAGENAME, 'ж') or rfind(PAGENAME, 'к') or rfind(PAGENAME, 'л') or rfind(PAGENAME, 'м') or rfind(PAGENAME, 'н') or rfind(PAGENAME, 'п') or rfind(PAGENAME, 'г') or rfind(PAGENAME, 'р') or rfind(PAGENAME, 'с') or rfind(PAGENAME, 'т') or rfind(PAGENAME, 'в') or rfind(PAGENAME, 'х') or rfind(PAGENAME, 'ј') or rfind(PAGENAME, 'з') or rfind(PAGENAME, 'ғ') or rfind(PAGENAME, 'ч') or rfind(PAGENAME, 'ш') then return "н" end end local function l if rfind(PAGENAME, 'b') or rfind(PAGENAME, 'c') or rfind(PAGENAME, 'd') or rfind(PAGENAME, 'f') or rfind(PAGENAME, 'g') or rfind(PAGENAME, 'h') or rfind(PAGENAME, 'j') or rfind(PAGENAME, 'k') or rfind(PAGENAME, 'l') or rfind(PAGENAME, 'm') or rfind(PAGENAME, 'n') or rfind(PAGENAME, 'p') or rfind(PAGENAME, 'q') or rfind(PAGENAME, 'r') or rfind(PAGENAME, 's') or rfind(PAGENAME, 't') or rfind(PAGENAME, 'v') or rfind(PAGENAME, 'x') or rfind(PAGENAME, 'y') or rfind(PAGENAME, 'z') or rfind(PAGENAME, 'ğ') or rfind(PAGENAME, 'ç') or rfind(PAGENAME, 'ş') then return "l" elseif rfind(PAGENAME, 'б') or rfind(PAGENAME, 'ҹ') or rfind(PAGENAME, 'д') or rfind(PAGENAME, 'ф') or rfind(PAGENAME, 'ҝ') or rfind(PAGENAME, 'һ') or rfind(PAGENAME, 'ж') or rfind(PAGENAME, 'к') or rfind(PAGENAME, 'л') or rfind(PAGENAME, 'м') or rfind(PAGENAME, 'н') or rfind(PAGENAME, 'п') or rfind(PAGENAME, 'г') or rfind(PAGENAME, 'р') or rfind(PAGENAME, 'с') or rfind(PAGENAME, 'т') or rfind(PAGENAME, 'в') or rfind(PAGENAME, 'х') or rfind(PAGENAME, 'ј') or rfind(PAGENAME, 'з') or rfind(PAGENAME, 'ғ') or rfind(PAGENAME, 'ч') or rfind(PAGENAME, 'ш') then return "л" end end local function r if rfind(PAGENAME, 'b') or rfind(PAGENAME, 'c') or rfind(PAGENAME, 'd') or rfind(PAGENAME, 'f') or rfind(PAGENAME, 'g') or rfind(PAGENAME, 'h') or rfind(PAGENAME, 'j') or rfind(PAGENAME, 'k') or rfind(PAGENAME, 'l') or rfind(PAGENAME, 'm') or rfind(PAGENAME, 'n') or rfind(PAGENAME, 'p') or rfind(PAGENAME, 'q') or rfind(PAGENAME, 'r') or rfind(PAGENAME, 's') or rfind(PAGENAME, 't') or rfind(PAGENAME, 'v') or rfind(PAGENAME, 'x') or rfind(PAGENAME, 'y') or rfind(PAGENAME, 'z') or rfind(PAGENAME, 'ğ') or rfind(PAGENAME, 'ç') or rfind(PAGENAME, 'ş') then return "r" elseif rfind(PAGENAME, 'б') or rfind(PAGENAME, 'ҹ') or rfind(PAGENAME, 'д') or rfind(PAGENAME, 'ф') or rfind(PAGENAME, 'ҝ') or rfind(PAGENAME, 'һ') or rfind(PAGENAME, 'ж') or rfind(PAGENAME, 'к') or rfind(PAGENAME, 'л') or rfind(PAGENAME, 'м') or rfind(PAGENAME, 'н') or rfind(PAGENAME, 'п') or rfind(PAGENAME, 'г') or rfind(PAGENAME, 'р') or rfind(PAGENAME, 'с') or rfind(PAGENAME, 'т') or rfind(PAGENAME, 'в') or rfind(PAGENAME, 'х') or rfind(PAGENAME, 'ј') or rfind(PAGENAME, 'з') or rfind(PAGENAME, 'ғ') or rfind(PAGENAME, 'ч') or rfind(PAGENAME, 'ш') then return "р" end end if args[2] == "c" or args[2] == "cc" or args[2] == "q" or args[2] == "k" then if args["stem"] then if args["sing"] == "no" then if args["nb"] == "no" then if args["broken"] then table.insert(data.genders, { "p" }) else table.insert("?") end else table.insert(data.genders, { "p" }) if args["broken"] then table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|plural"}, args["broken"] }) end end else if args["nb"] == "no" then table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, args["stem"] .. azv3 }) if args["broken"] then table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|plural"}, args["broken"] }) end else if args["broken"] then table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, args["stem"] .. azv3 }) table.insert(data.inflections, { label = "sound plural", accel = { form = "nom|sound|p"}, PAGENAME .. l .. azv2 .. r }) table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|p"}, args["broken"] }) else table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, args["stem"] .. azv3 }) table.insert(data.inflections, { label = "plural", accel = { form = "nom|p"}, PAGENAME .. l .. azv2 .. r }) end end end else if args["sing"] == "no" then if args["nb"] == "no" then if args["broken"] then table.insert(data.genders, { "p" }) else table.insert("?") end else table.insert(data.genders, { "p" }) if args["broken"] then table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|plural"}, args["broken"] }) end end else if args["nb"] == "no" then table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, stemforacc .. azv3 }) if args["broken"] then table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|plural"}, args["broken"] }) end else if args["broken"] then table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, stemforacc .. azv3 }) table.insert(data.inflections, { label = "sound plural", accel = { form = "nom|sound|p"}, stemforpl .. l .. azv2 .. r }) table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|p"}, args["broken"] }) else table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, stemforacc .. azv3 }) table.insert(data.inflections, { label = "plural", accel = { form = "nom|p"}, stemforpl .. l .. azv2 .. r }) end end end end else if args["stem"] then if args["sing"] == "no" then if args["nb"] == "no" then if args["broken"] then table.insert(data.genders, { "p" }) else table.insert("?") end else table.insert(data.genders, { "p" }) if args["broken"] then table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|plural"}, args["broken"] }) end end else if args["nb"] == "no" then table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, args["stem"] .. azv3 }) if args["broken"] then table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|plural"}, args["broken"] }) end else if args["broken"] then table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, args["stem"] .. azv3 }) table.insert(data.inflections, { label = "sound plural", accel = { form = "nom|sound|p"}, PAGENAME .. l .. azv2 .. r }) table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|p"}, args["broken"] }) else table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, args["stem"] .. azv3 }) table.insert(data.inflections, { label = "plural", accel = { form = "nom|p"}, PAGENAME .. l .. azv2 .. r }) end end end else if args["sing"] == "no" then if args["nb"] == "no" then if args["broken"] then table.insert(data.genders, { "p" }) else table.insert("?") end else table.insert(data.genders, { "p" }) if args["broken"] then table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|plural"}, args["broken"] }) end end else if args["nb"] == "no" then table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, PAGENAME .. n .. azv3 }) if args["broken"] then table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|plural"}, args["broken"] }) end else if args["broken"] then table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, PAGENAME .. n .. azv3 }) table.insert(data.inflections, { label = "sound plural", accel = { form = "nom|sound|p"}, PAGENAME .. l .. azv2 .. r }) table.insert(data.inflections, { label = "broken plural", accel = {form = "nom|broken|p"}, args["broken"] }) else table.insert(data.inflections, { label = "definite accusative", accel = {form = "def|acc|s"}, PAGENAME .. n .. azv3 }) table.insert(data.inflections, { label = "plural", accel = { form = "nom|p"}, PAGENAME .. l .. azv2 .. r }) end end end end end end } end

pos_functions["nouns"] = get_noun_pos(false)

pos_functions["proper nouns"] = get_noun_pos(true)

pos_functions["adjectives"] = do_adjective("adjectives")

return export