This is a private module sandbox of ZxxZxxZ, for his own experimentation. Items in this module may be added and removed at ZxxZxxZ's discretion; do not rely on this module's stability.
local com = require("Module:ar-common")
local export = {}
local conjugations = {}
local dia = {
s = "ْ",
a = "َ",
i = "ِ",
u = "ُ",
sh_a = "َّ",
sh_i = "ِّ",
sh_u = "ُّ"
}
local translit = {
= "f",
= "ʿ",
= "l",
= "k",
= "t",
= "b",
= "j",
= "d",
-- TODO
}
-- Within this module, conjugations are the functions that do the actual
-- conjugating by creating the forms of a basic verb.
-- They are defined further down.
local conjugations = {}
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local conj_type = frame.args or error("Conjugation type has not been specified. Please pass parameter 1 to the module invocation")
local args = frame:getParent().args
PAGENAME = mw.title.getCurrentTitle().text
NAMESPACE = mw.title.getCurrentTitle().nsText
--if this named parameter passed, make the verb intransitive, passive forms don't exist
local intrans = args
local intr = (verb_type == "intr")
local forms, title, categories
if conjugations then
forms, title, categories = conjugations(args)
else
error("Unknown conjugation type '" .. conj_type .. "'")
end
-- transitive/intransitive
if intrans then
table.insert(categories, "Arabic intransitive verbs")
else
table.insert(categories, "Arabic transitive verbs")
end
local ret = ""
if NAMESPACE == "" then
local sort_key = com.sort_key(PAGENAME)
for key, cat in ipairs(categories) do
ret = ret .. "]"
end
end
-- temp comment until form is fixed
return make_table(forms, title, intrans) .. ret
-- temporary, for testing forms only
--return test_forms(forms, title, intrans) .. ret
end
--[=[
Conjugation functions
]=]--
conjugations = function(args)
local forms, forms_tr = {}, {}
local categories = {"Arabic form-I verbs"}
local title = "form I"
-- for sound verbs in form I need to provide three radical consonants and two vowels - perfective and imperective
local rad1 = args or "ف"
local rad2 = args or "ع"
local rad3 = args or "ل"
local pf_vowel = args or "a"
local impf_vowel = args or "a"
-- Verbal nouns (maṣādir) for form I are upredictable and have to be supplied
forms = args or ""
forms = args or ""
--e.g. k, t, b for كتب
local rad1_tr, rad2_tr, rad3_tr = translit, translit, translit
-- will only need to attach past stem ending to this variable
local past_stem = rad1 .. dia .. rad2 .. dia .. rad3
local past_stem_tr = rad1_tr .. "a" .. rad2_tr .. pf_vowel .. rad3_tr
local pres_stem = rad1 .. dia.s .. rad2 .. dia .. rad3
local pres_stem_tr = rad1_tr .. rad2_tr .. impf_vowel .. rad3_tr
local conj_stem = ""
local conj_stem_tr = ""
local juss_stem = ""
local juss_stem_tr = ""
local ps_perf_stem = ""
local ps_perf_stem_tr = ""
local imper_stem = ""
local imper_stem_tr = ""
-- make perfective forms
forms = export.perfective_conj(forms, past_stem)
forms = export.imperfective_conj(forms, pres_stem)
forms = export.subjunctive_conj(forms, conj_stem)
forms = export.jussive_conj(forms, juss_stem)
forms = export.pass_perfective_conj(forms, ps_perf_stem)
forms = export.pass_imperfective_conj(forms, ps_perf_stem)
forms = export.pass_subjunctive_conj(forms, ps_perf_stem)
forms = export.pass_jussive_conj(forms, ps_perf_stem)
forms = export.make_imperative(forms, imper_stem)
-- to do
forms = ""
forms = ""
return forms, title, categories--, forms_tr
end
-- functions to add ending to stems
-- can be reused for all perfective forms with sound endings
function export.perfective_conj(forms, past_stem)
-- singular
forms = past_stem .."َ"
forms = past_stem .."َتْ"
forms = past_stem .."ْتَ"
forms = past_stem .."ْتِ"
forms = past_stem .."ْتُ"
--dual
forms = past_stem .."َا"
forms = past_stem .."َتَا"
forms = past_stem .."ْتُمَا"
-- plural
forms = past_stem .."ُوا"
forms = past_stem .."ْنَ"
forms = past_stem .."ْتُمْ"
forms = past_stem .."ْتُنَّ"
forms = past_stem .."ْنَا"
--forms_tr = past_stem_tr .. "a"
return forms--, forms_tr
end
-- can be reused for all imperfective forms with sound endings
function export.imperfective_conj(forms, pres_stem)
-- to do
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
return forms
end
-- can be reused for all subjunctive forms with sound endings
function export.subjunctive_conj(forms, conj_stem)
-- to do
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
return forms
end
-- can be reused for all jussive forms with sound endings
function export.jussive_conj(forms, juss_stem)
-- to do
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
return forms
end
-- can be reused for all passive perfective forms with sound endings
function export.pass_perfective_conj(forms, ps_perf_stem)
-- to do
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
return forms
end
-- can be reused for all passive imperfective forms with sound endings
function export.pass_imperfective_conj(forms, ps_perf_stem)
-- to do
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
return forms
end
-- can be reused for all passive subjunctive forms with sound endings
function export.pass_subjunctive_conj(forms, ps_perf_stem)
-- to do
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
return forms
end
-- can be reused for all passive jussive forms with sound endings
function export.pass_jussive_conj(forms, ps_perf_stem)
-- to do
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
return forms
end
-- can be reused for all imperative forms with sound endings
function export.make_imperative(forms, imper_stem)
-- to do
forms = ""
forms = ""
forms = ""
forms = ""
forms = ""
return forms
end
-- Test
function test_forms(forms, title, intr)
local text = "<br/>"
for key, form in pairs(forms) do
-- check for empty strings and nil's
if form ~= "" and form then
--text = key .. =] .. forms .. =]
text = text .. key .. ": " .. forms .. ", <br/>"
end
end
return text
end
-- Make the table
function make_table(forms, title, intr)
local title = "Conjugation of ''" .. forms .. "''" .. (title and " (" .. title .. ")" or "")
local title_tr = "TO ADD TRANSLITERATION OF THE TITLE"
local passive = true ----
local text = [=[<div class="NavFrame" style="width:100%">
<div class="NavHead" style="height:2.5em">]=] .. title .. [=[</div>
<div class="NavContent">
{| border="1" color="#cdcdcd" style="border-collapse:collapse; line-height:2.5em; border:1px solid #555555; background:#fdfdfd; width:100%; text-align:center" class="inflection-table"
|-
! colspan="6" style="background:#dedede" | verbal noun]=] .. (forms and "s" or "") .. "<br />" .. com.tag_text(forms and "المصادر" or "المصدر") .. [=[
| colspan="7" | ]=] .. forms .. (forms and ", " .. forms or "") .. [=[
|-
! colspan="6" style="background:#dedede" | active participle<br />]=] .. com.tag_text("اسم الفاعل") .. [=[
| colspan="7" | ]=] .. forms
if passive then
text = text .. [=[
|-
! colspan="6" style="background:#dedede" | passive participle<br />]=] .. com.tag_text("اسم المفعول") .. [=[
| colspan="7" | ]=] .. forms
end
text = text ..[=[
|-
! colspan="12" style="background:#bcbcbc" | active voice<br />]=] .. com.tag_text("الفعل المعلوم") .. [=[
|-
! colspan="2" style="background:#cdcdcd" |
! colspan="3" style="background:#cdcdcd" | singular<br />]=] .. com.tag_text("المفرد") .. [=[
! rowspan="12" style="background:#cdcdcd;width:.5em" |
! colspan="2" style="background:#cdcdcd" | dual<br />]=] .. com.tag_text("المثنى") .. [=[
! rowspan="12" style="background:#cdcdcd;width:.5em" |
! colspan="3" style="background:#cdcdcd" | plural<br />]=] .. com.tag_text("الجمع") .. [=[
|-
! colspan="2" style="background:#cdcdcd" |
! style="background:#cdcdcd" | 1<sup>st</sup> person<br />]=] .. com.tag_text("المتكلم") .. [=[
! style="background:#cdcdcd" | 2<sup>nd</sup> person<br />]=] .. com.tag_text("المخاطب") .. [=[
! style="background:#cdcdcd" | 3<sup>rd</sup> person<br />]=] .. com.tag_text("الغائب") .. [=[
! style="background:#cdcdcd" | 2<sup>nd</sup> person<br />]=] .. com.tag_text("المخاطب") .. [=[
! style="background:#cdcdcd" | 3<sup>rd</sup> person<br />]=] .. com.tag_text("الغائب") .. [=[
! style="background:#cdcdcd" | 1<sup>st</sup> person<br />]=] .. com.tag_text("المتكلم") .. [=[
! style="background:#cdcdcd" | 2<sup>nd</sup> person<br />]=] .. com.tag_text("المخاطب") .. [=[
! style="background:#cdcdcd" | 3<sup>rd</sup> person<br />]=] .. com.tag_text("الغائب") .. [=[
|-
! rowspan="2" style="background:#cdcdcd" | perfect indicative<br />]=] .. com.tag_text("الماضي") .. [=[
! style="background:#dedede" | ''m''
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! style="background:#dedede" | ''f''
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! rowspan="2" style="background:#cdcdcd" | imperfect indicative<br />]=] .. com.tag_text("المضارع") .. [=[
! style="background:#dedede" | ''m''
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! style="background:#dedede" | ''f''
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! rowspan="2" style="background:#cdcdcd" | subjunctive<br />]=] .. com.tag_text("المضارع المنصوب") .. [=[
! style="background:#dedede" | ''m''
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! style="background:#dedede" | ''f''
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! rowspan="2" style="background:#cdcdcd" | jussive<br />]=] .. com.tag_text("المضارع المجزوم") .. [=[
! style="background:#dedede" | ''m''
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! style="background:#dedede" | ''f''
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! rowspan="2" style="background:#cdcdcd" | imperative<br />]=] .. com.tag_text("الأمر") .. [=[
! style="background:#dedede" | ''m''
| rowspan="2" |
| ]=] .. forms .. [=[
| rowspan="2" |
| rowspan="2" | ]=] .. forms .. [=[
| rowspan="2" |
| rowspan="2" |
| ]=] .. forms .. [=[
| rowspan="2" |
|-
! style="background:#dedede" | ''f''
| ]=] .. forms .. [=[
| ]=] .. forms
if passive then
text = text .. [=[
|-
! colspan="12" style="background:#bcbcbc" | passive voice<br />]=] .. com.tag_text("الفعل المجهول") .. [=[
|-
| colspan="2" style="background:#cdcdcd" |
! colspan="3" style="background:#cdcdcd" | singular<br />]=] .. com.tag_text("المفرد") .. [=[
| rowspan="10" style="background:#cdcdcd;width:.5em" |
! colspan="2" style="background:#cdcdcd" | dual<br />]=] .. com.tag_text("المثنى") .. [=[
| rowspan="10" style="background:#cdcdcd;width:.5em" |
! colspan="3" style="background:#cdcdcd" | plural<br />]=] .. com.tag_text("الجمع") .. [=[
|-
| colspan="2" style="background:#cdcdcd" |
! style="background:#cdcdcd" | 1<sup>st</sup> person<br />]=] .. com.tag_text("المتكلم") .. [=[
! style="background:#cdcdcd" | 2<sup>nd</sup> person<br />]=] .. com.tag_text("المخاطب") .. [=[
! style="background:#cdcdcd" | 3<sup>rd</sup> person<br />]=] .. com.tag_text("الغائب") .. [=[
! style="background:#cdcdcd" | 2<sup>nd</sup> person<br />]=] .. com.tag_text("المخاطب") .. [=[
! style="background:#cdcdcd" | 3<sup>rd</sup> person<br />]=] .. com.tag_text("الغائب") .. [=[
! style="background:#cdcdcd" | 1<sup>st</sup> person<br />]=] .. com.tag_text("المتكلم") .. [=[
! style="background:#cdcdcd" | 2<sup>nd</sup> person<br />]=] .. com.tag_text("المخاطب") .. [=[
! style="background:#cdcdcd" | 3<sup>rd</sup> person<br />]=] .. com.tag_text("الغائب") .. [=[
|-
! rowspan="2" style="background:#cdcdcd" | perfect indicative<br />]=] .. com.tag_text("الماضي") .. [=[
! style="background:#dedede" | ''m''
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! style="background:#dedede" | ''f''
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! rowspan="2" style="background:#cdcdcd" | imperfect indicative<br />]=] .. com.tag_text("المضارع") .. [=[
! style="background:#dedede" | ''m''
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! style="background:#dedede" | ''f''
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! rowspan="2" style="background:#cdcdcd" | subjunctive<br />]=] .. com.tag_text("المضارع المنصوب") .. [=[
! style="background:#dedede" | ''m''
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! style="background:#dedede" | ''f''
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! rowspan="2" style="background:#cdcdcd" | jussive<br />]=] .. com.tag_text("المضارع المجزوم") .. [=[
! style="background:#dedede" | ''m''
| rowspan="2" | ]=]
text = text .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| rowspan="2" | ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
|-
! style="background:#dedede" | ''f''
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms .. [=[
| ]=] .. forms
end
text = text .. [=[
|}
</div>
</div>]=]
return text
end
return export