Module:rad-stem/templates: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 612: Line 612:
end
end
local function get_forms(stem, ending, regex1, regex2, regex3, regex4)
local function get_forms(stem, ending, regex1, regex2, regex3, regex4, regex5, regex6)
local temp = {}
local temp = {}
local post = ""
local post = ""
Line 633: Line 633:
regex3 = regex3 or ""
regex3 = regex3 or ""
regex4 = regex4 or ""
regex4 = regex4 or ""
regex5 = regex5 or ""
regex6 = regex6 or ""
if type(stem) == "table" then
if type(stem) == "table" then
for i, form in ipairs(stem) do
for i, form in ipairs(stem) do
temp[i] = {['word'] = mw.ustring.gsub(form['word'] .. ending, regex1, regex2), ['note'] = form['note']}
temp[i] = {['word'] = mw.ustring.gsub(form['word'] .. ending, regex1, regex2), ['note'] = form['note']}
temp[i]['word'] = mw.ustring.gsub(temp[i]['word'], regex3, regex4)
temp[i]['word'] = mw.ustring.gsub(temp[i]['word'], regex3, regex4)
temp[i]['word'] = mw.ustring.gsub(temp[i]['word'], regex5, regex6)
end
end
local new_temp = {}
new_temp[1] = temp[1]
for index = 2, #temp do
for check = 1, (index - 1) do
local to_add = true
if temp[index]["word"] == temp[check]["word"] then to_add = false end
if to_add then table.insert(new_temp, temp[index]) end
end
end
temp = new_temp
elseif type(stem) == "string" then
elseif type(stem) == "string" then
temp = mw.ustring.gsub(stem .. ending, regex1, regex2)
temp = mw.ustring.gsub(stem .. ending, regex1, regex2)
temp = mw.ustring.gsub(temp, regex3, regex4)
temp = mw.ustring.gsub(temp, regex3, regex4)
temp = mw.ustring.gsub(temp, regex5, regex6)
end
end
return rad_link_IPA(temp, post, noipa)
return rad_link_IPA(temp, post, noipa)
Line 707: Line 721:
_tr()
_tr()
th("past")
th("past")
td(get_forms(pp.pst,"aiș", "aaiș$", "áeș"))
td(get_forms(pp.pst,"aiș", "aaiș$", "áeș", "áaiș$", "ảeș"))
td(get_forms(pp.pst,"ai", "aai$", "áe"))
td(get_forms(pp.pst,"ai", "aai$", "áe", "áai$", "ảe"))
_tr()
_tr()
th("optative",2,1)
th("optative",2,1)
Line 745: Line 759:
_tr()
_tr()
th("past")
th("past")
td(get_forms(pp.pst,"airiș", "aairiș$", "áeriș"))
td(get_forms(pp.pst,"airiș", "aairiș$", "áeriș", "áairiș$", "ảeriș"))
td(get_forms(pp.pst,"airi", "aairi$", "áeri"))
td(get_forms(pp.pst,"airi", "aairi$", "áeri", "áairi$", "ảeri"))
_tr()
_tr()
th("optative",2,1)
th("optative",2,1)
Line 1,037: Line 1,051:
if pp.vstem then
if pp.vstem then
local aiheight = 1
local aiheight = 1
if get_forms(pp['2s'],"ai","avai$","áe") == get_forms(pp.pst,"ai", "aai$", "áe") then
if get_forms(pp['2s'],"ai","avai$","áe") == get_forms(pp.pst,"ai", "aai$", "áe", "áai$", "ảe") then
aiheight = 2
aiheight = 2
aidentical = true
aidentical = true
end
end
td(get_forms(pp['2s'],"ai","avai$","áe"),aiheight)
td(get_forms(pp['2s'],"ai","avai$","áe", "áai$", "ảe"),aiheight)
td(get_forms(pp['2s'],"á","avá$","áva"))
td(get_forms(pp['2s'],"á","avá$","áva"))
else
else
local aiheight = 1
local aiheight = 1
if get_forms(pp['2s'],"ai","âai$","oai") == get_forms(pp.pst,"ai", "aai$", "áe") then
if get_forms(pp['2s'],"ai","âai$","oai") == get_forms(pp.pst,"ai", "aai$", "áe", "áai$", "ảe") then
aiheight = 2
aiheight = 2
aidentical = true
aidentical = true
end
end
td(get_forms(pp['2s'],"ai","âai$","oai","aai","áe"),aiheight)
td(get_forms(pp['2s'],"ai","âai$","oai","aai","áe", "áai$", "ảe"),aiheight)
td(get_forms(pp['2s'],"á","âá$","oá","[aá]á","ả"))
td(get_forms(pp['2s'],"á","âá$","oá","[aá]á","ả"))
end
end
Line 1,062: Line 1,076:
_tr()
_tr()
th("past")
th("past")
if not aidentical then td(get_forms(pp.pst,"ai", "aai$", "áe")) end
if not aidentical then td(get_forms(pp.pst,"ai", "aai$", "áe", "áai$", "ảe")) end
td(get_forms(pp.pst,"ain", "aain$", "áen"))
td(get_forms(pp.pst,"ain", "aain$", "áen", "áain$", "ảen"))
td(get_forms(pp.pst,"aiș", "aaiș$", "áeș"),1,2)
td(get_forms(pp.pst,"aiș", "aaiș$", "áeș", "áaiș$", "ảeș"),1,2)
td(get_forms(pp.pst,"ai", "aai$", "áe"))
td(get_forms(pp.pst,"ai", "aai$", "áe", "áai$", "ảe"))
if pp.a ~= pp.apst then
if pp.a ~= pp.apst then
td(get_forms(pp.apst,"vuos"))
td(get_forms(pp.apst,"vuos"))
Line 1,152: Line 1,166:
_tr()
_tr()
th("past")
th("past")
td(get_forms(pp.pst,"airiè", "aairiè$", "áeriè"))
td(get_forms(pp.pst,"airiè", "aairiè$", "áeriè", "áairiè$", "ảeriè"))
td(get_forms(pp.pst,"airin", "aairin$", "áerin"))
td(get_forms(pp.pst,"airin", "aairin$", "áerin", "aairin$", "áerin"))
td(get_forms(pp.pst,"airiș", "aairiș$", "áeriș"),1,2)
td(get_forms(pp.pst,"airiș", "aairiș$", "áeriș", "aairiș$", "áeriș"),1,2)
td(get_forms(pp.pst,"airi", "aairi$", "áeri"))
td(get_forms(pp.pst,"airi", "aairi$", "áeri", "aairi$", "áeri"))
if pp.a ~= pp.apst then
if pp.a ~= pp.apst then
td(get_forms(pp.apst,"vúris"))
td(get_forms(pp.apst,"vúris"))