Module:ryn-mut: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 16: Line 16:
["bh"] = {nil, "mbh"},
["bh"] = {nil, "mbh"},
["c"] = {"ch", "nc"},
["c"] = {"ch", "nc"},
["ch"] = {nil, "nch"},
["ch"] = {"gh", "nch"},
["d"] = {"d̦", "nd"},
["d"] = {"d̦", "nd"},
["d̦"] = {"d̦", "nd̦"},
["d̦"] = {"d̦", "nd̦"},
Line 36: Line 36:
}
}
local vowel_pattern = "[aeiíoóu]"
local vowel_pattern = "[aeiíoóu]"
local gh_to_bh_vowel_pattern = "[eiíuó]"


local function get_radical_data(term)
local function get_radical_data(term)
Line 58: Line 59:
end
end
local change = mutation_rules[data.initial][1]
local change = mutation_rules[data.initial][1]
if change then return change .. data.remainder end
if change then
local r_initial = mw.ustring.sub(data.remainder, 1, 1)
if change == "gh" and mw.ustring.find(r_initial, gh_to_bh_vowel_pattern) then
change = "bh"
end
return change .. data.remainder
end
if data.prevowel and (not mw.ustring.sub(data.remainder, 1, 1) == "i") then
if data.prevowel and (not mw.ustring.sub(data.remainder, 1, 1) == "i") then
return data.initial .. "i" .. data.remainder
return data.initial .. "i" .. data.remainder