localexport={}functionexport.needs_accents(word)ifmw.ustring.find(word,"\204\129")thenreturnfalse-- A word needs accents if it contains more than one vowelelseifmw.ustring.find(mw.ustring.lower(word),"[аеєиіїоуюя].*[аеєиіїоуюя]")thenreturntrueelsereturnfalseendend-- Handles the alternation between initial і/у and й/в.functionexport.initial_alternation(word,previous)ifmw.ustring.find(word,"^і")ormw.ustring.find(word,"^й[^аеиоуяєію]")thenifmw.ustring.find(previous,"[аеиоуяєіїю́]$")thenreturnmw.ustring.gsub(word,"^[ій]","й")elsereturnmw.ustring.gsub(word,"^[ій]","і")endelseifmw.ustring.find(word,"^у")ormw.ustring.find(word,"^в[^аеиоуяєію]")thenifmw.ustring.find(previous,"[аеиоуяєіїю́]$")thenreturnmw.ustring.gsub(word,"^[ув]","в")elsereturnmw.ustring.gsub(word,"^[ув]","у")endendreturnwordendreturnexport