Module:ne-IPA

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

Nepali IPA pronunciation module. See {{ne-IPA}}.

Testcases

Module:ne-IPA/testcases:

1 of 54 tests failed. (refresh)

TextExpectedActualComments
test_phonetic:
Passedविवाह (vivāha)
Passedश्रावण (śrāwaṇ)
Passedहलो (halo)
Passedजहाज (jahāj)
Passedकार्य (kārya)
Passedपर्यो (paryo)
Passedविश्व (viśwa)
Passedअक्षर (akṣar)
Passedक्षेत्री (kṣetrī)
Passedत्यस (tyas)
Passedविश्व (viśwa)
Passedराज्य (rājya)
Passedअङ्ग्रेजी (aṅgrejī)
Passedपेय (peya)
Passedअन्तर्राष्ट्रिय (antarrāṣṭriya)dental assimilation
Passedसय (saya)non-initial ya before before consonants
Passedसत्य (satya)gemination of preceding consonant and replacement with e
Passedयस (yas)Initial ya replacement with e
Passedविश्वास (viśvās)w to b before certain vowels and glides
Passedविश्व (viśwa)
Passedवरिपरि (waripari)w elsewhere
Passedघरको (gharko)breathy vowel after voiced aspirates
Passedअर्थ (artha)
Passedअर्को (arko)
Passedतारा (tārā)tapped r intervocalically
Passedघोडा (ghoḍā)retroflex tap postvocalically
Passedडर (ḍar)ḍ elsewhere
Passedकस्को (kasko)
Passedकसको (kasko)
Passedलर्क (larka)turned v into schwa final syllable
Passedसम्म (samma)
Passedसंस्था (sansthā)
Passedरुची (rucī)
Passedहाम्रो (hāmro)
Passedबाह्र (bāhra)
Passedबाह्रखरी (bāhrakharī)
Passedबाह्य (bāhya)
Passedचर्चा (carcā)
Passedरचना (racanā)
Passedटर्रो (ṭarro)
Passedआर (ār)
Passedईर् (īr)
Passedरातो (rāto)
Failedउर (ura)
Passedदुई (duī)
Passedचप्पल (cappal)
Passedपक्का (pakkā)
Passedअस्ट्रेलिया (asṭreliyā)
Passedभिज़न (bhizan)
Passedऑस्ट्रेलिया (ŏsṭreliyā)
Passedॲप (ĕp)
Passedज़ू ()
Passedद़िस (ðis)
Passedथ़िक (θik)

local export = {}

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

local find = mw.ustring.find
local gcodepoint = mw.ustring.gcodepoint
local gmatch = mw.ustring.gmatch
local gsub = mw.ustring.gsub
local u = require("Module:string/char")

local correspondences = {
     = "ŋ",
     = "ɡ",
     = "t͡s",
     = "d͡z",
     = "t͡s",
     = "d͡z",
     = "n",
     = "ʈ",
     = "ɖ",
     = "ɳ",
     = "t̪",
     = "d̪",
     = "j",
     = "b",
     = "w",
     = "l",
     = "s",
     = "s",
     = "ɦ",
     = "ri",
     = "̃",
     = "",
     = "ː",
     = "",
     = ",",
     = "r",
     = "j̃",
     = "̃",
     = "ɽ",
     = "n",
     = "ʒ",
     = "z",
     = "ɣ",
     = "q",
     = "x",
     = "θ",
     = "ð",
     = "f",
     = "ɭ",
     = "ɹ",
     = "v",
     = "ʌ",
     = "ä",
     = "i",
     = "i",
     = "o",
     = "e",
     = "u",
     = "u",
     = "ʌi̯",
     = "ʌu̯",
     = "ɒ",
     = "æ",
     = "äu̯",
     = "äi̯",
     = "ʌ̃ĩ̯",
     = "ũ",
     = "ʌ̃ũ̯",
     = "õ",
     = "ʌ̃",
     = "ä̃",
     = "ẽ",
     = "ː",
     = "‿"
}

