|
|
| Line 1: |
Line 1: |
| local export = {} | | local export = {} |
| | local gsub = require("Module:string utilities").gsub |
|
| |
|
| local m_str_utils = require("Module:string utilities") | | local mapping = { |
| local lang = require("Module:languages").getByCode("sish")
| | ["ա"]="a", |
| local m_IPA = require("Module:IPA")
| | ["բ"]="b", |
| local yesno_module = "Module:yesno"
| | ["գ"]="g", |
| | | ["դ"]="d", |
| local toNFC = mw.ustring.toNFC
| | ["ե"]="ɛ", |
| local trim = m_str_utils.trim
| | ["զ"]="z", |
| local ufind = m_str_utils.find
| | ["է"]="e", |
| local ugsub = m_str_utils.gsub
| | ["ը"]="ə", |
| local ulower = m_str_utils.lower
| | ["թ"]="tʰ", |
| local ufind = m_str_utils.find
| | ["ժ"]="ʒ", |
| local unpack = unpack or table.unpack -- Lua 5.2 compatibility
| | ["ի"]="i", |
| local insert = table.insert
| | ["լ"]="l", |
| local concat = table.concat
| | ["խ"]="x", |
| | | ["ծ"]="t͡s", |
| local trackfn = require("Module:debug").track
| | ["կ"]="k", |
| | | ["հ"]="ː", |
| local function track(page)
| | ["ձ"]="d͡z", |
| trackfn("hy-pronunciation/" .. page)
| | ["ղ"]="ɣ", |
| return true
| | ["ճ"]="t͡ʃ", |
| end
| | ["մ"]="m", |
| | | ["յ"]="j", |
| -- single characters that map to IPA sounds
| | ["ն"]="n", |
| local phonemic_chars_map = {
| | ["շ"]="ʃ", |
| -- Eastern Armenian | | ["ո"]="ɔ", |
| east = {
| | ["չ"]="t͡ʃʰ", |
| ["ա"] = "ɑ",
| | ["պ"]="p", |
| ["բ"] = "b",
| | ["ջ"]="d͡ʒ", |
| ["գ"] = "ɡ",
| | ["ռ"]="r", |
| ["դ"] = "d",
| | ["ս"]="s", |
| ["ե"] = "e",
| | ["վ"]="v", |
| ["զ"] = "z",
| | ["տ"]="t", |
| ["է"] = "e",
| | ["ր"]="r", |
| ["ը"] = "ə",
| | ["ց"]="t͡s", |
| ["թ"] = "tʰ",
| | ["փ"]="pʰ", |
| ["ժ"] = "ʒ",
| | ["ք"]="kʰ", |
| ["ի"] = "i",
| | ["օ"]="o", |
| ["լ"] = "l",
| | ["ֆ"]="f", |
| ["խ"] = "χ",
| | ["իւ"]="y", |
| ["ծ"] = "t͡s",
| | ["էւ"]="ø", |
| ["կ"] = "k",
| | ["եւ"]="œ", |
| ["հ"] = "h",
| | ["Ա"]="A", |
| ["ձ"] = "d͡z",
| | ["Բ"]="B", |
| ["ղ"] = "ʁ",
| | ["Գ"]="G", |
| ["ճ"] = "t͡ʃ",
| | ["Դ"]="D", |
| ["մ"] = "m",
| | ["Ե"]="E", |
| ["յ"] = "j",
| | ["Զ"]="Z", |
| ["ն"] = "n",
| | ["Է"]="Ē", |
| ["շ"] = "ʃ",
| | ["Ը"]="Ə", |
| ["ո"] = "o",
| | ["Թ"]="Tʻ", |
| ["չ"] = "t͡ʃʰ",
| | ["Ժ"]="Ž", |
| ["պ"] = "p",
| | ["Ի"]="I", |
| ["ջ"] = "d͡ʒ",
| | ["Լ"]="L", |
| ["ռ"] = "r",
| | ["Խ"]="X", |
| ["ս"] = "s",
| | ["Ծ"]="C", |
| ["վ"] = "v",
| | ["Կ"]="K", |
| ["տ"] = "t",
| | ["Հ"]="H", |
| ["ր"] = "ɾ",
| | ["Ձ"]="J", |
| ["ց"] = "t͡sʰ",
| | ["Ղ"]="Ġ", |
| ["ւ"] = "v",
| | ["Ճ"]="Č", |
| ["փ"] = "pʰ",
| | ["Մ"]="M", |
| ["ք"] = "kʰ",
| | ["Յ"]="Y", |
| ["և"] = "ev",
| | ["Ն"]="N", |
| ["օ"] = "o",
| | ["Շ"]="Š", |
| ["ֆ"] = "f",
| | ["Ո"]="O", |
| ["-"] = " ",
| | ["Չ"]="Čʻ", |
| ["’"] = "",
| | ["Պ"]="P", |
| }, | | ["Ջ"]="J̌", |
| -- Western Armenian | | ["Ռ"]="Ṙ", |
| west = { | | ["Ս"]="S", |
| ["ա"] = "ɑ",
| | ["Վ"]="V", |
| ["բ"] = "p",
| | ["Տ"]="T", |
| ["գ"] = "k",
| | ["Ր"]="R", |
| ["դ"] = "t",
| | ["Ց"]="Cʻ", |
| ["ե"] = "e",
| | ["Ւ"]="W", |
| ["զ"] = "z",
| | ["Փ"]="Pʻ", |
| ["է"] = "e",
| | ["Ք"]="Kʻ", |
| ["ը"] = "ə",
| | ["Օ"]="Ō", |
| ["թ"] = "t",
| | ["Ֆ"]="F", |
| ["ժ"] = "ʒ",
| | ["ﬓ"]="mn", |
| ["ի"] = "i",
| | ["ﬔ"]="me", |
| ["լ"] = "l",
| | ["ﬕ"]="mi", |
| ["խ"] = "χ",
| | ["ﬖ"]="vn", |
| ["ծ"] = "d͡z",
| | ["ﬗ"]="mx", |
| ["կ"] = "ɡ",
| | ["ՠ"]="ä", |
| ["հ"] = "h",
| | ["ֈ"]="hª", |
| ["ձ"] = "t͡s",
| | -- punctuation |
| ["ղ"] = "ʁ",
| | ["՝"]=",", ["։"]=".", ["․"]=";", ["՛"]="́", ["՜"]="<sup>!</sup>", ["՞"]="<sup>?</sup>", |
| ["ճ"] = "d͡ʒ",
| | ["՟"]=".", ["֊"]="-", ["՚"]="’", ['«']='“', ['»']='”', ['ՙ']='ʻ' |
| ["մ"] = "m",
| |
| ["յ"] = "j",
| |
| ["ն"] = "n",
| |
| ["շ"] = "ʃ",
| |
| ["ո"] = "o",
| |
| ["չ"] = "t͡ʃ",
| |
| ["պ"] = "b",
| |
| ["ջ"] = "t͡ʃ",
| |
| ["ռ"] = "ɾ",
| |
| ["ս"] = "s",
| |
| ["վ"] = "v",
| |
| ["տ"] = "d",
| |
| ["ր"] = "ɾ",
| |
| ["ց"] = "t͡s",
| |
| ["ւ"] = "v",
| |
| ["փ"] = "p",
| |
| ["ք"] = "k",
| |
| ["և"] = "ev",
| |
| ["օ"] = "o",
| |
| ["ֆ"] = "f",
| |
| ["-"] = " ",
| |
| ["’"] = "",
| |
| }, | |
| } | | } |
|
| |
|
| -- character sequences of two that map to IPA sounds
| | local replacements = { |
| local phonemic_2chars_map = { | | -- desirable, but doesn't work: ['<sup>յ</sup>'] = 'ʸ', |
| east = { | | ['յ̵'] = mapping['ֈ'], |
| { "ու", "u" },
| | ['ղʻ'] = 'q', |
| }, | | ['Ո[ւՒ]'] = 'U', |
| west = { | | ['ու'] = 'u', |
| -- if not in the initial position and if not preceded by [ɑeəoiu]
| | ['Ո՛[ւՒ]'] = 'Ú', |
| {
| | ['ո՛ւ'] = 'ú', |
| "(.?.?)յու", -- can be overridden by using "."
| | ['Ո՜[ւՒ]'] = 'U<sup>!</sup>', |
| function(before)
| | ['ո՜ւ'] = 'u<sup>!</sup>', |
| if not (before == "" or ufind(before, "[%sաեէիոօ]$") or before == "ու") then
| | ['Ո՞[ւՒ]'] = 'U<sup>?</sup>', |
| return before .. "ʏ"
| | ['ո՞ւ'] = 'u<sup>?</sup>', |
| end
| | ['ո̈ւ'] = 'ü', |
| end,
| | ['Ո̈[ւՒ]'] = 'Ü', |
| },
| | ['օ̈'] = 'ö', |
| { "ու", "u" },
| | ['Օ̈'] = 'Ö', |
| { "էօ", "œ" },
| |
| -- Western Armenian inserts ə in the causative
| |
| { "ցնել", "t͡sənel" },
| |
| }, | |
| } | | } |
|
| |
|
| -- single characters that map to IPA sounds
| | function export.tr(text, lang, sc) |
| local phonetic_chars_map = {
| | if type(lang) == "table" then |
| -- Eastern Armenian
| | lang = lang:getFullCode() |
| east = {
| |
| ["ա"] = "ɑ",
| |
| ["բ"] = "b",
| |
| ["գ"] = "ɡ",
| |
| ["դ"] = "d",
| |
| ["ե"] = "e",
| |
| ["զ"] = "z",
| |
| ["է"] = "e",
| |
| ["ը"] = "ə",
| |
| ["թ"] = "tʰ",
| |
| ["ժ"] = "ʒ",
| |
| ["ի"] = "i",
| |
| ["լ"] = "l",
| |
| ["խ"] = "χ",
| |
| ["ծ"] = "t͡s",
| |
| ["կ"] = "k",
| |
| ["հ"] = "h",
| |
| ["ձ"] = "d͡z",
| |
| ["ղ"] = "ʁ",
| |
| ["ճ"] = "t͡ʃ",
| |
| ["մ"] = "m",
| |
| ["յ"] = "j",
| |
| ["ն"] = "n",
| |
| ["շ"] = "ʃ",
| |
| ["ո"] = "o",
| |
| ["չ"] = "t͡ʃʰ",
| |
| ["պ"] = "p",
| |
| ["ջ"] = "d͡ʒ",
| |
| ["ռ"] = "r",
| |
| ["ս"] = "s",
| |
| ["վ"] = "v",
| |
| ["տ"] = "t",
| |
| ["ր"] = "ɾ",
| |
| ["ց"] = "t͡sʰ",
| |
| ["ւ"] = "v",
| |
| ["փ"] = "pʰ",
| |
| ["ք"] = "kʰ",
| |
| ["և"] = "ev",
| |
| ["օ"] = "o",
| |
| ["ֆ"] = "f",
| |
| ["-"] = " ",
| |
| ["’"] = "",
| |
| },
| |
| -- note that the default pronunciation of ostensible /ɾ/ is [ɹ]
| |
| -- Western Armenian
| |
| west = {
| |
| ["ա"] = "ɑ",
| |
| ["բ"] = "pʰ",
| |
| ["գ"] = "kʰ",
| |
| ["դ"] = "tʰ",
| |
| ["ե"] = "e",
| |
| ["զ"] = "z",
| |
| ["է"] = "e",
| |
| ["ը"] = "ə",
| |
| ["թ"] = "tʰ",
| |
| ["ժ"] = "ʒ",
| |
| ["ի"] = "i",
| |
| ["լ"] = "l",
| |
| ["խ"] = "χ",
| |
| ["ծ"] = "d͡z",
| |
| ["կ"] = "ɡ",
| |
| ["հ"] = "h",
| |
| ["ձ"] = "t͡sʰ",
| |
| ["ղ"] = "ʁ",
| |
| ["ճ"] = "d͡ʒ",
| |
| ["մ"] = "m",
| |
| ["յ"] = "j",
| |
| ["ն"] = "n",
| |
| ["շ"] = "ʃ",
| |
| ["ո"] = "o",
| |
| ["չ"] = "t͡ʃʰ",
| |
| ["պ"] = "b",
| |
| ["ջ"] = "t͡ʃʰ",
| |
| ["ռ"] = "ɾ",
| |
| ["ս"] = "s",
| |
| ["վ"] = "v",
| |
| ["տ"] = "d",
| |
| ["ր"] = "ɾ",
| |
| ["ց"] = "t͡sʰ",
| |
| ["ւ"] = "v",
| |
| ["փ"] = "pʰ",
| |
| ["ք"] = "kʰ",
| |
| ["և"] = "ev",
| |
| ["օ"] = "o",
| |
| ["ֆ"] = "f",
| |
| ["-"] = " ",
| |
| ["’"] = "",
| |
| },
| |
| }
| |
| | |
| -- character sequences of two that map to IPA sounds
| |
| local phonetic_2chars_map = {
| |
| east = {
| |
| { "ու", "u" },
| |
| },
| |
| west = {
| |
| -- if not in the initial position and if not preceded by [ɑeəoiu]
| |
| {
| |
| "(.?.?)յու", -- can be overridden by using "."
| |
| function(before)
| |
| if not (before == "" or ufind(before, "[%sաեէիոօ]#") or before == "ու") then
| |
| return before .. "ʏ"
| |
| end
| |
| end,
| |
| },
| |
| { "ու", "u" },
| |
| { "էօ", "œ" },
| |
| -- պ, տ, կ are not voiced after ս and շ
| |
| { "սպ", "sp" },
| |
| { "ստ", "st" },
| |
| { "սկ", "sk" },
| |
| { "շպ", "ʃp" },
| |
| { "շտ", "ʃt" },
| |
| { "շկ", "ʃk" },
| |
| -- Western Armenian inserts ə in the causative
| |
| { "ցնել", "t͡sʰənel" },
| |
| },
| |
| }
| |
| | |
| function export.phonemic_IPA(phonemic, system) | |
| if not (phonemic_chars_map[system] and phonemic_2chars_map[system]) then
| |
| error("Invalid system " .. tostring(system))
| |
| end
| |
| | |
| phonemic = ulower(phonemic)
| |
| | |
| -- then long consonants that are orthographically geminated.
| |
| | |
| for _, replacement in ipairs(phonemic_2chars_map[system]) do
| |
| phonemic = ugsub(phonemic, unpack(replacement))
| |
| end
| |
| | |
| -- ոու is pronounced ou
| |
| phonemic = ugsub(phonemic, "ոːւ", "օու")
| |
| | |
| -- ե and ո are pronounced as je and vo word-initially.
| |
| phonemic = ugsub(phonemic, "^ե", "յէ")
| |
| phonemic = ugsub(phonemic, "^ո", "վօ")
| |
| -- except when followed by another վ.
| |
| phonemic = ugsub(phonemic, "^վօվ", "օվ")
| |
| | |
| --final ք, from the ancient plural, is extrasyllabic and should be marked.
| |
| phonemic = ugsub(phonemic, "([^ɑeiouəœʏ])ք$", "%1.ք")
| |
| | |
| -- ոու is pronounced oov
| |
| phonemic = ugsub(phonemic, "ոու", "օու")
| |
| | |
| -- palatalization in the Eastern Armenian sequence -ությ-, especially in the suffix -ություն [considered non-standard by strict prescriptivists]
| |
| if system == "east" then | |
| phonemic = ugsub(phonemic, "ությ", "ուցյ")
| |
| | |
| phonemic = ugsub(phonemic, "([բդգձջզժց])([փթքցչ])", "%1%2")
| |
| end
| |
| | |
| phonemic = ugsub(phonemic, ".", phonemic_chars_map[system])
| |
| | |
| --oov is actually ou
| |
| phonemic = ugsub(phonemic, "oov", "ou")
| |
| | |
| if system == "west" then
| |
| phonemic = ugsub(phonemic, "b([ptk])", "p%1") | |
| phonemic = ugsub(phonemic, "d([ptk])", "t%1")
| |
| phonemic = ugsub(phonemic, "ɡ([ptk])", "k%1")
| |
| phonemic = ugsub(phonemic, "d͡z([ptk])", "t͡s%1")
| |
| phonemic = ugsub(phonemic, "d͡ʒ([ptk])", "t͡ʃ%1")
| |
| phonemic = ugsub(phonemic, "z([ptk])", "s%1")
| |
| phonemic = ugsub(phonemic, "ʒ([ptk])", "ʃ%1")
| |
| end
| |
| | |
| phonemic = ugsub(phonemic, "ʁ([ptksʃ])", "χ%1")
| |
| phonemic = ugsub(phonemic, "v([ptksʃ])", "f%1")
| |
| | |
| -- generating the stress
| |
| phonemic = ugsub(phonemic, "%S+", function(word)
| |
| -- Do not add a stress mark for monosyllabic words. Check to see if the word contains only a single instance of [ɑeəoiuœʏ]+.
| |
| local numberOfVowels = select(2, ugsub(word, "[ɑeəoiuœʏ]", "%0"))
| |
| | |
| -- If polysyllabic, add IPA stress mark using the following rules. The stress is always on the last syllable not
| |
| -- formed by schwa [ə]. In some rare cases the stress is not on the last syllable. In such cases the stressed vowel
| |
| -- is marked by the Armenian stress character <՛>, e.g. մի՛թե. So:
| |
| -- 1) Find the vowel followed by <՛>․ If none, jump to step 2. Else check if it is the first vowel of the word.
| |
| -- If true, put the IPA stress at the beginning, else do step 3.
| |
| -- 2) Find the last non-schwa vowel, i.e. [ɑeoiuœʏ],
| |
| -- 3) If the IPA symbol preceding it is [ɑeəoiuœʏ], i.e. a vowel, put the stress symbol between them,
| |
| -- if it is NOT [ɑeoiuəœʏ], i.e. it is a consonant,
| |
| -- put the stress before that consonant.
| |
| if numberOfVowels > 1 then
| |
| local rcount
| |
| word, rcount = ugsub(word, "([^ɑeoiuœʏə]*[ɑeoiuœʏə])՛", "ˈ%1")
| |
| if rcount == 0 then
| |
| word = ugsub(word, "([^ɑeoiuœʏə]*[ɑeoiuœʏ][^ɑeoiuœʏə]*)$", "ˈ%1")
| |
| word = ugsub(
| |
| word,
| |
| "([^ɑeoiuœʏə]*[ɑeəoiuœʏ]?[ɑeoiuœʏ][^ɑeoiuœʏə]*ə[^ɑeoiuœʏə]*)#",
| |
| "ˈ%1#"
| |
| )
| |
| end
| |
| -- Including () in the second and third sets will only work
| |
| -- if () never encloses a vowel.
| |
| word = ugsub(word, "([ɑeəoiuœʏ])ˈ([^ɑeoiuœʏə()]+)([^ɑeoiuœʏəːˈʰ()j])", "%1%2ˈ%3")
| |
| word = ugsub(word, "(.)͡ˈ", "ˈ%1͡")
| |
| return word
| |
| end
| |
| end)
| |
| | |
| -- move stress marker out of opening/closing parentheses
| |
| if system == "east" or system == "west" then
| |
| phonemic = ugsub(phonemic, "ˈ%)", ")ˈ")
| |
| phonemic = ugsub(phonemic, "%(ˈ", "ˈ(")
| |
| end | | end |
|
| |
|
| -- "." prevents assimilation and can act as a dummy initial consonant, so must be removed. | | if lang == "xcl" then |
| phonemic = phonemic:gsub("%.", "")
| | mapping["ղ"]="ł" |
| phonemic = trim(phonemic)
| | mapping["Ղ"]="Ł" |
| | |
| return toNFC(phonemic)
| |
| end
| |
| | |
| function export.phonetic_IPA(phonetic, system)
| |
| if not (phonetic_chars_map[system] and phonetic_2chars_map[system]) then
| |
| error("Invalid system " .. tostring(system))
| |
| end | | end |
|
| |
|
| phonetic = ulower(phonetic)
| | for regex, replacement in pairs(replacements) do |
| | | text = gsub(text, regex, replacement) |
| -- then long consonants that are orthographically geminated.
| |
| phonetic = ugsub(phonetic, "(.)%1", "%1ː")
| |
| | |
| phonetic = ugsub(phonetic, " | ", "# | #")
| |
| phonetic = "##" .. ugsub(phonetic, " ", "# #") .. "##"
| |
| | |
| for _, replacement in ipairs(phonetic_2chars_map[system]) do | |
| phonetic = ugsub(phonetic, unpack(replacement)) | |
| end | | end |
|
| |
|
| -- ոու is pronounced ou | | text = gsub(text, '.', mapping) |
| phonetic = ugsub(phonetic, "ոːւ", "օու")
| | return text |
| | |
| -- ե and ո are pronounced as je and vo word-initially.
| |
| phonetic = ugsub(phonetic, "#ե", "#յէ")
| |
| phonetic = ugsub(phonetic, "#ո", "#վօ")
| |
| -- except when followed by another վ.
| |
| phonetic = ugsub(phonetic, "#վօվ", "#օվ")
| |
| | |
| -- ոու is pronounced oov
| |
| phonetic = ugsub(phonetic, "ոու", "օու")
| |
| | |
| phonetic = ugsub(phonetic, ".", phonetic_chars_map[system])
| |
| | |
| --oov is actually ou
| |
| phonetic = ugsub(phonetic, "oov", "ou")
| |
| | |
| --իա at the end of words is pronounced ja
| |
| phonetic = ugsub(phonetic, "iɑ#", "jɑ#")
| |
| | |
| -- insertion of the optional glide
| |
| phonetic = ugsub(phonetic, "iɑ", "i(j)ɑ") -- cases like խավիար, Մարիամ where "iɑ" is "jɑ" should be overriden manually: խավյար, Մարյամ. This is done automatically for final -իա
| |
| phonetic = ugsub(phonetic, "ie", "i(j)e")
| |
| phonetic = ugsub(phonetic, "io", "i(j)o")
| |
| phonetic = ugsub(phonetic, "iu", "i(j)u")
| |
| phonetic = ugsub(phonetic, "ɑi", "ɑ(j)i")
| |
| phonetic = ugsub(phonetic, "eɑ", "e(j)ɑ") -- cases like հոգեառ, ափեափ where no glide inserted because of boundaries between morphemes need to be handled manually by inserting a dot: հոքե.առ, ափե.ափ
| |
| phonetic = ugsub(phonetic, "ei", "e(j)i")
| |
| phonetic = ugsub(phonetic, "eu", "e(j)u")
| |
| phonetic = ugsub(phonetic, "oe", "o(j)e")
| |
| phonetic = ugsub(phonetic, "oi", "o(j)i")
| |
| phonetic = ugsub(phonetic, "ui", "u(j)i")
| |
| | |
| if ufind(phonetic, "(j)", 1, true) then
| |
| -- [[Wiktionary:Tracking/hy-pronunciation/optional glide]]
| |
| track("optional glide")
| |
| end
| |
| | |
| -- assimilation: ppʰ = pʰː; ttʰ = tʰː; ; kkʰ = kʰː
| |
| phonetic = ugsub(phonetic, "ppʰ", "pʰː")
| |
| phonetic = ugsub(phonetic, "ttʰ", "tʰː")
| |
| phonetic = ugsub(phonetic, "kkʰ ", "kʰː")
| |
| | |
| -- nasal assimilation
| |
| phonetic = ugsub(phonetic, "n([ɡk]+)", "ŋ%1")
| |
| | |
| -- pseudo-palatalization under the influence of Russian [COLLOQUIAL, NOT STANDARD]
| |
| --phonetic = ugsub(phonetic, "tj", "t͡sj")
| |
| --phonetic = ugsub(phonetic, "tʰj", "t͡sʰj")
| |
| --phonetic = ugsub(phonetic, "dj", "d͡zj")
| |
| | |
| -- palatalization in the Eastern Armenian sequence -ությ-, especially in the suffix -ություն [considered non-standard by strict prescriptivists]
| |
| if system == "east" then
| |
| phonetic = ugsub(phonetic, "utʰj", "ut͡sʰj")
| |
| end
| |
| | |
| -- trilling of ɾ in some positions [COLLOQUIAL, NOT STANDARD]
| |
| --phonetic = ugsub(phonetic, "ɾt", "rt")
| |
| | |
| -- devoicing of consonants in some positions
| |
| phonetic = ugsub(phonetic, "bpʰ", "pʰː")
| |
| phonetic = ugsub(phonetic, "dpʰ", "tʰpʰ")
| |
| phonetic = ugsub(phonetic, "ɡpʰ", "kʰpʰ")
| |
| phonetic = ugsub(phonetic, "d͡zpʰ", "t͡sʰpʰ")
| |
| phonetic = ugsub(phonetic, "d͡ʒpʰ", "t͡ʃʰpʰ")
| |
| phonetic = ugsub(phonetic, "vpʰ", "fpʰ")
| |
| phonetic = ugsub(phonetic, "ʒpʰ", "ʃpʰ")
| |
| | |
| phonetic = ugsub(phonetic, "btʰ", "pʰtʰ")
| |
| phonetic = ugsub(phonetic, "dtʰ", "tʰː")
| |
| phonetic = ugsub(phonetic, "ɡtʰ", "kʰtʰ")
| |
| phonetic = ugsub(phonetic, "d͡ztʰ", "t͡sʰtʰ")
| |
| phonetic = ugsub(phonetic, "d͡ʒtʰ", "t͡ʃʰtʰ")
| |
| phonetic = ugsub(phonetic, "vtʰ", "ftʰ")
| |
| phonetic = ugsub(phonetic, "ʒtʰ", "ʃtʰ")
| |
| | |
| phonetic = ugsub(phonetic, "bkʰ", "pʰkʰ")
| |
| phonetic = ugsub(phonetic, "dkʰ", "tkʰ")
| |
| phonetic = ugsub(phonetic, "ɡkʰ", "kʰː")
| |
| phonetic = ugsub(phonetic, "d͡zkʰ", "t͡sʰkʰ")
| |
| phonetic = ugsub(phonetic, "d͡ʒkʰ", "t͡ʃʰkʰ")
| |
| phonetic = ugsub(phonetic, "vkʰ", "fkʰ")
| |
| phonetic = ugsub(phonetic, "ʒkʰ", "ʃkʰ")
| |
| | |
| phonetic = ugsub(phonetic, "bt͡ʃʰ", "pʰt͡ʃʰ")
| |
| phonetic = ugsub(phonetic, "dt͡ʃʰ", "tʰt͡ʃʰ")
| |
| phonetic = ugsub(phonetic, "ɡt͡ʃʰ", "kʰt͡ʃʰ")
| |
| phonetic = ugsub(phonetic, "d͡zt͡ʃʰ", "t͡sʰt͡ʃʰ")
| |
| phonetic = ugsub(phonetic, "d͡ʒt͡ʃʰ", "t͡ʃʰː")
| |
| phonetic = ugsub(phonetic, "vt͡ʃʰ", "ft͡ʃʰ")
| |
| phonetic = ugsub(phonetic, "ʒt͡ʃʰ", "ʃt͡ʃʰ")
| |
| | |
| phonetic = ugsub(phonetic, "bt͡sʰ", "pʰt͡sʰ")
| |
| phonetic = ugsub(phonetic, "dt͡sʰ", "tʰt͡sʰ")
| |
| phonetic = ugsub(phonetic, "ɡt͡sʰ", "kʰt͡sʰ")
| |
| phonetic = ugsub(phonetic, "d͡zt͡sʰ", "t͡sʰː")
| |
| phonetic = ugsub(phonetic, "d͡ʒt͡sʰ", "t͡ʃʰt͡sʰ")
| |
| phonetic = ugsub(phonetic, "vt͡sʰ", "ft͡sʰ")
| |
| phonetic = ugsub(phonetic, "ʒt͡sʰ", "ʃt͡sʰ")
| |
| | |
| phonetic = ugsub(phonetic, "zpʰ", "spʰ")
| |
| phonetic = ugsub(phonetic, "ztʰ", "stʰ")
| |
| phonetic = ugsub(phonetic, "zkʰ", "skʰ")
| |
| | |
| phonetic = ugsub(phonetic, "ʁt͡s", "χt͡s")
| |
| phonetic = ugsub(phonetic, "ʁt͡ʃ", "χt͡ʃ")
| |
| phonetic = ugsub(phonetic, "ʁp", "χp")
| |
| phonetic = ugsub(phonetic, "ʁt", "χt")
| |
| phonetic = ugsub(phonetic, "ʁk", "χk")
| |
| phonetic = ugsub(phonetic, "ʁs", "χs")
| |
| phonetic = ugsub(phonetic, "ʁʃ", "χʃ")
| |
| | |
| phonetic = ugsub(phonetic, "vt͡s", "ft͡s")
| |
| phonetic = ugsub(phonetic, "vt͡ʃ", "ft͡ʃ")
| |
| phonetic = ugsub(phonetic, "vp", "fp")
| |
| phonetic = ugsub(phonetic, "vt", "ft")
| |
| phonetic = ugsub(phonetic, "vk", "fk")
| |
| phonetic = ugsub(phonetic, "vs", "fs")
| |
| phonetic = ugsub(phonetic, "vʃ", "fʃ")
| |
| | |
| if system == "west" then
| |
| phonetic = ugsub(phonetic, "χd͡z", "χt͡s")
| |
| phonetic = ugsub(phonetic, "χd͡ʒ", "χt͡ʃ")
| |
| phonetic = ugsub(phonetic, "χb", "χp")
| |
| phonetic = ugsub(phonetic, "χd", "χt")
| |
| phonetic = ugsub(phonetic, "χɡ", "χk")
| |
| end
| |
| | |
| if system == "west" then
| |
| phonetic = ugsub(phonetic, "t͡ʃʰd͡z", "t͡ʃʰt͡s")
| |
| phonetic = ugsub(phonetic, "t͡sʰd͡z", "t͡sʰt͡s")
| |
| phonetic = ugsub(phonetic, "pʰd͡z", "pʰt͡s")
| |
| phonetic = ugsub(phonetic, "tʰd͡z", "tʰt͡s")
| |
| phonetic = ugsub(phonetic, "kʰd͡z", "kʰt͡s")
| |
| | |
| phonetic = ugsub(phonetic, "t͡ʃʰd͡ʒ", "t͡ʃʰt͡ʃ")
| |
| phonetic = ugsub(phonetic, "t͡sʰd͡ʒ", "t͡sʰt͡ʃ")
| |
| phonetic = ugsub(phonetic, "pʰd͡ʒ", "pʰt͡ʃ")
| |
| phonetic = ugsub(phonetic, "tʰd͡ʒ", "tʰt͡ʃ")
| |
| phonetic = ugsub(phonetic, "kʰd͡ʒ", "kʰt͡ʃ")
| |
| | |
| phonetic = ugsub(phonetic, "t͡ʃʰb", "t͡ʃʰp")
| |
| phonetic = ugsub(phonetic, "t͡sʰb", "t͡sʰp")
| |
| phonetic = ugsub(phonetic, "pʰb", "pʰp")
| |
| phonetic = ugsub(phonetic, "tʰb", "tʰp")
| |
| phonetic = ugsub(phonetic, "kʰb", "kʰp")
| |
| | |
| phonetic = ugsub(phonetic, "t͡ʃʰd", "t͡ʃʰt")
| |
| phonetic = ugsub(phonetic, "t͡sʰd", "t͡sʰt")
| |
| phonetic = ugsub(phonetic, "pʰd", "pʰt")
| |
| phonetic = ugsub(phonetic, "tʰd", "tʰt")
| |
| phonetic = ugsub(phonetic, "kʰd", "kʰt")
| |
| | |
| phonetic = ugsub(phonetic, "t͡ʃʰɡ", "t͡ʃʰk")
| |
| phonetic = ugsub(phonetic, "t͡sʰɡ", "t͡sʰk")
| |
| phonetic = ugsub(phonetic, "pʰɡ", "pʰk")
| |
| phonetic = ugsub(phonetic, "tʰɡ", "tʰk")
| |
| phonetic = ugsub(phonetic, "kʰɡ", "kʰk")
| |
| end
| |
| | |
| -- prothetic ə before {s/ʃ/z}{p/t/k/b/d/g} in Western Armenian; this rule is not the norm in Eastern Armenian anymore
| |
| if system == "west" then
| |
| phonetic = ugsub(phonetic, "^([sʃz][ptkbdɡ]+)", "ə%1")
| |
| end
| |
| | |
| -- generating the stress
| |
| phonetic = ugsub(phonetic, "%S+", function(word)
| |
| -- Do not add a stress mark for monosyllabic words. Check to see if the word contains only a single instance of [ɑeəoiuœʏ]+.
| |
| local numberOfVowels = select(2, ugsub(word, "[ɑeəoiuœʏ]", "%0"))
| |
| | |
| -- If polysyllabic, add an acute using the following rules. The stress is always on the last syllable not
| |
| -- formed by schwa [ə]. In some rare cases the stress is not on the last syllable. In such cases the stressed vowel
| |
| -- is marked by the Armenian stress character <՛>, e.g. մի՛թե. So:
| |
| -- 1) Find the vowel followed by <՛> and put the acute on it․ If none, go to step 2.
| |
| -- 2) Find the last non-schwa vowel, i.e. [ɑeoiuœʏ], and put the acute on it.
| |
| if numberOfVowels > 1 then
| |
| local rcount
| |
| word, rcount = ugsub(word, "([ɑeoiuœʏə])՛", "%1́")
| |
| if rcount == 0 then
| |
| word = ugsub(word, "([ɑeoiuœʏ])([^ɑeoiuœʏə]*)(ə?[^ɑeoiuœʏə]?#)", "%1́%2%3")
| |
| end
| |
| return word
| |
| end
| |
| end)
| |
| | |
| if system == "east" or system == "west" then
| |
| phonetic = ugsub(phonetic, "([td])%1͡([sʃzʒ])(ʰ?)", "%1̚%1͡%2%3")
| |
| phonetic = ugsub(phonetic, "([td])͡([sʃzʒ])(ʰ?)ː", "%1̚%1͡%2%3")
| |
| end
| |
| | |
| -- "." prevents assimilation and can act as a dummy initial consonant, so must be removed.
| |
| phonetic = phonetic:gsub("%.", "")
| |
| | |
| phonetic = ugsub(phonetic, "#", "")
| |
|
| |
| phonetic = trim(phonetic)
| |
| | |
| return toNFC(phonetic)
| |
| end
| |
| | |
| function export.generic_IPA(frame)
| |
| local params = {
| |
| [1] = {},
| |
| ["system"] = {},
| |
| }
| |
| | |
| local parent_args = frame:getParent().args
| |
| local args = require("Module:parameters").process(parent_args, params, nil, "hy-pronunciation", "IPA")
| |
| | |
| local pagename = mw.loadData("Module:headword/data").pagename
| |
| | |
| end
| |
| | |
| function export.IPA(frame)
| |
| local params = {
| |
| E = { type = "boolean", default = "true" },
| |
| W = { type = "boolean", default = "true" },
| |
| [1] = { list = true },
| |
| e = { list = true, allow_holes = true },
| |
| colle = true,
| |
| w = { list = true, allow_holes = true },
| |
| collw = true,
| |
| bare = true,
| |
| pagename = true,
| |
| }
| |
| | |
| local parent_args = frame:getParent().args
| |
| local args = require("Module:parameters").process(parent_args, params, nil, "hy-pronunciation", "IPA")
| |
| local lines = {}
| |
| | |
| local function ins(text)
| |
| insert(lines, text)
| |
| end
| |
| | |
| local function get_pagename()
| |
| return args.pagename or mw.loadData("Module:headword/data").pagename
| |
| end
| |
| | |
| local function generate_pron(pron, system)
| |
| return { pron = ("/%s/ [%s]"):format(export.phonemic_IPA(pron, system), export.phonetic_IPA(pron, system)) }
| |
| end | |
| | |
| if args.bare then
| |
| local bare = require(yesno_module)(args.bare, args.bare)
| |
| if bare == true then
| |
| bare = "east"
| |
| end
| |
| if bare then
| |
| local items = {}
| |
| if not args[1][1] then
| |
| args[1][1] = get_pagename()
| |
| end
| |
| for _, pron in ipairs(args[1]) do
| |
| insert(items, generate_pron(pron, bare))
| |
| end
| |
| return m_IPA.format_IPA_full {
| |
| lang = lang,
| |
| items = items,
| |
| }
| |
| end
| |
| end
| |
| | |
| local function insert_east_or_west(prons, system, standard_accent, coll_pron, coll_qualifier)
| |
| local items = {}
| |
| for _, pron in ipairs(prons) do
| |
| if pron then
| |
| insert(items, generate_pron(pron, system))
| |
| end
| |
| end
| |
| ins("* " .. m_IPA.format_IPA_full({
| |
| lang = lang,
| |
| items = items,
| |
| a = { standard_accent },
| |
| }))
| |
| if coll_pron then
| |
| ins("** " .. m_IPA.format_IPA_full({
| |
| lang = lang,
| |
| items = { generate_pron(coll_pron, system) },
| |
| q = { coll_qualifier, "colloquial" },
| |
| }))
| |
| end
| |
| end
| |
| | |
| local function is_empty(tbl)
| |
| return tbl == nil or next(tbl) == nil
| |
| end
| |
| | |
| local function first_item_is_nil_in_non_empty_table(tbl)
| |
| if is_empty(tbl) then return false end
| |
| return tbl[1] == nil
| |
| end
| |
| | |
| local function insert_all_from_table(result, source)
| |
| for _, value in ipairs(source) do
| |
| if value then
| |
| insert(result, value)
| |
| end
| |
| end
| |
| end
| |
| | |
| if #args[1] == 1 and args[1][1] == get_pagename() then
| |
| -- [[Wiktionary:Tracking/hy-pronunciation/input equal to pagename]]
| |
| track("input equal to pagename")
| |
| end
| |
|
| |
| if args.E then
| |
| local eastern = {}
| |
| | |
| if not is_empty(args[1]) then
| |
| insert_all_from_table(eastern, args[1])
| |
| elseif not is_empty(args.e) then
| |
| if first_item_is_nil_in_non_empty_table(args.e) then
| |
| args.e[1] = get_pagename()
| |
| end
| |
| insert_all_from_table(eastern, args.e)
| |
| else
| |
| insert(eastern, get_pagename())
| |
| end
| |
| | |
| insert_east_or_west(
| |
| eastern,
| |
| "standard",
| |
| "sish-st",
| |
| args.colle,
| |
| "Standard Ossamic"
| |
| )
| |
| end
| |
|
| |
| return concat(lines, "\n")
| |
| end | | end |
|
| |
|
| return export | | return export |