Module:hi-convert

Hello, you have come here looking for the meaning of the word Module:hi-convert. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:hi-convert, but we will also tell you about its etymology, its characteristics and you will know how to say Module:hi-convert in singular and plural. Everything you need to know about the word Module:hi-convert you have here. The definition of the word Module:hi-convert will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:hi-convert, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

Introduction

This module transliterates Hindi (Devanagari) texts into the Urdu (Perso-Arab) script. It intends to transliterate lemmas, how they are written in Devanagari, for instance: नज़र (nazar) ➞ نَزَر, instead of نَظَر (naz̤ar), as it is impossible to correctly associate foreign Urdu letters.

Sanskrit Retroflex letters

Compound letters have been made to represent Sanskrit letters, sounds which are not natively found in Hindi or Urdu, thus are not recognised in Urdu. These are all Retroflex sounds, and such sounds are indicated in Urdu with a small tah, and the same case has been applied here, with the corresponding non-Retroflex Urdu letters. These letters are:

  • (ṣa) ➞ شَؕ
  • (ṇa) ➞ ݨَ
  • () ➞ ࣇ

Tests

ॐ त्र्यम्बकं यजामहे सुगन्धिं पुष्टिवर्धनम् । उर्वारुकमिव बन्धनान् मृत्योर् मुक्षीय माऽमृतात् ॥ कः खगौघाङचिच्छौजा झाञ्ज्ञोऽटौठीडडण्ढणः। तथोदधीन् पफर्बाभीर्मयोऽरिल्वाशिषां सहः॥

Example

उर्दू भाषा हिन्द आर्य भाषा है। उर्दू भाषा हिन्दुस्तानी भाषा की एक मानकीकृत रूप मानी जाती है। उर्दू में संस्कृत के तत्सम शब्द न्यून हैं और अरबी-फ़ारसी और संस्कृत से तद्भव शब्द अधिक हैं। ये मुख्यतः दक्षिण एशिया में बोली जाती है। यह भारत की शासकीय भाषाओं में से एक है तथा पाकिस्तान की राष्ट्रभाषा है। इस के अतिरिक्त भारत के राज्य जम्मू और कश्मीर की मुख्य प्रशासनिक भाषा है। साथ ही तेलंगाना, दिल्ली, बिहार और उत्तर प्रदेश की अतिरिक्त शासकीय भाषा है।

local export = {}
local gsub = mw.ustring.gsub
local match = mw.ustring.match
local sub = mw.ustring.sub
local cons = "ببپتثجچحخدذرزژسشصضطظعغفقکگلࣇمنݨویہھٹڈڑ"
local cons5 = "ببپتثجچحخدذرزژسشصضطظعغفقکگلࣇمنݨوہھٹڈڑ"
local cons3 = "ھ"
local vowels = "ایئےۓوؤآ"
local ZZP = "َُِ"
local conv = {
		 = "ک",  = "کھ",  = "گ",  = "گھ",  = "ن", 
		 = "چ",  = "چھ",  = "ج",  = "جھ",  = "ڃ", 
		 = "ٹ",  = "ٹھ",  = "ڈ",  = "ڈھ",  = "ݨ", 
		 = "ت",  = "تھ",  = "د",  = "دھ",  = "ن", 
		 = "پ",  = "پھ",  = "ب",  = "بھ",  = "م", 
		 = "+ی+",  = "ر",  = "ل",  = "+و+",  = "ࣇ", 
		 = "ش",  ="شؕ",  = "س",  = "ہ", 
 = 'ق',  = 'خ',  = 'غ',  = 'ࣇ',
	 = 'ز',  = 'ࣇ',  = 'ژ',  = 'ژ',  = 'ڑ',  = 'ڑھ',
	 = 'ف',  = 'ث',  = 'ن',  = 'ر',
	--  = 'گْی',
	
		 = "اَ",  = "آ",  = "اِ",  = "اِی",  = "اُ",  = "اُو",  = "ر",  = "ر",
		 = "ل",  = "ل",  = "ای",  = "اَی",  = "او",  = "اَو", 
  = "آ", 
  = "ای", 
  = "آ", 
  = "ای",
		
 = "ا",  = "ِ",   = "ِی", 
 = "ُ",  = "ُو",
 = "ر", 
 = "ر", 
 = "ل",
 = "ل", 
 = "ی",
 = "َی",
 = "و", 
 = "َو",
 = "‍ا",
 = "ی", 
 = "آ", 
 = "ای",
 = "ْ", 
	
		 = "ں",
  = "ں",  = "ہ",  = "",

		 = "٠",  = "١",  = "٢",  = "٣",  = "٤",  = "٥",  = "٦",  = "٧",  = "٨",  = "٩",
	        
	     = " ",  = "۔",
  = "؟",  = ":",
  = "؛",  = "٪",   = "،",  = "!", 
	    
	     = "خ",  = "ف",
    
		 = "اوم",
    	
    	 = "*",
	 = '.',
}

