45,660
edits
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local gsub = mw.ustring.gsub | |||
local export = {} | local export = {} | ||
Line 26: | Line 28: | ||
} | } | ||
for regex, repl in pairs(lenition_patterns) do | for regex, repl in pairs(lenition_patterns) do | ||
lenited = | lenited = word:gsub(regex, repl, 1) | ||
if lenited ~= word then return lenited end | if lenited ~= word then return lenited end | ||
end | end | ||
Line 35: | Line 37: | ||
function export.coalescence(word, stress) | function export.coalescence(word, stress) | ||
local diphthongs = { -- TODO: [ůy]V > ỷ in stressed | local diphthongs = { -- TODO: [ůy]V > ỷ in stressed | ||
["[aę]▫[aę]"] = "ả", ["e▫e"] = "ẻ", ["i▫i"] = "ỉ", ["[ | ["[aę]▫[aę]"] = "ả", ["e▫e"] = "ẻ", ["i▫i"] = "ỉ", ["u▫[yuů]"] = "ủ", ["[yů]▫u"] = "ủ", | ||
[" | ["a▫e"] = "ai", ["a▫o"] = "au", ["ę▫[uů]"] = "ay", | ||
[" | ["ę▫[ei]"] = "ei", ["ę▫o"] = "eu", | ||
["e▫[aę]"] = "ia", ["e▫o"] = "io", ["i▫y"] = "iů", | |||
[" | ["[uo]▫e"] = "oi", ["o▫ů"] = "ou", | ||
[" | ["[yůo]▫o"] = "uo", | ||
[" | ["[yů]▫[yů]"] = "ỷ", | ||
[" | ["([ae])▫ů"] = "%1y", ["([iou])▫ę"] = "%1a", | ||
["[yů]▫a"] = "ů▫a", ["[yů]▫ę"] = "ů▫a", ["[yů]▫e"] = "ů▫i", ["[yů]▫i"] = "ů▫i", -- to screen out stressed vs. unstressed | |||
[" | |||
["[yů] | |||
} | } | ||
for regex, repl in pairs(diphthongs) do | |||
word = word:gsub(regex, repl, 1) | |||
end | |||
if stress then | |||
word = word:gsub("[ůy]▫.", "ỷ") | |||
end | |||
word = word:gsub("▫", "") | |||
return word | |||
end | end | ||