Module:IPAc

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

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

-- {{#invoke:IPAc|main|'w3rd}} > <span title = "/ˈ/ primary stress follows">ˈ</span><span title = "'w' in 'wind' ">w</span><span title = "/ɜr/ 'ir' in 'bird' ">ɜr</span><span title = "'d' in 'dye' ">d</span>
-- This module has not been heavily tested

local p = {}

function p.main( frame )
    local result = ""
    
    local a = frame.args
    
    if type( a ) ~= "string" then error( "Must be a string" ) end
    
    local db = {
 = "'b' in 'buy' \">b",
 = "'d' in 'dye' \">d",
 = "optional 'd' \">ᵈ",
 = "/dj/ 'd' in 'dew' \">dj",
 = "/ð/ 'th' in 'thy' \">ð",
 = "/dʒ/ 'j' in 'jam' \">dʒ",
 = "'f' in 'find'  \">f",
 = "'g' in 'guy' \">ɡ",
 = "'h' in 'hi' \">h",
 = "/j/ 'y' in 'yes' \">j",
 = "'k' in 'kind' \">k",
 = "'l' in 'lie' \">l",
 = "/lj/ 'l' in 'lute' \">lj",
 = "'m' in 'my' \">m",
 = "'n' in 'nigh' \">n",
 = "/nj/ 'n' in 'new' \">nj",
 = "/ŋ/ 'ng' in 'sing' \">ŋ",
 = "/ŋɡ/ 'ng' in 'finger' \">ŋɡ",
 = "/θ/ 'th' in 'thigh' \">θ",
 = "/θj/ 'th' in 'enthusiasm' \">θj",
 = "'p' in 'pie' \">p",
 = "'r' in 'rye' \">r",
 = "'s' in 'sigh' \">s",
 = "/sj/ 's' in 'suit' \">sj",
 = "/ʃ/ 'sh' in 'shy' \">ʃ",
 = "'t' in 'tie' \">t",
 = "optional 't' \">ᵗ",
 = "/tj/ 't' in 'tune' \">tj",
 = "/tʃ/ 'ch' in 'china' \">tʃ",
 = "'v' in 'vie' \">v",
 = "'w' in 'wind' \">w",
 = "/hw/ 'wh' in 'why' \">hw",
 = "'z' in 'Zion' \">z",
 = "/zj/ 'z' in 'Zeus' \">zj",
 = "/ʒ/ 's' in 'pleasure' \">ʒ",
 = "/x/ 'ch' in 'loch' \">x",
 = "/ʔ/ the catch in 'uh-oh' \">ʔ",
 = "/ɑː/ 'a' in 'father' \">ɑː",
 = "/ɑr/ 'ar' in 'bard' \">ɑr",
 = "/ɒ/ short 'o' in 'body' \">ɒ",
 = "/ɒ̃/ nasal 'an' in 'vin blanc' \">ɒ̃",
 = "/ɒr/ 'or' in 'moral' \">ɒr",
 = "/æ/ short 'a' in 'bad' \">æ",
 = "/aɪ/ long 'i' in 'bide' \">aɪ",
 = "/aɪər/ 'ire' in 'fire' \">aɪər",
 = "/aʊ/ 'ou' in 'pout' \">aʊ",
 = "/aʊər/ 'our' in 'hour' \">aʊər",
 = "/ɛ/ short 'e' in 'bed' \">ɛ",
 = "/ɛr/ 'err' in 'merry' \">ɛr",
 = "/eɪ/ long 'a' in 'base' \">eɪ",
 = "/ær/ 'arr' in 'marry' \">ær",
 = "/ɛər/ 'are' in 'bare' \">ɛər",
 = "/ɪ/ short 'i' in 'bid' \">ɪ",
 = "/ɪr/ 'irr' in 'mirror' \">ɪr",
 = "/iː/ long 'e' in 'bead' \">iː",
 = "/ɪər/ 'ear' in 'beard' \">ɪər",
 = "/ⁱ/ optional 'i' in 'nasturtium' \">ⁱ",
 = "/ᵊ/ optional 'ə' in 'jewelry' \">ᵊ",
 = "/ʲ/ optional 'j' in 'Lucas' \">ʲ",
 = "/ɔː/ 'au' in 'fraud' \">ɔː",
 = "/ɔr/ 'or' in 'born' \">ɔr",
 = "/ɔɪ/ 'oy' in 'boy' \">ɔɪ",
 = "/ɔɪər/ 'oir' in 'loir' (rare) \">ɔɪər",
 = "/oʊ/ long 'o' in 'bode' \">oʊ",
 = "/ɔər/ 'ore' in 'bore' \">ɔər",
 = "/ʊ/ short 'oo' in 'foot' \">ʊ",
 = "/ʊr/ 'our' in 'courier' \">ʊr",
 = "/uː/ long 'oo' in 'food' \">uː",
 = "/ʊər/ 'our' in 'tour'  \">ʊər",
 = "/juː/ long 'u' in 'cute' \">juː",
 = "/jʊər/ 'ure' in 'cure' \">jʊər",
 = "/ʌ/ short 'u' in 'bud' \">ʌ",
 = "/ʌr/ 'urr' in 'hurry' \">ʌr",
 = "/ɜr/ 'ir' in 'bird' \">ɜr",
 = "/ə/ 'a' in 'about' \">ə",
 = "/ər/ 'er' in 'finger' \">ər",
 = "/ən/ 'on' in 'button' \">ən",
 = "/ɵ/ variable 1st 'o' in 'omission' \">ɵ", --ambiguous example
 = "/əm/ 'm' in 'rhythm' \">əm",
 = "/ɨ/ 'e' in 'roses' \">ɨ",
 = "/ʉ/ variable 2nd 'u' in 'beautiful' \">ʉ", --ambiguous example
 = "/jʉ/ variable 2nd 'u' in 'curriculum' \">jʉ", --ambigious example
 = "/əl/ 'le' in 'bottle' \">əl",
 = "/i/ 'y' in 'happy' \">i",
 = "/ˈ/ primary stress follows\">ˈ",
 = "/ˌ/ secondary stress follows\">ˌ",
 = "/./ syllable break \">.",
 = "/-/ affix \">-",
-- ]
 = "Representation in the International Phonetic Alphabet (IPA) \"> ",
 = "\">/ & /", -- this is useful for "and" in place names, which is highly variable and not important to transcribe
= "\">..." --this is useful for other highly variable words in place names, which are not important to transcribe

    }
    
    while mw.ustring.len( a ) > 0 do
        local fl, fv = 0, nil
        for t, i in pairs( db ) do 
            --mw.log( i, t )
            for tt, ii in pairs( t ) do
                --mw.log( tt, ii )
                if mw.ustring.find( a, ii, 1, true ) == 1 and mw.ustring.len( ii ) > fl then
                    fl = mw.ustring.len( ii )
                    fv = i
                end
            end
        end
        if fv == nil then
            fl, fv = 1, mw.ustring.sub( a, 1, 1 )
        else
            fv = "<span title = \"" .. fv .. "</span>"
        end
        result = result .. fv
        --mw.log( fl, fv, a )
        a = mw.ustring.sub( a, fl + 1 )
    end
        
    return result
end

return p