local vowels = "aāā̃ẽõiīuūi̯u̯e̞eī̃ū̃ĩoää̃ʌʌ̃ãũŏĕ̤"
local weak_h_c = "gjdḍd̪ṇɽbṛvrṟwy"
local primary_stress = "ˈ"
local secondary_stress = "ˌ"
local weak_h = "()h"
local aspirate = "()"
local syllabify_pattern = "(+)(+)(+)"

local function find_consonants(text)
    local current = ""
    local cons = {}
    for cc in gcodepoint(text .. " ") do
        local ch = u(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, phonetic)
    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

    if phonetic then
        translit = gsub(translit, "()()()", "%1%2̪%3") -- dental assimilation
        translit = gsub(translit, "()ṇ()", "%1ɳ%2")
        translit = gsub(translit, "()n()", "%1ɳ%2") -- retroflex assimilation 2nd
        translit = gsub(translit, "ṇ", "ʀ")
        translit = gsub(translit, "ॽ", "ʔ")
        translit = gsub(translit, "'", "ʔ")
        -- ɡlottal stop
        translit = gsub(translit, "(h?)r̥", "ɾi") -- hr̥ ligature initially
        translit = gsub(translit, "()kṣ", "%1k̚t͡sʰy") -- kṣ ligature
        translit = gsub(translit, "()kṣ", "t͡sʰ") -- kṣ initial
        translit = gsub(translit, "()h%1", "%1̤ː") -- h dropping
        translit = gsub(translit, "()h()", "%1%2̯")
        translit = gsub(translit, "()h()", "%1%2")
        translit = gsub(translit, "()h()", "%2̤ː")
        translit = gsub(translit, "()h()", "%1̤ː")
        translit = gsub(translit, "()h()", "%1%2")
        translit = gsub(translit, "()h()", "%1%2")
        translit = gsub(translit, "()h()", "%1(ɦ)%2")

        translit = gsub(translit, "()h()", "%1%2%2")
        translit = gsub(translit, "()hr()", "%1ɾ%2")
        translit = gsub(translit, "()hy()", "%1i̯y%2")
        translit = gsub(translit, "()()", "%1̻%2")
        translit = gsub(translit, "()()(h)", "s̠t̠ʰ")
        translit = gsub(translit, "()()(h)", "s̠d̠ʱ")
        translit = gsub(translit, "()()", "s̠t̠")
        translit = gsub(translit, "()()", "s̠d̠")
        translit = gsub(translit, "()()", "ɭ%2")
        translit = gsub(translit, "()(h?)()", "%1%2ɭ")
        translit = gsub(translit, "()(h?)()", "%1%2ɳ")
        translit = gsub(translit, "()(h?)()", "%1%2%3̪")
        translit = gsub(translit, "()()(?)()(?)", "%1%2̃%4̃")

        translit = gsub(translit, "()()()", "%1ɸ")
        translit = gsub(translit, "()()()", "%1k̞ʰ")
        translit = gsub(translit, "()()(?)", "%1ʐ")
        translit = gsub(translit, "()b(h?)()", "%1b%3")
        translit = gsub(translit, "()()()", "%1%2")
        translit = gsub(translit, "()g(h?)", "%1ɡ̞")
        translit = gsub(translit, "c(h?)c(h)", "t̚t͡sʰ")
        translit = gsub(translit, "cc", "t̚t͡s")
        translit = gsub(translit, "j(h?)j(h)", "d̚d͡zʱ")
        translit = gsub(translit, "jj", "d̚d͡z")
        translit = gsub(translit, "()(̪?)(?)(?)()(?)", "%1%2%3̚%4%5%6") -- no audible release
        translit = gsub(translit, "()ya", "%1e") -- ya to e before vowel
        translit = gsub(translit, "()ya", "%1(y)ʌ")
        translit =
            gsub(
            translit,
            "()()(̞?)(?)()a",
            "%1%2%2%4o"
        ) -- gemination of preceding consonant
        translit = gsub(translit, "()()()a", "%2o")
        translit =
            gsub(
            translit,
            "()()(̞?)(?)ya",
            "%1%2%2%4e"
        ) -- gemination of preceding consonant
        translit = gsub(translit, "()()ya", "%2e") -- no gemination
        translit = gsub(translit, "()ya", "e") -- ya to e
        translit = gsub(translit, "()ḍ(h?)(y?)", "%1ɽ%3") -- postvocalic allophone of ḍ and ḍh
        translit = gsub(translit, "()h()", "%1ʱ%2̤") -- breathy voice
        -- force final schwa
        translit = gsub(translit, "a~$", "ʌ")
        translit = gsub(translit, "a$", "ʌ") -- final schwa retention
        translit = gsub(translit, "(...)a ", "%1ʌ ") -- final schwa retenti
        translit = gsub(translit, "()r()", "%1ɾ%2")
        translit = gsub(translit, "m̐", "ːm")
    end
    local result = gsub(translit, ".", correspondences)

    translit = gsub(translit, "͠", "̃")
    ---translit = gmatch(translit, '^') and ('ˈ' .. gsub(translit, ' ', ' ˈ'))
    translit = gsub(translit, "(...)*$", "%1ʌ") -- second person mid-respect verb form
    translit = gsub(translit, "m̐", "m")
    translit = gsub(translit, "rr̥", "ri")
    translit =
        gsub(
        translit,
        "()()()()()",
        "%2w%4%5"
    )
    translit =
        gsub(
        translit,
        "()(?)(̃?)(?)()(̃?)(?)",
        "%1%2%3%4%5̯%6%7"
    )
    translit = gsub(translit, "()()̯̃", "ʌ̃%2̃")
    translit = gsub(translit, "()̃(?)()̯", "%1̃%2%3̯̃")
    translit = gsub(translit, "()(?)()̯(̃)", "%1̃%2%3̯%4")
    translit = gsub(translit, "%-", " ")
    translit = gsub(translit, "r̥", "ri")
    translit = syllabify(translit)

    -- aspiration rules
    translit = gsub(translit, aspirate .. "h", "%1ʰ")
    translit = gsub(translit, weak_h, "%1ʱ")
    translit = gsub(translit, "()%.h", ".%1ʱ")
    translit = gsub(translit, aspirate .. "%.h", ".%1ʰ")
    translit = gsub(translit, "%.ː", "ː.")

    local result = gsub(translit, ".", correspondences)

    -- formatting
    result = gsub(result, "ː̃", "̃ː")
    result = gsub(result, "ː.̃", "̃ː.")
    result = gsub(result, "()%1", "%1ː")
    result = gsub(result, "t̪͡s", "t͡s")
    result = gsub(result, "t̪̠", "t̠")
    result = gsub(result, "d̪̠", "d̠")
    result = gsub(result, "i̯̯", "i̯")
    result = gsub(result, "u̯̯", "u̯")
    result = gsub(result, "%. ", " ")
    result = gsub(result, "%.$", " ")
    result = gsub(result, "%.?%-", ".")
    result = gsub(result, "t̪̚t͡s", "t̚t͡s")
    result = gsub(result, "(̃)̃", "%1")
    result = gsub(result, "ĩ̯̯̃", "ĩ̯")
    result = gsub(result, "ĩ̯̯", "ĩ̯")
    result = gsub(result, "d̪̚d̪͡z", "d̚d͡z")
    result = gsub(result, "ʐʐ", "d̚d͡z")
    result = gsub(result, "ʐ", "(d)z")
    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 _, Nepali in ipairs(p) do
        table.insert(results, {pron = ""})
        if export.toIPA(Nepali) ~= export.toIPA(Nepali, true) then
        --table.insert(results, { pron = "" })
        end
    end

    return m_IPA.format_IPA_full { lang = lang, items = results }
end

return export