Module:kmr-nouns

-- Ported from ku:Modul:ku-tewîn-nav authored by Ghybu -- T:kmr-decl-noun -- Module:kmr-nouns/masc and fem ku:Modul:ku-tewîn-nav/mê û nêr -- Module:kmr-nouns/singular ku:Modul:ku-tewîn-nav/yekjimar

local export = {}

-- FERHENG -- -- Definite (def) -- Indefinite (indef) -- Singular (s) / Plural (p) -- Case -- Nominative (nom) -- Construct (cons) -- Oblique (obl) -- Demonstrative oblique (demons_obl) -- Vocativ (voc)

local gsub = mw.ustring.gsub local find = mw.ustring.find

-- bolden the suffix function b(bold) return ' .. bold .. ' end

function pronounDecl(g) if g == 'f' then return 'wê' end if g == 'm' then return 'wî' end end

function export.decl(title, gender, variant, bold) local decl = {} decl.def_nom_s = title decl.def_nom_p = title if (find(title, '[bcçdfghjklmnpqrsştvwxyz]$')) then if (gender == 'm') then decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('ê')) decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('ên')) decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('î')) decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('an')) decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('ek')) decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('in')) decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('ekî')) decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('ine')) decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('ekî')) decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('inan')) decl.voc_s = gsub(title, '(.)$', '%1' .. b('o')) decl.voc_p = gsub(title, '(.)$', '%1' .. b('ino')) elseif (gender == 'f') then decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('a')) decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('ên')) decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('ê')) decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('an')) decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('ek')) decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('in')) decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('eke')) decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('ine')) decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('ekê')) decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('inan')) decl.voc_s = gsub(title, '(.)$', '%1' .. b('ê')) decl.voc_p = gsub(title, '(.)$', '%1' .. b('ino')) end

