Module:Typing-aids/data/sa

local data = {}

local U = mw.ustring.char

local anusvAra = U(0x902) local visarga = U(0x903) local virAma = U(0x94D) local avagraha = "ऽ" local consonants = "कखगघङचछजझञटठडढणतथदधनपफबभमयरलवशषसह" local consonant = "[" .. consonants .. "]"

local acute = U(0x301)		-- combining acute

data["sa"] = { [1] = {		["ai"] = "ऐ", ["au"] = "औ", },	[2] = {		["ḹ"] = "ॡ", ["ṃ"] = anusvAra, ["ḥ"] = visarga, ["kh"] = "ख", ["gh"] = "घ", ["ṅ"] = "ङ", ["ch"] = "छ", ["jh"] = "झ", ["ñ"] = "ञ", ["ṭh"] = "ठ", ["ḍh"] = "ढ", ["ṇ"] = "ण", ["th"] = "थ", ["dh"] = "ध", ["n"] = "न", ["ph"] = "फ", ["bh"] = "भ", ["m"] = "म", ["y"] = "य", ["r"] = "र", ["l"] = "ल", ["v"] = "व", ["ś"] = "श", ["ṣ"] = "ष", ["s"] = "स", },	[3] = {		["a"] = "अ", ["ā"] = "आ", ["i"] = "इ", ["ī"] = "ई", ["u"] = "उ", ["ū"] = "ऊ", ["e"] = "ए", ["o"] = "ओ", ["ṝ"] = "ॠ", ["ḷ"] = "ऌ", ["k"] = "क", ["g"] = "ग", ["c"] = "च", ["j"] = "ज", ["ṭ"] = "ट", ["ḍ"] = "ड", ["t"] = "त", ["d"] = "द", ["n"] = "न", ["p"] = "प", ["b"] = "ब", ["h"] = "ह", },	[4] = {		["ṛ"] = "ऋ", ["[%-/]"] = "",		-- a-i, a-u for अइ, अउ ["'"] = avagraha, ["(" .. consonant .. ")" .. "(" .. consonant .. ")"] = "%1" .. virAma .. "%2",		["(" .. consonant .. ")$"] = "%1" .. virAma, [acute] = "", },	[5] = { -- this rule must be applied twice because a consonant may only be in one caoture per operation, so "CCC" will only recognize the first two consonants ["(" .. consonant .. ")" .. "(" .. consonant .. ")"] = "%1" .. virAma .. "%2",	},	[6] = {	-- This table is filled below }, }

local vowels = { ["अ"] = "", ["इ"] = U(0x93F), ["उ"] = U(0x941), ["ऋ"] = U(0x943), ["ऌ"] = U(0x962), ["ए"] = U(0x947), ["ओ"] = U(0x94B), ["आ"] = U(0x93E), ["ई"] = U(0x940), ["ऊ"] = U(0x942), ["ॠ"] = U(0x944), ["ॡ"] = U(0x963), ["ऐ"] = U(0x948), ["औ"] = U(0x94C), }

for independentForm, diacriticalForm in pairs(vowels) do data["sa"][6]["(" .. consonant .. ")" .. independentForm] = "%1" .. diacriticalForm end

-- Harvard-Kyoto to International Alphabet of Sanskrit Transliteration data["sa-tr"] = { [1] = {		["A"] = "ā", ["I"] = "ī", ["U"] = "ū", ["J"] = "ñ", ["T"] = "ṭ", ["D"] = "ḍ", ["N"] = "ṇ", ["G"] = "ṅ", ["z"] = "ś", ["S"] = "ṣ", ["M"] = "ṃ", ["H"] = "ḥ", ["lRR"] = "ḹ", ["/"] = acute, },	[2] = {		["lR"] = "ḷ", ["RR"] = "ṝ", },	[3] = {		["R"] = "ṛ", }, }

return data