Module:mg-pron: Difference between revisions

No edit summary
No edit summary
Line 69: Line 69:
}
}


function export.crux(term, pos)
function export.crux(term, pos, g)
term = mw.ustring.lower(term)
term = mw.ustring.lower(term)
Line 81: Line 81:
term = gsub(term, rule[1], rule[2])
term = gsub(term, rule[1], rule[2])
end
end
term = gsub(term, "ɡ", g and "ɡ" or "h")
return term
return term
Line 105: Line 107:
end
end


function separate_word(term, pos)
function separate_word(term, pos, g)
local result = {}
local result = {}
for word in gsplit(term, " ") do
for word in gsplit(term, " ") do
table.insert(result, export.crux(word , pos))
table.insert(result, export.crux(word , pos, g))
end
end
Line 124: Line 126:
local pos = frame.args[2] or args[2]
local pos = frame.args[2] or args[2]
local is_g = match(term, "g")
local ipa = "* "
local ipa = "* "
ipa = ipa .. line_format(separate_word(term, pos), {'Calá'})
ipa = ipa .. line_format(separate_word(term, pos), {'Calá'})
if is_g then
ipa = ipa .. line_format(separate_word(term, pos, true), {'g–h distinction'})
end
return ipa
return ipa