local p = {}
local m_links = require("Module:links")
local m_utils = require("Module:utilities")
local lang = require("Module:languages").getByCode("vi")
local tone_diacritics = { = "̀", = "", = "", = "̀", = "̀" }
local checked_finals = { = "m", = "n", = "nh", = "ng" }
function p.rdp_one(frame)
local lemma = frame.args
local rdp_syll_normed = mw.ustring.toNFD(lemma)
rdp_syll_normed = mw.ustring.gsub(rdp_syll_normed, "̣̂", "̂̀") -- dot-below is put before circumflex, which causes problems later on
rdp_syll_normed = mw.ustring.gsub(rdp_syll_normed, "̣̆", "̆̀") -- same with breve
for orig, modif in pairs(tone_diacritics) do
rdp_syll_normed = mw.ustring.gsub(rdp_syll_normed, orig, modif)
end
for orig, modif in pairs(checked_finals) do
rdp_syll_normed = mw.ustring.gsub(rdp_syll_normed, orig, modif)
end
return mw.ustring.toNFC(rdp_syll_normed) .. " " .. lemma
end
local function a_rdp(syllable)
local syllable_normed = mw.ustring.toNFD(syllable)
local a_with_tone = "a"
if mw.ustring.find(syllable_normed, "") ~= nil then
a_with_tone = "à"
end
local initial = mw.ustring.match(syllable_normed, "(+)")
return mw.ustring.toNFC(initial .. a_with_tone)
end
function p.rdp_two(frame)
local lemma = frame.args
local syllables = {}
for w in string.gmatch(lemma, "(+)") do
table.insert(syllables, w)
end
return syllables .. " " .. a_rdp(syllables) .. " " .. lemma
end
function p.rdp_two_var(frame)
local lemma = frame.args
local syllables = {}
for w in string.gmatch(lemma, "(+)") do
table.insert(syllables, w)
end
return lemma .. " " .. a_rdp(syllables) .. " " .. a_rdp(syllables)
end
function p.rdp_type(frame)
local type_of_rdp = { = "dim", = "aug"}
local lemma = frame.args
local s, number_of_spaces = string.gsub(lemma," "," ")
return type_of_rdp
end
return p