Module:gu-IPA/sandbox

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

Gujarati IPA pronunciation module. See {{gu-IPA}}.

Testcases

Module:gu-IPA/sandbox/testcases:

16 of 23 tests failed. (refresh)

TextExpectedActualComments
test_all:
Passedવખત (vakhat)ˈʋə.kʰət̪ˈʋə.kʰət̪
Passedદિવસ (divas)ˈd̪ɪ.ʋəsˈd̪ɪ.ʋəs
Passedહદ (had)ˈɦəd̪ˈɦəd̪
Failedરહેવું (rahevũ)ˈre̤.ʋũˈɾə.ɦeː.ʋũ
Passedતડકો (taḍko)ˈt̪əɖ.koˈt̪əɖ.ko
Passedભાષા (bhāṣā)ˈbʱɑ.ʃɑˈbʱɑ.ʃɑ
Failedછોકરું (chokrũ)ˈt͡ʃʰok.rũˈt͡ʃʰok.ɾũ
Passedઘોડું (ghoḍũ)ˈɡʱo.ɖũˈɡʱo.ɖũ
Failedદૃષ્ટિ (dŕṣṭi)ˈd̪rəʂʈiˈd̪ɾʊʂʈɪ
Failedદૃષ્ટિ (dŕṣṭi)ˈd̪rʊʂʈiˈd̪ɾʊʂʈɪ
Failedગુજરાતી (gujrātī)ˈgʊ.d͡ʒ(ə).ˌɾɑ.t̪iˈɡud͡ʒ.ɾɑ.t̪i
Passedપ્રાણી (prāṇī)ˈpɾɑ.ɳiˈpɾɑ.ɳi
Failedસાક્ષાત (sākṣāt)ˈsɑ.kʃɑt̪ˈsɑk.ʃɑt̪
Failedજમવાનું (jamvānũ)ˈd͡ʒəm.ˌʋɑ.nũˈd͡ʒəm.ʋɑ.nũ
Failedવિધર્મ (vidharma)ʋɪ.d̪ʱəɾ.məˈʋɪ.d̪ʱəɾ.mə
Failedઅંગરખો (aṅgarkho)ˈəŋ.gəɾ.kʱoˈəŋ.ɡəɾ.kʰo
Failedઆંતરરાષ્ટ્રીય (āntarrāṣṭrīya)ˈɑn̪.t̪əɾ.ɾɑʂ.ʈɾi.jəˈɑn.t̪əɾ.ɾɑʂ.ʈɾi.jə
Failedઆંકડાશાસ્ત્ર (ā̃kaḍāśāstra)ˈɑ̃.k(ə).ɖɑ.ʃɑs.t̪ɾəˈɑ̃.kə.ɖɑ.ʃɑs.t̪ɾə
Failedઅહીંતહીં (ahī̃thī̃)ˈə̤ĩ.ˌt̪ə̤ĩˈə.ɦĩ.t̪ʰĩ
Failedઐતિહાસિક (aitihāsik)əɪ̭.t̪ɪ.ɦɑ.sɪkˈəɪ.t̪ɪ.ɦɑ.sɪk
Failedઇસ્પિતાલ (ispitāl)ˈɪs.pɪ.ˌt̪ɑlˈɪs.pɪ.t̪ɑl
Failedઉષ્ણાગ્ર (uṣṇāgra)ˈʊʃ.ɳɑ.gɾəˈuʃ.ɳɑɡ.ɾə
Failedઓળખકર્તા (oḷkhakartā)ˈo.ɭəkʱ.ˌkəɾ.t̪ɑˈo.ɭkʰə.kəɾ.t̪ɑ

local export = {}

local lang = require("Module:languages").getByCode("gu")
local sc = require("Module:scripts").getByCode("Gujr")
local m_IPA = require("Module:IPA")

local gsub = mw.ustring.gsub
local gmatch = mw.ustring.gmatch
local find = mw.ustring.find

local correspondences = {
     = "ŋ",  = "ɡ", 
     = "t͡ʃ",  = "d͡ʒ",  = "ɲ",
     = "ʈ",  = "ɖ",  = "ɳ",
     = "t̪",  = "d̪",
     = "j",  = "ɾ",  = "ʋ",  = "l̪",
     = "ʃ",  = "ʂ",  = "ɦ",
     = "ɭ",  = "f",  = "ɣ",  = "ð",  = "β", 
     = "ɽ",

     = "ə",  = "ɑ",  = "ɪ",
     = "i",  = "o",  = "eː",  = "ɾʊ",
     = "u",  = "u",  = "ɔ",  = "ɔ",  = "ɛ",  = "æ",
     = "ə̤",  = "a̤",  = "i̤",  = "ṳ",   = "ɛ̤",  = "ɔ̤", 
     = "om",  = "ʰ",
     = "‿ˈ", -- get rid of spaces
}

local surati= {
	 = "ɦ",
}

local vowels = "aāiīuūoɔɛeæãā̃ẽĩī̃õũū̃ː"
local weak_h = "()h"
local aspirate = "()"
local syllabify_pattern = "()(+)()"

local function find_consonants(text)
	local current = ""
	local cons = {}
	for cc in mw.ustring.gcodepoint(text .. " ") do
		local ch = mw.ustring.char(cc)
		if find(current .. ch, "^$") or find(current .. ch, "^h$") then
			current = current .. ch
		else
			table.insert(cons, current)
			current = ch
		end
	end
	return cons
end

local function syllabify(text)
	for count = 1, 2 do
		text = gsub(text, syllabify_pattern, function(a, b, c)
			b_set = find_consonants(b)
			table.insert(b_set, #b_set > 1 and 2 or 1, ".")
			return a .. table.concat(b_set) .. c end)
	end
	return text
end

local identical = "knlsfzθ"
for character in gmatch(identical, ".") do
	correspondences = character
end

local function transliterate(text)
	return (lang:transliterate(text))
end

function export.link(term)
	return require("Module:links").full_link{ term = term, lang = lang, sc = sc }
end

function export.toIPA(text)
	local result = {}
	local translit = text
	if lang:findBestScript(text):isTransliterated() then
		translit = transliterate(text)
	end
	if not translit then
		error('The term "' .. text .. '" could not be transliterated.')
	end
	
	local translit = gsub(translit, "͠", "̃")
	local translit = gsub(translit, "%-", ".")
	local translit = gsub(translit, "ṣ()", "ś%1")
	
    local translit = syllabify(translit)
    local translit = gsub(translit, 'jñ', 'gy')
    local translit = gsub(translit, aspirate .. "h", '%1ʰ')
    local translit = gsub(translit, weak_h, '%1ʱ')
	local translit = gsub(translit, "%.ː", "ː.")
	
	for character in gmatch(translit, ".") do
		table.insert(result, correspondences or character)
	end
	
	result = table.concat(result)
	local result = gsub(result, "ː̃", "̃ː")

	result = gsub(result, "%.‿", "‿")
    
	return "ˈ" .. result
end

function export.make(frame)
	local args = frame:getParent().args
	local pagetitle = mw.title.getCurrentTitle().text
	
	local p, results = {}, {}
	
	if args then
		for index, item in ipairs(args) do
			table.insert(p, (item ~= "") and item or nil)
		end
	else
		p = { pagetitle }
	end
	
	for _, Gujarati in ipairs(p) do
		table.insert(results, export.toIPA(Gujarati))
	end
	
	return m_IPA.format_IPA_full { lang = lang, items = {{ pron = "/" .. table.concat(results, "/, /") .. "/" }}, }
end

return export