Module:Deranize: Difference between revisions

Update Neirani (replace vocalic pipoq with titieq)
(Fix tone marks with implicit o'aomo)
(Update Neirani (replace vocalic pipoq with titieq))
 
(One intermediate revision by the same user not shown)
Line 58: Line 58:
   ["diphthong"] = "󱛎",
   ["diphthong"] = "󱛎",
   [""] = "",
   [""] = "",
   -- diphthong reform
   -- neirani
   ["aı"] = "󱚶", -- DERANI LETTER DUDEO
   ["aı"] = "󱚶", -- DERANI LETTER DUDEO
   ["ao"] = "󱚳", -- DERANI LETTER PIPOQ
   ["ao"] = "󱚷", -- DERANI LETTER TITIEQ
   ["eı"] = "󱚸", -- DERANI LETTER ZOZEO
   ["eı"] = "󱚸", -- DERANI LETTER ZOZEO
   ["oı"] = "󱚽", -- DERANI LETTER NHANHOQ
   ["oı"] = "󱚽", -- DERANI LETTER NHANHOQ
Line 93: Line 93:
}
}


local reform = false
local neirani = false


function deranize_word(word)
function deranize_word(word)
Line 120: Line 120:
     local v = medial..final
     local v = medial..final
     local is_diphthong = v == "aı" or v == "ao" or v == "eı" or v == "oı"
     local is_diphthong = v == "aı" or v == "ao" or v == "eı" or v == "oı"
     if is_diphthong and reform then medial, final = v, "" end
     if is_diphthong and neirani then medial, final = v, "" end
     local glyphs = {initial, tone, medial}
     local glyphs = {initial, tone, medial}
     if initial == "" and is_first_syllable then
     if initial == ""
       if (final == "" or (reform and is_diphthong))
      and is_first_syllable
        and coda == ""
       and (final == "" or (neirani and is_diphthong))
        and (vowel_lookalikes[next_initial] or (reform and diphthong_lookalikes[next_initial])) then
      and coda == ""
        glyphs[1] = "'"
      and (vowel_lookalikes[next_initial] or (neirani and diphthong_lookalikes[next_initial])) then
      else
      glyphs[1] = "'"
        glyphs[1] = ""
      end
     end
     end
     if not is_first_syllable then glyphs[2] = "" end
     if not is_first_syllable then glyphs[2] = "" end
     if glyphs[1] == "'" or glyphs[1] == "ꝡ" then
     if glyphs[1] == "" or glyphs[1] == "'" or glyphs[1] == "ꝡ" then
       -- Move tone onto the first vowel
       -- Move tone onto the first vowel
       glyphs[2], glyphs[3] = glyphs[3], glyphs[2]
       glyphs[2], glyphs[3] = glyphs[3], glyphs[2]
     end
     end
     if is_diphthong and not reform then
     if is_diphthong and not neirani then
       glyphs[#glyphs+1] = "diphthong"
       glyphs[#glyphs+1] = "diphthong"
     elseif final ~= "" then
     elseif final ~= "" then
       glyphs[#glyphs+1] = "hiatus"
       glyphs[#glyphs+1] = "hiatus"
     end
     end
     if reform then
     if neirani then
       glyphs[#glyphs+1] = final
       glyphs[#glyphs+1] = final
     else
     else
Line 166: Line 164:
function deranize(frame)
function deranize(frame)
   assert(frame.args[1] ~= nil, "This function requires at least one argument")
   assert(frame.args[1] ~= nil, "This function requires at least one argument")
   reform = frame.args[2] ~= nil
   neirani = frame.args[2] ~= nil
   local text = u.gsub(u.lower(u.toNFD(frame.args[1])), "i", "ı")
   local text = u.gsub(u.lower(u.toNFD(frame.args[1])), "i", "ı")
   local converted = u.gsub(text, "(%S+)", deranize_word)
   local converted = u.gsub(text, "(%S+)", deranize_word)