Module:rad-IPA: Difference between revisions

Added Rre- accommodation and fixed disyllabic stress
m (Undo revision 4541 by TheNightAvl (talk))
Tag: Undo
(Added Rre- accommodation and fixed disyllabic stress)
Line 109: Line 109:
["."] = "|",
["."] = "|",
["'"] = "'",
["'"] = "'",
["‿"] = "‿",
}
}
data["à"] = data["a"]
data["à"] = data["a"]
Line 413: Line 414:


local boundary = {
local boundary = {
[" "] = true, ["|"] = true, ["·"] = true,
[" "] = true, ["|"] = true, ["·"] = true, ["‿"] = true,
}
}


Line 426: Line 427:
for toReplace, ReplaceKey in pairs(irregular) do
for toReplace, ReplaceKey in pairs(irregular) do
if mw.ustring.match(s, toReplace) then
if mw.ustring.find(s, toReplace) then
s = mw.ustring.gsub(s, toReplace, ReplaceKey)
s = mw.ustring.gsub(s, "(" .. toReplace .. ")", ReplaceKey)
-- generate_IPA: mw.log("Irregular spelling <" .. toReplace .. "> recognised. Treating as <" .. ReplaceKey .. ">.")
-- mw.log("Irregular spelling <" .. toReplace .. "> recognised. Treating as <" .. ReplaceKey .. ">.")
end
end
end
if mw.ustring.find(s, "(rredeș)") then -- deals with Rredeșa and Rrezlieþs
s = mw.ustring.gsub(s, "(a rredeș)", "ar‿redeș")
s = mw.ustring.gsub(s, "(u rredeș)", "ùr‿redeș")
s = mw.ustring.gsub(s, "(rredeș)", "redeș")
elseif mw.ustring.find(s, "(rrezl)") then
s = mw.ustring.gsub(s, "(u rrezl)", "ùr‿rezl")
s = mw.ustring.gsub(s, "(rrezl)", "rezl")
end
end
Line 536: Line 546:


-- generate_IPA: mw.log('————— STRING EXHAUSTED —————')
-- generate_IPA: mw.log('————— STRING EXHAUSTED —————')
mw.log("Base generation result: [" .. table.concat(IPA,"][") .. "]")
-- generate_IPA: mw.log("Base generation result: [" .. table.concat(IPA,"][") .. "]")
return IPA
return IPA
end
end
Line 1,210: Line 1,220:
elseif #working_word == 2 then -- disyllabic?
elseif #working_word == 2 then -- disyllabic?
if working_word[2]["heavy"] then -- condition 1
if working_word[1]["checked"] == false and working_word[2]["heavy"] then -- condition 1
stress(2)
stress(2)
else
else
Line 1,478: Line 1,488:
elseif syllables[i] == "|" then
elseif syllables[i] == "|" then
output = output .. " | "
output = output .. " | "
elseif syllables[i] == "‿" then
output = output .. "‿"
else
else
error("Unknown phone identified: " .. syllables[i])
error("Unknown phone identified: " .. syllables[i])
Line 1,550: Line 1,562:
end
end
if parameters["phon"] and parameters["format"] then
if parameters["phon"] and parameters["format"] then
outputIPA = "<span class=\"IPA" .. nolarge .. "\">[" .. outputIPA .. "]</span>"
outputIPA = "<span class=\"IPA" .. nolarge .. "\">[&nbsp;" .. outputIPA .. "&nbsp;]</span>"
elseif parameters["format"] then
elseif parameters["format"] then
outputIPA = "<span class=\"IPA" .. nolarge .. "\">/" .. outputIPA .. "/</span>"
outputIPA = "<span class=\"IPA" .. nolarge .. "\">/&nbsp;" .. outputIPA .. "&nbsp;/</span>"
end
end