elseif (find(title, '[aeêiîouû]$') and variant == '2') then if (gender == 'm') then decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('yê')) decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('yên')) if (find(title, '[î]$')) then decl.def_obl_s = title else decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('yî')) end decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('yan')) decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('yek')) decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('yin')) decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('yekî')) decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('yine')) decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('yekî')) decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('yinan')) decl.voc_s = gsub(title, '(.)$', '%1' .. b('yo')) decl.voc_p = gsub(title, '(.)$', '%1' .. b('yino')) elseif (gender == 'f') then decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('ya')) decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('yên')) if (find(title, '[ê]$')) then decl.def_obl_s = title else decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('yê')) end decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('yan')) decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('yek')) decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('yin')) decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('yeke')) decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('yine')) decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('yekê')) decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('yinan')) decl.voc_s = gsub(title, '(.)$', '%1' .. b('yê')) decl.voc_p = gsub(title, '(.)$', '%1' .. b('yino')) end elseif (find(title, '[aîoû]$')) then if (gender == 'm') then decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('yê')) decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('yên')) if (find(title, '[î]$')) then decl.def_obl_s = title else decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('yî')) end decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('yan')) decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('yek')) decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('yin')) decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('yekî')) decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('yine')) decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('yekî')) decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('yinan')) decl.voc_s = gsub(title, '(.)$', '%1' .. b('yo')) decl.voc_p = gsub(title, '(.)$', '%1' .. b('yino')) elseif (gender == 'f') then decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('ya')) decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('yên')) decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('yê')) decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('yan')) decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('yek')) decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('yin')) decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('yeke')) decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('yine')) decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('yekê')) decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('yinan')) decl.voc_s = gsub(title, '(.)$', '%1' .. b('yê')) decl.voc_p = gsub(title, '(.)$', '%1' .. b('yino')) end elseif (find(title, '[e]$')) then if (gender == 'm') then decl.def_cons_s = gsub(title, '(.)$', b('ê')) decl.def_cons_p = gsub(title, '(.)$', b('ên')) decl.def_obl_s = gsub(title, '(.)$', b('î')) decl.def_obl_p = gsub(title, '(.)$', b('an')) decl.indef_nom_s = gsub(title, '(.)$', 'e' .. b('k')) decl.indef_nom_p = gsub(title, '(.)$', b('in')) decl.indef_cons_s = gsub(title, '(.)$', 'e' .. b('kî')) decl.indef_cons_p = gsub(title, '(.)$', b('ine')) decl.indef_obl_s = gsub(title, '(.)$', 'e' .. b('kî')) decl.indef_obl_p = gsub(title, '(.)$', b('inan')) decl.voc_s = gsub(title, '(.)$', b('o')) decl.voc_p = gsub(title, '(.)$', b('ino')) elseif (gender == 'f') then decl.def_cons_s = gsub(title, '(.)$', b('a')) decl.def_cons_p = gsub(title, '(.)$', b('ên')) decl.def_obl_s = gsub(title, '(.)$', b('ê')) decl.def_obl_p = gsub(title, '(.)$', b('an')) decl.indef_nom_s = gsub(title, '(.)$', 'e' .. b('k')) decl.indef_nom_p = gsub(title, '(.)$', b('in')) decl.indef_cons_s = gsub(title, '(.)$', 'e' .. b('ke')) decl.indef_cons_p = gsub(title, '(.)$', b('ine')) decl.indef_obl_s = gsub(title, '(.)$', 'e' .. b('kê')) decl.indef_obl_p = gsub(title, '(.)$', b('inan')) decl.voc_s = gsub(title, '(.)$', b('ê')) decl.voc_p = gsub(title, '(.)$', b('ino')) end elseif (find(title, '[ê]$')) then if (gender == 'm') then decl.def_cons_s = gsub(title, '(.)$', b('iyê')) decl.def_cons_p = gsub(title, '(.)$', b('iyên')) decl.def_obl_s = gsub(title, '(.)$', b('iyî')) decl.def_obl_p = gsub(title, '(.)$', b('iyan')) decl.indef_nom_s = gsub(title, '(.)$', b('iyek')) decl.indef_nom_p = gsub(title, '(.)$', b('iyin')) decl.indef_cons_s = gsub(title, '(.)$', b('iyekî')) decl.indef_cons_p = gsub(title, '(.)$', b('iyine')) decl.indef_obl_s = gsub(title, '(.)$', b('iyekî')) decl.indef_obl_p = gsub(title, '(.)$', b('iyinan')) decl.voc_s = gsub(title, '(.)$', b('iyo')) decl.voc_p = gsub(title, '(.)$', b('iyino')) elseif (gender == 'f') then decl.def_cons_s = gsub(title, '(.)$', b('iya')) decl.def_cons_p = gsub(title, '(.)$', b('iyên')) if (find(title, '[ê]$')) then decl.def_obl_s = title else decl.def_obl_s = gsub(title, '(.)$', b('iyê')) end decl.def_obl_p = gsub(title, '(.)$', b('iyan')) decl.indef_nom_s = gsub(title, '(.)$', b('iyek')) decl.indef_nom_p = gsub(title, '(.)$', b('iyin')) decl.indef_cons_s = gsub(title, '(.)$', b('iyeke')) decl.indef_cons_p = gsub(title, '(.)$', b('iyine')) decl.indef_obl_s = gsub(title, '(.)$', b('iyekê')) decl.indef_obl_p = gsub(title, '(.)$', b('iyinan')) decl.voc_s = gsub(title, '(.)$', b('iyê')) decl.voc_p = gsub(title, '(.)$', b('iyino')) end end -- îy --> iy + link for i, v in pairs(decl) do		decl[i] = gsub(decl[i], 'îy', 'iy') if bold == 'no' then decl[i] = gsub(decl[i], '', '') decl[i] = gsub(decl[i], '', '') else local lang = require("Module:languages").getByCode("kmr") local alt = decl[i] decl[i] = gsub(decl[i], '', '') decl[i] = gsub(decl[i], '', '') local term = decl[i] local form = gsub(i, '_', '|') decl[i] = require("Module:links").full_link(				{					lang = lang,					term = term,					alt = alt,					accel = {form = form, gender = gender, lemma = title}				}) end end --pronouns for Demonstrative oblique form decl.def_demons_obl_s = '' .. pronounDecl(gender) .. ' ' .. decl.def_obl_s decl.def_demons_obl_p = 'wan' .. ' ' .. decl.def_obl_p return decl end

