local export = {}
function export.main(frame)
local lv = { --low vowels
= "a", = "a", = "a",
= "a", = "a", = "a",
= "e", = "e", = "e",
= "e", = "e"
}
local hv = { --high vowels
= "ı", = "ı", = "ı",
= "u", = "u", = "u",
= "i", = "i", = "i",
= "ü", = "ü"
}
local fv = { --front vowels
= "e", = "e", = "i",
= "ö", = "ü", = "ü",
= "e", = "i", = "i",
= "ö", = "ü"
}
local bv = { --back vowels
= "a", = "a", = "ı",
= "o", = "u", = "u",
= "a", = "ı", = "ı",
= "o", = "u"
}
local frontness = {
= bv, = bv, = bv,
= bv, = bv, = bv,
= fv, = fv, = fv,
= fv, = fv
}
local inf_noun = { --infinitive and verbal noun
= "infinitive",
= "verbal noun",
}
local imper_part = { --impersonal participles
= "imperfective",
= "perfective",
= "prospective"
}
local per_part = { --personal participles
= "non-prospective",
= "prospective"
}
local time_adv = { --temporal adverbs
= "simple",
= "specific",
= "perfective",
= '"since"',
= '"until"',
= '"as long as"'
}
local mode_adv = { --modal adverbs
= "simple",
= "reduplicated",
= '"as if"'
}
local nm = { --"normal" moods names (moods which use copula personal endings)
= "aorist",
= "continuous",
= "inferential",
= "future",
= "progressive",
= "necessitative"
}
local nqual = { --qualifiers for "normal" moods
= "simple",
= "past",
= "inferential",
= "conditional",
}
local wm = { --"weird" moods names (moods which don't use copula personal endings)
= "past",
= "conditional"
}
local wqual = { --"weird" moods qualifiers
= "simple",
= "conditional",
= "past",
= "inferential"
}
local impqual = { -- imperative qualifiers
= "simple",
= "formal",
= "informal"
}
local new_row = ""
local note = ""
local comma = ""
local voiceless = "ptkçfshş"
local str = frame:getParent().args.title or mw.title.getCurrentTitle().text
local irr = frame:getParent().args
local stem
local extra = ""
if mw.ustring.find(str, "%s") then
extra, stem = mw.ustring.match(str, "^(.+%s)(%w+)mk$")
else
stem = mw.ustring.match(str, "^(%w+)mk$")
end
local function link_term(term, index)
index = index or 1
if term ~= " " then
term = extra .. term
if term == str then
return "]"
end
if index == 1 then
return "]"
else
return term
end
else
return " "
end
end
local v2, v1, c = mw.ustring.match(stem, "(*)*(+)(*)$")
local altStem_V, altStem_iyor = stem, stem --alternative stems before vowels and before -iyor
if irr == "d" then
irr = "e"
altStem_V = mw.ustring.sub(stem, 1, -2) .. "d"
altStem_iyor = altStem_V
elseif not irr then
if c == "" then
altStem_V = stem .. "y"
altStem_iyor = mw.ustring.sub(stem, 1, -2)
if v2 == "" then
altStem_V = altStem_iyor .. "iy"
end
else
if v2 == "" then
irr = lv
else
irr = hv
end
end
end
local neg_stem = stem .. "m" .. lv
local pot_stem = altStem_V .. lv .. "bil"
local impot_stem = altStem_V ..lv .. "m" .. lv
local tab = [=[
<div class="NavFrame" style="width: 100%">
<div class="NavHead" style="background:#DFDFDF" >Conjugation of '']=] .. str .. [=['' </div>
<div class="NavContent">
<div class="vsSwitcher" data-toggle-category="complex tenses" style="max-width:100%;">
{| border="1px solid #aaaaaa" style="border-collapse:collapse; background:#F9F9F9; text-align:center; width:100%" class="inflection-table"
|-
! class="vsToggleElement" colspan=8 style="background:#DFDFDF" | Positive conjugation
|-
| rowspan=2 colspan=2 |
! colspan=3 style="background:#DFDFDF" | singular
! colspan=3 style="background:#DFDFDF" | plural
|-
! style="background:#DFDFDF" | 1st (ben)
! style="background:#DFDFDF" | 2nd (sen)
! style="background:#DFDFDF" | 3rd (o)
! style="background:#DFDFDF" | 1st (biz)
! style="background:#DFDFDF" | 2nd (siz)
! style="background:#DFDFDF" | 3rd (onlar)]=]
local function conjugate(stem, index)
v2, v1, c = mw.ustring.match(stem, "(?)*(+)(*)$")
c = mw.ustring.sub(c, -1, -1)
v2 = frontness or "e"
if c == "" then
irr = v1
end
irr = irr .. "r"
if index % 2 == 0 then
irr = v1 .. "z"
altStem_V = stem .. "y"
altStem_iyor = mw.ustring.sub(stem, 1, -2)
elseif index == 3 then
irr = "ir"
altStem_V, altStem_iyor = stem, stem
end
local nms = {
altStem_iyor .. irr,
altStem_iyor .. (c ~= "" and hv or hv) .. "yor",
stem .. "m" .. hv .. "ş",
altStem_V .. lv .. "c" .. lv .. "k",
stem .. "m" .. lv .. "kt" .. lv,
stem .. "m" .. lv .. "l" .. hv]
} -- normal mood suffixes
for i in ipairs(nms) do
local suf = nms --suffix
nms = {}
local sv, sc = mw.ustring.match(suf, "(*)(*)$") --suffix vowel, suffix consonant
local suf_y = (sc ~= "" and "" or "y") --eventual buffer y
local suf_len = (sc == "k" and "ğ" or "") --lenition of k
local suf_len_y = (sc == "k" and "ğ" or (sc == "z" and "y" or "")) --lenition of k and insertion of y
local suf_di = ((mw.ustring.find(voiceless, sc) and sc~= "") and "t" or "d") .. hv
nms = {
((sc ~= "k" and sc ~= "z") and suf or mw.ustring.sub(suf, 1, -2) .. suf_len) .. suf_y .. (sc ~= "z" and hv or "") .. "m",
suf .. "s" .. hv .. "n",
suf,
((sc ~= "k" and sc ~= "z") and suf or mw.ustring.sub(suf, 1, -2) .. suf_len_y) .. suf_y .. hv .. "z",
suf .. "s" .. hv .. "n" .. hv .. "z",
suf .. "l" .. lv .. "r"
}
nms = {
suf .. suf_y .. suf_di .. "m",
suf .. suf_y .. suf_di .. "n",
suf .. suf_y .. suf_di,
suf .. suf_y .. suf_di .. "k",
suf .. suf_y .. suf_di .. "n" .. hv .. "z",
suf .. "l" .. lv .. "rd" .. hv]
}
nms = {
suf .. suf_y .. "m" .. hv .. "ş" .. hv .. "m",
suf .. suf_y .. "m" .. hv .. "şs" .. hv .. "n",
suf .. suf_y .. "m" .. hv .. "ş",
suf .. suf_y .. "m" .. hv .. "ş" .. hv .. "z",
suf .. suf_y .. "m" .. hv .. "şs" .. hv .. "n" .. hv .. "z",
suf .. "l" .. lv .. "rm" .. hv] .. "ş"
}
nms = {
suf .. suf_y .. "s" .. lv .. "m",
suf .. suf_y .. "s" .. lv .. "n",
suf .. suf_y .. "s" .. lv,
suf .. suf_y .. "s" .. lv .. "k",
suf .. suf_y .. "s" .. lv .. "n" .. hv] .. "z",
suf .. "l" .. lv .. "rs" .. lv
}
end --compound tenses and personal endings
local wms = {
stem .. ((mw.ustring.find(voiceless, c) and c~= "") and "t" or "d") .. hv,
stem .. "s" .. lv
} --weird mood suffixes
for i in ipairs(wms) do
local suf = wms --suffix
wms = {}
local sv = mw.ustring.match(suf, "(*)$") --suffix vowel
wms = {
suf .. "m",
suf .. "n",
suf,
suf .. "k",
suf .. "n" .. hv .. "z",
suf .. "l" .. lv .. "r"
}
if hv == sv then
wms = {
suf .. "ys" .. lv .. "m",
suf .. "ys" .. lv .. "n",
suf .. "ys" .. lv,
suf .. "ys" .. lv .. "k",
suf .. "ys" .. lv .. "n" .. hv] .. "z",
suf .. "l" .. lv .. "rs" .. lv
}
else
wms = {
suf .. "yd" .. hv .. "m",
suf .. "yd" .. hv .. "n",
suf .. "yd" .. hv,
suf .. "yd" .. hv .. "k",
suf .. "yd" .. hv .. "n" .. hv .. "z",
suf .. "l" .. lv .. "rd" .. hv]
}
wms = {
suf .. "ym" .. hv .. "ş" .. hv .. "m",
suf .. "ym" .. hv .. "şs" .. hv .. "n",
suf .. "ym" .. hv .. "ş",
suf .. "ym" .. hv .. "ş" .. hv .. "z",
suf .. "ym" .. hv .. "şs" .. hv .. "n" .. hv .. "z",
suf .. "l" .. lv .. "rm" .. hv] .. "ş"
}
end
end --compound tenses and personal endings
local opt = {
altStem_V .. lv .. "y" .. hv] .. "m",
altStem_V .. lv .. "s" .. hv] .. "n",
altStem_V .. lv,
altStem_V .. lv .. "l" .. hv] .. "m",
altStem_V .. lv .. "s" .. hv] .. "n" .. hv] .. "z",
altStem_V ..lv .. "l" .. lv .. "r"
} --optative
local imp = {}
imp = {
" ",
stem,
stem .. "s" .. hv .. "n",
" ",
altStem_V .. hv .. "n",
stem .. "s" .. hv .. "nl" .. lv .. "r"
} --normal imperative
imp = {
" ",
altStem_V .. hv .. "n" .. hv .. "z",
" ",
" ",
altStem_V .. hv .. "n" .. hv .. "z",
" "
} --formal imperative
imp = {
" ",
wms .. lv,
" ",
" ",
wms .. lv,
" "
} --informal imperative
local inf_noun_s = {
stem .. "m" .. lv .. "k",
stem .. "m" .. lv
}
local imper_part_s = {
altStem_V .. lv .. "n",
stem .. "m" .. hv .. "ş",
altStem_V .. lv .. "c" .. lv .. "k"
}
local per_part_s = {
stem .. ((mw.ustring.find(voiceless, c) and c ~= "") and "t" or "d") .. hv,
altStem_V .. lv .. "c" .. lv
}
for i in ipairs(per_part_s) do
local suf = per_part_s
local sv = mw.ustring.match(suf, "()$")
per_part_s = {
suf .. "ğ" .. hv .. "m",
suf .. "ğ" .. hv .. "n",
suf .. "ğ" .. hv,
suf .. "ğ" .. hv .. "m" .. hv .. "z",
suf .. "ğ" .. hv .. "n" .. hv .. "z",
suf .. "kl" .. lv .. "r" .. hv]
}
end
local time_adv_s = {
altStem_iyor .. irr .. "ken",
altStem_V .. hv .. "nc" .. lv,
altStem_V .. hv .. "p",
altStem_V .. lv .. "l" .. hv],
altStem_V .. lv .. "s" .. hv] .. "y" .. lv,
stem .. ((mw.ustring.find(voiceless, c) and c ~= "") and "t" or "d") .. hv .. "kç" .. lv
}
local mode_adv_s = {
altStem_V .. lv .. "r" .. lv .. "k",
altStem_V .. lv .. " " .. altStem_V .. lv,
altStem_iyor .. irr .. "c" .. lv .. "s" .. hv] .. "n" .. lv
}
for i in ipairs(nms) do
tab = tab .. [=[
|-
! colspan=2 rowspan=1 class="vsShow" style="background:#abf" | ]=] .. nm .. [=[
! rowspan=4 class="vsHide" style="background:#abf" | ]=] .. nm
for j in ipairs(nms) do
new_row = (j ~= 1) and [=[
|- class="vsHide"]=] or ""
tab = tab .. new_row .. [=[
! class="vsHide" style="background:#abf" | ]=] .. nqual
for k in ipairs(nms) do
tab = tab .. [=[
| style="background:#cdf" | ]=] .. link_term(nms, j)
end
end
end --adding normal moods to the table
for i in ipairs(wms) do
tab = tab .. [=[
|-
! colspan=2 rowspan=1 class="vsShow" style="background:#afb" | ]=] .. wm .. [=[
! rowspan=]=] .. #wms ..=] .. wm
for j in ipairs(wms) do
new_row = (j ~= 1) and [=[
|- class="vsHide"]=] or ""
tab = tab .. new_row .. [=[
! class="vsHide" style="background:#afb" | ]=] .. wqual
for k in ipairs(wms) do
tab = tab .. [=[
| style="background:#cfd" | ]=] .. link_term(wms, j)
end
end
end --adding weird moods to the table
tab = tab .. [=[
|-
! colspan=2 style="background:#afb" | optative]=]
for i in ipairs(opt) do
tab = tab .. [=[
| style="background:#cfd" | ]=] .. link_term(opt)
end --adding optative mood to the table
tab = tab .. [=[
|-
! colspan=2 rowspan=1 class="vsShow" style="background:#afb" | imperative
! rowspan=3 class="vsHide" style="background:#afb" | imperative]=]
for i in ipairs(imp) do
new_row = (i ~= 1) and [=[
|- class="vsHide"]=]or ""
tab = tab .. new_row .. [=[
! class="vsHide" style="background:#afb" | ]=] .. impqual
for j in ipairs(imp) do
tab = tab .. [=[
| style="background:#cfd" | ]=] .. link_term(imp)
end
end --adding imperative mood to the table
for i in ipairs(inf_noun) do
tab = tab .. [=[
|-
! colspan=2 style="background:#ffa" | ]=] .. inf_noun .. [=[
| colspan=6 style="background:#ffc" | ]=] .. link_term(inf_noun_s)
end --adding infinitive and verbal noun
tab = tab .. [=[
|-
! class="vsShow" colspan=2 style="background:#fda" | impersonal participle
! class="vsHide" rowspan=3 style="background:#fda" | impersonal participle
| class="vsShow" colspan=6 style="background:#feb" | ]=]
for i in ipairs(imper_part) do
comma = ( i ~= 1) and ", " or ""
tab = tab .. comma .. link_term(imper_part_s)
end
for i in ipairs(imper_part_s) do
new_row = (i ~= 1) and [=[
|- class="vsHide"]=] or ""
tab = tab .. new_row .. [=[
! class="vsHide" style="background:#fda" | ]=] .. imper_part .. [=[
| class="vsHide" colspan=6 style="background:#feb"| ]=] .. link_term(imper_part_s)
end --adding impersonal participles
tab = tab .. [=[
|-
! rowspan=2 style="background:#fda" | personal participle]=]
for i in ipairs(per_part) do
new_row = (i ~= 1) and [=[
|-]=] or ""
tab = tab .. new_row .. [=[
! style="background:#fda" | ]=] .. per_part
for j in ipairs(per_part_s) do
tab = tab .. [=[
| style="background:#feb" | ]=] .. link_term(per_part_s)
end
end --adding personal participles
tab = tab .. [=[
|-
! class="vsShow" colspan=2 style="background:#faa" | temporal adverb
! class="vsHide" rowspan=6 style="background:#faa" | temporal adverb
| class="vsShow" colspan=6 style="background:#fcc" | ]=]
for i in ipairs(time_adv) do
note = (i == 1) and "<sup>1</sup>" or ""
comma = (i ~= 1) and ", " or ""
tab = tab .. comma .. link_term(time_adv_s) .. note
end
for i in ipairs(time_adv) do
note = (i == 1) and "<sup>1</sup>" or ""
new_row = (i ~= 1) and [=[
|-]=] or ""
tab = tab .. new_row .. [=[
! class="vsHide" style="background:#faa" | ]=] .. time_adv .. [=[
| class="vsHide" colspan=6 style="background:#fcc" | ]=] .. link_term(time_adv_s) .. note
end --adding temporal adverbs
tab = tab .. [=[
|-
! class="vsShow" colspan=2 style="background:#faa" | modal adverb
! class="vsHide" rowspan=3 style="background:#faa" | modal adverb
| class="vsShow" colspan=6 style="background:#fcc" | ]=]
for i in ipairs(mode_adv) do
note = (i == 3) and "<sup>1</sup>" or ""
comma = (i ~= 1) and ", " or ""
tab = tab .. comma .. link_term(mode_adv_s) .. note
end
for i in ipairs(mode_adv) do
note = (i == 3) and "<sup>1</sup>" or ""
new_row = (i ~= 1) and [=[
|-]=] or ""
tab = tab .. new_row .. [=[
! class="vsHide" style="background:#faa" | ]=] .. mode_adv .. [=[
| class="vsHide" colspan=6 style="background:#fcc" | ]=] .. link_term(mode_adv_s) .. note
end --adding modal adverbs
tab = tab .. [=[
|-
| colspan=8 style="background:#DFDFDF" | <sup>1</sup>) The suffixes ] and ] may be suffixed to the base form of any of the following tenses: aorist, continuous, inferential (even when it follows another suffix), and future.
|}</div>]=]
if index == 2 or index == 3 then
tab = tab .. "</div>"
elseif index == 4 then
tab = tab .. "</div></div></div>"
end
end
conjugate(stem, 1)
--NEGATIVE
tab = tab .. [=[
<div class="vsSwitcher" data-toggle-category="negative conjugation" style="max-width:100%;">
* <p style="display:flex; align-self:left">Show negative conjugation: <span class="vsToggleElement"> </span></p>
<div class="vsHide vsSwitcher" data-toggle-category="complex tenses" style="max-width:100%;">
{| border="1px solid #aaaaaa" style="border-collapse:collapse; background:#F9F9F9; text-align:center; width:100%" class="inflection-table"
|-
! class="vsToggleElement" colspan=8 style="background: #DFDFDF" | Negative conjugation
|-
| rowspan=2 colspan=2 |
! colspan=3 style="background:#DFDFDF" | singular
! colspan=3 style="background:#DFDFDF" | plural
|-
! style="background:#DFDFDF" | 1st (ben)
! style="background:#DFDFDF" | 2nd (sen)
! style="background:#DFDFDF" | 3rd (o)
! style="background:#DFDFDF" | 1st (biz)
! style="background:#DFDFDF" | 2nd (siz)
! style="background:#DFDFDF" | 3rd (onlar)]=]
conjugate(neg_stem, 2)
--POTENTIAL
tab = tab .. [=[
<div class="vsSwitcher" data-toggle-category="potential conjugation" style="max-width:100%;">
* <p style="display:flex; align-self:left">Show potential conjugation: <span class="vsToggleElement"> </span></p>
<div class="vsHide vsSwitcher" data-toggle-category="complex tenses" style="max-width:100%;">
{| border="1px solid #aaaaaa" style="border-collapse:collapse; background:#F9F9F9; text-align:center; width:100%" class="inflection-table"
|-
! class="vsToggleElement" colspan=8 style="background: #DFDFDF" | Potential conjugation
|-
| rowspan=2 colspan=2 |
! colspan=3 style="background:#DFDFDF" | singular
! colspan=3 style="background:#DFDFDF" | plural
|-
! style="background:#DFDFDF" | 1st (ben)
! style="background:#DFDFDF" | 2nd (sen)
! style="background:#DFDFDF" | 3rd (o)
! style="background:#DFDFDF" | 1st (biz)
! style="background:#DFDFDF" | 2nd (siz)
! style="background:#DFDFDF" | 3rd (onlar)]=]
conjugate(pot_stem, 3)
--IMPOTENTIAL
tab = tab .. [=[
<div class="vsSwitcher" data-toggle-category="impotential conjugation" style="max-width:100%;">
* <p style="display:flex; align-self:left">Show impotential conjugation: <span class="vsToggleElement"> </span></p>
<div class="vsHide vsSwitcher" data-toggle-category="complex tenses" style="max-width:100%;">
{| border="1px solid #aaaaaa" style="border-collapse:collapse; background:#F9F9F9; text-align:center; width:100%" class="inflection-table"
|-
! class="vsToggleElement" colspan=8 style="background: #DFDFDF" | Impotential conjugation
|-
| rowspan=2 colspan=2 |
! colspan=3 style="background:#DFDFDF" | singular
! colspan=3 style="background:#DFDFDF" | plural
|-
! style="background:#DFDFDF" | 1st (ben)
! style="background:#DFDFDF" | 2nd (sen)
! style="background:#DFDFDF" | 3rd (o)
! style="background:#DFDFDF" | 1st (biz)
! style="background:#DFDFDF" | 2nd (siz)
! style="background:#DFDFDF" | 3rd (onlar)]=]
conjugate(impot_stem, 4)
return(tab)
end
return export