Module:tr-IPA

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


local export = {}

local modIPA = require("Module:IPA")
local lang = require("Module:languages").getByCode("tr")

local phonemes = {
     = "dʒ",
     = "tʃ",
     = "ɡ",
     = "ɟ",
     = "",
     = "(j)",
     = "ɯ",
     = "ʒ",
     = "c",
     = "ɫ",
     = "l",
     = "ø",
     = "(ʔ)",
     = "ɾ",
     = "ʃ",
     = "y",
     = "j",
     = "a",
     = "i",
     = "u",
     = "ˈ",
     = "ː"
}

local voiced = {
     = "c",
     = "ğ",
     = "b",
     = "d"
}

function export.main(frame)
    local args = require("Module:parameters").process(frame:getParent().args, {
         = {list = true, allow_holes = true},
         = {list = true, allow_holes = true, allow_empty = false},
         = {list = true, allow_holes = true, allow_empty = false, alias_of = "qual"},
         = {list = true, allow_holes = true, allow_empty = false},
         = {list = true, allow_holes = true, allow_empty = false, alias_of = "nostress"}
    })
    
    local words = args
    if #words == 0 or words == "" then
        words = mw.ustring.lower(mw.title.getCurrentTitle().text)
    end
    
    local IPA = {}

    local function transcribe(value, isUnstressed)
        local C = "bcçdfgGğhjkKlLmnpqrsştvyz" --consonants
        local V = "aeıioöuüâîû" --vowels

        value = mw.ustring.gsub(mw.ustring.gsub(value, "çç", "tç"), "cc", "dc") .. "/" --deal with double affricates
        value = mw.ustring.gsub(value, "()%*", function(x) return mw.ustring.upper(x) end) --deal with unpredictable palatalization
        value = mw.ustring.gsub(value, "(%(?:?%)?-)(?%f)", "%1.%2") --add syllable divisors
        value = mw.ustring.gsub(value, "()()", "%1.%2") --add syllable divisors between consecutive vowels
        value = mw.ustring.gsub(value, "**", function(x) return mw.ustring.gsub(x, "", function(y) return mw.ustring.upper(y) end) end) --deal with predictable palatalization
        value = mw.ustring.gsub(value, "()()", "%1:%2") --deal with circumflexed vowels' length
        value = mw.ustring.gsub(value, "()", ":%1") --yumuşak ge lengthening
        value = mw.ustring.gsub(value, "()()", "%2%1%2") --dorsal assimilation of g
        value = mw.ustring.gsub(value, "()()", "%2%1%2") --dorsal assimilation of k
        value = mw.ustring.gsub(value, "l()L", "L%1L") --palatal assimilation of l
        value = mw.ustring.gsub(value, "L()l", "L%1L")
        if not mw.ustring.find(value, "'") and not isUnstressed then --add final stress if not otherwise specified
            if not mw.ustring.find(value, "%s") or mw.ustring.find(mw.ustring.match(value, "%s(.+)"), "%.") then
                value = mw.ustring.gsub(value, "%.?(+)$", "'%1")
            else
                value = mw.ustring.gsub(value, "%s(.+)$", " '%1")
            end
        end
        value = "/" .. mw.ustring.gsub(value, ".", phonemes) --IPA transcription

        return value
    end

    for i, word in ipairs(words) do
        local quals = args.qual
        local stress = args.nostress

        if mw.ustring.find(word, "") then
            IPA = {pron = word, q = {quals}}
        else
            local term, isAcc, accVowel = mw.ustring.match(word, "^(.-)(?)(?)$")

            if term == "" then
                term = mw.title.getCurrentTitle().text
            end

            term = mw.ustring.gsub(mw.ustring.lower(mw.ustring.gsub(term, "I", "ı")), "i̇", "i")

            if mw.ustring.match(isAcc, "") then
                local acc
                IPA = {pron = transcribe(term, stress), q = {quals}}

                if mw.ustring.match(isAcc, "%+") then --accusative form
                    acc = mw.ustring.sub(term, 1, -2) .. ":" .. mw.ustring.sub(term, -1) .. accVowel
                elseif mw.ustring.match(isAcc, "%-") then
                    acc = mw.ustring.sub(term, 1, -2) .. ":" .. voiced .. accVowel
                end

                if quals then
                    IPA = {pron = transcribe(acc, stress), q = {quals, "definite accusative"}}
                else
                    IPA = {pron = transcribe(acc, stress), q = {"definite accusative"}}
                end
            else
                IPA = {pron = transcribe(term .. accVowel, stress), q = {quals}}
            end
        end
    end

    return modIPA.format_IPA_full{lang = lang, items = IPA}
end

return export