local nasal_assim_short = {
	 = 'ङ्',  = 'ङ्',  = 'ङ्',  = 'ङ्',  = 'ङ्',
	 = 'ञ्',  = 'ञ्',  = 'ञ्',  = 'ञ्',  = 'ञ्',  
	 = 'ण्',  = 'ण्',  = 'ण्',  = 'ण्',  = 'ण्',
	 = 'न्',  = 'न्',  = 'न्',  = 'न्',  = 'न्',
	 = 'म्',  = 'म्',  = 'म्',  = 'म्',  = 'म्',
	 = 'म्',  = 'ँ',  = 'न्',  = 'न्',  = 'न्',
	 = 'ँ'
}

local nasal_assim_long = {
	 = 'ँ',  = 'ँ',  = 'ङ्',  = 'ङ्',  = 'ङ्',
	 = 'ँ',  = 'ँ',  = 'ञ्',  = 'ञ्',  = 'ञ्',  
	 = 'ँ',  = 'ँ',  = 'ण्',  = 'ण्',  = 'ण्',
	 = 'न्',  = 'न्',  = 'न्',  = 'न्',  = 'न्',
	 = 'ँ',  = 'ँ',  = 'म्',  = 'म्',  = 'म्',
	 = 'ँ'
}

-- These clusters when occurring word-finally will not trigger a schwa added
-- after them even though the second consonant is in special_cons, which normally
-- causes the extra schwa to be added. NOTE: The clusters are reversed from their
-- ultimate effect, e.g. the first cluster is written 'ml' but actually applies
-- to words ending in 'lm'. The clusters below overall refer to the six clusters
-- describable by , i.e. rm, rn, rv, lm, ln, lv.
local perm_cl = {
	 = true,  = true,  = true,
	 = true,  = true,  = true,
}

local all_cons, special_cons = 'कखगघङचछजझञटठडढतथदधपफबभशषसयरलवहणनम', 'यरलवहनम'
local vowel, vowel_sign = '*َaिुृेोाीूैौॉॅॆॊ\'', 'अइउएओआईऊऋऐऔऑऍ\''
local long_vowel, short_vowel = 'ाीूआईऊ', '*َaिुृॉॅॆॊअइउऋऑऍोैौेओऔएऐ\''
local syncope_pattern = '()(़?)َ(़?)(?)'

local function rev_string(text)
	local result, length = {}, mw.ustring.len(text)
	for i = length, 1, -1 do
		table.insert(result, sub(text, i, i))
	end
	return table.concat(result)
end

