Module:dv-IPA

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

Dhivehi IPA pronunciation module. See {{dv-IPA}}.

Testcases

Module:dv-IPA/testcases:

1 of 1 test failed. (refresh)

TextExpectedActualDiffers atComments
test_all:
Passedކުރަނީ (kuranī)kuɾaniːkuɾaniː
Script error during testing: attempt to concatenate field '?' (a nil value)
stack traceback:
	: ?
	: in function 'v'
	mw.ustring.lua:84: in function 'gsub'
	Module:dv-IPA:48: in function 'to_IPA'
	Module:dv-IPA/testcases:11: in function 'func'
	Module:UnitTests:313: in function 'iterate'
	Module:dv-IPA/testcases:26: in function <Module:dv-IPA/testcases:17>
	(tail call): ?
	(tail call): ?
	: in function 'xpcall'
	...
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	: ?
	: in function 'expandTemplate'
	mw.lua:333: in function <mw.lua:307>
	(tail call): ?
	(tail call): ?
	Module:documentation:1043: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	: ?

local export = {}

local lang = require("Module:languages").getByCode("dv")
local sc = require("Module:scripts").getByCode("Thaa")
local m_IPA = require("Module:IPA")
local gsub = mw.ustring.gsub

local consonants = {
	 = 'h',  = 'ʂ',  = 'n',  = 'ɾ',  = 'b',
	 = 'ɭ',  = 'k',  = '',  = 'v',  = 'm',
	 = 'f',  = 'd̪',  = 't̪',  = 'l',  = 'ɡ',
	 = 'ɲ',  = 's',  = 'ɖ',  = 'z',  = 'ʈ',
	 = 'j',  = 'p',  = 'd͡ʒ',  = 't͡ʃ',  = 'ɳ',
	 = 's',  = 'h',  = 'x',  = 'z',  = 'z',
	 = 'ʃ',  = 's',  = 'd̪',  = 't̪',  = 'z',
	 = '',  = 'ɡ',  = 'k',  = 'ʋ',
}

-- this controls prenasalized stop digraphs consisting of ނ and a voiced stop
local prenasal = {
	 = 'ᵐ',
	 = 'ⁿ',  = 'ⁿ',
	 = 'ⁿ',
}

local vowel_diacritics = {
	 = 'a',  = 'aː',  = 'i',   = 'iː',   = 'u',   = 'uː',
	 = 'e',  = 'eː',  = 'o',  = 'oː',
	 = ''		-- virama
}

local other = {
}

local adjust1 = {
}

local adjust2 = {
	='t̚t͡ʃ', ='d̚d͡ʒ', ='n̠ʲd͡ʒ',
}

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

function export.to_IPA(text)
	
	text = gsub(
		text,
	   "()(?)",
		function(c, d)
			return consonants .. vowel_diacritics
		end)

	for k, v in pairs(adjust1) do
		text = gsub(text, k, v)
	end

	-- If an independent vowel is after another vowel, assume diphthong
	text = gsub(text, "(ː?)•", "%1")
	text = gsub(text, '.', other)

	-- Phonetic transcription
	text2 = text
	for k, v in pairs(adjust2) do
		text2 = gsub(text2, k, v)
	end

	return (text == text2 and { text } or { text, text2 })

end

function export.show(frame)
	local args = frame:getParent().args
	local page_title = mw.title.getCurrentTitle().text
	local text = args or page_title
	local qualifier = args or nil

	local transcriptions = export.to_IPA(text)
	local IPA_text
	if not transcriptions then
		IPA_text = m_IPA.format_IPA_full {
			lang = lang,
			items = {{ pron = "/" .. transcriptions .. "/" }},
		}
	else
		IPA_text = m_IPA.format_IPA_full {
			lang = lang,
			items = {{ pron = "/" .. transcriptions .. "/" }, { pron = " .. "]" }},
		}
	end

	return "* " .. (qualifier and require("Module:qualifier").format_qualifier{qualifier} .. " " or "")
		.. IPA_text
end

return export