. In DICTIOUS you will not only get to know all the dictionary meanings for the word
, but we will also tell you about its etymology, its characteristics and you will know how to say
in singular and plural. Everything you need to know about the word
you have here. The definition of the word
will help you to be more precise and correct when speaking or writing your texts. Knowing the definition of
, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
-- This is a data module for ].
local conj_data = {}
local sa_utils = require("Module:sa-utilities")
local to_IAST = require("Module:sa-utilities/translit/SLP1-to-IAST").tr
local to_SLP = require("Module:sa-utilities/translit/IAST-to-SLP1").tr
local sub = mw.ustring.sub
local gsub = mw.ustring.gsub
local gasub = string.gsub -- For when byte by byte comparison is good enough.
local match = mw.ustring.match
local split = mw.text.split
-- Returns { form, stem } if the stem is explicity provided in the form (i.e. form = "riṇakti<riṇac>" or form = "rincanti<riñc>")
local function split_xs(form)
if form == nil then
return nil
end
local s = split(form, "<")
if s ~= nil then
local sanitized_s2 = sub(s, 1, -2)
return {s, sanitized_s2}
else
return {form, nil}
end
end
-- Splits "stem1,stem2" into { stem1, stem2 }
local function split_stems(form)
-- TODO: in the older system, we'd have entries where multiple stems could be supplied and show up side-by-side in the same table.
-- I.e. "áricat" and "áraikṣīt" as two aorist variants of "riṇakti". The current system is to make them both separate entries altogether
-- so their conjugation systems don't overlap and cause confusion.
-- Older entries using the older version of this module need to be updated—right now, any extra stems that are supplied are just ignored
-- Note: this doesn't affect manually provided forms, like irregular third-person singular active perfects having long/short-vowel forms
return split(form, ",")
end
local function apply_ending(args, data, tag, stem, es, is_part)
if type(es) == "string" then
es = {es}
end
local forms = data.forms or {}
local i = #forms + 1
for _, e in ipairs(es) do
local note
if type(e) == "table" then
note = e.note
e = e
end
-- reduce Vedic forms to zero in case of novedic parameter
if args.novedic == true and note and match(note, "edic$") then
stem = ""; e = ""; note = ""
else
args.has_accent = match(stem, sa_utils.accent)
local set_stem = stem
-- if 'set', add 'i' between consonants, except before 'y' (optative)
if args.set == true and match(stem, sa_utils.consonant .. "$") and match(e, "^") then
set_stem = sa_utils.internal_sandhi({
stem = stem,
ending = "i",
has_accent = args.has_accent,
non_final = true,
mono = args.mono,
accent_override = args.accent_override,
no_retroflex_root_s = args.no_retroflex_root_s
})
end
if args.auto_sandhi == true then
forms = sa_utils.internal_sandhi({
stem = set_stem,
ending = e,
has_accent = args.has_accent,
non_final = is_part,
mono = args.mono,
j_to_z = args.j_to_z,
h_to_g = args.h_to_g,
ambig_final = args.ambig_final,
diaspirate = args.diaspirate,
no_syncope = args.no_syncope,
accent_override = args.accent_override,
no_retroflex_root_s = args.no_retroflex_root_s -- for roots 'pis'/'niṃs'/'hiṃs' and 'tresur' from 'tras')
})
else
forms = set_stem .. e
end
-- Apply special tagging, currently just Ⓛ.
forms = gasub(forms,
"a("..sa_utils.accent.."?)("..sa_utils.consonant.."a)Ⓛ", "A%1%2")
forms = gasub(forms, "Ⓛ", "") -- Clean up.
if note then
forms = note
end
i = i + 1
end
end
data.forms = forms
end
local function make_forms(args, data, stem, forms)
for mood, mood_forms in pairs(forms) do
if args.tense == "nonf" then
local tag = mood
apply_ending(args, data, tag, stem, mood_forms, false)
else
for voice, voice_forms in pairs(mood_forms) do
if mood == "part" then
local tag = mood .. "_" .. voice
apply_ending(args, data, tag, stem, voice_forms, true)
else
for person_number, es in pairs(voice_forms) do
local tag = mood .. "_" .. voice .. "_" .. person_number
apply_ending(args, data, tag, stem, es, false)
end
end
end
end
end
end
local function validate(stem, lemma)
if stem == nil then
error("could not detect stem from " .. to_IAST(lemma) .. "; set args.o to fill in values manually")
end
end
local function detect(t, lemma, match_pattern, oxy_match_pattern, strong)
local prefix = "weak_"
if strong then prefix = "strong_" end
if not t then
lemma = split_stems(lemma)
local splitted = split_xs(lemma)
if splitted == nil then return nil end
t = splitted
t = splitted
t = ""
t = true
end
local detected_stem = match(t, match_pattern)
if detected_stem ~= nil then
if oxy_match_pattern ~= nil then
t = match(t, oxy_match_pattern)
end
if t == nil then
t = detected_stem
end
return true
end
return false
end
local function detect_strong(t, lemma, match_pattern, oxy_match_pattern)
return detect(t, lemma, match_pattern, oxy_match_pattern, true)
end
local function detect_weak(t, lemma, match_pattern, oxy_match_pattern)
return detect(t, lemma, match_pattern, oxy_match_pattern, false)
end
local function use_strong_for_weak(t, weak_lemma)
if weak_lemma ~= nil then return false end
t = t
t = t
return true
end
-- Only for verbs with 3p on -ati, override with 'class=' parameter.
-- Does not detect 'iyāy' and 'alar' (Whitney §1002e).
local function detect_intensive(args, t)
-- anchoring detection pattern at the end to allow for prefixes
if match(t.strong_stem, sa_utils.consonant.."a/?"..sa_utils.consonant.."+"..sa_utils.vowel.."M?"..sa_utils.consonant.."*$") then
if match(t.strong_stem, "vivy?"..sa_utils.vowel..sa_utils.consonant.."$") then
-- prefixed class 3 verb like 'upaviveṣṭi'
return false
else
-- dissyllabic reduplication
return true
end
elseif match(t.strong_stem, sa_utils.consonant.."/?"..sa_utils.consonant.."+"..sa_utils.vowel_with_accent.."M?"..sa_utils.consonant.."*$")
or match(t.strong_stem, sa_utils.consonant.."a/?"..sa_utils.consonant.."+M?"..sa_utils.consonant.."*$") -- avoiding 'saṃśās'
or args.class == "int" then
t = "1"
return true
end
end
local function change_to_inj_strong(args, t)
if args.inj_strong_stem then
t = "1"
t.inj_strong_stem = to_SLP(args.inj_strong_stem)
return true
elseif match(t.strong_stem, "^a/?"..sa_utils.consonant.."+"..sa_utils.vowel.."M?"..sa_utils.consonant.."*$") then
t = "2"
t.inj_strong_stem = gasub(t.strong_stem, "^a(/?)("..sa_utils.consonant.."+"
..sa_utils.vowel..")(M?"..sa_utils.consonant.."*)$", "%2%1%3")
t.inj_strong_stem = gasub(t.inj_strong_stem, "c(C.+)$", "%1")
return true
end
end
-- for a- and sa-aorist (+ reduplicated)
local function change_to_inj_strong_oxy(args, t)
if args.inj_strong_stem then
t = "1"
t.inj_strong_stem = to_SLP(args.inj_strong_stem)
t.inj_strong_oxy = gasub(t.strong_stem, "^+(/?).+$", "%1")
return true
elseif match(t.strong_stem, "^a/?"..sa_utils.consonant.."+"..sa_utils.vowel.."M?"..sa_utils.consonant.."*$") then
t = "2"
if match(t.strong_stem, "^a/?ar$") or match(t.strong_stem, "^a/?sa$") then -- Whitney §853
t.inj_strong_stem = gasub(t.strong_stem, "^a(/?)("..sa_utils.consonant.."a)("..sa_utils.consonant..")$", "%2%1%3")
t.inj_strong_oxy = ""
else
t.inj_strong_stem = gasub(t.strong_stem, "^a/?(.+)$", "%1")
t.inj_strong_oxy = gasub(t.strong_stem, "^a(/?).+$", "%1")
end
t.inj_strong_stem = gasub(t.inj_strong_stem, "c(C.+)$", "%1")
return true
-- also look for reduplicated aorists
elseif match(t.strong_stem, "^a/?"..sa_utils.consonant..""..sa_utils.consonant.."+"..sa_utils.vowel.."M?"..sa_utils.consonant.."+$") then
t = "3"
t.inj_strong_stem = gasub(t.strong_stem, "^a/?(.+)$", "%1")
t.inj_strong_oxy = "" -- for now giving no accent as the position isn't fully clear, see Whitney §869c
return true
end
end
local function change_to_inj_weak(args, t)
if args.inj_weak_stem then
t = "1"
t.inj_weak_stem = to_SLP(args.inj_weak_stem)
return true
-- sometimes no vowel in weak root aorist stem
elseif match(t.weak_stem, "^a/?"..sa_utils.consonant.."+"..sa_utils.vowel.."?M?"..sa_utils.consonant.."*$") then
t = "2"
t.inj_weak_stem = gasub(t.weak_stem, "^a(/?)("..sa_utils.consonant.."+"
..sa_utils.vowel..")(M?"..sa_utils.consonant.."*)$", "%2%1%3")
t.inj_weak_stem = gasub(t.inj_weak_stem, "c(C.+)$", "%1")
return true
end
end
local function change_to_inj_weak_oxy(args, t)
if args.inj_weak_stem then
t = "1"
t.inj_weak_stem = to_SLP(args.inj_weak_stem)
t.inj_weak_oxy = gasub(t.weak_stem, "^+(/?).+$", "%1")
return true
-- sometimes no vowel in weak root aorist stem
elseif match(t.weak_stem, "^a/?"..sa_utils.consonant.."+"..sa_utils.vowel.."?M?"..sa_utils.consonant.."*$") then
t = "2"
t.inj_weak_stem = gasub(t.weak_stem, "^a/?(.+)$", "%1")
t.inj_weak_stem = gasub(t.inj_weak_stem, "c(C.+)$", "%1")
t.inj_weak_oxy = gasub(t.weak_stem, "^a(/?).+$", "%1")
return true
end
end
conj_data = {}
setmetatable(conj_data, {
__call = function (self, args, data)
local make_thematic_forms = function (oxy)
return {
= {
= {
= "A" .. oxy .. "mi",
= "a" .. oxy .. "si",
= "a" .. oxy .. "ti",
= "A" .. oxy .. "vas",
= "a" .. oxy .. "Tas",
= "a" .. oxy .. "tas",
= {"A" .. oxy .. "mas", {"A" .. oxy .. "masi", note = "Vedic"}},
= "a" .. oxy .. "Ta",
= "a" .. oxy .. "nti"
},
= {
= "e" .. oxy,
= "a" .. oxy .. "se",
= "a" .. oxy .. "te",
= "A" .. oxy .. "vahe",
= "e" .. oxy .. "Te",
= "e" .. oxy .. "te",
= "A" .. oxy .. "mahe",
= "a" .. oxy .. "Dve",
= "a" .. oxy .. "nte"
}
},
= {
= {
= "A" .. oxy .. "ni",
-- = {"a" .. oxy, "a" .. oxy .. "tAt"},
= "a" .. oxy,
= "a" .. oxy .. "tu",
= "A" .. oxy .. "va",
= "a" .. oxy .. "tam",
= "a" .. oxy .. "tAm",
= "A" .. oxy .. "ma",
= "a" .. oxy .. "ta",
= "a" .. oxy .. "ntu"
},
= {
= "E" .. oxy,
= "a" .. oxy .. "sva",
= "a" .. oxy .. "tAm",
= "A" .. oxy .. "vahE",
= "e" .. oxy .. "TAm",
= "e" .. oxy .. "tAm",
= "A" .. oxy .. "mahE",
= "a" .. oxy .. "Dvam",
= "a" .. oxy .. "ntAm"
},
},
= {
= {
= "e" .. oxy .. "yam",
= "e" .. oxy .. "s",
= "e" .. oxy .. "t",
= "e" .. oxy .. "va",
= "e" .. oxy .. "tam",
= "e" .. oxy .. "tAm",
= "e" .. oxy .. "ma",
= "e" .. oxy .. "ta",
= "e" .. oxy .. "yur"
},
= {
= "e" .. oxy .. "ya",
= "e" .. oxy .. "TAs",
= "e" .. oxy .. "ta",
= "e" .. oxy .. "vahi",
= "e" .. oxy .. "yATAm",
= "e" .. oxy .. "yAtAm",
= "e" .. oxy .. "mahi",
= "e" .. oxy .. "Dvam",
= "e" .. oxy .. "ran"
},
},
= {
= {
= "A" .. oxy .. "ni",
= {"A" .. oxy .. "s", "A" .. oxy .. "si"},
= {"A" .. oxy .. "t", "A" .. oxy .. "ti"},
= "A" .. oxy .. "va",
= "A" .. oxy .. "Tas",
= "A" .. oxy .. "tas",
= "A" .. oxy .. "ma",
= "A" .. oxy .. "Ta",
= "A" .. oxy .. "n"
},
= {
= "E" .. oxy,
= {"A" .. oxy .. "se", "A" .. oxy .. "sE"},
= {"A" .. oxy .. "te", "A" .. oxy .. "tE"},
= "A" .. oxy .. "vahE",
= "E" .. oxy .. "Te",
= "E" .. oxy .. "te",
= "A" .. oxy .. "mahE",
= "A" .. oxy .. "DvE",
= {"a" .. oxy .. "nta", "A" .. oxy .. "ntE"},
},
},
= {
= "a" .. oxy .. "t",
= "a" .. oxy .. "mAna"
}
}
end
local make_athematic_strong_forms_cons = function ()
return {
= {
= {
= "mi",
= "si",
= "ti",
},
},
= {
= {
= "tu",
}
}
}
end
local make_athematic_strong_forms_vow = function ()
return {
= {
= {
= "Ani",
= "Ava",
= "Ama",
},
= {
= "E",
= "AvahE",
= "AmahE",
}
},
= {
= {
= {"Ani", "A"},
= {"as", "asi"},
= {"at", "ati"},
= "Ava",
= "aTas",
= "atas",
= "Ama",
= "aTa",
= "an"
},
= {
= "E",
= {"ase", "AsE"},
= {"ate", "AtE"},
= "AvahE",
= "ETe",
= "Ete",
= "AmahE",
-- example of -adhve is 'śayadhve' (RV 10.108.4), see 'Stativ und Passivaorist im Indoiranischen' p.110
= {"aDve", "ADvE"},
= {"anta", "AntE"},
}
}
}
end
local make_athematic_weak_forms_cons = function (oxy) -- endings starting with consonant not m/v/y
return {
= {
= {
= "Ta" .. oxy .. "s",
= "ta" .. oxy .. "s",
= "Ta" .. oxy,
},
= {
= "se" .. oxy,
= "te" .. oxy,
= "Dve" .. oxy,
}
},
= {
= {
-- = {"Di" .. oxy, "tA" .. oxy .. "t"},
= "ta" .. oxy .. "m",
= "tA" .. oxy .. "m",
= "ta" .. oxy,
},
= {
= "sva" .. oxy,
= "tA" .. oxy .. "m",
= "Dva" .. oxy .. "m",
}
}
}
end
local make_athematic_weak_forms_mvy = function (oxy) -- endings starting with m/v/y
return {
= {
= {
= "va" .. oxy .. "s",
= {"ma" .. oxy .. "s", {"ma" .. oxy .. "si", note = "Vedic"}},
},
= {
= "va" .. oxy .. "he",
= "ma" .. oxy .. "he",
}
},
= {
= {
= "yA" .. oxy .. "m",
= "yA" .. oxy .. "s",
= "yA" .. oxy .. "t",
= "yA" .. oxy .. "va",
= "yA" .. oxy .. "tam",
= "yA" .. oxy .. "tAm",
= "yA" .. oxy .. "ma",
= "yA" .. oxy .. "ta",
= "yu" .. oxy .. "s"
}
}
}
end
local make_athematic_weak_forms_vow = function (oxy) -- endings starting with vowels
return {
= {
= {
= "a" .. oxy .. "nti"
},
= {
= "e" .. oxy,
= "A" .. oxy .. "Te",
= "A" .. oxy .. "te",
= "a" .. oxy .. "te"
}
},
= {
= {
= "a" .. oxy .. "ntu"
},
= {
= "A" .. oxy .. "TAm",
= "A" .. oxy .. "tAm",
= "a" .. oxy .. "tAm"
}
},
= {
= {
= "Iya" .. oxy,
= "ITA" .. oxy .. "s",
= "Ita" .. oxy,
= "Iva" .. oxy .. "hi",
= "IyA" .. oxy .. "TAm",
= "IyA" .. oxy .. "tAm",
= "Ima" .. oxy .. "hi",
= "IDva" .. oxy .. "m",
= "Ira" .. oxy .. "n"
}
},
= {
= "a" .. oxy .. "t",
= "Ana" .. oxy,
}
}
end
local make_athematic_class_3_forms_vow = function() -- endings starting with vowel for class 3 (no oxy)
return {
= {
= {
= "ati"
},
= {
= "e",
= "ATe",
= "Ate",
= "ate"
}
},
= {
= {
= "atu"
},
= {
= "ATAm",
= "AtAm",
= "atAm"
}
},
= {
= {
= "Iya",
= "ITAs",
= "Ita",
= "Ivahi",
= "IyATAm",
= "IyAtAm",
= "Imahi",
= "IDvam",
= "Iran"
}
},
= {
= "at",
= "Ana",
}
}
end
local make_extra_class_5_8_forms = function(oxy)
return {
= {
= {
= "va" .. oxy .. "s",
= {"ma" .. oxy .. "s", {"ma" .. oxy .. "si", note = "Vedic"}},
},
= {
= "va" .. oxy .. "he",
= "ma" .. oxy .. "he",
}
},
= {
= {
= {"u" .. oxy, {"uhi" .. oxy, note = "Vedic"}}
}
}
}
end
local make_intensive_weak_forms_extra = function() -- not in case of dissyllabic reduplication (Whitney §1007a)
return {
= {
= {
= "Imi",
= "Izi",
= "Iti",
}
},
= {
= {
= "Itu",
}
}
}
end
local make_athematic_imper_2s_Di = function(oxy)
return {
= {
= {
= "Di" .. oxy
}
}
}
end
local make_athematic_imper_2s_hi = function(oxy)
return {
= {
= {
= "hi" .. oxy
}
}
}
end
local make_class_9_cons_imper_2s = function(oxy)
return {
= {
= {
= "Ana" .. oxy
}
}
}
end
local t = {}
local is_thematic = args.weak_lemma == nil
if is_thematic then
if not detect_strong(t, args.strong_lemma, "(.+)a" .. sa_utils.accent .. "?ti$", "a(" .. sa_utils.accent .. "?)ti$") then
if not detect_strong(t, args.strong_lemma, "(.+)a" .. sa_utils.accent .. "?te$", "a(" .. sa_utils.accent .. "?)te$") then
validate(t, args.strong_lemma)
else
args.n = "m" -- deponent
end
end
make_forms(args, data, t, make_thematic_forms(t))
-- class 10 (Whitney §1043f)
if (args.class == "10" or not args.class) and match(t.strong_stem, sa_utils.vowel
.."M?"..sa_utils.consonant.."+a" .. sa_utils.accent .. "?y$") then
args.accent_override = true
make_forms(args, data, t, {
= {
= {{ "Ana", note = "Later Sanskrit" }},
}
})
end
-- active athematic verbs
elseif detect_strong(t, args.strong_lemma, "(.+)i$") or match(args.strong_lemma, "^<.+>$") then
if not detect_weak(t, args.weak_lemma, "(.+)a" .. sa_utils.accent .. "?nti$", "a(" .. sa_utils.accent .. "?)nti$") then
if not detect_weak(t, args.weak_lemma, "(.+A)" .. sa_utils.accent .. "?nti$", "A(" .. sa_utils.accent .. "?)nti$") then
if not detect_weak(t, args.weak_lemma, "(.+)ati$", sa_utils.vowel .. "(" .. sa_utils.accent .. "?).+ati$") then
validate(t, args.weak_lemma)
else
t.ati_3p = true
end
end
end
-- if no strong stem supplied, check weak stem in case of possible sandhi
if match(args.strong_lemma, "ti$") then
t.strong_stem = gasub(t.strong_stem, ".$", gasub(t.weak_stem, ".+(.)$", "%1"))
-- if 3s ends on -dhi/-ṭi
elseif match(args.strong_lemma, "i$") then
if match(t.weak_stem, "kz$") then
t.strong_stem = gasub(t.strong_stem, "z$", "kz")
else
t.strong_stem = gasub(t.strong_stem, ".$", gasub(t.weak_stem, ".+(.)$", "%1"))
if match(t.strong_stem, "h$") then
args.h_to_g = true
elseif match(t.strong_stem, "j$") then
args.j_to_z = true
end
end
-- if 3s ends on -ḍhi
elseif match(args.strong_lemma, "Qi$") then
t.strong_stem = gasub(t.strong_stem, "^(.*)$", "%1h")
-- error for roots on -i/ī/u/ū when no weak stem provided
elseif match(args.weak_lemma, sa_utils.consonant.."i?ya/?n?ti$")
or ( match(args.weak_lemma, "uva/?n?ti$") and not match(t.strong_stem, "o/?")) then
error("Please add weak stem for roots on -i/-ī and -u/-ū.")
end
make_forms(args, data, t, make_athematic_strong_forms_cons())
-- assuming 3s on -īti is intensive (as a normal class 3 root on -ī would have -eti)
if t.ati_3p == true and (not args.class or args.class == "int") and ( match (t.strong_stem, "I$") or detect_intensive(args, t) ) then
args.n = "a" -- no middle (maybe add middle participle?)
t.strong_stem_before_vow = gasub(t.strong_stem, "I$", "")
if match(t.strong_stem_before_vow, sa_utils.vowel.."?$") then
make_forms(args, data, t, make_athematic_strong_forms_vow())
else
make_forms(args, data, t, make_athematic_strong_forms_vow()) -- using weak stem with (normally) strong endings
end
if t.intensive == "1" then -- no dissyllabic reduplication and not on -īti
if match(t.strong_stem, sa_utils.vowel_with_accent.."?$") then -- Whitney §1004a
make_forms(args, data, t, make_intensive_weak_forms_extra())
else
make_forms(args, data, t, make_intensive_weak_forms_extra())
end
end
else
if match(t.strong_stem, "O/?$") and match(t.weak_stem, "u$") then -- Whitney §626
t.strong_stem = gasub(t.strong_stem, "O(/?)$", "a%1v")
elseif match(t.strong_stem, "a/?vI$") and match(t.weak_stem, "v?$") then -- e.g. 'brū', see Whitney §632-3
t.strong_stem = gasub(t.strong_stem, "I$", "")
elseif match(t.strong_stem, "i$") and match(t.weak_stem, "$") then -- for 'set' verbs (Whitney §631)
t.strong_stem = gasub(t.strong_stem, "i$", "")
end
make_forms(args, data, t, make_athematic_strong_forms_vow())
end
if match(args.weak_lemma, "ati$") then -- if 3p on -ati and no weak stem provided
args.accent_override = true
-- for class 5/8 verbs on vowel + -noti
elseif match(t.strong_stem, sa_utils.vowel .. "o/?$") then
t.temp_stem = gasub(t.strong_stem, "o/?$", "")
make_forms(args, data, t, make_extra_class_5_8_forms(t)) -- includes active imper. 2s
t.imper_2s_created = true
-- for verbs like āpnoti
elseif match(t.strong_stem, sa_utils.consonant .. "o/?$") then
args.no_syncope = true
t.weak_stem = gasub(t.weak_stem, "uv$", "u")
-- class 9
elseif match(t.strong_stem, "A/?$") and match(t.weak_stem, "$") then
t.weak_stem = gasub(t.weak_stem, "^.*$", "%1I")
end
if t.imper_2s_created == true then
-- do nothing
elseif match(t.weak_stem, sa_utils.consonant .."I$") then -- Whitney §722
t.temp_stem = gasub(t.weak_stem, "I$", "")
make_forms(args, data, t, make_class_9_cons_imper_2s(t))
elseif match(t.weak_stem, sa_utils.vowel .. "$") or match(t.weak_stem, sa_utils.consonant.."$")
or match(t.weak_stem, "^y$") or args.set == true then
make_forms(args, data, t, make_athematic_imper_2s_hi(t))
else
make_forms(args, data, t, make_athematic_imper_2s_Di(t))
end
make_forms(args, data, t, make_athematic_weak_forms_cons(t))
if args.extra_1p_stem then -- optional extra stem for endings starting with m/v/y
t.weak_stem = to_SLP(args.extra_1p_stem)
end
make_forms(args, data, t, make_athematic_weak_forms_mvy(t))
if match(args.weak_lemma, ".<.*>$") then
t.weak_stem = gasub(args.weak_lemma, "a?" .. sa_utils.accent .. "?n?ti<.*>$", "")
elseif args.extra_1p_stem or match(t.weak_stem, "I$") then
t.weak_stem = gasub(args.weak_lemma, "a?" .. sa_utils.accent .. "?nti$", "")
end
if t.ati_3p == true then
args.accent_override = false
make_forms(args, data, t, make_athematic_class_3_forms_vow())
else
make_forms(args, data, t, make_athematic_weak_forms_vow(t))
end
-- deponent verbs
elseif detect_strong(t, args.strong_lemma, "(.+)e/?$", "e(/?)$") then
args.n = "m" -- deponent
if not detect_weak(t, args.weak_lemma, "(.+"..sa_utils.accent..".+)ate$", sa_utils.vowel.."("..sa_utils.accent..").+ate$") then
if not detect_weak(t, args.weak_lemma, "(.+)a"..sa_utils.accent.."?te$", "a("..sa_utils.accent.."?)te$") then
if not detect_weak(t, args.weak_lemma, "(.+A/?)te$") then
validate(t, args.weak_lemma)
end
end
elseif t.strong_oxy ~= "" then
t.accented_class_3 = true
end
-- for class 5/8 verbs on vowel + -nute (+ tarute)
-- adding '-no' for detection as this might be the strong stem supplied to form 1st person imperative
if match(t.strong_stem, sa_utils.vowel .. "/?$")
and (not args.class or match(args.class, "^$")) and not args.extra_1p_stem then
t.temp_stem = gasub(t.strong_stem, "/?$", "")
make_forms(args, data, t, make_extra_class_5_8_forms(t))
-- for verbs like āpnoti, but middle (the regex also includes hnute, but this is ok)
elseif match(t.strong_stem, sa_utils.consonant .. "/?$") then
args.no_syncope = true
end
-- produce 1st person imperative if strong stem is supplied with 3sg
if match(args.strong_lemma, "<.*>$") then
make_forms(args, data, t, make_athematic_strong_forms_vow())
-- or if root has 'a/ā' (when guṇa would be the same),
-- and not accented class 3 (accent on strong stem unpredictable) or potentially class 7
elseif match(t.strong_stem, ""..sa_utils.accent.."?"..sa_utils.consonant.."*$")
and not t.accented_class_3 == true and not match(t.strong_stem, ""..sa_utils.consonant.."$") then
-- look at 3p to avoid possible sandhi before 3s -te
t.strong_stem = gasub(t.weak_stem, "()("..sa_utils.consonant.."*)$", "%1"..t.strong_oxy.."%2")
make_forms(args, data, t, make_athematic_strong_forms_vow())
-- or if stem ends on -u (including hnu/snu is ok)
elseif match(t.strong_stem, "u$") then
t.strong_stem = gasub(t.strong_stem, "u$", "o"..t.strong_oxy)
make_forms(args, data, t, make_athematic_strong_forms_vow())
-- or class 9
elseif match(t.strong_stem, "I$") and match(t.weak_stem, "$") then
t.strong_stem = gasub(t.strong_stem, "I$", "A"..t.strong_oxy)
make_forms(args, data, t, make_athematic_strong_forms_vow())
end
if match(args.strong_lemma, sa_utils.vowel_with_accent .. "te/?$") then
t.weak_stem_before_cons = gasub(args.strong_lemma, "te/?$", "")
elseif match(args.strong_lemma, sa_utils.vowel_with_accent .. "te/?<.*>$") then
t.weak_stem_before_cons = gasub(args.strong_lemma, "te/?<.*>$", "")
else
t.weak_stem_before_cons = t.weak_stem
end
if t.accented_class_3 == true then
args.accent_override = true -- no accent on class 3 stem if ending starts with consonant
end
make_forms(args, data, t, make_athematic_weak_forms_cons(t))
if args.extra_1p_stem then
t.weak_stem_before_cons = to_SLP(args.extra_1p_stem)
end
make_forms(args, data, t, make_athematic_weak_forms_mvy(t))
if match(args.weak_lemma, ".<.*>$") then
t.weak_stem = gasub(args.weak_lemma, "a?" .. sa_utils.accent .. "?te<.*>$", "")
end
if t.accented_class_3 == true then
args.accent_override = false
make_forms(args, data, t, make_athematic_class_3_forms_vow())
else
make_forms(args, data, t, make_athematic_weak_forms_vow(t))
end
else
validate(t, args.strong_lemma)
end
end
})
conj_data = {}
setmetatable(conj_data, {
__call = function (self, args, data)
-- accent for augmentless forms
local make_thematic_impf_forms = function(oxy)
return {
= {
= {
= "a" .. oxy .. "m",
= "a" .. oxy .. "s",
= "a" .. oxy .. "t",
= "A" .. oxy .. "va",
= "a" .. oxy .. "tam",
= "a" .. oxy .. "tAm",
= "A" .. oxy .. "ma",
= "a" .. oxy .. "ta",
= "a" .. oxy .. "n"
},
= {
= "e" .. oxy,
= "a" .. oxy .. "TAs",
= "a" .. oxy .. "ta",
= "A" .. oxy .. "vahi",
= "e" .. oxy .. "TAm",
= "e" .. oxy .. "tAm",
= "A" .. oxy .. "mahi",
= "a" .. oxy .. "Dvam",
= "a" .. oxy .. "nta"
},
}
}
end
local athematic_impf_strong_endings_cons = {
= {
= {
= "s",
= "t",
},
},
}
local athematic_impf_strong_endings_vow = {
= {
= {
= "am",
},
},
}
-- accent for augmentless forms
local make_athematic_impf_weak_forms_cons = function(oxy) -- endings starting with consonants not m/v/y
return {
= {
= {
= "ta" .. oxy .. "m",
= "tA" .. oxy .. "m",
= "ta" .. oxy,
},
= {
= "TA" .. oxy .. "s",
= "ta" .. oxy,
= "Dva" .. oxy .. "m",
}
}
}
end
local make_athematic_impf_weak_forms_mvy = function(oxy) -- endings starting with m/v/y
return {
= {
= {
= "va" .. oxy,
= "ma" .. oxy,
},
= {
= "va" .. oxy .. "hi",
= "ma" .. oxy .. "hi",
}
}
}
end
local make_athematic_impf_weak_forms_vow = function(oxy) -- endings starting with vowels (without active 3p)
return {
= {
= {
= "i" .. oxy,
= "A" .. oxy .. "TAm",
= "A" .. oxy .. "tAm",
= "a" .. oxy .. "ta"
}
}
}
end
local make_athematic_impf_3p_an = function(oxy)
return {
= {
= {
= "a" .. oxy .. "n"
}
}
}
end
local make_athematic_impf_3p_ur = function(oxy)
return {
= {
= {
= "u" .. oxy .. "r"
}
}
}
end
local intensive_impf_endings_extra = {
= {
= {
= "Is",
= "It",
},
},
}
local t = {}
local is_thematic = args.weak_lemma == nil
if is_thematic then
if not detect_strong(t, args.strong_lemma, "(.+)a/?t$", "a(/?)t$") then
if not detect_strong(t, args.strong_lemma, "(.+)a/?ta$", "a(/?)ta$") then
validate(t, args.strong_lemma)
else
args.n = "m" -- deponent
end
end
make_forms(args, data, t, make_thematic_impf_forms(t))
-- active verbs
elseif detect_strong(t, args.strong_lemma, "(.*" .. sa_utils.vowel_with_accent .. ")t$")
or detect_strong(t, args.strong_lemma, "(.+)$") or match(args.strong_lemma, "^<.+>$") then
if not detect_weak(t, args.weak_lemma, "(.+)a/?n$", "a(/?)n$") then
if not detect_weak(t, args.weak_lemma, "(.+A)/?n$", "A(/?)n$") then
if not detect_weak(t, args.weak_lemma, "(.+)u$") then
validate(t, args.weak_lemma)
else
t.ur_3p = true
end
end
end
-- look at weak stem if 3s '-t' disappeared and no strong stem is supplied
if match(args.strong_lemma, "$") then
if args.diaspirate == true then
t.strong_stem = gasub(t.strong_stem, "()(.+)$", function(cons, post) return sa_utils.deaspirate .. post end)
end
if match(args.strong_lemma, "k$") then
t.strong_stem = gasub(t.strong_stem, ".$", gasub(t.weak_stem, ".+(.)$", "%1"))
if match(t.strong_stem, "h$") then
args.h_to_g = true
end
elseif match(t.weak_stem, "kz$") then
t.strong_stem = gasub(t.strong_stem, ".$", "kz")
else
t.strong_stem = gasub(t.strong_stem, ".$", gasub(t.weak_stem, ".+(.)$", "%1"))
if match(t.strong_stem, "j$") then
args.j_to_z = true
elseif match(t.strong_stem, "f$") then
t.strong_stem = gasub(t.strong_stem, ".$", "r")
end
end
elseif match(t.weak_stem, "$")
and match(args.strong_lemma, "" .. sa_utils.vowel_with_accent.."t$") then
t.strong_stem = gasub(t.strong_stem, "^(.+)$", "%1" .. gasub(t.weak_stem, ".+(.)$", "%1"))
-- error for roots on -i/ī/u/ū when no weak stem provided
elseif match(args.weak_lemma, sa_utils.consonant.."i?ya/?n$")
or ( match(args.weak_lemma, "uva/?n$") and not match(t.strong_stem, "o/?")) then
error("Please add weak stem for roots on -i/-ī and -u/-ū.")
end
-- intensive verbs (assuming 3s on -īt is intensive, as a normal class 3 root on -ī would have -et)
if t.ur_3p == true and (not args.class or args.class == "int") and ( match(t.strong_stem, "I$") or detect_intensive(args, t) ) then
args.n = "a"
t.strong_stem_before_vow = gasub(t.strong_stem, "I$", "")
if match(t.strong_stem_before_vow, sa_utils.vowel.."?$") then
make_forms(args, data, t, athematic_impf_strong_endings_vow)
else
make_forms(args, data, t, athematic_impf_strong_endings_vow) -- weak stem with normally strong ending
end
else -- non-intensive
if match(args.strong_lemma, "O/?t$") and match(t.weak_stem, "u$") then -- Whitney §626
t.strong_stem_before_vow = gasub(t.strong_stem, "O(/?)$", "a%1v")
-- verbs with inserted 'ī' in 2/3 sg., see Whitney §631-3 (roots on -ī should have -e in strong stem)
elseif match(args.strong_lemma, "It$") then
t.strong_stem_before_vow = gasub(t.strong_stem, "I$", "")
else
t.strong_stem_before_vow = t.strong_stem
end
make_forms(args, data, t, athematic_impf_strong_endings_vow)
end
-- use 3s form for 2s and 3s (if appropriate)
local syllable = sa_utils.vowel_with_accent..sa_utils.consonant.."+"
if match(args.strong_lemma, "^"..syllable..sa_utils.vowel_with_accent
.."t<"..syllable..sa_utils.vowel_with_accent..">$")
or match(args.strong_lemma, "^"..syllable..syllable..sa_utils.vowel_with_accent.."t<"
..syllable..syllable..sa_utils.vowel_with_accent..">$") then
-- do nothing
elseif match(args.strong_lemma, sa_utils.vowel_with_accent.."t<.+>$") then
t.strong_stem = gasub(args.strong_lemma, "t<.+>$", "")
end
make_forms(args, data, t, athematic_impf_strong_endings_cons)
-- if intensive without dissyllabic reduplication
if t.intensive == "1" then
if match(t.strong_stem, sa_utils.vowel_with_accent.."?$") then -- Whitney §1004a
make_forms(args, data, t, intensive_impf_endings_extra)
else
make_forms(args, data, t, intensive_impf_endings_extra)
end
end
-- e.g. āpnot
if match(t.strong_stem, sa_utils.consonant .. "o/?$") then
args.no_syncope = true
t.weak_stem = gasub(t.weak_stem, "uv$", "u")
-- extra forms for verbs on vowel + -noti
elseif match(t.strong_stem, sa_utils.vowel .. "o/?$") then
t.temp_stem = gasub(t.strong_stem, "o/?$", "")
make_forms(args, data, t, make_athematic_impf_weak_forms_mvy(t))
-- class 9
elseif match(t.strong_stem, "A/?$") and match(t.weak_stem, "$") then
t.weak_stem = gasub(t.weak_stem, "^.*$", "%1I")
-- class 3 roots on -ṛ
elseif match(args.weak_lemma, ".aru$") and not match(t.strong_stem, "A/?$") then
t.weak_stem = gasub(t.weak_stem, "ar$", "f")
-- class 3 roots on -i/ī/u/ū with no weak stem provided
elseif match(args.weak_lemma, ".au$") and not match(t.strong_stem, "A/?$") then
error("Please add weak stem for class 3 roots on -i/-ī and -u/-ū.")
end
make_forms(args, data, t, make_athematic_impf_weak_forms_cons(t))
if args.extra_1p_stem then
t.weak_stem = to_SLP(args.extra_1p_stem)
end
make_forms(args, data, t, make_athematic_impf_weak_forms_mvy(t))
if match(args.weak_lemma, "n<.*>$") then
t.weak_stem = gasub(args.weak_lemma, "a?/?n<.*>$", "")
-- class 3 verbs on -ā with weak stem supplied
elseif match(args.weak_lemma, "u<.*>$") and match(t.strong_stem, "A$") then
t.weak_stem = gasub(args.weak_lemma, "u<.*>$", "")
elseif args.extra_1p_stem or match(t.weak_stem, "I$") then
t.weak_stem = gasub(args.weak_lemma, "a/?n$", "")
end
make_forms(args, data, t, make_athematic_impf_weak_forms_vow(t))
if t.ur_3p == true then
-- active 3p for class 3 verbs is often not from the weak stem
if match(args.weak_lemma, ".<.*>$") then
t.weak_stem = gasub(args.weak_lemma, 'u<.*>$', '')
else
t.weak_stem = gasub(t.weak_stem, "f$", "ar")
end
make_forms(args, data, t, make_athematic_impf_3p_ur(t))
else
if match(t.strong_stem, "A$") and match(t.weak_stem, "A$") then -- Whitney §621a
t.temp_stem = gasub(t.weak_stem, "A$", "")
make_forms(args, data, t, make_athematic_impf_3p_ur(t))
end
make_forms(args, data, t, make_athematic_impf_3p_an(t))
end
-- deponent verbs
elseif detect_strong(t, args.strong_lemma, "(.+)a/?$") then
if detect_weak(t, args.weak_lemma, "(.+)a/?ta$", "a(/?)ta$") or detect_weak(t, args.weak_lemma, "(.+A/?)ta$") then
args.n = "m" -- deponent
-- for verbs on vowel + -nuta (+ impf. of tarute)
if match(t.strong_stem, sa_utils.vowel .. "u$")
and (not args.class or match(args.class, "^$")) and not args.extra_1p_stem then
t.temp_stem = gasub(t.strong_stem, "u$", "")
make_forms(args, data, t, make_athematic_impf_weak_forms_mvy(t))
-- e.g. āpnot, but middle
elseif match(t.strong_stem, sa_utils.consonant .. "u?$") then
args.no_syncope = true
end
if match(args.strong_lemma, sa_utils.vowel_with_accent .. "ta$") then
t.weak_stem_before_cons = gasub(args.strong_lemma, "ta$", "")
else
t.weak_stem_before_cons = t.weak_stem
end
make_forms(args, data, t, make_athematic_impf_weak_forms_cons(t))
if args.extra_1p_stem then
t.weak_stem_before_cons = to_SLP(args.extra_1p_stem)
end
make_forms(args, data, t, make_athematic_impf_weak_forms_mvy(t))
if match(args.weak_lemma, ".<.*>$") then
t.weak_stem = gasub(args.weak_lemma, "a?/?ta<.*>$", "")
end
make_forms(args, data, t, make_athematic_impf_weak_forms_vow(t))
else
validate(t, args.weak_lemma)
end
else
validate(t, args.strong_lemma)
end
end
})
conj_data = {}
setmetatable(conj_data, {
__call = function (self, args, data)
local make_strong_forms = function (oxy)
return {
= {
= {
= "syA" .. oxy .. "mi",
= "sya" .. oxy .. "si",
= "sya" .. oxy .. "ti",
= "syA" .. oxy .. "vas",
= "sya" .. oxy .. "Tas",
= "sya" .. oxy .. "tas",
= {"syA" .. oxy .. "mas", {"syA" .. oxy .. "masi", note = "Vedic"}},
= "sya" .. oxy .. "Ta",
= "sya" .. oxy .. "nti"
},
= {
= "sye" .. oxy,
= "sya" .. oxy .. "se",
= "sya" .. oxy .. "te",
= "syA" .. oxy .. "vahe",
= "sye" .. oxy .. "Te",
= "sye" .. oxy .. "te",
= "syA" .. oxy .. "mahe",
= "sya" .. oxy .. "Dve",
= "sya" .. oxy .. "nte"
}
},
= {
= "sya" .. oxy .. "t",
= "sya" .. oxy .. "mAna"
}
}
end
local t = {}
if not detect_strong(t, args.strong_lemma, "(.+).ya" .. sa_utils.accent .. "?ti$", "(" .. sa_utils.accent .. "?)ti$") then
if not detect_strong(t, args.strong_lemma, "(.+).ya" .. sa_utils.accent .. "?te$", "(" .. sa_utils.accent .. "?)te$") then
validate(t, args.strong_lemma)
else
args.n = "m" -- deponent
end
end
make_forms(args, data, t, make_strong_forms(t))
table.insert(data.categories, "Sanskrit verbs with s-future")
end
})
conj_data = {}
setmetatable(conj_data, {
__call = function (self, args, data)
local pfut_endings = {
= {
= {
= "smi",
= "si",
= "",
= "svas",
= "sTas",
= {"rO", {"rA", note = "Vedic"}}, -- 'gantārā' occurs in Rigveda 8.13.10
= {"smas", {"smasi", note = "Vedic"}},
= "sTa",
= "ras"
},
= {
= "he",
= "se",
= "",
= "svahe",
= "sATe",
= "rO",
= "smahe",
= "Dve",
= "ras"
}
}
}
local t = {}
if not detect_strong(t, args.strong_lemma, "(.+A" .. sa_utils.accent .. "?)$") then
validate(t, args.strong_lemma)
-- for the periphrastic future, there is no way to tell if the verb is deponent from the lemma (third-person singular form)
-- atmanepada verbs require the "n=m" argument to avoid showing the active forms
end
make_forms(args, data, t, pfut_endings)
table.insert(data.categories, "Sanskrit verbs with periphrastic future")
end
})
conj_data = {}
setmetatable(conj_data, {
__call = function (self, args, data)
local t = {}
if not detect_strong(t, args.strong_lemma, "(.+).yat$") then
if not detect_strong(t, args.strong_lemma, "(.+).yata$") then
validate(t, args.strong_lemma)
else
args.n = "m" -- deponent
end
end
make_forms(args, data, t, {
= {
= {
= "syam",
= "syas",
= "syat",
= "syAva",
= "syatam",
= "syatAm",
= "syAma",
= "syata",
= "syan"
},
= {
= "sye",
= "syaTAs",
= "syata",
= "syAvahi",
= "syeTAm",
= "syetAm",
= "syAmahi",
= "syaDvam",
= "syanta"
}
}
})
end
})
conj_data = {}
setmetatable(conj_data, {
__call = function (self, args, data)
-- there is some added complexity here compared to the other tenses due to the number of aorist types in Sanskrit
local make_strong_is_forms = function(var_i)
return {
= {
= {
= var_i .. "zam",
= "Is",
= "It",
= var_i .. "zva",
= var_i .. "zwam",
= var_i .. "zwAm",
= var_i .. "zma",
= var_i .. "zwa",
= var_i .. "zur"
},
}
}
end
local make_strong_is_inj_forms = function(var_i)
return {
= {
= {
= var_i .. "zam",
= "Is",
= "It",
= var_i .. "zva",
= var_i .. "zwam",
= var_i .. "zwAm",
= var_i .. "zma",
= var_i .. "zwa",
= var_i .. "zur"
},
},
= {
= {
= var_i .. "zAni",
= { var_i .. "zas", var_i .. "zasi"},
= { var_i .. "zat", var_i .. "zati"},
= var_i .. "zAva",
= var_i .. "zaTas",
= var_i .. "zatas",
= var_i .. "zAma",
= var_i .. "zaTa",
= var_i .. "zan",
}
}
}
end
local make_weak_is_forms = function(var_i)
return {
= {
= {
= var_i .. "zi",
= var_i .. "zWAs",
= var_i .. "zwa",
= var_i .. "zvahi",
= var_i .. "zATAm",
= var_i .. "zAtAm",
= var_i .. "zmahi",
= var_i .. "Qvam",
= var_i .. "zata"
},
}
}
end
local make_weak_is_inj_forms = function(var_i)
return {
= {
= {
= var_i .. "zi",
= var_i .. "zWAs",
= var_i .. "zwa",
= var_i .. "zvahi",
= var_i .. "zATAm",
= var_i .. "zAtAm",
= var_i .. "zmahi",
= var_i .. "Qvam",
= var_i .. "zata"
},
},
= {
= {
= var_i .. "zE",
= { var_i .. "zase", var_i .. "zAsE"},
= { var_i .. "zate", var_i .. "zAtE"},
= var_i .. "zAvahe",
= var_i .. "zETe",
= var_i .. "zEte",
= { var_i .. "zAmahe", var_i .. "zAmahE"},
= { var_i .. "zaDve", var_i .. "zADvE"},
= var_i .. "zanta",
}
}
}
end
local strong_s_endings = {
= {
= {
= "sam",
= {"sIs", {"s", note = "Vedic"}},
= {"sIt", {"s", note = "Vedic"}},
= "sva",
= "stam",
= "stAm",
= "sma",
= "sta",
= "sur"
},
}
}
local strong_s_inj_endings = {
= {
= {
= "sam",
= {"sIs", {"s", note = "Vedic"}},
= {"sIt", {"s", note = "Vedic"}},
= "sva",
= "stam",
= "stAm",
= "sma",
= "sta",
= "sur"
}
}
}
local active_s_subj_endings = {
= {
= {
= "sAni",
= {"sas", "sasi"},
= {"sat", "sati"},
= "sAva",
= "saTas",
= "satas",
= "sAma",
= "saTa",
= "san",
}
}
}
local weak_s_endings = {
= {
= {
= "si",
= "sTAs",
= "sta",
= "svahi",
= "sATAm",
= "sAtAm",
= "smahi",
= "sDvam", -- further treated by sandhi module
= "sata"
},
}
}
local weak_s_inj_endings = {
= {
= {
= "si",
= "sTAs",
= "sta",
= "svahi",
= "sATAm",
= "sAtAm",
= "smahi",
= "sDvam", -- further treated by sandhi module
= "sata"
},
}
}
local middle_s_subj_endings = {
= {
= {
= "sE",
= {"sase", "sAsE"},
= {"sate", "sAtE"},
= "sAvahE",
= "sETe",
= "sEte",
= {"sAmahe", "sAmahE"},
= {"saDve", "sADvE"}, -- speculative
= "santa"
}
}
}
-- for a- + sa-aorist
local make_strong_thematic_forms = function(oxy)
return {
= {
= {
= "a" .. oxy .. "m",
= "a" .. oxy .. "s",
= "a" .. oxy .. "t",
= "A" .. oxy .. "va",
= "a" .. oxy .. "tam",
= "a" .. oxy .. "tAm",
= "A" .. oxy .. "ma",
= "a" .. oxy .. "ta",
= "a" .. oxy .. "n"
},
}
}
end
local make_strong_thematic_inj_forms = function(oxy)
return {
= {
= {
= "a" .. oxy .. "m",
= "a" .. oxy .. "s",
= "a" .. oxy .. "t",
= "A" .. oxy .. "va",
= "a" .. oxy .. "tam",
= "a" .. oxy .. "tAm",
= "A" .. oxy .. "ma",
= "a" .. oxy .. "ta",
= "a" .. oxy .. "n"
},
},
= {
= {
= "A" .. oxy .. "ni",
= {"A" .. oxy .. "s", "A" .. oxy .. "si"},
= {"A" .. oxy .. "t", "A" .. oxy .. "ti"},
= "A" .. oxy .. "va",
= "A" .. oxy .. "Tas",
= "A" .. oxy .. "tas",
= "A" .. oxy .. "ma",
= "A" .. oxy .. "Ta",
= "A" .. oxy .. "n",
}
}
}
end
local make_weak_sa_forms = function (oxy)
return {
= {
= {
= "i" .. oxy,
= "A" .. oxy .. "TAm",
= "A" .. oxy .. "tAm",
},
}
}
end
local make_weak_sa_inj_forms = function (oxy)
return {
= {
= {
= "i" .. oxy,
= "A" .. oxy .. "TAm",
= "A" .. oxy .. "tAm",
}
}
}
end
local make_weak_a_forms = function(oxy)
return {
= {
= {
= "e" .. oxy,
= "e" .. oxy .. "TAm",
= "e" .. oxy .. "tAm",
}
}
}
end
local make_weak_a_inj_forms = function(oxy)
return {
= {
= {
= "e" .. oxy,
= "e" .. oxy .. "TAm",
= "e" .. oxy .. "tAm",
}
}
}
end
local make_weak_thematic_forms = function(oxy)
return {
= {
= {
= "a" .. oxy .. "TAs",
= "a" .. oxy .. "ta",
= "A" .. oxy .. "vahi",
= "A" .. oxy .. "mahi",
= "a" .. oxy .. "Dvam",
= "a" .. oxy .. "nta"
}
}
}
end
local make_weak_thematic_inj_forms = function(oxy)
return {
= {
= {
= "a" .. oxy .. "TAs",
= "a" .. oxy .. "ta",
= "A" .. oxy .. "vahi",
= "A" .. oxy .. "mahi",
= "a" .. oxy .. "Dvam",
= "a" .. oxy .. "nta"
}
},
= {
= {
= "E" .. oxy,
= {"A" .. oxy .. "se", "A" .. oxy .. "sE"},
= {"A" .. oxy .. "te", "A" .. oxy .. "tE"},
= "A" .. oxy .. "vahE",
= "E" .. oxy .. "Te",
= "E" .. oxy .. "te",
= {"A" .. oxy .. "mahe", "A" .. oxy .. "mahE"},
= {"A" .. oxy .. "Dve", "A" .. oxy .. "DvE"},
= "a" .. oxy .. "nta", -- speculative (maybe also -ānte in Rigvedic period)
},
}
}
end
local strong_root_endings = { -- without 3p
= {
= {
= "am",
= "s",
= "t",
= "va",
= "tam",
= "tAm",
= "ma",
= "ta",
}
}
}
local strong_root_inj_endings = { -- without 3p
= {
= {
= "am",
= "s",
= "t",
= "va",
= "tam",
= "tAm",
= "ma",
= "ta",
}
},
= {
= {
= "Ani", -- subjunctives on -am have been suggested by Hoffmann, 'Der Injunktiv im Veda', p.248
= {"as", "asi"},
= {"at", "ati"},
= "Ava",
= "aTas",
= "atas",
= "Ama",
= "aTa",
= {"an", "anti"}, -- for ending '-anti', see for example 'Aufsätze zur Indoiranisch' p.385
}
}
}
local an_3p_root_ending = {
= {
= {
= "an",
}
}
}
local make_an_3p_root_inj = function(oxy)
return {
= {
= {
= "a" .. oxy .. "n"
}
}
}
end
local ur_3p_root_ending = {
= {
= {
= "ur",
}
}
}
local make_ur_3p_root_inj = function(oxy)
return {
= {
= {
= "u" .. oxy .. "r"
}
}
}
end
-- middle only for some Vedic forms, the root-aorist can only be in active voice in Classical Sanskrit
local middle_root_endings_vow = {
= {
= {
= "i",
= "ATAm",
= "AtAm",
= "ata" -- but '-ran' frequently occurs, see Whitney §834b (probably originally a passive form)
}
}
}
local middle_root_endings_cons = {
= {
= {
= "TAs",
= "ta",
= "Dvam",
}
}
}
local middle_root_endings_mvy = {
= {
= {
= "vahi",
= "mahi",
}
}
}
local make_middle_root_inj_forms_vow = function(oxy)
return {
= {
= {
= "i" .. oxy,
= "A" .. oxy .. "TAm",
= "A" .. oxy .. "tAm",
= "a" .. oxy .. "nta" -- not '-ata', see 'Aufsätze zur Indoiranistik' (Hoffmann), p.362
}
}
}
end
local make_middle_root_inj_forms_cons = function(oxy)
return {
= {
= {
= "TA" .. oxy .. "s",
= "ta" .. oxy,
= "Dva" .. oxy .. "m",
}
}
}
end
local make_middle_root_inj_forms_mvy = function(oxy)
return {
= {
= {
= "va" .. oxy .. "hi",
= "ma" .. oxy .. "hi",
}
}
}
end
-- the endings '-āsai', '-ātai' would rather occur in the Atharvaveda (which doesn't have many attestations of subjunctive middle aorists)
local middle_root_subj_endings = {
= {
= {
= "E",
= {"ase", "AsE"},
= {"ate", "AtE"},
= "AvahE",
= "ETe",
= "Ete",
= {"Amahe", "AmahE"},
= {"aDve", "ADvE"}, -- speculative
= "anta"
}
}
}
local t = {}
local weak_lemma = args.weak_lemma or args.passive_lemma
if (not args.aor or args.aor == "s" or args.aor == "ṣ") and detect_strong(t, args.strong_lemma, "(.+)It$") then
table.insert(data.categories, "Sanskrit verbs with s-aorist")
make_forms(args, data, t, strong_s_endings)
if change_to_inj_strong(args, t) then
make_forms(args, data, t, strong_s_inj_endings)
end
if t then
-- root on ā, or hard-coded 'rādh' or '(av)āp' (Whitney gives no other roots with medial 'ā' for s-aorist)
if match(t.inj_strong_stem, "A/?$") or match(t.inj_strong_stem, "rA/?D$")
or match(t.inj_strong_stem, "^A/?p$") or match(t.inj_strong_stem, "^avA/?p$") then
t.subj_strong_stem = t.inj_strong_stem
make_forms(args, data, t, active_s_subj_endings)
elseif match(t.inj_strong_stem, "/?M?"..sa_utils.consonant.."*$") then
local vow_change = { = 'a' , = 'e', = 'o', = 'a', = 'e', = 'o' }
t.subj_strong_stem = gasub(t.inj_strong_stem, "("..sa_utils.vowel..")(/?M?"..sa_utils.consonant.."*)$",
function(a,b) return vow_change.. b end)
make_forms(args, data, t, active_s_subj_endings)
end
end
elseif (not args.aor or args.aor == "iṣ" or args.aor == "siṣ" or args.aor == "īṣ") and detect_strong(t, args.strong_lemma, "(.+)It$") then
if args.aor == "siṣ" then
table.insert(data.categories, "Sanskrit verbs with siṣ-aorist")
t.var_i = "i"
make_forms(args, data, t, make_strong_is_forms(t))
if change_to_inj_strong(args, t) then
make_forms(args, data, t, make_strong_is_inj_forms(t))
end
-- middle forms for siṣ-aorist are not allowed by the grammarians (but might have existed: Whitney §915)
else
table.insert(data.categories, "Sanskrit verbs with iṣ-aorist")
if args.aor == "īṣ" then -- in case of 'gra(b)h', see Whitney §900b
t.var_i = "I"
else
t.var_i = "i"
end
make_forms(args, data, t, make_strong_is_forms(t))
if change_to_inj_strong(args, t) then
-- the subjunctive stem for the iṣ-aorist is usually the same as the ind./inj. stem (Whitney §906b)
-- exception: san- vs. sān-
make_forms(args, data, t, make_strong_is_inj_forms(t))
end
if use_strong_for_weak(t, weak_lemma) then
make_forms(args, data, t, make_weak_is_forms(t))
if t then
make_forms(args, data, t, make_weak_is_inj_forms(t))
end
end
end
-- detection of oxytone accent in case of injunctive
elseif (not args.aor or args.aor == "sa") and detect_strong(t, args.strong_lemma, "(.+kz)a/?t$", "kza(/?)t$") then
table.insert(data.categories, "Sanskrit verbs with sa-aorist")
make_forms(args, data, t, make_strong_thematic_forms(t))
if change_to_inj_strong_oxy(args, t) then
make_forms(args, data, t, make_strong_thematic_inj_forms(t))
end
if use_strong_for_weak(t, weak_lemma) then
make_forms(args, data, t, make_weak_sa_forms(t))
make_forms(args, data, t, make_weak_thematic_forms(t))
if t then
make_forms(args, data, t, make_weak_sa_inj_forms(t))
make_forms(args, data, t, make_weak_thematic_inj_forms(t))
end
end
elseif (not args.aor or args.aor == "a") and detect_strong(t, args.strong_lemma, "(.+)a/?t$", "a(/?)t$") then
table.insert(data.categories, "Sanskrit verbs with a-aorist")
make_forms(args, data, t, make_strong_thematic_forms(t))
if change_to_inj_strong_oxy(args, t) then
make_forms(args, data, t, make_strong_thematic_inj_forms(t))
end
if use_strong_for_weak(t, weak_lemma) then
make_forms(args, data, t, make_weak_a_forms(t))
make_forms(args, data, t, make_weak_thematic_forms(t))
if t then
make_forms(args, data, t, make_weak_a_inj_forms(t))
make_forms(args, data, t, make_weak_thematic_inj_forms(t))
end
end
-- the 't' of 'avart' should be detected as part of the stem
elseif (not args.aor or args.aor == "root") and ( detect_strong(t, args.strong_lemma, "(.+" .. sa_utils.vowel .. ")t$")
or detect_strong(t, args.strong_lemma, "(.+)$") or match(args.strong_lemma, "^<.+>$") ) then
table.insert(data.categories, "Sanskrit verbs with root-aorist")
make_forms(args, data, t, strong_root_endings)
if change_to_inj_strong(args, t) then
make_forms(args, data, t, strong_root_inj_endings)
end
t.root_3p_stem = t.strong_stem
-- for active 3p, remove final ā from stem
if match(t.strong_stem, "A$") then
t.root_3p_stem = gasub(t.root_3p_stem, "A$", "")
make_forms(args, data, t, ur_3p_root_ending)
t = true
elseif match(t.strong_stem, "U$") then -- for bhū
t.root_3p_stem = gasub(t.root_3p_stem, "U$", "Uv")
make_forms(args, data, t, an_3p_root_ending)
-- else Vedic root-aorist, reconstructed to have strong stem in active forms, except 3p
-- attested forms (in Whitney) not following this pattern:
-- 1) 'arudhma' (but this is probably rather an imperfect, from 'arundhma') and 2) 'aśravan'
else
t.root_3p_stem = gasub(t.root_3p_stem, "e("..sa_utils.consonant..")$", "i%1")
t.root_3p_stem = gasub(t.root_3p_stem, "o("..sa_utils.consonant..")$", "u%1")
t.root_3p_stem = gasub(t.root_3p_stem, "ar("..sa_utils.consonant..")$", "f%1")
t.root_3p_stem = gasub(t.root_3p_stem, "ar$", "r")
t.root_3p_stem = gasub(t.root_3p_stem, "("..sa_utils.consonant..sa_utils.consonant..")e$", "%1iy")
t.root_3p_stem = gasub(t.root_3p_stem, "e$", "y")
t.root_3p_stem = gasub(t.root_3p_stem, "("..sa_utils.consonant..sa_utils.consonant..")o$", "%1uv")
t.root_3p_stem = gasub(t.root_3p_stem, "o$", "v")
t.root_3p_stem = gasub(t.root_3p_stem, "(a/?)a()$", "%1%2")
t.root_3p_stem = gasub(t.root_3p_stem, "(a/?j)an$", "%1Y")
t.root_3p_stem = gasub(t.root_3p_stem, "(a/?)Gas$", "%1kz")
if t.root_3p_stem == t.strong_stem then
make_forms(args, data, t, ur_3p_root_ending)
t = true
else
make_forms(args, data, t, an_3p_root_ending)
end
end
if t then
if args.inj_weak_stem then
t.inj_root_3p_stem = to_SLP(args.inj_weak_stem)
elseif not args.inj_strong_stem then
t.inj_root_3p_stem = gasub(t.root_3p_stem, "^a/?(.+)$", "%1")
t.inj_root_3p_stem = gasub(t.inj_root_3p_stem, "^c(C.+)$", "%1")
else
t.inj_root_3p_stem = t.inj_strong_stem
end
t.inj_root_3p_oxy = gasub(t.root_3p_stem, "^+(/?).+$", "%1")
args.accent_override = true
if t then
make_forms(args, data, t, make_ur_3p_root_inj(t))
else
make_forms(args, data, t, make_an_3p_root_inj(t))
end
args.accent_override = false
end
elseif args.strong_lemma ~= "-" then
error("Could not detect aorist type from " .. to_IAST(args.strong_lemma)) -- failed to recognize an aorist type
end
if weak_lemma then
-- if ends on -gdha, -ddha or -bdha, then the stem necessarily ends on resp. -h/dh/bh (except '(a)gdha')
local aspirate = { = 'h', = 'D', = 'B' }
weak_lemma = gasub(weak_lemma, '(.+)()(Da)$', function(a,b,c) return a .. aspirate.. c end)
if match(weak_lemma, "hDa$") then
args.h_to_g = true
end
if (not args.aor or args.aor == "iṣ" or args.aor == "īṣ") and detect_weak(t, weak_lemma, "(.+)zwa$") then
table.insert(data.categories, "Sanskrit verbs with iṣ-aorist")
if args.aor == "īṣ" or match(args.weak_lemma, "Izwa$") then
t.var_i = "I"
else
t.var_i = "i"
end
make_forms(args, data, t, make_weak_is_forms(t))
if change_to_inj_weak(args, t) then
make_forms(args, data, t, make_weak_is_inj_forms(t))
end
elseif (not args.aor or args.aor == "s" or args.aor == "ṣ") and (detect_weak(t, weak_lemma, "(.+)sta$") or detect_weak(t, weak_lemma, "(.+)zwa$")
or detect_weak(t, weak_lemma, "(.+)ta$") or detect_weak(t, weak_lemma, "(.+)Da$")) then
table.insert(data.categories, "Sanskrit verbs with s-aorist")
make_forms(args, data, t, weak_s_endings)
if change_to_inj_weak(args, t) then
make_forms(args, data, t, weak_s_inj_endings)
-- for now only middle subjunctive for roots with guna in ind./inj.
if match(t.inj_weak_stem, "/?M?"..sa_utils.consonant.."*$") then
t.subj_weak_stem = t.inj_weak_stem
make_forms(args, data, t, middle_s_subj_endings)
end
end
elseif (not args.aor or args.aor == "sa") and detect_weak(t, weak_lemma, "(.+kz)a/?ta$", "kza(/?)ta$") then
table.insert(data.categories, "Sanskrit verbs with sa-aorist")
make_forms(args, data, t, make_weak_sa_forms(t))
make_forms(args, data, t, make_weak_thematic_forms(t))
if change_to_inj_weak_oxy(args, t) then
make_forms(args, data, t, make_weak_sa_inj_forms(t))
make_forms(args, data, t, make_weak_thematic_inj_forms(t))
end
elseif (not args.aor or args.aor == "a") and detect_weak(t, weak_lemma, "(.+)a/?ta$", "a(/?)ta$") then
table.insert(data.categories, "Sanskrit verbs with a-aorist")
make_forms(args, data, t, make_weak_a_forms(t))
make_forms(args, data, t, make_weak_thematic_forms(t))
if change_to_inj_weak_oxy(args, t) then
make_forms(args, data, t, make_weak_a_inj_forms(t))
make_forms(args, data, t, make_weak_thematic_inj_forms(t))
end
elseif (not args.aor or args.aor == "root") and detect_weak(t, weak_lemma, "(.+)a$") then
table.insert(data.categories, "Sanskrit verbs with root-aorist")
make_forms(args, data, t, middle_root_endings_vow)
if change_to_inj_weak_oxy(args, t) then
make_forms(args, data, t, make_middle_root_inj_forms_vow(t))
end
if match(args.weak_lemma, sa_utils.vowel.."ta<.*>$") then -- basically for roots gam/tan/man
t.weak_stem = gasub(args.weak_lemma, "ta<.*>$", "")
elseif match(args.weak_lemma, "^a/?gDa<.*>$") then -- for 'gdha'
t.weak_stem = gasub(args.weak_lemma, "gDa<.*>$", "G")
end
make_forms(args, data, t, middle_root_endings_cons)
if t then
if t == "2" then
t.inj_weak_stem = gasub(t.weak_stem, "^a/?(.+)$", "%1")
end
make_forms(args, data, t, make_middle_root_inj_forms_cons(t))
end
if args.extra_1p_stem then
t.weak_stem = to_SLP(args.extra_1p_stem)
end
make_forms(args, data, t, middle_root_endings_mvy)
if t then
if t == "2" then
t.inj_weak_stem = gasub(t.weak_stem, "^a/?(.+)$", "%1")
end
make_forms(args, data, t, make_middle_root_inj_forms_mvy(t))
end
if args.inj_strong_stem then
t.inj_strong_stem = to_SLP(args.inj_strong_stem)
make_forms(args, data, t, middle_root_subj_endings)
elseif t then
make_forms(args, data, t, middle_root_subj_endings)
end
else
error("Could not detect aorist type from " .. to_IAST(weak_lemma)) -- failed to recognize an aorist type
end
end
end
})
conj_data = {}
setmetatable(conj_data, {
__call = function (self, args, data)
local make_strong_forms = function (oxy)
return {
= {
= {
= "yA" .. oxy .. "sam",
= "yA" .. oxy .. "s",
= {"yA" .. oxy .. "t", {"yA" .. oxy .. "s", note = "Vedic"}}, -- Whitney §838 for Vedic ending
= "yA" .. oxy .. "sva",
= "yA" .. oxy .. "stam",
= "yA" .. oxy .. "stAm",
= "yA" .. oxy .. "sma",
= "yA" .. oxy .. "sta",
= "yA" .. oxy .. "sur"
}
}
}
end
local make_weak_forms = function (oxy)
return {
= {
= {
= "sIya" .. oxy,
= "sIzWA" .. oxy .. "s",
= "sIzwa" .. oxy,
= "sIva" .. oxy .. "hi",
= {{"sIyA" .. oxy .. "sTAm", note = "Uncertain"}}, -- Whitney §924a: "of very questionable value"
= {{"sIyA" .. oxy .. "stAm", note = "Uncertain"}},
= "sIma" .. oxy .. "hi",
= "sIQva" .. oxy .. "m",
= "sIra" .. oxy .. "n"
}
}
}
end
local t = {}
if detect_strong(t, args.strong_lemma, "(.+)yA" .. sa_utils.accent .. "?t$", "yA(" .. sa_utils.accent .. "?)t$") then
make_forms(args, data, t, make_strong_forms(t))
elseif args.strong_lemma ~= "-" then
validate(t, args.strong_lemma)
end
local weak_lemma = args.weak_lemma or args.passive_lemma
if weak_lemma then
if detect_weak(t, weak_lemma, "(.+)Izwa" .. sa_utils.accent .. "?$", "Izwa(" .. sa_utils.accent .. "?)$") then
make_forms(args, data, t, make_weak_forms(t))
else
validate(t, weak_lemma)
end
end
end
})
conj_data = {}
setmetatable(conj_data, {
__call = function (self, args, data)
local make_weak_forms_cons = function (oxy) -- endings starting with consonant (except act. part.)
return {
= {
= {
= "va" .. oxy,
= "ma" .. oxy,
},
= {
= "se" .. oxy,
= "va" .. oxy .. "he",
= "ma" .. oxy .. "he",
= "Dve" .. oxy,
}
},
}
end
local make_weak_forms_vow = function (oxy) -- endings starting with vowel
return {
= {
= {
= "a" .. oxy .. "Tur",
= "a" .. oxy .. "tur",
= "a" .. oxy,
= "u" .. oxy .. "s"
},
= {
= "e" .. oxy,
= "e" .. oxy,
= "A" .. oxy .. "Te",
= "A" .. oxy .. "te",
= "ire" .. oxy
}
},
= {
= "Ana" .. oxy
}
}
end
local make_vedic_anit_forms = function (oxy)
return {
= {
= {
= {{"va" .. oxy, note = "Vedic"}},
= {{"ma" .. oxy, note = "Vedic"}},
},
= {
= {{"se" .. oxy, note = "Vedic"}},
= {{"va" .. oxy .. "he", note = "Vedic"}},
= {{"ma" .. oxy .. "he", note = "Vedic"}},
= {{"Dve" .. oxy, note = "Vedic"}},
= {{"re" .. oxy, note = "Vedic"}},
}
}
}
end
local make_vedic_anit_mid_3p = function (oxy)
return {
= {
= {
= {{"re" .. oxy, note = "Vedic"}},
}
}
}
end
local make_anit_perf_participle = function(oxy)
return { = { = "vA" .. oxy .. "Ms" } }
end
local make_set_perf_participle = function(oxy)
return { = { = "ivA" .. oxy .. "Ms" } }
end
local make_strong_au_forms = function(oxy)
return {
= {
= {
= "O" .. oxy,
= {"A" .. oxy .. "Ta", {"iTa" .. oxy, note = "Later Sanskrit"}},
= "O" .. oxy,
},
}
}
end
local anit_perf_2s_ending = {
= {
= {
= "Ta"
}
}
}
local set_perf_2s_ending = {
= {
= {
= "iTa"
}
}
}
local set_perf_2s_ending_later_skt = {
= {
= {
= {{"iTa", note = "Later Sanskrit"}}
}
}
}
local make_weak_perf_2s = function(oxy)
return {
= {
= {
= {{"iTa" .. oxy, note = "Later Sanskrit"}}
}
}
}
end
local t = {}
if detect_strong(t, args.strong_lemma, "(.+)O/?$", "O(/?)$") then
make_forms(args, data, t, make_strong_au_forms(t))
args.set = true
make_forms(args, data, t, make_weak_forms_cons(t))
make_forms(args, data, t, make_set_perf_participle(t))
make_forms(args, data, t, make_weak_forms_vow(t))
else
if not detect_strong(t, args.strong_lemma, "(.+)a$") then
if not detect_strong(t, args.strong_lemma, "(.+)e" .. sa_utils.accent .. "?$", "e(" .. sa_utils.accent .. "?)$") then
validate(t, args.strong_lemma)
else
args.n = "m" -- deponent
end
end
local weak_lemma = args.weak_lemma or args.passive_lemma
if not use_strong_for_weak(t, weak_lemma) then
if not detect_weak(t, weak_lemma, "(.+)u" .. sa_utils.accent .. "?$", "u(" .. sa_utils.accent .. "?)$") then
validate(t, weak_lemma)
end
end
-- if no strong stem supplied in case of e.g. cakāra, look at weak stem
if match(args.strong_lemma, "A"..sa_utils.accent.."?"..sa_utils.consonant.."a$")
and not match(t.weak_stem, "A"..sa_utils.accent.."?"..sa_utils.consonant.."$") then
t.strong_stem = gasub(t.strong_stem, "A("..sa_utils.accent.."?.)$", "a%1")
end
-- if Brugmann's law is applicable
if match(t.strong_stem, "a"..sa_utils.accent.."?"..sa_utils.consonant.."$")
or match(t.strong_stem, ""..sa_utils.accent.."?$") then
make_forms(args, data, t, {
= {
= {
= {"a", {"aⓁ", note = "Later Sanskrit"}}, -- only 3 verbs with vriddhi-form in Vedic (Whitney §793d)
= "aⓁ",
},
}
})
else
make_forms(args, data, t, {
= {
= {
= "a",
= "a",
},
}
})
end
if args.weak_lemma and ( match(args.weak_lemma, sa_utils.consonant.."i?yu/?$") or match(args.weak_lemma, "uvu/?$") ) then
error("Please add weak stem for active participle for roots on -i/-ī and -u/-ū.")
elseif match(t.weak_stem, sa_utils.consonant .. 'r$') then
t.weak_stem = gasub(t.weak_stem, 'r$', 'f') -- change -r of weak stem to -ṛ if after consonant
elseif match(t.weak_stem, "$") or match(t.weak_stem, sa_utils.consonant..sa_utils.consonant.."$") then
args.no_syncope = true
end
-- anit roots (on -ṛ or -u) + 'vid'
if ( match(t.weak_stem, "$") or match(t.weak_stem, "^vid$") or match(t.weak_stem, "vid$") ) and not args.set == true then
make_forms(args, data, t, anit_perf_2s_ending)
make_forms(args, data, t, make_weak_forms_cons(t))
make_forms(args, data, t, make_anit_perf_participle(t))
if match(args.weak_lemma, ".<.*>$") then
t.weak_stem = gasub(args.weak_lemma, "u/?<.*>$", "")
end
make_forms(args, data, t, make_weak_forms_vow(t))
if match(t.weak_stem, "vid$") then
make_forms(args, data, t, make_vedic_anit_mid_3p(t))
end
else
args.set = false -- as this interferes with adding -tha
-- rules for 2s
if (match(t.strong_stem, "uva/?.$") and match(t.weak_stem, "U.$")) -- e.g. uvac-
or (match(t.strong_stem, "iya/?.$") and match(t.weak_stem, "I.$")) -- iyaj-
or (match(t.strong_stem, "/??$") and (match(t.weak_stem, "e.$") -- e.g. tatan- / ten-
or match(t.weak_stem, sa_utils.consonant..sa_utils.consonant.."$"))) -- e.g. jajan- / jajñ-
or match(t.strong_stem, "U/?v$") -- babhūv-
or match(t.strong_stem, "a/?$") or match(t.strong_stem, "/?$") then -- e.g. ninay-, dadhar-
make_forms(args, data, t, anit_perf_2s_ending) -- add -tha
t = true
end
if match(t.strong_stem, "a/?$") and match(t.weak_stem, "e.$") then
-- or match(t.weak_stem, sa_utils.consonant..sa_utils.consonant.."$")) then -- this specific line might be wrong
make_forms(args, data, t, make_weak_perf_2s(t))
elseif match(t.strong_stem, "a/?$") then
make_forms(args, data, t, set_perf_2s_ending_later_skt) -- add -itha (post-Vedic)
else
make_forms(args, data, t, set_perf_2s_ending) -- add -itha
end
if match(t.strong_stem, "a"..sa_utils.accent.."?"..sa_utils.consonant.."$") and not t.Ta_added then
make_forms(args, data, t, {
= {
= {
= {{"Ta", note = "Vedic"}}
}
}
})
end
-- use (supplied) weak stem for participle
if sa_utils.is_monosyllabic(t.weak_stem) or args.mono == true then -- not accurate for some verbs (Whitney §803a)
make_forms(args, data, t, make_set_perf_participle(t))
else
make_forms(args, data, t, make_anit_perf_participle(t))
end
-- change weak stem to form used in 3p
if args.weak_lemma then
if match(args.weak_lemma, ".<.*>$") then
t.weak_stem = gasub(args.weak_lemma, "u/?<.*>$", "")
else
t.weak_stem = gasub(t.weak_stem, "("..sa_utils.consonant..")f$", "%1r")
t.weak_stem = gasub(t.weak_stem, "$", "uv")
t.weak_stem = gasub(t.weak_stem, "("..sa_utils.vowel..sa_utils.consonant..")$", "%1y")
t.weak_stem = gasub(t.weak_stem, "("..sa_utils.consonant..sa_utils.consonant..")$", "%1iy")
end
end
args.set = true
make_forms(args, data, t, make_weak_forms_cons(t))
make_forms(args, data, t, make_weak_forms_vow(t))
-- Vedic rules from Whitney §798a (omitting y/r/l/v from the consonants
-- as r+r is not allowed and none of them are among Wh.'s examples)
if match(t.weak_stem, "$") then
args.set = false
if args.weak_lemma and match(args.weak_lemma, "<.*>$") then
t.weak_stem = gasub(args.weak_lemma, "^.*<(.*)>$", "%1")
end
make_forms(args, data, t, make_vedic_anit_forms(t))
end
end
end
end
})
local function legacy_split_stems(form)
return split(form, ",")
end
-- Gets stems for COMPLEX_FORM given a pattern in MATCH_RE
local function legacy_get_stem(complex_form, match_re)
local s = split_xs(complex_form)
if s ~= nil then return s end
return match(s, match_re)
end
-- Returns { stems, accents }
local function legacy_get_stems_from_lemmas(lemma, match_pattern, oxy_match_pattern)
local strong_lemmas = legacy_split_stems(lemma)
local strong_stems = {}
local oxys = nil
if oxy_match_pattern ~= nil then
oxys = {}
end
for i, strong_lemma in ipairs(strong_lemmas) do
local prov = split_xs(strong_lemma)
if oxy_match_pattern ~= nil then
oxys = match(prov, oxy_match_pattern)
end
strong_stems = legacy_get_stem(strong_lemma, match_pattern)
validate(strong_stems, strong_lemma)
end
return { strong_stems, oxys }
end
conj_data = {}
setmetatable(conj_data, {
-- TODO: this whole system needs to be removed
-- it's kept just so as to not break verbal entries which use this module, but non-finite forms
-- should now be part of the root derivations and not tied to the verbal conjugation
__call = function (self, args, data)
local make_strong_forms = function (oxy)
return {
= { "ya", "tavya" .. oxy, "anI" .. oxy .. "ya" },
= { "yA", "tavyA" .. oxy, "anI" .. oxy .. "yA" }
}
end
local make_weak_forms = function (oxy)
return {
= "tvA" .. oxy,
= "ta" .. oxy,
= "tA" .. oxy
}
end
local strong_stems = legacy_get_stems_from_lemmas(
args.strong_lemma,
"(.+)ya$",
"(" .. sa_utils.accent .. "?)"
)
for i, strong_stem in ipairs(strong_stems) do
make_forms(args, data, strong_stem, {
= "tum"
})
strong_stem = gsub(strong_stem, sa_utils.accent, "")
make_forms(args, data, strong_stem, make_strong_forms(strong_stems))
local ya_form = #(data.forms) - 2 -- TODO: This is not a great way of doing this
local prov = split_xs(legacy_split_stems(args.strong_lemma))
data.forms = prov
data.forms = match(prov, "(.+)a$") .. "A"
end
local weak_lemma = args.weak_lemma or args.passive_lemma
if weak_lemma == nil then
for i, strong_stem in ipairs(strong_stems) do
make_forms(args, data, gsub(strong_stem, sa_utils.accent, ""), make_weak_forms(strong_stems))
end
else
local weak_stems = legacy_get_stems_from_lemmas(
weak_lemma,
"(.+).a" .. sa_utils.accent .. "?$",
"a(" .. sa_utils.accent .. "?)$"
)
for i, weak_stem in ipairs(weak_stems) do
make_forms(args, data, weak_stem, make_weak_forms(weak_stems))
end
end
end
})
return conj_data