function export.tr(text, lang, sc)
	--force word-final anusvara to behave as a pure nasal
	text = gsub(text, 'ं$', 'ں')
	text = gsub(text, 'ं ', 'ں ')
	text = gsub(text, 'ं%-', 'ں-')
    text = gsub(text, 'ं%।', 'ں۔')
    text = gsub(text, 'ं%,', 'ں،')
	--abbreviation dot
	text = gsub(text, '॰', '.')
	text = gsub(text, '(़?)(?)', function(c, d)
		return c .. (d == "" and 'َ' or d) end)
	for word in mw.ustring.gmatch(text, "+") do
		local orig_word = word
		word = rev_string(word)
		word = gsub(word, '^َ(़?)()(.)(.?)', function(opt, first, second, third)
			return (((match(first, '') and match(second, '्') and not perm_cl)
				or match(first .. second, 'य'))
				and 'ا' or "") .. opt .. first .. second .. third end)
		while match(word, syncope_pattern) do
			word = gsub(word, syncope_pattern, '%1%2%3%4')
		end
		word = rev_string(word)
		--sometimes chandrabindu != anusvara
		word = gsub(word, '()ं()', function(prev, succ)
			return prev .. (nasal_assim_short or "ن") .. succ
		end)
		word = gsub(word, '()ँ()', function(prev, succ)
			return prev .. "ن" .. succ
		end)
		--force chandrabindu to behave as anusvara
		word = gsub(word, 'ँ', 'ं')
		word = gsub(word, '()ं(.़?)', function(prev, succ)
			return prev .. (nasal_assim_short or "ن") .. succ
		end)
		word = gsub(word, '()ं(.़?)', function(prev, succ)
			return prev .. (nasal_assim_long or "ن") .. succ
		end)
		-- Convert * to %* so we can match it in a regex.
		local escaped_orig_word = gsub(orig_word, "%*", "%*")
		text = gsub(text, escaped_orig_word, word)
	end
	text = gsub(text, '.़?', conv)
    text = gsub(text, 'جْڃ', 'گْی')
    text = gsub(text, 'ڃز', 'نز')
    text = gsub(text, '%*', 'ا')
text = gsub(text, "ک़", "ق")
text = gsub(text, "کھ़", "خ")
text = gsub(text, "گ़", "غ")
text = gsub(text, "پھ़", "ف")
text = gsub(text, "ج़", "ز")
text = gsub(text, "جھ़", "ژ")
text = gsub(text, "ش़", "ژ")
text = gsub(text, "ڈ़" ,"ڑ")
text = gsub(text, "ڈھ़" ,"ڑھ")
text = gsub(text, "()ی$", "%1ے")
text = gsub(text, "()(ْ)%1" ,"%1ّ") 
text = gsub(text, "()اِ", "%1ئِ")
text = gsub(text, "()اُ", "%1ءو")
text = gsub(text, "()ای", "%1ئے")
text = gsub(text, "()اِی", "%1ئی")
text = gsub(text, "()اُو", "%1ؤ")
text = gsub(text, "()(َ)ی$", "%1َے")
text = gsub(text, "()ی ", "%1ے ")
text = gsub(text, "()(َ)ی ", "%1َے ")
text = gsub(text, "()ی۔", "%1ے۔")
text = gsub(text, "()(َ)ی۔", "%1َے۔")
text = gsub(text, "()ی،", "%1ے،")
text = gsub(text, "()(َ)ی،", "%1َے،")

text = gsub(text, "()(ِ)$", "%1ی")
text = gsub(text, "()(ُ)$", "%1و")
text = gsub(text, "()(ِ) ", "%1ی ")
text = gsub(text, "()(ُ) ", "%1و ")
text = gsub(text, "()(ِ)۔", "%1ی۔")
text = gsub(text, "()(ُ)۔", "%1و۔")
text = gsub(text, "()(ِ)،", "%1ی،")
text = gsub(text, "()(ُ)،", "%1و،")
text = gsub(text, "()او", "%1ؤ")
text = gsub(text, "+", "")
text = gsub(text, "()()", "%2%1")
text = gsub(text, "ئِی", "ئی")
	return mw.ustring.toNFC(text)
end

return export