မော်ဂျူး:uk-common
Documentation for this module may be created at မော်ဂျူး:uk-common/doc
local export = {}
function export.needs_accents(word)
if mw.ustring.find(word, "\204\129") then
return false
-- A word needs accents if it contains more than one vowel
elseif mw.ustring.find(mw.ustring.lower(word), "[аеєиіїоуюя].*[аеєиіїоуюя]") then
return true
else
return false
end
end
-- Handles the alternation between initial і/у and й/в.
function export.initial_alternation(word, previous)
if mw.ustring.find(word, "^і") or mw.ustring.find(word, "^й[^аеиоуяєію]") then
if mw.ustring.find(previous, "[аеиоуяєіїю́]$") then
return mw.ustring.gsub(word, "^[ій]", "й")
else
return mw.ustring.gsub(word, "^[ій]", "і")
end
elseif mw.ustring.find(word, "^у") or mw.ustring.find(word, "^в[^аеиоуяєію]") then
if mw.ustring.find(previous, "[аеиоуяєіїю́]$") then
return mw.ustring.gsub(word, "^[ув]", "в")
else
return mw.ustring.gsub(word, "^[ув]", "у")
end
end
return word
end
return export