local function genderTable(gender) if (gender == 'm') then return 'masculine gender' elseif (gender == 'f') then return 'feminine gender' end end

function export.declension(frame) local args = frame:getParent.args local gender = args[1] local singular = args[2] local variant = args['variant'] local title = args['title'] if title then title = title else title = mw.title.getCurrentTitle.subpageText end

decl_mf = require('Module:kmr-nouns/masc and fem').mf  decl_singular = require('Module:kmr-nouns/singular').singular

if (gender == 'mf') then return decl_mf(title, variant) elseif (singular == 's') then return decl_singular(title, gender, variant) else return ' '  ..'\n Declension of ' ..title.. ' '  ..'\n ' ..'\n{| colspan="5" border="1" style="border-collapse:collapse; background-color:white; clear:right; width:100%; " class="inflection-table"' ..'\n|-' ..'\n! colspan="3" align="center" |Definite ' .. genderTable(gender) ..'\n|-' ..'\n! style="background-color:#FFFFE0; text-align:left;" | Case' ..'\n! colspan="1" style="background-color:#FFFFE0;" | Singular' ..'\n! colspan="1" style="background-color:#FFFFE0;" | Plural' ..'\n|-' ..'\n| style="background-color:#e7e8ea; text-align:left;" | Nominative' ..'\n|' .. export.decl(title, gender, variant)["def_nom_s"] ..'\n|' .. export.decl(title, gender, variant)["def_nom_p"] ..'\n|-' ..'\n| style="background-color:#e7e8ea; text-align:left;" | Construct' ..'\n|' .. export.decl(title, gender, variant)["def_cons_s"] ..'\n|' .. export.decl(title, gender, variant)["def_cons_p"] ..'\n|-' ..'\n| style="background-color:#e7e8ea; text-align:left;" | Oblique' ..'\n|' .. export.decl(title, gender, variant)["def_obl_s"] ..'\n|' .. export.decl(title, gender, variant)["def_obl_p"] ..'\n|-' ..'\n| style="background-color:#e7e8ea; text-align:left;" | Demonstrative oblique' ..'\n|' .. export.decl(title, gender, variant)["def_demons_obl_s"] ..'\n|' .. export.decl(title, gender, variant)["def_demons_obl_p"] ..'\n|-' ..'\n| style="background-color:#e7e8ea; text-align:left;" | Vocative' ..'\n|' .. export.decl(title, gender, variant)["voc_s"] ..'\n|' .. export.decl(title, gender, variant)["voc_p"] ..'\n|-' ..'\n! colspan="5" align="center" |Indefinite ' .. genderTable(gender) ..'\n|-' ..'\n!style="background-color:#FFFFE0; text-align:left;" | Case' ..'\n!colspan="1" style="background-color:#FFFFE0;" | Singular' ..'\n!colspan="1" style="background-color:#FFFFE0;" | Plural' ..'\n|-' ..'\n| style="background-color:#e7e8ea; text-align:left;" | Nominative' ..'\n|' .. export.decl(title, gender, variant)["indef_nom_s"] ..'\n|' .. export.decl(title, gender, variant)["indef_nom_p"] ..'\n|-' ..'\n| style="background-color:#e7e8ea; text-align:left;" | Construct' ..'\n|' .. export.decl(title, gender, variant)["indef_cons_s"] ..'\n|' .. export.decl(title, gender, variant)["indef_cons_p"] ..'\n|-' ..'\n| style="background-color:#e7e8ea; text-align:left;" | Oblique' ..'\n|' .. export.decl(title, gender, variant)["indef_obl_s"] ..'\n|' .. export.decl(title, gender, variant)["indef_obl_p"] ..'\n|} ' end end

return export