Module:xchc-noun: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 36: Line 36:
local function gsubrh(word, data, def)
local function gsubrh(word, data, def)
local ipa = wordpron(word)
local ipa = wordpron(word)
local roundh = ipa:match("[yuɔo]") and "r" or ipa:match("[ie]") and "u" or nil
local roundh = ipa:match("[yuøo]") and "r" or ipa:match("[ie]") and "u" or nil
local repl = {["r"] = data.r, ["u"] = data.u}
local repl = {["r"] = data.r, ["u"] = data.u}
return word:gsub("R", repl[roundh or def])
return word:gsub("R", repl[roundh or def])