Note: ç and ʐ are t͡s and d͡z
ʣin ʦil çʌ çʰʌ ʐʌ ʐʱʌ ī ū iː uː bud̪̚d̪ʱʌm t̪ʰʌ d̪ʱʌ pʰʌ ɛʈ ænɖ ɛnɖ lɑʈ.ri bi.bä̤ː sräwʌɳ ɦʌlo çʰäːɾä çʌ.ɾä ʐäːʐ kärːe pʌɾ.jo bisːo ʌkçʰer ʌk̚çʰer çʰet̪ri t̪es bisːo räʐʐe ʌu̯sʌdi mʌu̯sʌdi mʌi̯le ʌ̃ũ̯sʌdi mʌ̃ĩ̯ mʌ̃ũ̯
जिन् चिल् ज् च् च छ ज झ ई ऊ ई ऊ बुद्धम् थ ध फ ऍट् ऍन्ड् ऍन्ड् लॉट्रि बिबाः स्राओण् हलो छाःरा चरा जाःज् कार्रे पर्यो बिस्सो अक्छेर् अक्छेर् छेत्रि तेस् बिस्सो राज्जे औसदि मौसदि मैले औंसदि मैं मौं
local gmatch = mw.ustring.gmatch
local gsub = mw.ustring.gsub
local match = mw.ustring.match
local sub = mw.ustring.sub
local u = require("Module:string/char")
local export = {}
local c = {
= {
='क', ='ग', ='ख', ='घ', ='ङ',
='ञ', ='च', ='ज', ='छ', ='झ',
='च', ='ज', ='छ', ='झ',
='ट', ='ड', ='ठ', ='ढ', ='ण',
='त', ='द', ='थ', ='ध', ='न', ='न',
='ल', ='त', ='द', ='थ', ='ध',
='प', ='ब', ='फ', ='भ', ='म',
='य', ='र', ='ल', ='व', ='व', ='श',
='ष', ='स', ='ज़', ='ह', ='ॹ',
='ड', ='ढ', ='फ', ='फ', ='ख़',
='ब', ='ग', ='ग', ='ख', ='र',
='', ='', ='', ='च्च', ='ज्ज',
='च्छ', ='ज्झ', ='ळ',
='आ', ='इ', ='ई', ='उ', ='ऊ',
='ए', ='ओ', ='ऑ', ='ऍ',
='ऑ', ='ऍ', ='औ', ='ऐ',
='अ',
='आँ', ='इँ', ='ईं', ='उँ', ='ऊँ',
='एँ', ='ओं', ='औं', ='ऐं',
='अँ', ='ँः', ='आँः',
-- chandrabindu
='ँ',
-- visarga
='ः', ='', ='',
= "",
},
}
local v = {
= {
= "", = "ा",
= "ि", = "ी",
= "ु", = "ू",
= "े",
= "ँ", = "ाँ", = "ाँः", ='ँः',
= "िं", = "ीं",
= "ुुँ", = "ूूँ",
= "ेें", = "ॅ", = "ॅ",
= "ो", = "ों", = "ॉ", = "ॉ",
= "", = "ौ", = "ै", = "ौं", = "ैैं",
},
}
local s = {
= {
= "०", = "१", = "२", = "३", = "४",
= "५", = "६", = "७", = "८", = "९",
= "", = "।", = "",
},
}
local join = {
= "्",
}
local kill = {
= "्",
}
local nukta = u(0x09bc) -- Just list all those used here.
local function return_error(text)
return error(("Unrecognised part: \"%s\""):format(text))
end
function export.tr(text, script, options)
if type(text) == "table" then
options = {}
text, script = text.args, text.args
end
local easy_syllable_pattern =
"^(*)()(̃?)("..kill.."?)$"
text = gsub(text, "", s)
-- Compose patterns for processing onsets.
local letter = "..nukta.."]?"
local letter_pair = "("..letter..")("..letter..")"
for word in gmatch(text, "+") do
local word_conv, orig_word = {}, word
word = gsub(word, "(ṃ?)", "%1 ")
word = gsub(word, " $", "")
for syllable in mw.text.gsplit(word, " ") do
if not match(syllable, "$") then
syllable = syllable .. "ʌ" .. kill
end
syllable = gsub(syllable, easy_syllable_pattern,
function(onset, vowel, coda, optJoin)
if onset == "" then
onset = vowel
vowel = ""
end
if not c then
onset = gsub(onset, ".ʰ", c)
onset = gsub(onset, ".ʱ", c)
onset = gsub(onset, ".͡", c)
onset = gsub(onset, "..ʱ", c)
onset = gsub(onset, "..ʰ", c)
onset = gsub(onset, ".", c)
-- Join pairs of consonants
onset = gsub(onset, letter_pair, "%1"..join.."%2")
-- Join adjacent consonants that were in different pairs.
onset = gsub(onset, letter_pair, "%1"..join.."%2")
else
onset = c
end
return onset .. (v or return_error(vowel)) .. c .. optJoin
end)
table.insert(word_conv, syllable)
end
word = table.concat(word_conv, "")
word = gsub(word, "इः्", "ई")
word = gsub(word, "उः्", "ऊ")
word = gsub(word, "ः्", "ः")
word = gsub(word, "िः्", "ी")
word = gsub(word, "ुः्", "ू")
word = gsub(word, "त्स्ʰ", "छ")
word = gsub(word, "द्ज़््", "ज्")
word = gsub(word, "अउ̯", "औ")
word = gsub(word, "अइ̯", "ऐ")
word = gsub(word, "उ̯", "ौ")
word = gsub(word, "इ̯", "ै")
word = gsub(word, "अँइँ̯", "ऐं")
word = gsub(word, "अँउँ̯", "औं")
word = gsub(word, "ँइँ̯", "ैं")
word = gsub(word, "ँउँ̯", "ौं")
word = gsub(word, "ॺ", "ढ़")
word = gsub(word, "()्ः", "%1्%1")
word = gsub(word, "()(्)य()", "%1े%3")
word = gsub(word, "(?)य()", "%1ए%2")
word = gsub(word, "()य$", "%1ए")
word = gsub(word, "(?)व()", "%1ओ%2")
word = gsub(word, "()(्)व()", "%1ो%3")
word = gsub(word, "ड़््", "ड़्")
text = gsub(text, orig_word, word, 1)
end
return text
end
return export